赞
踩
D:\DevlopmentSoftwares\Anaconda3\Scripts
D:\DevlopmentSoftwares\Anaconda3
D:\DevlopmentSoftwares\Anaconda3\Library\bin
git clone https://github.com/ultralytics/yolov5.git
yolov5
文件路径下内新建文件夹weights
,将下载好的yolov5m6.pt
文件拷贝进去;conda create -n yolov5 python=3.7 //环境名为yolov5 ,python版本选择3.7
conda activate yolov5 //激活yolov5 环境
安装pytorch时需要先去查看自己的cuda版本:
nvcc --version
然后选择适配 的pytorch版本,pytorch官网:https://pytorch.org/;
# ROCM 4.0.1 (Linux only) pip install torch==1.8.1+rocm4.0.1 torchvision==0.9.1+rocm4.0.1 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # ROCM 3.10 (Linux only) pip install torch==1.8.1+rocm3.10 torchvision==0.9.1+rocm3.10 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # CUDA 11.1 pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # CUDA 10.2 pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # CUDA 10.1 pip install torch==1.8.1+cu101 torchvision==0.9.1+cu101 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # CPU only pip install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
举例:我的CUDA版本是11.1,选择:
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
检测pytorch安装结果,显示如下结果则成功:
python
>>> import torch
>>> print(torch.cuda.is_available())
True
>>> print(torch.version.cuda)
11.1
yolov5
代码库中的 requirements.txt
文件,将torch
和tourchvision
的信息注释掉;scipy>=1.4.1
# torch>=1.7.0
# torchvision>=0.8.1
tqdm>=4.41.0
torch
和torchversion
单独安装好之后,使用清华镜像源,在yolov5
路径下执行:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
Anaconda Prompt
;yolov5
环境;conda activate yolov5
yolov5
路径下:cd E:\Dev\yolov5
python detect.py --source ./data/images/ --weights weights/yolov5m6.pt --conf 0.4
yolov5\runs\detect\exp3
路径下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。