我把您的Decoupled Head 移植到到了我的代码里。修改了common.py 和yolo.py.我运行yolo.py测试网络是否可以正常forward,但出现了以下问题:
28 [19, 23, 27] 1 7337351 Decoupled_Detect [10, [[18, 14, 12, 26, 23, 20], [33, 24, 19, 44, 45, 34], [66, 49, 104, 73, 168, 136]], [216, 216, 416]]
<class 'NoneType'> None
Traceback (most recent call last):
File "/workspace/xdy/yolov5/models/yolo.py", line 689, in
model = Model(opt.cfg,opt.feature).to(device)
File "/workspace/xdy/yolov5/models/yolo.py", line 332, in init
m.stride = torch.tensor([s / x.shape[-2] for x in self.forward(torch.zeros(1, ch, s, s))]) # forward
File "/workspace/xdy/yolov5/models/yolo.py", line 355, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "/workspace/xdy/yolov5/models/yolo.py", line 378, in _forward_once
x = m(x) # run
File "/root/miniconda3/envs/torch17/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/workspace/xdy/yolov5/models/yolo.py", line 57, in forward
bs, _, ny, nx = x[i].shape # x(bs,255,20,20) to x(bs,3,20,20,85)
AttributeError: 'NoneType' object has no attribute 'shape'
class Decoupled_Detect中的forward 的 x[i]是个空值 用原来的detect倒是正常,求作者大大指教