Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于concatFusionFactor的问题 #22

Open
SwjtuerFz opened this issue Dec 17, 2023 · 2 comments
Open

关于concatFusionFactor的问题 #22

SwjtuerFz opened this issue Dec 17, 2023 · 2 comments

Comments

@SwjtuerFz
Copy link

您好,我的数据是768*768,。请问我把concat替换为concatFusionFactor后,运行yolo.py,报如下的错误。应该还要改哪些地方呢?

D:\ProgramData\Anaconda3\envs\py38\python.exe D:/1bishe/yolov5-master2/models/yolo.py
models\yolo: cfg=yolov5s-biformer2-scale.yaml, batch_size=1, device=0, profile=False, line_profile=False, test=False
YOLOv5 2023-12-11 Python-3.8.18 torch-1.13.0+cu117 CUDA:0 (NVIDIA GeForce RTX 3060 Laptop GPU, 6144MiB)

             from  n    params  module                                  arguments                     

0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 18816 models.common.C3 [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 2 115712 models.common.C3 [128, 128, 2]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 3 625152 models.common.C3 [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 1182720 models.common.C3 [512, 512, 1]
9 -1 1 1055744 models.Biformer.BiLevelRoutingAttention [512]
10 -1 1 656896 models.common.SPPF [512, 512, 5]
11 -1 1 131584 models.common.Conv [512, 256, 1, 1]
12 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
13 [-1, 6] 1 1 models.common.ConcatFusionFactor [1]
14 -1 1 427520 models.common.C3 [768, 256, 1, False]
15 -1 1 33024 models.common.Conv [256, 128, 1, 1]
16 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
17 [-1, 4] 1 1 models.common.ConcatFusionFactor [1]
18 -1 1 107264 models.common.C3 [384, 128, 1, False]
19 -1 1 147712 models.common.Conv [128, 128, 3, 2]
20 [-1, 15] 1 1 models.common.ConcatFusionFactor [1]
21 -1 1 296448 models.common.C3 [256, 256, 1, False]
22 -1 1 590336 models.common.Conv [256, 256, 3, 2]
23 [-1, 11] 1 1 models.common.ConcatFusionFactor [1]
24 -1 1 1182720 models.common.C3 [512, 512, 1, False]
25 [18, 21, 24] 1 229245 Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
Traceback (most recent call last):
File "D:/1bishe/yolov5-master2/models/yolo.py", line 391, in
model = Model(opt.cfg).to(device)
File "D:/1bishe/yolov5-master2/models/yolo.py", line 200, in init
m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward
File "D:/1bishe/yolov5-master2/models/yolo.py", line 199, in
forward = lambda x: self.forward(x)[0] if isinstance(m, Segment) else self.forward(x)
File "D:/1bishe/yolov5-master2/models/yolo.py", line 214, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "D:/1bishe/yolov5-master2/models/yolo.py", line 125, in _forward_once
x = m(x) # run
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\1bishe\yolov5-master2\models\common.py", line 228, in forward
return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), 1))
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\1bishe\yolov5-master2\models\common.py", line 68, in forward
return self.act(self.bn(self.conv(x)))
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [128, 768, 1, 1], expected input[1, 512, 48, 48] to have 768 channels, but got 512 channels instead

@WindVChen
Copy link
Owner

哈喽 @SwjtuerFz

concatFusionFactor 相比于 concat 只多了一个缩放系数,应该是不会影响程序的运行的,可以查查下其他代码段?

@SwjtuerFz
Copy link
Author

SwjtuerFz commented Dec 20, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants