1.代码(下载zip后解压)

https://github.com/WongKinYiu/yolov7https://github.com/WongKinYiu/yolov7

2.anaconda配置环境(以管理员身份打开anaconda prompt

(1)创建环境

conda create -n yolov7 python=3.8

(2)激活环境

activate yolov7

(3)在代码文件夹路径下

pip install -r requirements.txt

而后 pip list查看安装成功没有,以下进行torch版本更换。

如果完全按照requirements.txt来安装的话,会发现安装的torch版本并不是gpu版本,所以得重新安装gpu版本的才能用你的gpu来训练Yolov7

Pytorch下载官网:PyTorchAn open source machine learning framework that accelerates the path from research prototyping to production deployment.https://pytorch.org/到previous中去寻找对应自己cuda版本的pytorch,选择wheel下(linux and windows)的pip下载指令,我选择的是对应cuda 11.1的(其实我的cuda版本是11.2),复制pip指令,我用的指令(torch1.8.0版本):

# 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

再通过pip list查看是否成功。

附加cuda与pytorch版本对应关系:PyTorch和CUDA版本对应关系 - 墨莲玦 - 博客园

eea1311f1fb44e268530876e48c91178.png

3.安装小工具(labelImg):用于制作VOC数据集时,对数据集进行标注的工具。

GitHub - heartexlabs/labelImg: LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data. - GitHub - heartexlabs/labelImg: LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.https://github.com/tzutalin/labelImg下载zip后解压压缩包,注意路径一定不要有中文名称。

(1)以管理员身份运行anaconda prompt输入:

conda install pyqt=5 

(2)使用cd 命令进入刚刚下载解压的labelimg文件夹 【第一条指令执行完在终端是没有什么显示的,直接是下一条指令输入】

pyrcc5 -o resources.py resources.qrc
python labelImg.py

(3)第二条指令输入后可能出现以下两种错误

1.ModuleNotFoundError: No module named 'libs.resources'

解决办法 将resources.py文件放入libs文件夹,再输入python labelImg.py尝试。可能会在出错

a1433616dbaf4e9b8526b3aace6cef5c.png

 2.ModuleNotFoundError: No module named 'lxml'

 

 参考链接:(全程记录yolov7入门到实现训练)跟着炮哥yolov5教程自学yolov7,接触yolov7半天,成功实现训练

yolov7: 从搭配环境到训练自己的数据集

labelImg安装所遇到的那些坑

 

Logo

欢迎来到由智源人工智能研究院发起的Triton中文社区,这里是一个汇聚了AI开发者、数据科学家、机器学习爱好者以及业界专家的活力平台。我们致力于成为业内领先的Triton技术交流与应用分享的殿堂,为推动人工智能技术的普及与深化应用贡献力量。

更多推荐