我想检测9个物体,都是衣服。所以我想用yolov5。我想使用预先训练好的yolov5x.pt砝码进行训练。我将yolov5x.yaml和clothing_data.yaml中的类别数更改为9。当我尝试通过以下方式训练自定义数据集时:
!python train.py --img 640 --batch 4 --epochs 100 --data ./data/clothing.yaml --cfg models/yolov5x.yaml --weights yolov5x.pt --name yolov5x_clothing --cache
它显示了错误
KeyError: 'model.18.conv.weight'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "train.py", line 404, in <module>
train(hyp)
File "train.py", line 122, in train
raise KeyError(s) from e
KeyError: "yolov5x.pt is not compatible with models/yolov5x.yaml. Specify --weights '' or specify a --cfg compatible with yolov5x.pt."
我不知道在这里该怎么办。我用
!git clone https://github.com/ultralytics/yolov5
%cd yolov5
!git checkout ec72eea62bf5bb86b0272f2e65e413957533507f
这里有我遗漏的东西吗?请让我知道。提前谢谢
我在下载了链接中提到的当前版本的权重后解决了这个问题: YOLO V5 current releases
在我的例子中,回购协议中的权重不知何故不起作用。这绝对解决了问题
相关问题 更多 >
编程相关推荐