手把手教你运行YOLOv6(小白成功版)

实现过程参考:

环境安装 — YOLOv6_docs 文档

开源项目:GitHub - meituan/YOLOv6: YOLOv6: a single-stage object detection framework dedicated to industrial applications.

环境安装 

  1. 创建并激活一个conda环境

conda create -n yolov6 python=3.8

conda activate yolov6

  1. 安装pytorch

conda

# CUDA 10.2(我用的这个)
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch

# CUDA 11.1
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

# CPU Only
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cpuonly -c pytorch

wheel

# CUDA 11.1
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

# CUDA 10.2(我用的这个)
pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0

# CPU only
pip install torch==1.8.0+cpu torchvision==0.9.0+cpu torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

安装YOLOv6

git clone https://github.com/meituan/YOLOv6
cd YOLOv6
pip install -r requirements.txt

验证安装

  1. 下载权重文件
    1. 从官方 YOLOv6 Github 仓库中下载最新的模型权重;
    2. 使用 wget 下载(注意下载链接需要更新到最新的版本号,确认是最近发布的模型)
pip install wget
# 注意确认以下链接中的版本号是否为最新(这点很重要,官网教程是0.3.0,但我用的时候已经是0.4.0,改了就没有报错!)
#wget https://github.com/meituan/YOLOv6/releases/download/0.3.0/yolov6n.pt(官网教程的)
wget https://github.com/meituan/YOLOv6/releases/download/0.4.0/yolov6n.pt
mkdir weights
mv yolov6n.pt weights/yolov6n.pt

我安装的时候是4.0,从这里看:Releases · meituan/YOLOv6 · GitHub

  1. 推理验证
python tools/infer.py --weights weights/yolov6n.pt --source data/images/

# 可选参数
# --device 0         *使用的计算资源,包括cuda, cpu等,默认为0
# --name exp         *用于指定source图像推理结果可视化的保存文件夹                       
# --view-img          *使用该参数表示在屏幕上显示检测结果,默认为False
# --conf_thres 0.4    *置信度阈值,默认为0.4

就实现啦!

 

 

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值