2

我想检测 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 的 repo

!git clone https://github.com/ultralytics/yolov5
%cd yolov5
!git checkout ec72eea62bf5bb86b0272f2e65e413957533507f

我在这里缺少什么吗?请告诉我。提前致谢。

4

1 回答 1

0

我在下载链接中提到的当前版本的权重后解决了这个问题: YOLO V5 当前版本

就我而言,回购中的权重无法以某种方式工作。这绝对解决了它。

于 2020-12-18T07:22:21.207 回答