Basically I have changed the backbone of the initial model from ResNet50 to MobilenetV2, but after some training I realized that without pretrained weights the model will converge extremely slow. From this I understood that I have to load the pretrained weights somehow only for the transformer parts.
Is that possible?
Any information on how I could do this is gladly welcomed.
I tried something like :
model_without_ddp.transformer.load_state_dict(checkpoint['model'],strict=False)
thinking that with the strict parameter set to false the values would be loaded only for the transformer but i even if the code does not error out I don't see any changes in the transformer weights.
So basically I found out that I can parse the loaded checkpoint and delete unnecessary weights from the dict before loading them into the model. That being said I'll close this issue giving that it has been resolved.
Basically I have changed the backbone of the initial model from ResNet50 to MobilenetV2, but after some training I realized that without pretrained weights the model will converge extremely slow. From this I understood that I have to load the pretrained weights somehow only for the transformer parts.
Is that possible? Any information on how I could do this is gladly welcomed.
I tried something like :
model_without_ddp.transformer.load_state_dict(checkpoint['model'],strict=False)
thinking that with the strict parameter set to false the values would be loaded only for the transformer but i even if the code does not error out I don't see any changes in the transformer weights.So basically I found out that I can parse the loaded checkpoint and delete unnecessary weights from the dict before loading them into the model. That being said I'll close this issue giving that it has been resolved.