z1069614715 / objectdetection_script

一些关于目标检测的脚本的改进思路代码,详细请看readme.md
5.08k stars 460 forks source link

RuntimeError: shape mismatch: value tensor of shape [41, 1] cannot be broadcast to indexing result of shape [41] #2

Closed sili-t closed 1 year ago

sili-t commented 1 year ago

大佬,在添加OTA中,拉的版本是yolov5 7.0 按照视频步骤,还是有如下问题 Traceback (most recent call last): File "/home//yolov5/train.py", line 634, in main(opt) File "/home//yolov5/train.py", line 528, in main train(opt.hyp, opt, device, callbacks) File "/home//yolov5/train.py", line 310, in train loss, loss_items = compute_loss(pred, targets.to(device),imgs) # loss scaled by batch_size File "/home//yolov5/utils/loss.py", line 300, in call tobj[b, a, gj, gi] = (1.0 - self.gr) + self.gr * iou.detach().clamp(0).type(tobj.dtype) # iou ratio RuntimeError: shape mismatch: value tensor of shape [41, 1] cannot be broadcast to indexing result of shape [41]

z1069614715 commented 1 year ago

我刚自己复现一次 没有报错