解决办法:
1.打开【utils】→【loss.py】;
2.ctrl+f搜索anchors = self.anchors[i]
,将其替换为:anchors, shape = self.anchors[i], p[i].shape
替换效果:
3.ctrl+f搜索indices.append
,将那一行代码替换为indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1))) # image, anchor, grid
,替换效果:
4.保存运行,问题解决。