一、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