目录
1、安装Anaconda
一路安装,<只需要注意这里要将conda添加到PATH中,不推荐添加环境变量中>。
打开终端。
conda -V
2、虚拟环境搭建
#搭建环境
conda create -n YOLO5 python=3.8
#激活环境
conda activate YOLO5
以下可以不用操作,直接第三步。
conda命令参考
安装PyTorch
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是否可用。
#输入
import torch
torch.cuda.is_available()
3、下载源码和安装依赖库
https://github.com/ultralytics/yolov5
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple #之前
#首先注释掉requirements.txt中pycocotools>=2.0 # COCO mAP
#单独安装pip install pycocotools
##安装出错参考https://github.com/philferriere/cocoapi
4、数据标注
数据标注我们要用labelimg,使用pip即可安装。
pip install labelimg
#终端输入labelimg打开标注软件:
终端输入labelimg打开标注软件,标注完成后,每张图像会生成对应的xml标注文件。