我想改进 torchvision 中可用的预训练 RetinaNet 模型,以便创建我自己的对象检测。
我正在尝试在此链接上复制 FastRCNN 所做的工作: https ://pytorch.org/tutorials/intermediate/torchvision_tutorial.html#finetuning-from-a-pretrained-model
我所做的如下:
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[0].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)
模型已声明,训练不会中断。然而,性能是如此糟糕,以至于一个非常愚蠢的检测都不起作用。
我的问题是,我写的代码可以重新训练 RetinaNet 模型吗?