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

copy.deepcopy does not work on Faster R-CNN models #1

Open
joskaaaa opened this issue Jun 13, 2019 · 2 comments
Open

copy.deepcopy does not work on Faster R-CNN models #1

joskaaaa opened this issue Jun 13, 2019 · 2 comments

Comments

@joskaaaa
Copy link

Relying on copy.deepcopy to copy the model in:

  • compression_conf_fc.ipynb
  • compress.py

Does not work for Faster R-CNN models which use mixed serialization & non-script modules.

This results in the error: _pickle.PickleError: ScriptModules cannot be saved using torch.save. Mixed serialization of script and non-script modules is not supported. For purely script modules use my_script_module.save(<filename>) instead.

Refer to PyTorch issue 18106.

What Faster R-CNN Resnet50 model were you using for this to work? I have been trying with the torchvision pretrained model with no success: torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)

@juliagusak
Copy link
Member

juliagusak commented Jun 14, 2019

Hello @joskaaaa ,

we have experimented with two pre-trained Faster R-CNN models, one from the facebook repository and another one from here.

In both models ROI part is not serializable. That is why on compression step we firstly extract a backbone from the model, then compress it and insert compressed backbone back to the model.

@mattans
Copy link

mattans commented Nov 12, 2019

@juliagusak can you please explain how to save and load MaskRCNN objects?

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

3 participants