我想检测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."我不知道在这里该做什么。我使用以下命令克隆了yolov5的存储库
!git clone https://github.com/ultralytics/yolov5
%cd yolov5
!git checkout ec72eea62bf5bb86b0272f2e65e413957533507f我是不是漏掉了什么?请让我知道。提前谢谢。
发布于 2020-12-18 15:22:21
我在下载了链接中提到的权重的当前版本后解决了这个问题:YOLO V5 current releases
在我的例子中,repo中的权重不知何故不起作用。这绝对解决了这个问题。
https://stackoverflow.com/questions/65310594
复制相似问题