Traceback (most recent call last):
File "C:/YOLOV5/yolov5-5.0/train.py", line 543, in <module>
train(hyp, opt, device, tb_writer)
File "C:/YOLOV5/yolov5-5.0/train.py", line 304, in train
loss, loss_items = compute_loss(pred, targets.to(device)) # loss scaled by batch_size
File "C:\YOLOV5\yolov5-5.0\utils\loss.py", line 117, in __call__
tcls, tbox, indices, anchors = self.build_targets(p, targets) # targets
File "C:\YOLOV5\yolov5-5.0\utils\loss.py", line 211, in build_targets
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type __int64
改动如下:
在loss.py中第178行和第211行
修改前:
修改后:
anchors, shape = self.anchors[i], p[i].shape