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

Number of channels for model input #4

Open
kalpa61 opened this issue Sep 26, 2024 · 0 comments
Open

Number of channels for model input #4

kalpa61 opened this issue Sep 26, 2024 · 0 comments

Comments

@kalpa61
Copy link

kalpa61 commented Sep 26, 2024

Encountered a code bug when replicating, specifically, the Vit model expected input channel is 2, but the input channel is 3, the source code missing the intermediate processing part? The following is the program error:

Traceback (most recent call last):
File "D:\PycharmProject\MEMix\main.py", line 239, in
run_training(cut_alpha=2.0, mix_alpha=1.0,num_classes=5)
File "D:\PycharmProject\MEMix\main.py", line 124, in run_training
ALL, attn, final = net_all(mix_flow, onset)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "D:\PycharmProject\MEMix\model.py", line 272, in forward
x = self.model(x,y) # [B,768]
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "D:\PycharmProject\MEMix\model.py", line 201, in forward
x = self.forward_features(x,y)
File "D:\PycharmProject\MEMix\model.py", line 175, in forward_features
x = self.patch_embed(x)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\timm\layers\patch_embed.py", line 131, in forward
x = self.proj(x)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\conv.py", line 460, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\Anaconda3\envs\Mers\lib\site-packages\torch\nn\modules\conv.py", line 456, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [768, 2, 16, 16], expected input[34, 3, 224, 224] to have 2 channels, but got 3 channels instead

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

1 participant