Yolov5目标检测模型运行遇到的相关问题汇总

一、yolov5-5.0常见错误

1. pycocotools工具包无法安装

具体报错如下:

requirements: pycocotools>=2.0 not found and is required by YOLOv5
pkg_resources.DistributionNotFound: The 'pycocotools>=2.0' distribution was not found and is required by the application

针对此问题,我的做法是直接下载pycocotools工具包。
地址:https://pan.baidu.com/s/1miwQQ96X1Gp6-ji310IgAA,提取码:9n50
然后将其解压在自己Anaconda安装路径中:\Lib\site-packages。
有人也提出了另外的解决方法,pycharm命令行输入:

pip install pycocotools-windows

然我试过也不太行,但有人可以,可能是电脑问题。

2. 数据通道错误

RuntimeError: Given groups=1, weight of size 【512, 1024, 1, 1】, expected input【1, 512, 8, 8】 to have 1024 channels, but got 512 channels instead

这个问题是模型不对导致的。
在train.py中更改参数行:

parser.add_argument('--cfg', type=str, default='models/yolov5s.yaml', help='model.yaml path')

3.attribute 'SPPF’无法找到

Can't get attribute 'SPPF' on <module 'models.common' from 'E:\\Yolo\\yolov5-5.0\\models\\common.py'>

这问题是因为SPPF的类在5.0版本没有被引用,需要我们在6.0版本中打开models/common.py,将其中SPPF类放入5.0的common文件中,然后引用warnings包。

4. coco128未正确解压

Error loading data from ../coco128/images/train2017/: train: ..\coco128\images\train2017 does not exist

这个问题是因为unzip工具不适用,需要将coco128压缩文件剪切到与yolov5.0文件夹相同的目录下解压,并打开。并在coco128.yaml文件中修改路径,

train: ../coco128/images/train2017/
val: ../coco128/images/train2017/

5. Out Of Memory

将batchsize减小就可以了。

二、yolov5-6.0常见错误

1. OSError: cannot open resource

这个问题属于字体错误,windows下需要手动下载Arial.ttf然后复制到C:\Users\LENOVO\AppData\Roaming\Ultralytics文件夹下即可。

版权声明:本文为CSDN博主「人狮子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/baidu_35536188/article/details/122392486

人狮子

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

tf-faster-rcnn运行再记录

拿到新的数据,修改roi_rename.py里文件的路径、名称等; 新建resource-Annotations文件夹; 然后打开anaconda、activate Labelimg、labelimg&

YOLO区域目标检测

基于YOLO的区域检测 最近在研究YOLO的项目,也研究一些大神关于区域检测的代码,发现比较稀缺,几番周折之后,研究了一下,搞了一套暂且能凑合用的,先码上&#