Pretrained resnet conversion AttributeError
See original GitHub issue[---------------------------------------------------------------------------]
AttributeError Traceback (most recent call last)
<ipython-input-4-2a0f9d424028> in <module>
4 output_2d = model_2d(input_2d)
5
----> 6 model_3d = ACSConverter(model_2d)
7 # once converted, model_3d is using ACSConv and capable of processing 3D volumes.
8 B, C_in, D, H, W = (1, 3, 64, 64, 64)
~/miniconda3/envs/rENE/lib/python3.6/site-packages/ACSConv-0.1.0-py3.6.egg/acsconv/converters/acsconv_converter.py in __init__(self, model)
27 """ Save the weights, convert the model to ACS counterpart, and then reload the weights """
28 preserve_state_dict = model.state_dict()
---> 29 model = self.convert_module(model)
30 model.load_state_dict(preserve_state_dict,strict=False) #
31 self.model = model
~/miniconda3/envs/rENE/lib/python3.6/site-packages/ACSConv-0.1.0-py3.6.egg/acsconv/converters/base_converter.py in convert_module(self, module)
24 if isinstance(child, nn.Conv2d):
25 arguments = nn.Conv2d.__init__.__code__.co_varnames[1:]
---> 26 kwargs = {k: getattr(child, k) for k in arguments}
27 kwargs = self.convert_conv_kwargs(kwargs)
28 setattr(module, child_name, self.__class__.target_conv(**kwargs))
~/miniconda3/envs/rENE/lib/python3.6/site-packages/ACSConv-0.1.0-py3.6.egg/acsconv/converters/base_converter.py in <dictcomp>(.0)
24 if isinstance(child, nn.Conv2d):
25 arguments = nn.Conv2d.__init__.__code__.co_varnames[1:]
---> 26 kwargs = {k: getattr(child, k) for k in arguments}
27 kwargs = self.convert_conv_kwargs(kwargs)
28 setattr(module, child_name, self.__class__.target_conv(**kwargs))
~/miniconda3/envs/rENE/lib/python3.6/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
946 return modules[name]
947 raise AttributeError("'{}' object has no attribute '{}'".format(
--> 948 type(self).__name__, name))
949
950 def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:
AttributeError: 'Conv2d' object has no attribute 'kernel_size_'
model_2d = resnet18(pretrained=True)
Pretrained resnet is not converted properly.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
ResNet object has no attribute 'predict' - Stack Overflow
TLDR: I get an error called ModuleAttributeError that says the 'ResNet' module has no attribute 'predict'. The image is preprocessed here as ...
Read more >Convert ResNet101 from TensorFlow to PyTorch #22 - GitHub
Dear @kitstar, I want to convert a ResNet V1 101 model (from ... I transfer the pretrained vgg16.ckpt in tensorflow to be used...
Read more >speechbrain.pretrained.interfaces module - Read the Docs
Defines interfaces for simple inference with pretrained models ... It is, however, possible to convert a file from a higher sampling rate to...
Read more >Transfer Learning in Keras with Computer Vision Models
A way to short-cut this process is to re-use the model weights from pre-trained models that were developed for standard computer vision ...
Read more >AttributeError: 'VGG' object has no attribute 'copy' - vision
AttributeError : 'VGG' object has no attribute 'copy' ... self.pre_trained_model == 'VGG16': self.torch_model = models.vgg16(pretrained=True) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I assume the corresponding torch version is 1.8 for torchvision 0.9. It is indeed not compatible with our current codebase. We are going to update a compatible version for torch 1.8. You could either wait for the new codebase or downgrade the torch version to 1.0.
Sorry for the trouble.
The repo is compatible with PyTorch 1.8 now. Welcome to try it!