Closed sunshine-zkf closed 5 years ago
In my case the issue was caused by incompatible pretrained network weights. You can fix it either by: 1) not using the pretrained network: model = torchvision.models.detection.retinanet_resnet50_fpn(pretrained=False)
or
2) loading the network with pretrained=True AND use the default num_classes (91). If you're using a custom dataset (e.g: 10 classes), you can then switch out the classification head with a new one: model = torchvision.models.detection.retinanet_resnet50_fpn(pretrained=True) in_channels = model.backbone.out_channels num_anchors_per_location = model.anchor_generator.num_anchors_per_location()[0] model.head.classification_head = torchvision.models.detection.retinanet.RetinaNetClassificationHead(in_channels, num_anchors_per_location, num_classes=10)
When i run python train.py, found a problem as follow:
how to fix it? can you give some advises? thank you @kuangliu