My model is below:
bb_model = torchvision.models.resnet101()
bb_model_path = ‘/model/pretrain/resnet101-5d3b4d8f.pth’
bb_model.load_state_dict(torch.load(bb_model_path))
backbone = nn.Sequential(bb_model.conv1,
bb_model.bn1,
bb_model.relu,
bb_model.maxpool,
bb_model.layer1,
bb_model.layer2,
bb_model.layer3,
bb_model.layer4)
backbone.out_channels = 2048
anchor_generator = AnchorGenerator(sizes=((32, 64, 128, 256, 512),),aspect_ratios=((0.5, 1.0, 2.0),))
roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=[‘0’],output_size=7,sampling_ratio=2)
model = FasterRCNN(backbone,num_classes=201, rpn_anchor_generator=anchor_generator, box_roi_pool=roi_pooler)
model_path = args.model_dir
model.load_state_dict(torch.load(model_path))
When I give the net a input, the output of th network is none:
[{‘boxes’: tensor([], size=(0, 4), grad_fn=), ‘labels’: tensor([], dtype=torch.int64), ‘scores’: tensor([], grad_fn=)}]
What cause the problem?