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

Pruned efficientnets don't respect the in_chans parameter #1597

Open
jphdotam opened this issue Dec 20, 2022 · 0 comments
Open

Pruned efficientnets don't respect the in_chans parameter #1597

jphdotam opened this issue Dec 20, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jphdotam
Copy link

When creating a model using timm.create_model(arch, pretrained=True, in_chans=1, num_classes=1), single-channel input images can be used with tf_efficientnet_b2_ns, but not efficientnet_b3_pruned. The pruned models result in the following error:

  File "/home/james/miniconda3/envs/mammo/lib/python3.10/site-packages/timm/models/efficientnet.py", line 557, in forward
    x = self.forward_features(x)

  File "/home/james/miniconda3/envs/mammo/lib/python3.10/site-packages/timm/models/efficientnet.py", line 540, in forward_features
    x = self.conv_stem(x)

  File "/home/james/miniconda3/envs/mammo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1482, in _call_impl
    return forward_call(*args, **kwargs)

  File "/home/james/miniconda3/envs/mammo/lib/python3.10/site-packages/timm/models/layers/conv2d_same.py", line 30, in forward
    return conv2d_same(x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups)

  File "/home/james/miniconda3/envs/mammo/lib/python3.10/site-packages/timm/models/layers/conv2d_same.py", line 17, in conv2d_same
    return F.conv2d(x, weight, bias, stride, (0, 0), dilation, groups)

RuntimeError: Given groups=1, weight of size [40, 3, 3, 3], expected input[14, 1, 2459, 2459] to have 3 channels, but got 1 channels instead
@jphdotam jphdotam added the bug Something isn't working label Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants