1.安装anaconda
https://www.anaconda.com/products/individual#linux 下载64-Bit (x86) Installer (529 MB)
进入目标文件夹bash Anaconda3-2020.11-Linux-x86_64.sh,一路回车,中途输入yes
1.1关闭默认开启(base)环境
如果觉得默认开启(base)环境有点不爽,可输入以下命令改回常规情况:
$ conda config --set auto_activate_base false
1.2 加速conda下载
如果已经输入上一条命令修改了默认开启环境,那就应该同时创建了.condarc文件在主目录中
在主目录中按ctrl+H显示隐藏文件,拉到最下方找到.condarc文件,打开,在文件最后输入:
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
show_channel_urls: true
ctrl+S保存,关闭即可
2. 安装pytorch
$ conda create -n yolov5 python=3.8
$ conda activate yolov5
$ conda install pytorch torchvision cudatoolkit=10.2
看自己的pytorch版本下载对应的cuda
3. 配置yolov5
$ git clone https://github.com/ultralytics/yolov5.git
解压后,进入文件夹,输入以下命令安装必要的依赖
$ pip3 install -r requirements.txt
下载模型:笔者下载的是yolov5s.pt
3.1 官方demo测试
$ python detect.py --source "data/images/bus.jpg" --weights="weights/yolov5s.pt"
效果:
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-M9JKzlPy-1614925706128)(1.png)]](https://i-blog.csdnimg.cn/blog_migrate/c4ae5f2f267c5043087358065229bc1a.png#pic_center)
Reference
https://www.bilibili.com/video/av244641372/
https://blog.youkuaiyun.com/qq_42237662/article/details/107201241
YoloV5部署实战

本文详细介绍如何通过Anaconda环境管理工具安装PyTorch及配置YoloV5目标检测模型的过程,包括加速conda下载速度的方法、PyTorch的安装步骤、YoloV5的配置流程及其官方demo的测试步骤。
1001

被折叠的 条评论
为什么被折叠?



