根据前面提到的标题,如果我已经对主干进行了预训练,我只想训练RPN,而不是使用torchvision的更快的R-CNN来训练分类器
是否有任何参数可以传递给create_model函数,或者我会在train()函数中停止分类器训练
我在手机上,请原谅我的编辑
这是我的创建模型函数
Create your backbone from timm
backbone = timm.create_model(
“resnet50”,
pretrained=True,
num_classes=0, # this is important to remove fc layers
global_pool="" # this is important to remove fc layers
)
backbone.out_channels = backbone.feature_info[-1][“num_chs”]
anchor_generator = AnchorGenerator(
sizes=((16, 32, 64, 128, 256),), aspect_ratios=((0.25, 0.5, 1.0, 2.0),)
)
roi_pooler = torchvision.ops.MultiScaleRoIAlign(
featmap_names=[“0”], output_size=7, sampling_ratio=2
)
fastercnn_model = FasterRCNN(
backbone=backbone,
num_classes=1000,
rpn_anchor_generator=anchor_generator,
box_roi_pool=roi_pooler,
)
您可以执行以下操作
相关问题 更多 >
编程相关推荐