pythonpytorchtorchvisionretinanet

TorchVision using pretrained weights for entire model vs backbone


TorchVision Detection models have a weights and a weights_backbone parameter. Does using pretrained weights imply that the model uses pretrained weights_backbone under the hood? I am training a RetinaNet model and I'm not sure which of the two options I should use and what the differences are.


Solution

  • The difference is pretty simple: you can either choose to do transfer learning on the backbone only or on the whole network.

    RetinaNet from Torchvision has a Resnet50 backbone. You should be able to do both of:

    As implied by their names, the backbone weights are different. The former were trained on COCO (object detection) while the later were trained on ImageNet (classification).

    To answer your question, pretrained weights implies that the whole network, including backbone weights, are initialized. However, I don't think that it calls backbone_weights under the hood.