I would like to fine the pre-trained RetinaNet model available in torchvision in order to create my own object detection.
I'm trying to replicate what is done for the FastRCNN at this link: https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html#finetuning-from-a-pretrained-model
What I have done is the following:
model = model = torchvision.models.detection.retinanet_resnet50_fpn(pretrained=True) num_classes = 2 # get number of input features and anchor boxed for the classifier in_features = model.head.classification_head.conv.in_channels num_anchors = model.head.classification_head.num_anchors # replace the pre-trained head with a new one model.head = RetinaNetHead(in_features, num_anchors, num_classes)
The model is declared, and the training doesn't break. However the performance are so bad that neither a very stupid detection works.
My question is, the code that I wrote is okay to retrain the RetinaNet model?