A custom computer vision primitive (get_pretrained_model() ) that facilities easy and smooth transfer learning (feature extraction AND fine-tuning) with ALL torchvision.models #1023
ChampPhil
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Before I explain, I want to give credit to @Rick-29 - who created a transfer learning function
that can returns a pre-trained model from
torchvision.modelswith its output layer adjusted. The link to that post is here: #675The limitations of this function are:
It does not support fine-tuning, and returns a model with all layers frozen except the output layer.
The pre-trained models within
torchvision.modelscan have different naming conventions/organization. For example, torchvision.models.resnet18 modules' are:['conv1', 'bn1', 'relu', 'maxpool', 'layer1', 'layer2', 'layer3', 'layer4', 'avgpool', 'fc']and torchvision.models.efficientnet_b0 modules' are['features', 'avgpool', 'classifier']. This drastic difference would have caused errors in @Rick-29's function and made it only work on certain pre-trained models and error out on others.I propose a new, optimized function that
torchvision.modelsassertfunctionalityBeta Was this translation helpful? Give feedback.
All reactions