positive666 / yolo_research

based on yolo-high-level project (detect\pose\classify\segment\):include yolov5\yolov7\yolov8\ core ,improvement research ,SwintransformV2 and Attention Series. training skills, business customization, engineering deployment C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

train yolov5_SwinV2.yaml

ccccjiax opened this issue · comments

❔Question

Traceback (most recent call last):
File "train.py", line 640, in
main(opt)
File "train.py", line 534, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 123, in train
model = Model(cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create
File "D:\yolov5_research-master\models\yolo.py", line 1026, in init
m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward
File "D:\yolov5_research-master\models\yolo.py", line 1025, in
forward = lambda x: self.forward(x)[0] if isinstance(m, (Segment, ISegment, IRSegment)) else self.forward
(x)
File "D:\yolov5_research-master\models\yolo.py", line 1088, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "D:\yolov5_research-master\models\yolo.py", line 943, in _forward_once
x = m(x) # run
File "D:\yolov5_research-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_imp
l
return forward_call(*input, **kwargs)
File "D:\yolov5_research-master\venv\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\yolov5_research-master\venv\lib\site-packages\torch\nn\modules\conv.py", line 460, in _conv_forwar
d
self.padding, self.dilation, self.groups)

RuntimeError: Given groups=1, weight of size [256, 3, 256, 256], expected input[1, 512, 8, 8] to have 3 chann
els, but got 512 channels instead

Additional context

The problem may be that the backbone is structurally wrong,This Yaml reference structure is from last year, now it seems a little outdated, I will take time to debug and verify, and will sort out the relevant transformer in the near future, you can refer to the official swinV2 in common.py or swin offic repo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.