RetinaNet (from torchvision) fine tuning

Hi all, I want to fine-tune retinanet from torchvision using the pipeline from https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html, but a couple of issues happening. For the model, I am altering the pretrained model with the following code for one object class:

model = torchvision.models.detection.retinanet_resnet50_fpn(pretrained=True)
num_anchors=model.head.classification_head.num_anchors
in_channels=model.head.classification_head.conv[0].in_channels
model.head=RetinaNetHead(in_channels, num_anchors, 2)

The issue is the evaluation gives absolute zero on every metric and loss shows nan randomly for the same data.

1 Like