Open gibotsgithub opened 1 year ago
我遇到了相同的问题,解决方案看这个链接:https://blog.csdn.net/Thebest_jack/article/details/125649451
Needs to replace two lines in the file loss.py . 1、Replace “anchors = self.anchors[i] ” with "anchors, shape = self.anchors[i], p[i].shape" 2、Replace “indices.append((b, a, gj.clamp_(0, featurewh[1] - 1), gi.clamp(0, featurewh[0] - 1)))” with "indices.append((b, a, gj.clamp(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1)))" .
In addition , after this has fixed , if anyone has the "AttributeError: 'FreeTypeFont' object has no attribute 'getsize' " , just tpye pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Pillow==9.5 . Pillow >=10 has delete the attribute "getsize()"
0%| | 0/4 [00:00<?, ?it/s]
main(opt)
File "/home/server/scanning/python-server/ocri-python/app/test/harshal_yolo/yolov5_obb/train.py", line 530, in main
train(opt.hyp, opt, device, callbacks)
File "/home/server/scanning/python-server/ocri-python/app/test/harshal_yolo/yolov5_obb/train.py", line 326, in train
loss, loss_items = compute_loss(pred, targets.to(device)) # loss scaled by batch_size
File "/home/server/scanning/python-server/ocri-python/app/test/harshal_yolo/yolov5_obb/utils/loss.py", line 135, in call
tcls, tbox, indices, anchors, tgaussian_theta = self.build_targets(p, targets) # targets
File "/home/server/scanning/python-server/ocri-python/app/test/harshal_yolo/yolov5_obb/utils/loss.py", line 265, in buildtargets
indices.append((b, a, gj.clamp(0, featurewh[1] - 1), gi.clamp(0, feature_wh[0] - 1))) # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type long int
Traceback (most recent call last): File "/home/server/scanning/python-server/ocri-python/app/test/harshal_yolo/yolov5_obb/train.py", line 633, in
How do I fix this? It worked in colab, but not running on my laptop