【问题标题】:"yolov5x.pt is not compatible with models/yolov5x.yaml. Specify --weights '' or specify a --cfg compatible with yolov5x.pt."“yolov5x.pt 与模型/yolov5x.yaml 不兼容。指定 --weights '' 或指定与 yolov5x.pt 兼容的 --cfg。”
【发布时间】:2023-03-26 23:17:01
【问题描述】:

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

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

【问题讨论】:

  • 您看到this 问题了吗?也许您需要删除当前的预训练模型才能下载最新版本?
  • 感谢@cbolwerk ..我使用的是与 repo 一起下载的权重。它不知何故不起作用。然后我使用了最新发布的权重,它终于奏效了。我猜他们没有更新它们。

标签: python object-detection yolov5


【解决方案1】:

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

在我的情况下,repo 中的权重无法正常工作。这绝对解决了它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-13
    • 2017-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-07
    相关资源
    最近更新 更多