【问题标题】:Yolov7 segmentation loss function error during first epochYolov7 分割损失函数在第一个时期的错误
【发布时间】:2022-11-03 10:15:28
【问题描述】:

我正在尝试运行 yolov7 分段,但在第一个时期出现错误

     Epoch   gpu_mem       box       obj       cls     total    labels  img_size
  0%|                                                                                                                                    | 0/930 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "train.py", line 613, in <module>
    train(hyp, opt, device, tb_writer)
  File "train.py", line 363, in train
    loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs)  # loss scaled by batch_size
  File "C:\xxx\yolov7-mask\utils\loss.py", line 585, in __call__
    bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
  File "C:\xxx\yolov7-mask\utils\loss.py", line 641, in build_targets
    indices, anch = self.find_3_positive(p, targets)
  File "C:\xxx\yolov7-mask\utils\loss.py", line 811, in find_3_positive
    gain[2:6] = torch.tensor(p[i].shape)[[3, 2, 3, 2]]  # xyxy gain
KeyError: 0

我正在使用命令

python train.py --workers 4 --device 0 --batch-size 4 --data data/cracks.yaml --cfg cfg/yolov7-mask.yaml --img 416 416 --weights ./yolov7-mask.pt --name yolov7 --epochs 1000 --hyp data/hyp.scratch.mask.yaml

我的cracks.yaml 看起来像这样

train: ../datasets/cracks/train
val: ../datasets/cracks/valid
test: ../datasets/cracks/test

nc: 1
names: ['crack']

我做错了什么?它是来自 GitHub 的全新安装。

【问题讨论】:

    标签: python deep-learning image-segmentation yolo detectron


    【解决方案1】:

    我可以知道你从哪里得到hyp.scratch.mask.yaml 文件吗?谢谢

    【讨论】:

      猜你喜欢
      • 2021-07-19
      • 2018-11-04
      • 2021-07-30
      • 2018-09-23
      • 2022-01-24
      • 2022-01-07
      • 1970-01-01
      • 2018-03-03
      • 2018-10-22
      相关资源
      最近更新 更多