Sharpiless / yolov5-distillation-5.0

yolov5 5.0 version distillation || yolov5 5.0版本知识蒸馏,yolov5l >> yolov5s
GNU General Public License v3.0
153 stars 27 forks source link

TypeError: 'builtin_function_or_method' object does not support item assignment #13

Open GitHub1002 opened 1 year ago

GitHub1002 commented 1 year ago

Traceback (most recent call last): File "train.py", line 674, in train(hyp, opt, device, tb_writer) File "train.py", line 371, in train loss, loss_items = compute_loss( File "/home/dell2/FMK/yolov5-distillation-5.0/utils/loss.py", line 184, in call tcls, tbox, indices, anchors = self.build_targets( File "/home/dell2/FMK/yolov5-distillation-5.0/utils/loss.py", line 255, in build_targets gain[2:6] = torch.tensor(p[i].shape)[[3, 2, 3, 2]] # xyxy gain TypeError: 'builtin_function_or_method' object does not support item assignment

xyh001007 commented 1 year ago

do you solve it?

HeadInTheClouds97 commented 1 year ago

In loss.py 167lines gain = torch.ones(7, device=targets.device).long to gain = torch.ones(7, device=targets.device).long()