如何简单的使用yolov5
1、安装环境
安装mincoda docs.conda.io/en/latest/m…
选择对应的python脚本 这里我选择是python3.7的mac版本 安装后配置清华源 vi ~/.condarc
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
2、下载源码
https://github.com/ultralytics/yolov5.git
3、配置一个python的虚拟环境
conda create -n y5 python==3.9 -y
conda activate y5
安装代码所需要的包
pip install -r requirements.txt -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com
4、尝试一下吧
4.1 下载模型
把下载好的模型放在项目中,这里我直接放到了weights中
4.2 浅尝一下
在项目的terminal下输入
/Users/zhuqinshu/opt/miniconda3/envs/y5t/bin/python /Users/zhuqinshu/vscodeProjects/yolov5/detect.py
可能遇到的问题
5、如何训练自己的模型
安装打标器
pip3 install pyqt5 lxml labelImg
然后输入labelImg就可以启动
注:mac有可能会出问题,下面给出方案
git clone https://github.com/tzutalin/labelImg.git
cd labelImg
python3 labelImg.py
labelImg.py这一步又可能报错:ModuleNotFoundError: No module named 'libs.resources'
解决方法 pyrcc5 -o libs/resources.py resources.qrc
然后继续 python3 labelImg.py