open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.61k stars 9.47k forks source link

model and loaded state dict do not match exactly #2175

Closed zuhaoran closed 4 years ago

zuhaoran commented 4 years ago

I want to run faster-RCNN without RPN. It can The model can be trained, but with a WARNING.This model uses too much video memory, so I suspect it doesn't freeze the network layer. There is my config.

model = dict(
    type='FasterRCNN',
    pretrained='torchvision://resnet101',
    backbone=dict(
        type='ResNet',
        depth=101,
        num_stages=3,
        strides=(1, 2, 2),
        dilations=(1, 1, 1),
        out_indices=(2,),
        frozen_stages=1,  
        norm_cfg=norm_cfg,
        norm_eval=True,
        style='caffe'),
    shared_head=dict(
        type='ResLayer',
        depth=101,
        stage=3,
        stride=2,
        dilation=1,
        style='caffe',
        norm_cfg=norm_cfg,
        norm_eval=True),
    rpn_head=dict(
        type='RPNHead',
        in_channels=1024,
        feat_channels=1024,
        anchor_scales=[2, 4, 8, 16, 32],
        anchor_ratios=[0.5, 1.0, 2.0],
        anchor_strides=[16],
        target_means=[.0, .0, .0, .0],
        target_stds=[1.0, 1.0, 1.0, 1.0],
        loss_cls=dict(
            type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
        loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)),
    bbox_roi_extractor=dict(
        type='SingleRoIExtractor',
        roi_layer=dict(type='RoIAlign', out_size=14, sample_num=2),
        out_channels=1024,
        featmap_strides=[16]),
    bbox_head=dict(
        type='BBoxHead',
        with_avg_pool=True,
        roi_feat_size=7,
        in_channels=2048,
        num_classes=81,
        target_means=[0., 0., 0., 0.],
        target_stds=[0.1, 0.1, 0.2, 0.2],
        reg_class_agnostic=False,
        loss_cls=dict(
            type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
        loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)))

There is my log.

2020-02-25 18:32:48,349 - INFO - Distributed training: False 2020-02-25 18:32:48,708 - INFO - load model from: torchvision://resnet101 2020-02-25 18:32:49,000 - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: layer4.0.conv1.weight, layer4.0.bn1.running_mean, layer4.0.bn1.running_var, layer4.0.bn1.weight, layer4.0.bn1.bias, layer4.0.conv2.weight, layer4.0.bn2.running_mean, layer4.0.bn2.running_var, layer4.0.bn2.weight, layer4.0.bn2.bias, layer4.0.conv3.weight, layer4.0.bn3.running_mean, layer4.0.bn3.running_var, layer4.0.bn3.weight, layer4.0.bn3.bias, layer4.0.downsample.0.weight, layer4.0.downsample.1.running_mean, layer4.0.downsample.1.running_var, layer4.0.downsample.1.weight, layer4.0.downsample.1.bias, layer4.1.conv1.weight, layer4.1.bn1.running_mean, layer4.1.bn1.running_var, layer4.1.bn1.weight, layer4.1.bn1.bias, layer4.1.conv2.weight, layer4.1.bn2.running_mean, layer4.1.bn2.running_var, layer4.1.bn2.weight, layer4.1.bn2.bias, layer4.1.conv3.weight, layer4.1.bn3.running_mean, layer4.1.bn3.running_var, layer4.1.bn3.weight, layer4.1.bn3.bias, layer4.2.conv1.weight, layer4.2.bn1.running_mean, layer4.2.bn1.running_var, layer4.2.bn1.weight, layer4.2.bn1.bias, layer4.2.conv2.weight, layer4.2.bn2.running_mean, layer4.2.bn2.running_var, layer4.2.bn2.weight, layer4.2.bn2.bias, layer4.2.conv3.weight, layer4.2.bn3.running_mean, layer4.2.bn3.running_var, layer4.2.bn3.weight, layer4.2.bn3.bias, fc.weight, fc.bias

2020-02-25 18:32:49,276 - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1.weight, bn1.running_mean, bn1.running_var, bn1.weight, bn1.bias, layer1.0.conv1.weight, layer1.0.bn1.running_mean, layer1.0.bn1.running_var, layer1.0.bn1.weight, layer1.0.bn1.bias, layer1.0.conv2.weight, layer1.0.bn2.running_mean, layer1.0.bn2.running_var, layer1.0.bn2.weight, layer1.0.bn2.bias, layer1.0.conv3.weight, layer1.0.bn3.running_mean, layer1.0.bn3.running_var, layer1.0.bn3.weight, layer1.0.bn3.bias, layer1.0.downsample.0.weight, layer1.0.downsample.1.running_mean, layer1.0.downsample.1.running_var, layer1.0.downsample.1.weight, layer1.0.downsample.1.bias, layer1.1.conv1.weight, layer1.1.bn1.running_mean, layer1.1.bn1.running_var, layer1.1.bn1.weight, layer1.1.bn1.bias, layer1.1.conv2.weight, layer1.1.bn2.running_mean, layer1.1.bn2.running_var, layer1.1.bn2.weight, layer1.1.bn2.bias, layer1.1.conv3.weight, layer1.1.bn3.running_mean, layer1.1.bn3.running_var, layer1.1.bn3.weight, layer1.1.bn3.bias, layer1.2.conv1.weight, layer1.2.bn1.running_mean, layer1.2.bn1.running_var, layer1.2.bn1.weight, layer1.2.bn1.bias, layer1.2.conv2.weight, layer1.2.bn2.running_mean, layer1.2.bn2.running_var, layer1.2.bn2.weight, layer1.2.bn2.bias, layer1.2.conv3.weight, layer1.2.bn3.running_mean, layer1.2.bn3.running_var, layer1.2.bn3.weight, layer1.2.bn3.bias, layer2.0.conv1.weight, layer2.0.bn1.running_mean, layer2.0.bn1.running_var, layer2.0.bn1.weight, layer2.0.bn1.bias, layer2.0.conv2.weight, layer2.0.bn2.running_mean, layer2.0.bn2.running_var, layer2.0.bn2.weight, layer2.0.bn2.bias, layer2.0.conv3.weight, layer2.0.bn3.running_mean, layer2.0.bn3.running_var, layer2.0.bn3.weight, layer2.0.bn3.bias, layer2.0.downsample.0.weight, layer2.0.downsample.1.running_mean, layer2.0.downsample.1.running_var, layer2.0.downsample.1.weight, layer2.0.downsample.1.bias, layer2.1.conv1.weight, layer2.1.bn1.running_mean, layer2.1.bn1.running_var, layer2.1.bn1.weight, layer2.1.bn1.bias, layer2.1.conv2.weight, layer2.1.bn2.running_mean, layer2.1.bn2.running_var, layer2.1.bn2.weight, layer2.1.bn2.bias, layer2.1.conv3.weight, layer2.1.bn3.running_mean, layer2.1.bn3.running_var, layer2.1.bn3.weight, layer2.1.bn3.bias, layer2.2.conv1.weight, layer2.2.bn1.running_mean, layer2.2.bn1.running_var, layer2.2.bn1.weight, layer2.2.bn1.bias, layer2.2.conv2.weight, layer2.2.bn2.running_mean, layer2.2.bn2.running_var, layer2.2.bn2.weight, layer2.2.bn2.bias, layer2.2.conv3.weight, layer2.2.bn3.running_mean, layer2.2.bn3.running_var, layer2.2.bn3.weight, layer2.2.bn3.bias, layer2.3.conv1.weight, layer2.3.bn1.running_mean, layer2.3.bn1.running_var, layer2.3.bn1.weight, layer2.3.bn1.bias, layer2.3.conv2.weight, layer2.3.bn2.running_mean, layer2.3.bn2.running_var, layer2.3.bn2.weight, layer2.3.bn2.bias, layer2.3.conv3.weight, layer2.3.bn3.running_mean, layer2.3.bn3.running_var, layer2.3.bn3.weight, layer2.3.bn3.bias, layer3.0.conv1.weight, layer3.0.bn1.running_mean, layer3.0.bn1.running_var, layer3.0.bn1.weight, layer3.0.bn1.bias, layer3.0.conv2.weight, layer3.0.bn2.running_mean, layer3.0.bn2.running_var, layer3.0.bn2.weight, layer3.0.bn2.bias, layer3.0.conv3.weight, layer3.0.bn3.running_mean, layer3.0.bn3.running_var, layer3.0.bn3.weight, layer3.0.bn3.bias, layer3.0.downsample.0.weight, layer3.0.downsample.1.running_mean, layer3.0.downsample.1.running_var, layer3.0.downsample.1.weight, layer3.0.downsample.1.bias, layer3.1.conv1.weight, layer3.1.bn1.running_mean, layer3.1.bn1.running_var, layer3.1.bn1.weight, layer3.1.bn1.bias, layer3.1.conv2.weight, layer3.1.bn2.running_mean, layer3.1.bn2.running_var, layer3.1.bn2.weight, layer3.1.bn2.bias, layer3.1.conv3.weight, layer3.1.bn3.running_mean, layer3.1.bn3.running_var, layer3.1.bn3.weight, layer3.1.bn3.bias, layer3.2.conv1.weight, layer3.2.bn1.running_mean, layer3.2.bn1.running_var, layer3.2.bn1.weight, layer3.2.bn1.bias, layer3.2.conv2.weight, layer3.2.bn2.running_mean, layer3.2.bn2.running_var, layer3.2.bn2.weight, layer3.2.bn2.bias, layer3.2.conv3.weight, layer3.2.bn3.running_mean, layer3.2.bn3.running_var, layer3.2.bn3.weight, layer3.2.bn3.bias, layer3.3.conv1.weight, layer3.3.bn1.running_mean, layer3.3.bn1.running_var, layer3.3.bn1.weight, layer3.3.bn1.bias, layer3.3.conv2.weight, layer3.3.bn2.running_mean, layer3.3.bn2.running_var, layer3.3.bn2.weight, layer3.3.bn2.bias, layer3.3.conv3.weight, layer3.3.bn3.running_mean, layer3.3.bn3.running_var, layer3.3.bn3.weight, layer3.3.bn3.bias, layer3.4.conv1.weight, layer3.4.bn1.running_mean, layer3.4.bn1.running_var, layer3.4.bn1.weight, layer3.4.bn1.bias, layer3.4.conv2.weight, layer3.4.bn2.running_mean, layer3.4.bn2.running_var, layer3.4.bn2.weight, layer3.4.bn2.bias, layer3.4.conv3.weight, layer3.4.bn3.running_mean, layer3.4.bn3.running_var, layer3.4.bn3.weight, layer3.4.bn3.bias, layer3.5.conv1.weight, layer3.5.bn1.running_mean, layer3.5.bn1.running_var, layer3.5.bn1.weight, layer3.5.bn1.bias, layer3.5.conv2.weight, layer3.5.bn2.running_mean, layer3.5.bn2.running_var, layer3.5.bn2.weight, layer3.5.bn2.bias, layer3.5.conv3.weight, layer3.5.bn3.running_mean, layer3.5.bn3.running_var, layer3.5.bn3.weight, layer3.5.bn3.bias, layer3.6.conv1.weight, layer3.6.bn1.running_mean, layer3.6.bn1.running_var, layer3.6.bn1.weight, layer3.6.bn1.bias, layer3.6.conv2.weight, layer3.6.bn2.running_mean, layer3.6.bn2.running_var, layer3.6.bn2.weight, layer3.6.bn2.bias, layer3.6.conv3.weight, layer3.6.bn3.running_mean, layer3.6.bn3.running_var, layer3.6.bn3.weight, layer3.6.bn3.bias, layer3.7.conv1.weight, layer3.7.bn1.running_mean, layer3.7.bn1.running_var, layer3.7.bn1.weight, layer3.7.bn1.bias, layer3.7.conv2.weight, layer3.7.bn2.running_mean, layer3.7.bn2.running_var, layer3.7.bn2.weight, layer3.7.bn2.bias, layer3.7.conv3.weight, layer3.7.bn3.running_mean, layer3.7.bn3.running_var, layer3.7.bn3.weight, layer3.7.bn3.bias, layer3.8.conv1.weight, layer3.8.bn1.running_mean, layer3.8.bn1.running_var, layer3.8.bn1.weight, layer3.8.bn1.bias, layer3.8.conv2.weight, layer3.8.bn2.running_mean, layer3.8.bn2.running_var, layer3.8.bn2.weight, layer3.8.bn2.bias, layer3.8.conv3.weight, layer3.8.bn3.running_mean, layer3.8.bn3.running_var, layer3.8.bn3.weight, layer3.8.bn3.bias, layer3.9.conv1.weight, layer3.9.bn1.running_mean, layer3.9.bn1.running_var, layer3.9.bn1.weight, layer3.9.bn1.bias, layer3.9.conv2.weight, layer3.9.bn2.running_mean, layer3.9.bn2.running_var, layer3.9.bn2.weight, layer3.9.bn2.bias, layer3.9.conv3.weight, layer3.9.bn3.running_mean, layer3.9.bn3.running_var, layer3.9.bn3.weight, layer3.9.bn3.bias, layer3.10.conv1.weight, layer3.10.bn1.running_mean, layer3.10.bn1.running_var, layer3.10.bn1.weight, layer3.10.bn1.bias, layer3.10.conv2.weight, layer3.10.bn2.running_mean, layer3.10.bn2.running_var, layer3.10.bn2.weight, layer3.10.bn2.bias, layer3.10.conv3.weight, layer3.10.bn3.running_mean, layer3.10.bn3.running_var, layer3.10.bn3.weight, layer3.10.bn3.bias, layer3.11.conv1.weight, layer3.11.bn1.running_mean, layer3.11.bn1.running_var, layer3.11.bn1.weight, layer3.11.bn1.bias, layer3.11.conv2.weight, layer3.11.bn2.running_mean, layer3.11.bn2.running_var, layer3.11.bn2.weight, layer3.11.bn2.bias, layer3.11.conv3.weight, layer3.11.bn3.running_mean, layer3.11.bn3.running_var, layer3.11.bn3.weight, layer3.11.bn3.bias, layer3.12.conv1.weight, layer3.12.bn1.running_mean, layer3.12.bn1.running_var, layer3.12.bn1.weight, layer3.12.bn1.bias, layer3.12.conv2.weight, layer3.12.bn2.running_mean, layer3.12.bn2.running_var, layer3.12.bn2.weight, layer3.12.bn2.bias, layer3.12.conv3.weight, layer3.12.bn3.running_mean, layer3.12.bn3.running_var, layer3.12.bn3.weight, layer3.12.bn3.bias, layer3.13.conv1.weight, layer3.13.bn1.running_mean, layer3.13.bn1.running_var, layer3.13.bn1.weight, layer3.13.bn1.bias, layer3.13.conv2.weight, layer3.13.bn2.running_mean, layer3.13.bn2.running_var, layer3.13.bn2.weight, layer3.13.bn2.bias, layer3.13.conv3.weight, layer3.13.bn3.running_mean, layer3.13.bn3.running_var, layer3.13.bn3.weight, layer3.13.bn3.bias, layer3.14.conv1.weight, layer3.14.bn1.running_mean, layer3.14.bn1.running_var, layer3.14.bn1.weight, layer3.14.bn1.bias, layer3.14.conv2.weight, layer3.14.bn2.running_mean, layer3.14.bn2.running_var, layer3.14.bn2.weight, layer3.14.bn2.bias, layer3.14.conv3.weight, layer3.14.bn3.running_mean, layer3.14.bn3.running_var, layer3.14.bn3.weight, layer3.14.bn3.bias, layer3.15.conv1.weight, layer3.15.bn1.running_mean, layer3.15.bn1.running_var, layer3.15.bn1.weight, layer3.15.bn1.bias, layer3.15.conv2.weight, layer3.15.bn2.running_mean, layer3.15.bn2.running_var, layer3.15.bn2.weight, layer3.15.bn2.bias, layer3.15.conv3.weight, layer3.15.bn3.running_mean, layer3.15.bn3.running_var, layer3.15.bn3.weight, layer3.15.bn3.bias, layer3.16.conv1.weight, layer3.16.bn1.running_mean, layer3.16.bn1.running_var, layer3.16.bn1.weight, layer3.16.bn1.bias, layer3.16.conv2.weight, layer3.16.bn2.running_mean, layer3.16.bn2.running_var, layer3.16.bn2.weight, layer3.16.bn2.bias, layer3.16.conv3.weight, layer3.16.bn3.running_mean, layer3.16.bn3.running_var, layer3.16.bn3.weight, layer3.16.bn3.bias, layer3.17.conv1.weight, layer3.17.bn1.running_mean, layer3.17.bn1.running_var, layer3.17.bn1.weight, layer3.17.bn1.bias, layer3.17.conv2.weight, layer3.17.bn2.running_mean, layer3.17.bn2.running_var, layer3.17.bn2.weight, layer3.17.bn2.bias, layer3.17.conv3.weight, layer3.17.bn3.running_mean, layer3.17.bn3.running_var, layer3.17.bn3.weight, layer3.17.bn3.bias, layer3.18.conv1.weight, layer3.18.bn1.running_mean, layer3.18.bn1.running_var, layer3.18.bn1.weight, layer3.18.bn1.bias, layer3.18.conv2.weight, layer3.18.bn2.running_mean, layer3.18.bn2.running_var, layer3.18.bn2.weight, layer3.18.bn2.bias, layer3.18.conv3.weight, layer3.18.bn3.running_mean, layer3.18.bn3.running_var, layer3.18.bn3.weight, layer3.18.bn3.bias, layer3.19.conv1.weight, layer3.19.bn1.running_mean, layer3.19.bn1.running_var, layer3.19.bn1.weight, layer3.19.bn1.bias, layer3.19.conv2.weight, layer3.19.bn2.running_mean, layer3.19.bn2.running_var, layer3.19.bn2.weight, layer3.19.bn2.bias, layer3.19.conv3.weight, layer3.19.bn3.running_mean, layer3.19.bn3.running_var, layer3.19.bn3.weight, layer3.19.bn3.bias, layer3.20.conv1.weight, layer3.20.bn1.running_mean, layer3.20.bn1.running_var, layer3.20.bn1.weight, layer3.20.bn1.bias, layer3.20.conv2.weight, layer3.20.bn2.running_mean, layer3.20.bn2.running_var, layer3.20.bn2.weight, layer3.20.bn2.bias, layer3.20.conv3.weight, layer3.20.bn3.running_mean, layer3.20.bn3.running_var, layer3.20.bn3.weight, layer3.20.bn3.bias, layer3.21.conv1.weight, layer3.21.bn1.running_mean, layer3.21.bn1.running_var, layer3.21.bn1.weight, layer3.21.bn1.bias, layer3.21.conv2.weight, layer3.21.bn2.running_mean, layer3.21.bn2.running_var, layer3.21.bn2.weight, layer3.21.bn2.bias, layer3.21.conv3.weight, layer3.21.bn3.running_mean, layer3.21.bn3.running_var, layer3.21.bn3.weight, layer3.21.bn3.bias, layer3.22.conv1.weight, layer3.22.bn1.running_mean, layer3.22.bn1.running_var, layer3.22.bn1.weight, layer3.22.bn1.bias, layer3.22.conv2.weight, layer3.22.bn2.running_mean, layer3.22.bn2.running_var, layer3.22.bn2.weight, layer3.22.bn2.bias, layer3.22.conv3.weight, layer3.22.bn3.running_mean, layer3.22.bn3.running_var, layer3.22.bn3.weight, layer3.22.bn3.bias, fc.weight, fc.bias

hellock commented 4 years ago

The warning is expected, since you do not use all parts of the model.

zuhaoran commented 4 years ago

@hellock Thank you for your answer