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文件夹下即可。

2. Cannot uninstall ‘PyYAML’

直接terminal输入

pip install --ignore-installed PyYAML
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值