-
Notifications
You must be signed in to change notification settings - Fork 370
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
freeze_backbone and freeze_decoder in Trainers #1290
freeze_backbone and freeze_decoder in Trainers #1290
Conversation
Can you do other trainers too? For this paper, all of our tasks will be semantic segmentation, but might as well do all trainers if it's easy. |
be4cd0d
to
4fa65fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the parameter names. Also not sure if freezing the ResNet encoder in a U-Net counts as linear probing or not. Same with classification/regression. Might be easier just to freeze the entire model and add a single layer MLP to the end.
@@ -110,7 +124,9 @@ class and used with 'ce' loss | |||
*encoder_weights* to *weights*. | |||
|
|||
.. versionadded: 0.5 | |||
The *class_weights* parameter. | |||
The *class_weights*, *freeze_backbone*, | |||
and *freeze_decoder* parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not documented.
Can you reference some papers that freeze the entire UNet and add fine-tune an MLP on top? I have never seen this before. Also it would make more sense to fine tune a conv layer not a MLP. Could you also suggest better parameter names? |
I'm only talking about classification/regression. No idea what the usual practice is for linear probing of semantic segmentation. Will think about parameter names, don't have a better name off the top of my head. I still kind of like linear_probing because it makes it clear why you would want to use the parameter. |
Disagree about the naming. Freeze_backbone is the action we are performing. Linear probing is just the downstream task a user may choose to perform with the classifier with a frozen backbone. There may be other potential reasons for freezing the backbone other than linear probing. |
This PR adds a
freeze_backbone
arg to all trainers and afreeze_decoder
arg to theSemanticSegmentationTask
andPixelwiseRegressionTask
. This is particularly useful if wanting to fine-tune (aka linear probe) only the classifier head of a pretrained model or only the decoder or segmentation head in an encoder/decoder architecture.