-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Hi,
Thank you for sharing code!
I write a simple code for testing an image:
import mmcv
from mmcv.parallel import MMDataParallel, collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.apis import inference_detector, show_result
from mmdet.models import build_backbone, build_detector
cfg = mmcv.Config.fromfile('local_configs/cascade_rcnn_r101_fpn_20e_pretrain_sge_resnet101.py')
cfg.model.pretrained = 'pretrained_model/cascade_rcnn_fpn_20e_sge_resnet101.pth'
model = build_detector(cfg.model, test_cfg=cfg.test_cfg)
_ = load_checkpoint(model, cfg.model.pretrained)
model = MMDataParallel(model, device_ids=[0])
model.eval()
img = mmcv.imread('cat.jpg')
result = inference_detector(model, img, cfg)
show_result(img, result)
while the checkpoint was downloaded from README.MD. I get the error below:
unexpected key in source state_dict: backbone.conv1.weight, backbone.bn1.weight, backbone.bn1.bias, backbone.bn1.running_mean, backbone.bn1.running_var, backbone.bn1.num_batches_tracked, backbone.layer1.0.conv1.weight, backbone.layer1.0.bn1.weight, backbone.layer1.0.bn1.bias, backbone.layer1.0.bn1.running_mean, backbone.layer1.0.bn1.running_var, backbone.layer1.0.bn1.num_batches_tracked, backbone.layer1.0.conv2.weight, backbone.layer1.0.bn2.weight, backbone.layer1.0.bn2.bias, backbone.layer1.0.bn2.running_mean, backbone.layer1.0.bn2.running_var, backbone.layer1.0.bn2.num_batches_tracked, backbone.layer1.0.conv3.weight, back...
missing keys in source state_dict: layer3.1.bn3.running_mean, layer3.5.bn3.running_mean, layer2.1.conv2.weight, layer3.0.downsample.1.bias, layer2.0.downsample.1.running_mean, layer3.3.bn2.running_var, layer3.12.bn1.running_mean, layer2.0.bn1.weight, layer3.4.bn2.running_mean, layer2.1.conv1.weight, layer3.1.bn2.bias, layer3.18.bn1.weight, layer1.2.bn2.weight, layer4.0.bn2.bias, layer3.12.bn2.weight, layer2.0.bn2.running_mean, layer3.11.bn3.weight, layer3.20.bn3.weight, layer1.0.bn2.weight, layer4.2.conv3.weight, layer3.0.downsample.0.weight, layer3.5.bn1.running_mean, layer4.2.conv2.weight, layer3.2.conv3.weight, ...
It seems that the checkpoint file has a prefix 'backbore', but I don't know how to solve it.
Hoping for your reply!
Thank you!
Metadata
Metadata
Assignees
Labels
No labels