Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when load pretrained model of VoVNet99, missing key in state_dict #34

Open
LeopoldACC opened this issue Jul 25, 2022 · 1 comment
Open

Comments

@LeopoldACC
Copy link

hi, thanks for your work,but when I want to load the pretrained model, the key is not as the same as the model I build.
I extract the model building process into one python file, as below:

# Copyright (c) Youngwan Lee (ETRI) All Rights Reserved.
# Copyright 2021 Toyota Research Institute.  All rights reserved.
from collections import OrderedDict

# import fvcore.nn.weight_init as weight_init
import torch
import torch.nn as nn
import torch.nn.functional as F

from detectron2.layers import FrozenBatchNorm2d, ShapeSpec, get_norm
from detectron2.modeling.backbone import Backbone
from detectron2.modeling.backbone.build import BACKBONE_REGISTRY
from detectron2.modeling.backbone.fpn import FPN, LastLevelMaxPool
import pdb 
    
__all__ = ["VoVNet", "build_vovnet_backbone", "build_vovnet_fpn_backbone"]

_NORM = False

VoVNet19_slim_dw_eSE = {
    'stem': [64, 64, 64],
    'stage_conv_ch': [64, 80, 96, 112],
    'stage_out_ch': [112, 256, 384, 512],
    "layer_per_block": 3,
    "block_per_stage": [1, 1, 1, 1],
    "eSE": True,
    "dw": True
}

VoVNet19_dw_eSE = {
    'stem': [64, 64, 64],
    "stage_conv_ch": [128, 160, 192, 224],
    "stage_out_ch": [256, 512, 768, 1024],
    "layer_per_block": 3,
    "block_per_stage": [1, 1, 1, 1],
    "eSE": True,
    "dw": True
}

VoVNet19_slim_eSE = {
    'stem': [64, 64, 128],
    'stage_conv_ch': [64, 80, 96, 112],
    'stage_out_ch': [112, 256, 384, 512],
    'layer_per_block': 3,
    'block_per_stage': [1, 1, 1, 1],
    'eSE': True,
    "dw": False
}

VoVNet19_eSE = {
    'stem': [64, 64, 128],
    "stage_conv_ch": [128, 160, 192, 224],
    "stage_out_ch": [256, 512, 768, 1024],
    "layer_per_block": 3,
    "block_per_stage": [1, 1, 1, 1],
    "eSE": True,
    "dw": False
}

VoVNet39_eSE = {
    'stem': [64, 64, 128],
    "stage_conv_ch": [128, 160, 192, 224],
    "stage_out_ch": [256, 512, 768, 1024],
    "layer_per_block": 5,
    "block_per_stage": [1, 1, 2, 2],
    "eSE": True,
    "dw": False
}

VoVNet57_eSE = {
    'stem': [64, 64, 128],
    "stage_conv_ch": [128, 160, 192, 224],
    "stage_out_ch": [256, 512, 768, 1024],
    "layer_per_block": 5,
    "block_per_stage": [1, 1, 4, 3],
    "eSE": True,
    "dw": False
}

VoVNet99_eSE = {
    'stem': [64, 64, 128],
    "stage_conv_ch": [128, 160, 192, 224],
    "stage_out_ch": [256, 512, 768, 1024],
    "layer_per_block": 5,
    "block_per_stage": [1, 3, 9, 3],
    "eSE": True,
    "dw": False
}

_STAGE_SPECS = {
    "V-19-slim-dw-eSE": VoVNet19_slim_dw_eSE,
    "V-19-dw-eSE": VoVNet19_dw_eSE,
    "V-19-slim-eSE": VoVNet19_slim_eSE,
    "V-19-eSE": VoVNet19_eSE,
    "V-39-eSE": VoVNet39_eSE,
    "V-57-eSE": VoVNet57_eSE,
    "V-99-eSE": VoVNet99_eSE,
}


def dw_conv3x3(in_channels, out_channels, module_name, postfix, stride=1, kernel_size=3, padding=1):
    """3x3 convolution with padding"""
    return [
        (
            '{}_{}/dw_conv3x3'.format(module_name, postfix),
            nn.Conv2d(
                in_channels,
                out_channels,
                kernel_size=kernel_size,
                stride=stride,
                padding=padding,
                groups=out_channels,
                bias=False
            )
        ),
        (
            '{}_{}/pw_conv1x1'.format(module_name, postfix),
            nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, groups=1, bias=False)
        ),
        ('{}_{}/pw_norm'.format(module_name, postfix), get_norm(_NORM, out_channels)),
        ('{}_{}/pw_relu'.format(module_name, postfix), nn.ReLU(inplace=True)),
    ]


def conv3x3(in_channels, out_channels, module_name, postfix, stride=1, groups=1, kernel_size=3, padding=1):
    """3x3 convolution with padding"""
    return [
        (
            f"{module_name}_{postfix}/conv",
            nn.Conv2d(
                in_channels,
                out_channels,
                kernel_size=kernel_size,
                stride=stride,
                padding=padding,
                groups=groups,
                bias=False,
            ),
        ),
        (f"{module_name}_{postfix}/norm", get_norm(_NORM, out_channels)),
        (f"{module_name}_{postfix}/relu", nn.ReLU(inplace=True)),
    ]


def conv1x1(in_channels, out_channels, module_name, postfix, stride=1, groups=1, kernel_size=1, padding=0):
    """1x1 convolution with padding"""
    return [
        (
            f"{module_name}_{postfix}/conv",
            nn.Conv2d(
                in_channels,
                out_channels,
                kernel_size=kernel_size,
                stride=stride,
                padding=padding,
                groups=groups,
                bias=False,
            ),
        ),
        (f"{module_name}_{postfix}/norm", get_norm(_NORM, out_channels)),
        (f"{module_name}_{postfix}/relu", nn.ReLU(inplace=True)),
    ]


class Hsigmoid(nn.Module):
    def __init__(self, inplace=True):
        super(Hsigmoid, self).__init__()
        self.inplace = inplace

    def forward(self, x):
        return F.relu6(x + 3.0, inplace=self.inplace) / 6.0


class eSEModule(nn.Module):
    def __init__(self, channel, reduction=4):
        super(eSEModule, self).__init__()
        self.avg_pool = nn.AdaptiveAvgPool2d(1)
        self.fc = nn.Conv2d(channel, channel, kernel_size=1, padding=0)
        self.hsigmoid = Hsigmoid()

    def forward(self, x):
        input = x
        x = self.avg_pool(x)
        x = self.fc(x)
        x = self.hsigmoid(x)
        return input * x


class _OSA_module(nn.Module):
    def __init__(
        self, in_ch, stage_ch, concat_ch, layer_per_block, module_name, SE=False, identity=False, depthwise=False
    ):

        super(_OSA_module, self).__init__()

        self.identity = identity
        self.depthwise = depthwise
        self.isReduced = False
        self.layers = nn.ModuleList()
        in_channel = in_ch
        if self.depthwise and in_channel != stage_ch:
            self.isReduced = True
            self.conv_reduction = nn.Sequential(
                OrderedDict(conv1x1(in_channel, stage_ch, "{}_reduction".format(module_name), "0"))
            )
        for i in range(layer_per_block):
            if self.depthwise:
                self.layers.append(nn.Sequential(OrderedDict(dw_conv3x3(stage_ch, stage_ch, module_name, i))))
            else:
                self.layers.append(nn.Sequential(OrderedDict(conv3x3(in_channel, stage_ch, module_name, i))))
            in_channel = stage_ch

        # feature aggregation
        in_channel = in_ch + layer_per_block * stage_ch
        self.concat = nn.Sequential(OrderedDict(conv1x1(in_channel, concat_ch, module_name, "concat")))

        self.ese = eSEModule(concat_ch)

    def forward(self, x):

        identity_feat = x

        output = []
        output.append(x)
        if self.depthwise and self.isReduced:
            x = self.conv_reduction(x)
        for layer in self.layers:
            x = layer(x)
            output.append(x)

        x = torch.cat(output, dim=1)
        xt = self.concat(x)

        xt = self.ese(xt)

        if self.identity:
            xt = xt + identity_feat

        return xt


class _OSA_stage(nn.Sequential):
    def __init__(
        self, in_ch, stage_ch, concat_ch, block_per_stage, layer_per_block, stage_num, SE=False, depthwise=False
    ):

        super(_OSA_stage, self).__init__()

        if not stage_num == 2:
            self.add_module("Pooling", nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=True))

        if block_per_stage != 1:
            SE = False
        module_name = f"OSA{stage_num}_1"
        self.add_module(
            module_name, _OSA_module(in_ch, stage_ch, concat_ch, layer_per_block, module_name, SE, depthwise=depthwise)
        )
        for i in range(block_per_stage - 1):
            if i != block_per_stage - 2:  # last block
                SE = False
            module_name = f"OSA{stage_num}_{i + 2}"
            self.add_module(
                module_name,
                _OSA_module(
                    concat_ch,
                    stage_ch,
                    concat_ch,
                    layer_per_block,
                    module_name,
                    SE,
                    identity=True,
                    depthwise=depthwise
                ),
            )


class VoVNet(Backbone):
    def __init__(self, cfg, input_ch, out_features=None):
        """
        Args:
            input_ch(int) : the number of input channel
            out_features (list[str]): name of the layers whose outputs should
                be returned in forward. Can be anything in "stem", "stage2" ...
        """
        super(VoVNet, self).__init__()

        global _NORM
        _NORM = cfg.NORM

        stage_specs = _STAGE_SPECS[cfg.NAME]

        stem_ch = stage_specs["stem"]
        config_stage_ch = stage_specs["stage_conv_ch"]
        config_concat_ch = stage_specs["stage_out_ch"]
        block_per_stage = stage_specs["block_per_stage"]
        layer_per_block = stage_specs["layer_per_block"]
        SE = stage_specs["eSE"]
        depthwise = stage_specs["dw"]

        self._out_features = out_features

        # Stem module
        conv_type = dw_conv3x3 if depthwise else conv3x3
        stem = conv3x3(input_ch, stem_ch[0], "stem", "1", 2)
        stem += conv_type(stem_ch[0], stem_ch[1], "stem", "2", 1)
        stem += conv_type(stem_ch[1], stem_ch[2], "stem", "3", 2)
        self.add_module("stem", nn.Sequential((OrderedDict(stem))))
        current_stirde = 4
        self._out_feature_strides = {"stem": current_stirde, "stage2": current_stirde}
        self._out_feature_channels = {"stem": stem_ch[2]}

        stem_out_ch = [stem_ch[2]]
        in_ch_list = stem_out_ch + config_concat_ch[:-1]
        # OSA stages
        self.stage_names = []
        for i in range(4):  # num_stages
            name = "stage%d" % (i + 2)  # stage 2 ... stage 5
            self.stage_names.append(name)
            self.add_module(
                name,
                _OSA_stage(
                    in_ch_list[i],
                    config_stage_ch[i],
                    config_concat_ch[i],
                    block_per_stage[i],
                    layer_per_block,
                    i + 2,
                    SE,
                    depthwise,
                ),
            )

            self._out_feature_channels[name] = config_concat_ch[i]
            if not i == 0:
                self._out_feature_strides[name] = current_stirde = int(current_stirde * 2)

        # initialize weights
        self._initialize_weights()

    def _initialize_weights(self):
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                nn.init.kaiming_normal_(m.weight)

    def _freeze_backbone(self, freeze_at):
        if freeze_at < 0:
            return

        for stage_index in range(freeze_at):
            if stage_index == 0:
                m = self.stem  # stage 0 is the stem
            else:
                m = getattr(self, "stage" + str(stage_index + 1))
            for p in m.parameters():
                p.requires_grad = False
                FrozenBatchNorm2d.convert_frozen_batchnorm(self)

    def forward(self, x):
        outputs = {}
        x = self.stem(x)
        if "stem" in self._out_features:
            outputs["stem"] = x
        for name in self.stage_names:
            x = getattr(self, name)(x)
            if name in self._out_features:
                outputs[name] = x

        return outputs

    def output_shape(self):
        return {
            name: ShapeSpec(channels=self._out_feature_channels[name], stride=self._out_feature_strides[name])
            for name in self._out_features
        }


@BACKBONE_REGISTRY.register()
def build_vovnet_backbone(cfg, input_shape):
    """
    Create a VoVNet instance from config.
    Returns:
        VoVNet: a :class:`VoVNet` instance.
    """
    out_features = cfg.OUT_FEATURES
    return VoVNet(cfg, input_shape.channels, out_features=out_features)


@BACKBONE_REGISTRY.register()
def build_vovnet_fpn_backbone(cfg, input_shape: ShapeSpec):
    """
    Args:
        cfg: a detectron2 CfgNode
    Returns:
        backbone (Backbone): backbone module, must be a subclass of :class:`Backbone`.
    """
    bottom_up = build_vovnet_backbone(cfg, input_shape)
    in_features = cfg.MODEL.FPN.IN_FEATURES
    out_channels = cfg.MODEL.FPN.OUT_CHANNELS
    backbone = FPN(
        bottom_up=bottom_up,
        in_features=in_features,
        out_channels=out_channels,
        norm=cfg.FE.FPN.NORM,
        top_block=LastLevelMaxPool(),
        fuse_type=cfg.FE.FPN.FUSE_TYPE,
    )
    return backbone


# class LastLevelP6(nn.Module):
#     """
#     This module is used in FCOS to generate extra layers
#     """
#     def __init__(self, in_channels, out_channels, in_features="res5"):
#         super().__init__()
#         self.num_levels = 1
#         self.in_feature = in_features
#         self.p6 = nn.Conv2d(in_channels, out_channels, 3, 2, 1)
#         for module in [self.p6]:
#             weight_init.c2_xavier_fill(module)

#     def forward(self, x):
#         p6 = self.p6(x)
#         return [p6]


@BACKBONE_REGISTRY.register()
def build_fcos_vovnet_fpn_backbone_p6(cfg, input_shape: ShapeSpec):
    """
    Args:
        cfg: a detectron2 CfgNode
    Returns:
        backbone (Backbone): backbone module, must be a subclass of :class:`Backbone`.
    """
    bottom_up = build_vovnet_backbone(cfg.FE.BACKBONE, input_shape)
    in_features = cfg.FE.FPN.IN_FEATURES
    out_channels = cfg.FE.FPN.OUT_CHANNELS
    in_channels_top = out_channels
    top_block = LastLevelP6(in_channels_top, out_channels, "p5")
    backbone = FPN(
        bottom_up=bottom_up,
        in_features=in_features,
        out_channels=out_channels,
        norm=cfg.FE.FPN.NORM,
        # top_block=LastLevelMaxPool(),
        top_block=top_block,
        fuse_type=cfg.FE.FPN.FUSE_TYPE,
    )

    backbone._size_divisibility *= 2

    return backbone

import argparse
import yaml
import os
from yacs.config import CfgNode as CN
_C = CN()
_C.defaults=['d2_fpn@FPN']

_C.BUILDER='build_fcos_vovnet_fpn_backbone_p6'

_C.BACKBONE=CN()

_C.BACKBONE.NAME= 'V-99-eSE'
_C.BACKBONE.OUT_FEATURES=['stage2', 'stage3', 'stage4', 'stage5']
_C.BACKBONE.NORM='BN'

_C.NAME= 'V-99-eSE'
_C.OUT_FEATURES = ['stage2', 'stage3', 'stage4', 'stage5']
_C.NORM='BN'

_C.MODEL=CN()
_C.MODEL.BACKBONE=CN()
_C.MODEL.BACKBONE.NORM = 'FrozenBN'
_C.MODEL.FPN=CN()
_C.MODEL.FPN.NORM = 'FrozenBN'
_C.MODEL.FPN.IN_FEATURES= ['stage2', 'stage3', 'stage4', 'stage5']#["level3", "level4", "level5"]
_C.MODEL.FPN.OUT_CHANNELS=256

_C.FE=CN()
_C.FE.BACKBONE=CN()
_C.FE.BACKBONE.NORM='FrozenBN'
_C.FE.FPN=CN()
_C.FE.FPN.NORM='FrozenBN'
_C.FE.FPN.FUSE_TYPE='sum'#sum/avg
_C.FE.OUT_FEATURES= _C.OUT_FEATURES


def parse_option():
    parser = argparse.ArgumentParser('VoVNet backbone config', add_help=False)
    parser.add_argument('--cfg', type=str, required=False, default = './vovnet_cfg/v2_99_fpn.yaml',metavar="FILE", help='path to config file', )
    parser.add_argument(
        "--opts",
        help="Modify config options by adding 'KEY VALUE' pairs. ",
        default=None,
        nargs='+',
    )
    args, unparsed = parser.parse_known_args()

    config = get_config(args)
    return args, config

def _update_config_from_file(config, cfg_file):
    config.defrost()
    with open(cfg_file, 'r') as f:
        yaml_cfg = yaml.load(f, Loader=yaml.FullLoader)

    for cfg in yaml_cfg.setdefault('BASE', ['']):
        if cfg:
            _update_config_from_file(
                config, os.path.join(os.path.dirname(cfg_file), cfg)
            )
    print('=> merge config from {}'.format(cfg_file))
    config.merge_from_file(cfg_file)
    config.freeze()

def update_config(config, args):
    _update_config_from_file(config, args.cfg)
    config.defrost()
    if args.opts:
        config.merge_from_list(args.opts)
    config.freeze()

def get_config(args):
    """Get a yacs CfgNode object with default values."""
    # Return a clone so that the defaults will not be altered
    # This is for the "local variable" use pattern
    config = _C.clone()
    update_config(config, args)

    return config
if __name__ == '__main__':
    args, config = parse_option()
    
    model = build_vovnet_fpn_backbone(config,input_shape = ShapeSpec(channels=3, height=448, width=800, stride=None))
    # pretrained_model = torch.load('/data/CenterFusion0/models/vovnet99_dd3d15m.pth',map_location=torch.device('cpu'))
    # model.load_state_dict(pretrained_model)
    x = torch.randn(1,3,448,800)
    y = model.forward(x)
    pdb.set_trace()
    print(y)

The error info is shown as below:

/home/gongzheng/.local/lib/python3.6/site-packages/redis/utils.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefo
re, support for it is deprecated in cryptography and will be removed in a future release.                                                                               
  import cryptography  # noqa                                                                                                                                           
=> merge config from ./vovnet_cfg/v2_99_fpn.yaml                                                                                                                        
Traceback (most recent call last):                                                                                                                                      
  File "vovnet.py", line 538, in <module>                                                                                                                               
    model.load_state_dict(pretrained_model)                                                                                                                             
  File "/home/gongzheng/anaconda3/envs/cf/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict                                        
    self.__class__.__name__, "\n\t".join(error_msgs)))                                                                                                                  
RuntimeError: Error(s) in loading state_dict for FPN:                                                                                                                   
        Missing key(s) in state_dict: "fpn_lateral2.weight", "fpn_lateral2.norm.weight", "fpn_lateral2.norm.bias", "fpn_output2.weight", "fpn_output2.norm.weight", "fpn
_output2.norm.bias", "fpn_lateral3.weight", "fpn_lateral3.norm.weight", "fpn_lateral3.norm.bias", "fpn_output3.weight", "fpn_output3.norm.weight", "fpn_output3.norm.bia
s", "fpn_lateral4.weight", "fpn_lateral4.norm.weight", "fpn_lateral4.norm.bias", "fpn_output4.weight", "fpn_output4.norm.weight", "fpn_output4.norm.bias", "fpn_lateral5
.weight", "fpn_lateral5.norm.weight", "fpn_lateral5.norm.bias", "fpn_output5.weight", "fpn_output5.norm.weight", "fpn_output5.norm.bias", "bottom_up.stem.stem_1/conv.we
ight", "bottom_up.stem.stem_1/norm.weight", "bottom_up.stem.stem_1/norm.bias", "bottom_up.stem.stem_1/norm.running_mean", "bottom_up.stem.stem_1/norm.running_var", "bot
tom_up.stem.stem_2/conv.weight", "bottom_up.stem.stem_2/norm.weight", "bottom_up.stem.stem_2/norm.bias", "bottom_up.stem.stem_2/norm.running_mean", "bottom_up.stem.stem
_2/norm.running_var", "bottom_up.stem.stem_3/conv.weight", "bottom_up.stem.stem_3/norm.weight", "bottom_up.stem.stem_3/norm.bias", "bottom_up.stem.stem_3/norm.running_m
ean", "bottom_up.stem.stem_3/norm.running_var", "bottom_up.stage2.OSA2_1.layers.0.OSA2_1_0/conv.weight", "bottom_up.stage2.OSA2_1.layers.0.OSA2_1_0/norm.weight", "botto
m_up.stage2.OSA2_1.layers.0.OSA2_1_0/norm.bias", "bottom_up.stage2.OSA2_1.layers.0.OSA2_1_0/norm.running_mean", "bottom_up.stage2.OSA2_1.layers.0.OSA2_1_0/norm.running_
var", "bottom_up.stage2.OSA2_1.layers.1.OSA2_1_1/conv.weight", "bottom_up.stage2.OSA2_1.layers.1.OSA2_1_1/norm.weight", "bottom_up.stage2.OSA2_1.layers.1.OSA2_1_1/norm.
bias", "bottom_up.stage2.OSA2_1.layers.1.OSA2_1_1/norm.running_mean", "bottom_up.stage2.OSA2_1.layers.1.OSA2_1_1/norm.running_var", "bottom_up.stage2.OSA2_1.layers.2.OS
A2_1_2/conv.weight", "bottom_up.stage2.OSA2_1.layers.2.OSA2_1_2/norm.weight", "bottom_up.stage2.OSA2_1.layers.2.OSA2_1_2/norm.bias", "bottom_up.stage2.OSA2_1.layers.2.O
SA2_1_2/norm.running_mean", "bottom_up.stage2.OSA2_1.layers.2.OSA2_1_2/norm.running_var", "bottom_up.stage2.OSA2_1.layers.3.OSA2_1_3/conv.weight", "bottom_up.stage2.OSA
2_1.layers.3.OSA2_1_3/norm.weight", "bottom_up.stage2.OSA2_1.layers.3.OSA2_1_3/norm.bias", "bottom_up.stage2.OSA2_1.layers.3.OSA2_1_3/norm.running_mean", "bottom_up.sta
ge2.OSA2_1.layers.3.OSA2_1_3/norm.running_var", "bottom_up.stage2.OSA2_1.layers.4.OSA2_1_4/conv.weight", "bottom_up.stage2.OSA2_1.layers.4.OSA2_1_4/norm.weight", "botto
m_up.stage2.OSA2_1.layers.4.OSA2_1_4/norm.bias", "bottom_up.stage2.OSA2_1.layers.4.OSA2_1_4/norm.running_mean", "bottom_up.stage2.OSA2_1.layers.4.OSA2_1_4/norm.running_
var", "bottom_up.stage2.OSA2_1.concat.OSA2_1_concat/conv.weight", "bottom_up.stage2.OSA2_1.concat.OSA2_1_concat/norm.weight", "bottom_up.stage2.OSA2_1.concat.OSA2_1_con
cat/norm.bias", "bottom_up.stage2.OSA2_1.concat.OSA2_1_concat/norm.running_mean", "bottom_up.stage2.OSA2_1.concat.OSA2_1_concat/norm.running_var", "bottom_up.stage2.OSA
2_1.ese.fc.weight", "bottom_up.stage2.OSA2_1.ese.fc.bias", "bottom_up.stage3.OSA3_1.layers.0.OSA3_1_0/conv.weight", "bottom_up.stage3.OSA3_1.layers.0.OSA3_1_0/norm.weig
ht", "bottom_up.stage3.OSA3_1.layers.0.OSA3_1_0/norm.bias", "bottom_up.stage3.OSA3_1.layers.0.OSA3_1_0/norm.running_mean", "bottom_up.stage3.OSA3_1.layers.0.OSA3_1_0/no
rm.running_var", "bottom_up.stage3.OSA3_1.layers.1.OSA3_1_1/conv.weight", "bottom_up.stage3.OSA3_1.layers.1.OSA3_1_1/norm.weight", "bottom_up.stage3.OSA3_1.layers.1.OSA
3_1_1/norm.bias", "bottom_up.stage3.OSA3_1.layers.1.OSA3_1_1/norm.running_mean", "bottom_up.stage3.OSA3_1.layers.1.OSA3_1_1/norm.running_var", "bottom_up.stage3.OSA3_1.
layers.2.OSA3_1_2/conv.weight", "bottom_up.stage3.OSA3_1.layers.2.OSA3_1_2/norm.weight", "bottom_up.stage3.OSA3_1.layers.2.OSA3_1_2/norm.bias", "bottom_up.stage3.OSA3_1
.layers.2.OSA3_1_2/norm.running_mean", "bottom_up.stage3.OSA3_1.layers.2.OSA3_1_2/norm.running_var", "bottom_up.stage3.OSA3_1.layers.3.OSA3_1_3/conv.weight", "bottom_up
.stage3.OSA3_1.layers.3.OSA3_1_3/norm.weight", "bottom_up.stage3.OSA3_1.layers.3.OSA3_1_3/norm.bias", "bottom_up.stage3.OSA3_1.layers.3.OSA3_1_3/norm.running_mean", "bo
ttom_up.stage3.OSA3_1.layers.3.OSA3_1_3/norm.running_var", "bottom_up.stage3.OSA3_1.layers.4.OSA3_1_4/conv.weight", "bottom_up.stage3.OSA3_1.layers.4.OSA3_1_4/norm.weig
ht", "bottom_up.stage3.OSA3_1.layers.4.OSA3_1_4/norm.bias", "bottom_up.stage3.OSA3_1.layers.4.OSA3_1_4/norm.running_mean", "bottom_up.stage3.OSA3_1.layers.4.OSA3_1_4/no
rm.running_var", "bottom_up.stage3.OSA3_1.concat.OSA3_1_concat/conv.weight", "bottom_up.stage3.OSA3_1.concat.OSA3_1_concat/norm.weight", "bottom_up.stage3.OSA3_1.concat
.OSA3_1_concat/norm.bias", "bottom_up.stage3.OSA3_1.concat.OSA3_1_concat/norm.running_mean", "bottom_up.stage3.OSA3_1.concat.OSA3_1_concat/norm.running_var", "bottom_up
.stage3.OSA3_1.ese.fc.weight", "bottom_up.stage3.OSA3_1.ese.fc.bias", "bottom_up.stage3.OSA3_2.layers.0.OSA3_2_0/conv.weight", "bottom_up.stage3.OSA3_2.layers.0.OSA3_2_
0/norm.weight", "bottom_up.stage3.OSA3_2.layers.0.OSA3_2_0/norm.bias", "bottom_up.stage3.OSA3_2.layers.0.OSA3_2_0/norm.running_mean", "bottom_up.stage3.OSA3_2.layers.0.
OSA3_2_0/norm.running_var", "bottom_up.stage3.OSA3_2.layers.1.OSA3_2_1/conv.weight", "bottom_up.stage3.OSA3_2.layers.1.OSA3_2_1/norm.weight", "bottom_up.stage3.OSA3_2.l
ayers.1.OSA3_2_1/norm.bias", "bottom_up.stage3.OSA3_2.layers.1.OSA3_2_1/norm.running_mean", "bottom_up.stage3.OSA3_2.layers.1.OSA3_2_1/norm.running_var", "bottom_up.sta
ge3.OSA3_2.layers.2.OSA3_2_2/conv.weight", "bottom_up.stage3.OSA3_2.layers.2.OSA3_2_2/norm.weight", "bottom_up.stage3.OSA3_2.layers.2.OSA3_2_2/norm.bias", "bottom_up.st
age3.OSA3_2.layers.2.OSA3_2_2/norm.running_mean", "bottom_up.stage3.OSA3_2.layers.2.OSA3_2_2/norm.running_var", "bottom_up.stage3.OSA3_2.layers.3.OSA3_2_3/conv.weight",
 "bottom_up.stage3.OSA3_2.layers.3.OSA3_2_3/norm.weight", "bottom_up.stage3.OSA3_2.layers.3.OSA3_2_3/norm.bias", "bottom_up.stage3.OSA3_2.layers.3.OSA3_2_3/norm.running_mean", "bottom_up.stage3.OSA3_2.layers.3.OSA3_2_3/norm.running_var", "bottom_up.stage3.OSA3_2.layers.4.OSA3_2_4/conv.weight", "bottom_up.stage3.OSA3_2.layers.4.OSA3_2_
4/norm.weight", "bottom_up.stage3.OSA3_2.layers.4.OSA3_2_4/norm.bias", "bottom_up.stage3.OSA3_2.layers.4.OSA3_2_4/norm.running_mean", "bottom_up.stage3.OSA3_2.layers.4.
OSA3_2_4/norm.running_var", "bottom_up.stage3.OSA3_2.concat.OSA3_2_concat/conv.weight", "bottom_up.stage3.OSA3_2.concat.OSA3_2_concat/norm.weight", "bottom_up.stage3.OS
A3_2.concat.OSA3_2_concat/norm.bias", "bottom_up.stage3.OSA3_2.concat.OSA3_2_concat/norm.running_mean", "bottom_up.stage3.OSA3_2.concat.OSA3_2_concat/norm.running_var",
 "bottom_up.stage3.OSA3_2.ese.fc.weight", "bottom_up.stage3.OSA3_2.ese.fc.bias", "bottom_up.stage3.OSA3_3.layers.0.OSA3_3_0/conv.weight", "bottom_up.stage3.OSA3_3.layer
s.0.OSA3_3_0/norm.weight", "bottom_up.stage3.OSA3_3.layers.0.OSA3_3_0/norm.bias", "bottom_up.stage3.OSA3_3.layers.0.OSA3_3_0/norm.running_mean", "bottom_up.stage3.OSA3_
3.layers.0.OSA3_3_0/norm.running_var", "bottom_up.stage3.OSA3_3.layers.1.OSA3_3_1/conv.weight", "bottom_up.stage3.OSA3_3.layers.1.OSA3_3_1/norm.weight", "bottom_up.stag
e3.OSA3_3.layers.1.OSA3_3_1/norm.bias", "bottom_up.stage3.OSA3_3.layers.1.OSA3_3_1/norm.running_mean", "bottom_up.stage3.OSA3_3.layers.1.OSA3_3_1/norm.running_var", "bo
ttom_up.stage3.OSA3_3.layers.2.OSA3_3_2/conv.weight", "bottom_up.stage3.OSA3_3.layers.2.OSA3_3_2/norm.weight", "bottom_up.stage3.OSA3_3.layers.2.OSA3_3_2/norm.bias", "b
ottom_up.stage3.OSA3_3.layers.2.OSA3_3_2/norm.running_mean", "bottom_up.stage3.OSA3_3.layers.2.OSA3_3_2/norm.running_var", "bottom_up.stage3.OSA3_3.layers.3.OSA3_3_3/co
nv.weight", "bottom_up.stage3.OSA3_3.layers.3.OSA3_3_3/norm.weight", "bottom_up.stage3.OSA3_3.layers.3.OSA3_3_3/norm.bias", "bottom_up.stage3.OSA3_3.layers.3.OSA3_3_3/n
orm.running_mean", "bottom_up.stage3.OSA3_3.layers.3.OSA3_3_3/norm.running_var", "bottom_up.stage3.OSA3_3.layers.4.OSA3_3_4/conv.weight", "bottom_up.stage3.OSA3_3.layer
s.4.OSA3_3_4/norm.weight", "bottom_up.stage3.OSA3_3.layers.4.OSA3_3_4/norm.bias", "bottom_up.stage3.OSA3_3.layers.4.OSA3_3_4/norm.running_mean", "bottom_up.stage3.OSA3_
3.layers.4.OSA3_3_4/norm.running_var", "bottom_up.stage3.OSA3_3.concat.OSA3_3_concat/conv.weight", "bottom_up.stage3.OSA3_3.concat.OSA3_3_concat/norm.weight", "bottom_u
p.stage3.OSA3_3.concat.OSA3_3_concat/norm.bias", "bottom_up.stage3.OSA3_3.concat.OSA3_3_concat/norm.running_mean", "bottom_up.stage3.OSA3_3.concat.OSA3_3_concat/norm.ru
nning_var", "bottom_up.stage3.OSA3_3.ese.fc.weight", "bottom_up.stage3.OSA3_3.ese.fc.bias", "bottom_up.stage4.OSA4_1.layers.0.OSA4_1_0/conv.weight", "bottom_up.stage4.O
SA4_1.layers.0.OSA4_1_0/norm.weight", "bottom_up.stage4.OSA4_1.layers.0.OSA4_1_0/norm.bias", "bottom_up.stage4.OSA4_1.layers.0.OSA4_1_0/norm.running_mean", "bottom_up.s
tage4.OSA4_1.layers.0.OSA4_1_0/norm.running_var", "bottom_up.stage4.OSA4_1.layers.1.OSA4_1_1/conv.weight", "bottom_up.stage4.OSA4_1.layers.1.OSA4_1_1/norm.weight", "bot
tom_up.stage4.OSA4_1.layers.1.OSA4_1_1/norm.bias", "bottom_up.stage4.OSA4_1.layers.1.OSA4_1_1/norm.running_mean", "bottom_up.stage4.OSA4_1.layers.1.OSA4_1_1/norm.runnin
g_var", "bottom_up.stage4.OSA4_1.layers.2.OSA4_1_2/conv.weight", "bottom_up.stage4.OSA4_1.layers.2.OSA4_1_2/norm.weight", "bottom_up.stage4.OSA4_1.layers.2.OSA4_1_2/nor
m.bias", "bottom_up.stage4.OSA4_1.layers.2.OSA4_1_2/norm.running_mean", "bottom_up.stage4.OSA4_1.layers.2.OSA4_1_2/norm.running_var", "bottom_up.stage4.OSA4_1.layers.3.
OSA4_1_3/conv.weight", "bottom_up.stage4.OSA4_1.layers.3.OSA4_1_3/norm.weight", "bottom_up.stage4.OSA4_1.layers.3.OSA4_1_3/norm.bias", "bottom_up.stage4.OSA4_1.layers.3
.OSA4_1_3/norm.running_mean", "bottom_up.stage4.OSA4_1.layers.3.OSA4_1_3/norm.running_var", "bottom_up.stage4.OSA4_1.layers.4.OSA4_1_4/conv.weight", "bottom_up.stage4.O
SA4_1.layers.4.OSA4_1_4/norm.weight", "bottom_up.stage4.OSA4_1.layers.4.OSA4_1_4/norm.bias", "bottom_up.stage4.OSA4_1.layers.4.OSA4_1_4/norm.running_mean", "bottom_up.s
tage4.OSA4_1.layers.4.OSA4_1_4/norm.running_var", "bottom_up.stage4.OSA4_1.concat.OSA4_1_concat/conv.weight", "bottom_up.stage4.OSA4_1.concat.OSA4_1_concat/norm.weight"
, "bottom_up.stage4.OSA4_1.concat.OSA4_1_concat/norm.bias", "bottom_up.stage4.OSA4_1.concat.OSA4_1_concat/norm.running_mean", "bottom_up.stage4.OSA4_1.concat.OSA4_1_con
cat/norm.running_var", "bottom_up.stage4.OSA4_1.ese.fc.weight", "bottom_up.stage4.OSA4_1.ese.fc.bias", "bottom_up.stage4.OSA4_2.layers.0.OSA4_2_0/conv.weight", "bottom_
up.stage4.OSA4_2.layers.0.OSA4_2_0/norm.weight", "bottom_up.stage4.OSA4_2.layers.0.OSA4_2_0/norm.bias", "bottom_up.stage4.OSA4_2.layers.0.OSA4_2_0/norm.running_mean", "
bottom_up.stage4.OSA4_2.layers.0.OSA4_2_0/norm.running_var", "bottom_up.stage4.OSA4_2.layers.1.OSA4_2_1/conv.weight", "bottom_up.stage4.OSA4_2.layers.1.OSA4_2_1/norm.we
ight", "bottom_up.stage4.OSA4_2.layers.1.OSA4_2_1/norm.bias", "bottom_up.stage4.OSA4_2.layers.1.OSA4_2_1/norm.running_mean", "bottom_up.stage4.OSA4_2.layers.1.OSA4_2_1/
norm.running_var", "bottom_up.stage4.OSA4_2.layers.2.OSA4_2_2/conv.weight", "bottom_up.stage4.OSA4_2.layers.2.OSA4_2_2/norm.weight", "bottom_up.stage4.OSA4_2.layers.2.O
SA4_2_2/norm.bias", "bottom_up.stage4.OSA4_2.layers.2.OSA4_2_2/norm.running_mean", "bottom_up.stage4.OSA4_2.layers.2.OSA4_2_2/norm.running_var", "bottom_up.stage4.OSA4_
2.layers.3.OSA4_2_3/conv.weight", "bottom_up.stage4.OSA4_2.layers.3.OSA4_2_3/norm.weight", "bottom_up.stage4.OSA4_2.layers.3.OSA4_2_3/norm.bias", "bottom_up.stage4.OSA4
_2.layers.3.OSA4_2_3/norm.running_mean", "bottom_up.stage4.OSA4_2.layers.3.OSA4_2_3/norm.running_var", "bottom_up.stage4.OSA4_2.layers.4.OSA4_2_4/conv.weight", "bottom_
up.stage4.OSA4_2.layers.4.OSA4_2_4/norm.weight", "bottom_up.stage4.OSA4_2.layers.4.OSA4_2_4/norm.bias", "bottom_up.stage4.OSA4_2.layers.4.OSA4_2_4/norm.running_mean", "
bottom_up.stage4.OSA4_2.layers.4.OSA4_2_4/norm.running_var", "bottom_up.stage4.OSA4_2.concat.OSA4_2_concat/conv.weight", "bottom_up.stage4.OSA4_2.concat.OSA4_2_concat/n
orm.weight", "bottom_up.stage4.OSA4_2.concat.OSA4_2_concat/norm.bias", "bottom_up.stage4.OSA4_2.concat.OSA4_2_concat/norm.running_mean", "bottom_up.stage4.OSA4_2.concat
.OSA4_2_concat/norm.running_var", "bottom_up.stage4.OSA4_2.ese.fc.weight", "bottom_up.stage4.OSA4_2.ese.fc.bias", "bottom_up.stage4.OSA4_3.layers.0.OSA4_3_0/conv.weight
", "bottom_up.stage4.OSA4_3.layers.0.OSA4_3_0/norm.weight", "bottom_up.stage4.OSA4_3.layers.0.OSA4_3_0/norm.bias", "bottom_up.stage4.OSA4_3.layers.0.OSA4_3_0/norm.runni
ng_mean", "bottom_up.stage4.OSA4_3.layers.0.OSA4_3_0/norm.running_var", "bottom_up.stage4.OSA4_3.layers.1.OSA4_3_1/conv.weight", "bottom_up.stage4.OSA4_3.layers.1.OSA4_
3_1/norm.weight", "bottom_up.stage4.OSA4_3.layers.1.OSA4_3_1/norm.bias", "bottom_up.stage4.OSA4_3.layers.1.OSA4_3_1/norm.running_mean", "bottom_up.stage4.OSA4_3.layers.
1.OSA4_3_1/norm.running_var", "bottom_up.stage4.OSA4_3.layers.2.OSA4_3_2/conv.weight", "bottom_up.stage4.OSA4_3.layers.2.OSA4_3_2/norm.weight", "bottom_up.stage4.OSA4_3
.layers.2.OSA4_3_2/norm.bias", "bottom_up.stage4.OSA4_3.layers.2.OSA4_3_2/norm.running_mean", "bottom_up.stage4.OSA4_3.layers.2.OSA4_3_2/norm.running_var", "bottom_up.s
tage4.OSA4_3.layers.3.OSA4_3_3/conv.weight", "bottom_up.stage4.OSA4_3.layers.3.OSA4_3_3/norm.weight", "bottom_up.stage4.OSA4_3.layers.3.OSA4_3_3/norm.bias", "bottom_up.
stage4.OSA4_3.layers.3.OSA4_3_3/norm.running_mean", "bottom_up.stage4.OSA4_3.layers.3.OSA4_3_3/norm.running_var", "bottom_up.stage4.OSA4_3.layers.4.OSA4_3_4/conv.weight
", "bottom_up.stage4.OSA4_3.layers.4.OSA4_3_4/norm.weight", "bottom_up.stage4.OSA4_3.layers.4.OSA4_3_4/norm.bias", "bottom_up.stage4.OSA4_3.layers.4.OSA4_3_4/norm.runni
ng_mean", "bottom_up.stage4.OSA4_3.layers.4.OSA4_3_4/norm.running_var", "bottom_up.stage4.OSA4_3.concat.OSA4_3_concat/conv.weight", "bottom_up.stage4.OSA4_3.concat.OSA4
_3_concat/norm.weight", "bottom_up.stage4.OSA4_3.concat.OSA4_3_concat/norm.bias", "bottom_up.stage4.OSA4_3.concat.OSA4_3_concat/norm.running_mean", "bottom_up.stage4.OS
A4_3.concat.OSA4_3_concat/norm.running_var", "bottom_up.stage4.OSA4_3.ese.fc.weight", "bottom_up.stage4.OSA4_3.ese.fc.bias", "bottom_up.stage4.OSA4_4.layers.0.OSA4_4_0/
conv.weight", "bottom_up.stage4.OSA4_4.layers.0.OSA4_4_0/norm.weight", "bottom_up.stage4.OSA4_4.layers.0.OSA4_4_0/norm.bias", "bottom_up.stage4.OSA4_4.layers.0.OSA4_4_0
/norm.running_mean", "bottom_up.stage4.OSA4_4.layers.0.OSA4_4_0/norm.running_var", "bottom_up.stage4.OSA4_4.layers.1.OSA4_4_1/conv.weight", "bottom_up.stage4.OSA4_4.layers.1.OSA4_4_1/norm.weight", "bottom_up.stage4.OSA4_4.layers.1.OSA4_4_1/norm.bias", "bottom_up.stage4.OSA4_4.layers.1.OSA4_4_1/norm.running_mean", "bottom_up.stage4.OSA
4_4.layers.1.OSA4_4_1/norm.running_var", "bottom_up.stage4.OSA4_4.layers.2.OSA4_4_2/conv.weight", "bottom_up.stage4.OSA4_4.layers.2.OSA4_4_2/norm.weight", "bottom_up.st
age4.OSA4_4.layers.2.OSA4_4_2/norm.bias", "bottom_up.stage4.OSA4_4.layers.2.OSA4_4_2/norm.running_mean", "bottom_up.stage4.OSA4_4.layers.2.OSA4_4_2/norm.running_var", "
bottom_up.stage4.OSA4_4.layers.3.OSA4_4_3/conv.weight", "bottom_up.stage4.OSA4_4.layers.3.OSA4_4_3/norm.weight", "bottom_up.stage4.OSA4_4.layers.3.OSA4_4_3/norm.bias", 
"bottom_up.stage4.OSA4_4.layers.3.OSA4_4_3/norm.running_mean", "bottom_up.stage4.OSA4_4.layers.3.OSA4_4_3/norm.running_var", "bottom_up.stage4.OSA4_4.layers.4.OSA4_4_4/
conv.weight", "bottom_up.stage4.OSA4_4.layers.4.OSA4_4_4/norm.weight", "bottom_up.stage4.OSA4_4.layers.4.OSA4_4_4/norm.bias", "bottom_up.stage4.OSA4_4.layers.4.OSA4_4_4
/norm.running_mean", "bottom_up.stage4.OSA4_4.layers.4.OSA4_4_4/norm.running_var", "bottom_up.stage4.OSA4_4.concat.OSA4_4_concat/conv.weight", "bottom_up.stage4.OSA4_4.
concat.OSA4_4_concat/norm.weight", "bottom_up.stage4.OSA4_4.concat.OSA4_4_concat/norm.bias", "bottom_up.stage4.OSA4_4.concat.OSA4_4_concat/norm.running_mean", "bottom_u
p.stage4.OSA4_4.concat.OSA4_4_concat/norm.running_var", "bottom_up.stage4.OSA4_4.ese.fc.weight", "bottom_up.stage4.OSA4_4.ese.fc.bias", "bottom_up.stage4.OSA4_5.layers.
0.OSA4_5_0/conv.weight", "bottom_up.stage4.OSA4_5.layers.0.OSA4_5_0/norm.weight", "bottom_up.stage4.OSA4_5.layers.0.OSA4_5_0/norm.bias", "bottom_up.stage4.OSA4_5.layers
.0.OSA4_5_0/norm.running_mean", "bottom_up.stage4.OSA4_5.layers.0.OSA4_5_0/norm.running_var", "bottom_up.stage4.OSA4_5.layers.1.OSA4_5_1/conv.weight", "bottom_up.stage4
.OSA4_5.layers.1.OSA4_5_1/norm.weight", "bottom_up.stage4.OSA4_5.layers.1.OSA4_5_1/norm.bias", "bottom_up.stage4.OSA4_5.layers.1.OSA4_5_1/norm.running_mean", "bottom_up
.stage4.OSA4_5.layers.1.OSA4_5_1/norm.running_var", "bottom_up.stage4.OSA4_5.layers.2.OSA4_5_2/conv.weight", "bottom_up.stage4.OSA4_5.layers.2.OSA4_5_2/norm.weight", "b
ottom_up.stage4.OSA4_5.layers.2.OSA4_5_2/norm.bias", "bottom_up.stage4.OSA4_5.layers.2.OSA4_5_2/norm.running_mean", "bottom_up.stage4.OSA4_5.layers.2.OSA4_5_2/norm.runn
ing_var", "bottom_up.stage4.OSA4_5.layers.3.OSA4_5_3/conv.weight", "bottom_up.stage4.OSA4_5.layers.3.OSA4_5_3/norm.weight", "bottom_up.stage4.OSA4_5.layers.3.OSA4_5_3/n
orm.bias", "bottom_up.stage4.OSA4_5.layers.3.OSA4_5_3/norm.running_mean", "bottom_up.stage4.OSA4_5.layers.3.OSA4_5_3/norm.running_var", "bottom_up.stage4.OSA4_5.layers.
4.OSA4_5_4/conv.weight", "bottom_up.stage4.OSA4_5.layers.4.OSA4_5_4/norm.weight", "bottom_up.stage4.OSA4_5.layers.4.OSA4_5_4/norm.bias", "bottom_up.stage4.OSA4_5.layers
.4.OSA4_5_4/norm.running_mean", "bottom_up.stage4.OSA4_5.layers.4.OSA4_5_4/norm.running_var", "bottom_up.stage4.OSA4_5.concat.OSA4_5_concat/conv.weight", "bottom_up.sta
ge4.OSA4_5.concat.OSA4_5_concat/norm.weight", "bottom_up.stage4.OSA4_5.concat.OSA4_5_concat/norm.bias", "bottom_up.stage4.OSA4_5.concat.OSA4_5_concat/norm.running_mean"
, "bottom_up.stage4.OSA4_5.concat.OSA4_5_concat/norm.running_var", "bottom_up.stage4.OSA4_5.ese.fc.weight", "bottom_up.stage4.OSA4_5.ese.fc.bias", "bottom_up.stage4.OSA
4_6.layers.0.OSA4_6_0/conv.weight", "bottom_up.stage4.OSA4_6.layers.0.OSA4_6_0/norm.weight", "bottom_up.stage4.OSA4_6.layers.0.OSA4_6_0/norm.bias", "bottom_up.stage4.OS
A4_6.layers.0.OSA4_6_0/norm.running_mean", "bottom_up.stage4.OSA4_6.layers.0.OSA4_6_0/norm.running_var", "bottom_up.stage4.OSA4_6.layers.1.OSA4_6_1/conv.weight", "botto
m_up.stage4.OSA4_6.layers.1.OSA4_6_1/norm.weight", "bottom_up.stage4.OSA4_6.layers.1.OSA4_6_1/norm.bias", "bottom_up.stage4.OSA4_6.layers.1.OSA4_6_1/norm.running_mean",
 "bottom_up.stage4.OSA4_6.layers.1.OSA4_6_1/norm.running_var", "bottom_up.stage4.OSA4_6.layers.2.OSA4_6_2/conv.weight", "bottom_up.stage4.OSA4_6.layers.2.OSA4_6_2/norm.
weight", "bottom_up.stage4.OSA4_6.layers.2.OSA4_6_2/norm.bias", "bottom_up.stage4.OSA4_6.layers.2.OSA4_6_2/norm.running_mean", "bottom_up.stage4.OSA4_6.layers.2.OSA4_6_
2/norm.running_var", "bottom_up.stage4.OSA4_6.layers.3.OSA4_6_3/conv.weight", "bottom_up.stage4.OSA4_6.layers.3.OSA4_6_3/norm.weight", "bottom_up.stage4.OSA4_6.layers.3
.OSA4_6_3/norm.bias", "bottom_up.stage4.OSA4_6.layers.3.OSA4_6_3/norm.running_mean", "bottom_up.stage4.OSA4_6.layers.3.OSA4_6_3/norm.running_var", "bottom_up.stage4.OSA
4_6.layers.4.OSA4_6_4/conv.weight", "bottom_up.stage4.OSA4_6.layers.4.OSA4_6_4/norm.weight", "bottom_up.stage4.OSA4_6.layers.4.OSA4_6_4/norm.bias", "bottom_up.stage4.OS
A4_6.layers.4.OSA4_6_4/norm.running_mean", "bottom_up.stage4.OSA4_6.layers.4.OSA4_6_4/norm.running_var", "bottom_up.stage4.OSA4_6.concat.OSA4_6_concat/conv.weight", "bo
ttom_up.stage4.OSA4_6.concat.OSA4_6_concat/norm.weight", "bottom_up.stage4.OSA4_6.concat.OSA4_6_concat/norm.bias", "bottom_up.stage4.OSA4_6.concat.OSA4_6_concat/norm.ru
nning_mean", "bottom_up.stage4.OSA4_6.concat.OSA4_6_concat/norm.running_var", "bottom_up.stage4.OSA4_6.ese.fc.weight", "bottom_up.stage4.OSA4_6.ese.fc.bias", "bottom_up
.stage4.OSA4_7.layers.0.OSA4_7_0/conv.weight", "bottom_up.stage4.OSA4_7.layers.0.OSA4_7_0/norm.weight", "bottom_up.stage4.OSA4_7.layers.0.OSA4_7_0/norm.bias", "bottom_u
p.stage4.OSA4_7.layers.0.OSA4_7_0/norm.running_mean", "bottom_up.stage4.OSA4_7.layers.0.OSA4_7_0/norm.running_var", "bottom_up.stage4.OSA4_7.layers.1.OSA4_7_1/conv.weig
ht", "bottom_up.stage4.OSA4_7.layers.1.OSA4_7_1/norm.weight", "bottom_up.stage4.OSA4_7.layers.1.OSA4_7_1/norm.bias", "bottom_up.stage4.OSA4_7.layers.1.OSA4_7_1/norm.run
ning_mean", "bottom_up.stage4.OSA4_7.layers.1.OSA4_7_1/norm.running_var", "bottom_up.stage4.OSA4_7.layers.2.OSA4_7_2/conv.weight", "bottom_up.stage4.OSA4_7.layers.2.OSA
4_7_2/norm.weight", "bottom_up.stage4.OSA4_7.layers.2.OSA4_7_2/norm.bias", "bottom_up.stage4.OSA4_7.layers.2.OSA4_7_2/norm.running_mean", "bottom_up.stage4.OSA4_7.layer
s.2.OSA4_7_2/norm.running_var", "bottom_up.stage4.OSA4_7.layers.3.OSA4_7_3/conv.weight", "bottom_up.stage4.OSA4_7.layers.3.OSA4_7_3/norm.weight", "bottom_up.stage4.OSA4
_7.layers.3.OSA4_7_3/norm.bias", "bottom_up.stage4.OSA4_7.layers.3.OSA4_7_3/norm.running_mean", "bottom_up.stage4.OSA4_7.layers.3.OSA4_7_3/norm.running_var", "bottom_up
.stage4.OSA4_7.layers.4.OSA4_7_4/conv.weight", "bottom_up.stage4.OSA4_7.layers.4.OSA4_7_4/norm.weight", "bottom_up.stage4.OSA4_7.layers.4.OSA4_7_4/norm.bias", "bottom_u
p.stage4.OSA4_7.layers.4.OSA4_7_4/norm.running_mean", "bottom_up.stage4.OSA4_7.layers.4.OSA4_7_4/norm.running_var", "bottom_up.stage4.OSA4_7.concat.OSA4_7_concat/conv.w
eight", "bottom_up.stage4.OSA4_7.concat.OSA4_7_concat/norm.weight", "bottom_up.stage4.OSA4_7.concat.OSA4_7_concat/norm.bias", "bottom_up.stage4.OSA4_7.concat.OSA4_7_con
cat/norm.running_mean", "bottom_up.stage4.OSA4_7.concat.OSA4_7_concat/norm.running_var", "bottom_up.stage4.OSA4_7.ese.fc.weight", "bottom_up.stage4.OSA4_7.ese.fc.bias",
 "bottom_up.stage4.OSA4_8.layers.0.OSA4_8_0/conv.weight", "bottom_up.stage4.OSA4_8.layers.0.OSA4_8_0/norm.weight", "bottom_up.stage4.OSA4_8.layers.0.OSA4_8_0/norm.bias"
, "bottom_up.stage4.OSA4_8.layers.0.OSA4_8_0/norm.running_mean", "bottom_up.stage4.OSA4_8.layers.0.OSA4_8_0/norm.running_var", "bottom_up.stage4.OSA4_8.layers.1.OSA4_8_
1/conv.weight", "bottom_up.stage4.OSA4_8.layers.1.OSA4_8_1/norm.weight", "bottom_up.stage4.OSA4_8.layers.1.OSA4_8_1/norm.bias", "bottom_up.stage4.OSA4_8.layers.1.OSA4_8
_1/norm.running_mean", "bottom_up.stage4.OSA4_8.layers.1.OSA4_8_1/norm.running_var", "bottom_up.stage4.OSA4_8.layers.2.OSA4_8_2/conv.weight", "bottom_up.stage4.OSA4_8.l
ayers.2.OSA4_8_2/norm.weight", "bottom_up.stage4.OSA4_8.layers.2.OSA4_8_2/norm.bias", "bottom_up.stage4.OSA4_8.layers.2.OSA4_8_2/norm.running_mean", "bottom_up.stage4.O
SA4_8.layers.2.OSA4_8_2/norm.running_var", "bottom_up.stage4.OSA4_8.layers.3.OSA4_8_3/conv.weight", "bottom_up.stage4.OSA4_8.layers.3.OSA4_8_3/norm.weight", "bottom_up.
stage4.OSA4_8.layers.3.OSA4_8_3/norm.bias", "bottom_up.stage4.OSA4_8.layers.3.OSA4_8_3/norm.running_mean", "bottom_up.stage4.OSA4_8.layers.3.OSA4_8_3/norm.running_var",
 "bottom_up.stage4.OSA4_8.layers.4.OSA4_8_4/conv.weight", "bottom_up.stage4.OSA4_8.layers.4.OSA4_8_4/norm.weight", "bottom_up.stage4.OSA4_8.layers.4.OSA4_8_4/norm.bias"
, "bottom_up.stage4.OSA4_8.layers.4.OSA4_8_4/norm.running_mean", "bottom_up.stage4.OSA4_8.layers.4.OSA4_8_4/norm.running_var", "bottom_up.stage4.OSA4_8.concat.OSA4_8_concat/conv.weight", "bottom_up.stage4.OSA4_8.concat.OSA4_8_concat/norm.weight", "bottom_up.stage4.OSA4_8.concat.OSA4_8_concat/norm.bias", "bottom_up.stage4.OSA4_8.concat
.OSA4_8_concat/norm.running_mean", "bottom_up.stage4.OSA4_8.concat.OSA4_8_concat/norm.running_var", "bottom_up.stage4.OSA4_8.ese.fc.weight", "bottom_up.stage4.OSA4_8.es
e.fc.bias", "bottom_up.stage4.OSA4_9.layers.0.OSA4_9_0/conv.weight", "bottom_up.stage4.OSA4_9.layers.0.OSA4_9_0/norm.weight", "bottom_up.stage4.OSA4_9.layers.0.OSA4_9_0
/norm.bias", "bottom_up.stage4.OSA4_9.layers.0.OSA4_9_0/norm.running_mean", "bottom_up.stage4.OSA4_9.layers.0.OSA4_9_0/norm.running_var", "bottom_up.stage4.OSA4_9.layer
s.1.OSA4_9_1/conv.weight", "bottom_up.stage4.OSA4_9.layers.1.OSA4_9_1/norm.weight", "bottom_up.stage4.OSA4_9.layers.1.OSA4_9_1/norm.bias", "bottom_up.stage4.OSA4_9.laye
rs.1.OSA4_9_1/norm.running_mean", "bottom_up.stage4.OSA4_9.layers.1.OSA4_9_1/norm.running_var", "bottom_up.stage4.OSA4_9.layers.2.OSA4_9_2/conv.weight", "bottom_up.stag
e4.OSA4_9.layers.2.OSA4_9_2/norm.weight", "bottom_up.stage4.OSA4_9.layers.2.OSA4_9_2/norm.bias", "bottom_up.stage4.OSA4_9.layers.2.OSA4_9_2/norm.running_mean", "bottom_
up.stage4.OSA4_9.layers.2.OSA4_9_2/norm.running_var", "bottom_up.stage4.OSA4_9.layers.3.OSA4_9_3/conv.weight", "bottom_up.stage4.OSA4_9.layers.3.OSA4_9_3/norm.weight", 
"bottom_up.stage4.OSA4_9.layers.3.OSA4_9_3/norm.bias", "bottom_up.stage4.OSA4_9.layers.3.OSA4_9_3/norm.running_mean", "bottom_up.stage4.OSA4_9.layers.3.OSA4_9_3/norm.ru
nning_var", "bottom_up.stage4.OSA4_9.layers.4.OSA4_9_4/conv.weight", "bottom_up.stage4.OSA4_9.layers.4.OSA4_9_4/norm.weight", "bottom_up.stage4.OSA4_9.layers.4.OSA4_9_4
/norm.bias", "bottom_up.stage4.OSA4_9.layers.4.OSA4_9_4/norm.running_mean", "bottom_up.stage4.OSA4_9.layers.4.OSA4_9_4/norm.running_var", "bottom_up.stage4.OSA4_9.conca
t.OSA4_9_concat/conv.weight", "bottom_up.stage4.OSA4_9.concat.OSA4_9_concat/norm.weight", "bottom_up.stage4.OSA4_9.concat.OSA4_9_concat/norm.bias", "bottom_up.stage4.OS
A4_9.concat.OSA4_9_concat/norm.running_mean", "bottom_up.stage4.OSA4_9.concat.OSA4_9_concat/norm.running_var", "bottom_up.stage4.OSA4_9.ese.fc.weight", "bottom_up.stage
4.OSA4_9.ese.fc.bias", "bottom_up.stage5.OSA5_1.layers.0.OSA5_1_0/conv.weight", "bottom_up.stage5.OSA5_1.layers.0.OSA5_1_0/norm.weight", "bottom_up.stage5.OSA5_1.layers
.0.OSA5_1_0/norm.bias", "bottom_up.stage5.OSA5_1.layers.0.OSA5_1_0/norm.running_mean", "bottom_up.stage5.OSA5_1.layers.0.OSA5_1_0/norm.running_var", "bottom_up.stage5.O
SA5_1.layers.1.OSA5_1_1/conv.weight", "bottom_up.stage5.OSA5_1.layers.1.OSA5_1_1/norm.weight", "bottom_up.stage5.OSA5_1.layers.1.OSA5_1_1/norm.bias", "bottom_up.stage5.
OSA5_1.layers.1.OSA5_1_1/norm.running_mean", "bottom_up.stage5.OSA5_1.layers.1.OSA5_1_1/norm.running_var", "bottom_up.stage5.OSA5_1.layers.2.OSA5_1_2/conv.weight", "bot
tom_up.stage5.OSA5_1.layers.2.OSA5_1_2/norm.weight", "bottom_up.stage5.OSA5_1.layers.2.OSA5_1_2/norm.bias", "bottom_up.stage5.OSA5_1.layers.2.OSA5_1_2/norm.running_mean
", "bottom_up.stage5.OSA5_1.layers.2.OSA5_1_2/norm.running_var", "bottom_up.stage5.OSA5_1.layers.3.OSA5_1_3/conv.weight", "bottom_up.stage5.OSA5_1.layers.3.OSA5_1_3/nor
m.weight", "bottom_up.stage5.OSA5_1.layers.3.OSA5_1_3/norm.bias", "bottom_up.stage5.OSA5_1.layers.3.OSA5_1_3/norm.running_mean", "bottom_up.stage5.OSA5_1.layers.3.OSA5_
1_3/norm.running_var", "bottom_up.stage5.OSA5_1.layers.4.OSA5_1_4/conv.weight", "bottom_up.stage5.OSA5_1.layers.4.OSA5_1_4/norm.weight", "bottom_up.stage5.OSA5_1.layers
.4.OSA5_1_4/norm.bias", "bottom_up.stage5.OSA5_1.layers.4.OSA5_1_4/norm.running_mean", "bottom_up.stage5.OSA5_1.layers.4.OSA5_1_4/norm.running_var", "bottom_up.stage5.O
SA5_1.concat.OSA5_1_concat/conv.weight", "bottom_up.stage5.OSA5_1.concat.OSA5_1_concat/norm.weight", "bottom_up.stage5.OSA5_1.concat.OSA5_1_concat/norm.bias", "bottom_u
p.stage5.OSA5_1.concat.OSA5_1_concat/norm.running_mean", "bottom_up.stage5.OSA5_1.concat.OSA5_1_concat/norm.running_var", "bottom_up.stage5.OSA5_1.ese.fc.weight", "bott
om_up.stage5.OSA5_1.ese.fc.bias", "bottom_up.stage5.OSA5_2.layers.0.OSA5_2_0/conv.weight", "bottom_up.stage5.OSA5_2.layers.0.OSA5_2_0/norm.weight", "bottom_up.stage5.OS
A5_2.layers.0.OSA5_2_0/norm.bias", "bottom_up.stage5.OSA5_2.layers.0.OSA5_2_0/norm.running_mean", "bottom_up.stage5.OSA5_2.layers.0.OSA5_2_0/norm.running_var", "bottom_
up.stage5.OSA5_2.layers.1.OSA5_2_1/conv.weight", "bottom_up.stage5.OSA5_2.layers.1.OSA5_2_1/norm.weight", "bottom_up.stage5.OSA5_2.layers.1.OSA5_2_1/norm.bias", "bottom
_up.stage5.OSA5_2.layers.1.OSA5_2_1/norm.running_mean", "bottom_up.stage5.OSA5_2.layers.1.OSA5_2_1/norm.running_var", "bottom_up.stage5.OSA5_2.layers.2.OSA5_2_2/conv.we
ight", "bottom_up.stage5.OSA5_2.layers.2.OSA5_2_2/norm.weight", "bottom_up.stage5.OSA5_2.layers.2.OSA5_2_2/norm.bias", "bottom_up.stage5.OSA5_2.layers.2.OSA5_2_2/norm.r
unning_mean", "bottom_up.stage5.OSA5_2.layers.2.OSA5_2_2/norm.running_var", "bottom_up.stage5.OSA5_2.layers.3.OSA5_2_3/conv.weight", "bottom_up.stage5.OSA5_2.layers.3.O
SA5_2_3/norm.weight", "bottom_up.stage5.OSA5_2.layers.3.OSA5_2_3/norm.bias", "bottom_up.stage5.OSA5_2.layers.3.OSA5_2_3/norm.running_mean", "bottom_up.stage5.OSA5_2.lay
ers.3.OSA5_2_3/norm.running_var", "bottom_up.stage5.OSA5_2.layers.4.OSA5_2_4/conv.weight", "bottom_up.stage5.OSA5_2.layers.4.OSA5_2_4/norm.weight", "bottom_up.stage5.OS
A5_2.layers.4.OSA5_2_4/norm.bias", "bottom_up.stage5.OSA5_2.layers.4.OSA5_2_4/norm.running_mean", "bottom_up.stage5.OSA5_2.layers.4.OSA5_2_4/norm.running_var", "bottom_
up.stage5.OSA5_2.concat.OSA5_2_concat/conv.weight", "bottom_up.stage5.OSA5_2.concat.OSA5_2_concat/norm.weight", "bottom_up.stage5.OSA5_2.concat.OSA5_2_concat/norm.bias"
, "bottom_up.stage5.OSA5_2.concat.OSA5_2_concat/norm.running_mean", "bottom_up.stage5.OSA5_2.concat.OSA5_2_concat/norm.running_var", "bottom_up.stage5.OSA5_2.ese.fc.wei
ght", "bottom_up.stage5.OSA5_2.ese.fc.bias", "bottom_up.stage5.OSA5_3.layers.0.OSA5_3_0/conv.weight", "bottom_up.stage5.OSA5_3.layers.0.OSA5_3_0/norm.weight", "bottom_u
p.stage5.OSA5_3.layers.0.OSA5_3_0/norm.bias", "bottom_up.stage5.OSA5_3.layers.0.OSA5_3_0/norm.running_mean", "bottom_up.stage5.OSA5_3.layers.0.OSA5_3_0/norm.running_var
", "bottom_up.stage5.OSA5_3.layers.1.OSA5_3_1/conv.weight", "bottom_up.stage5.OSA5_3.layers.1.OSA5_3_1/norm.weight", "bottom_up.stage5.OSA5_3.layers.1.OSA5_3_1/norm.bia
s", "bottom_up.stage5.OSA5_3.layers.1.OSA5_3_1/norm.running_mean", "bottom_up.stage5.OSA5_3.layers.1.OSA5_3_1/norm.running_var", "bottom_up.stage5.OSA5_3.layers.2.OSA5_
3_2/conv.weight", "bottom_up.stage5.OSA5_3.layers.2.OSA5_3_2/norm.weight", "bottom_up.stage5.OSA5_3.layers.2.OSA5_3_2/norm.bias", "bottom_up.stage5.OSA5_3.layers.2.OSA5
_3_2/norm.running_mean", "bottom_up.stage5.OSA5_3.layers.2.OSA5_3_2/norm.running_var", "bottom_up.stage5.OSA5_3.layers.3.OSA5_3_3/conv.weight", "bottom_up.stage5.OSA5_3
.layers.3.OSA5_3_3/norm.weight", "bottom_up.stage5.OSA5_3.layers.3.OSA5_3_3/norm.bias", "bottom_up.stage5.OSA5_3.layers.3.OSA5_3_3/norm.running_mean", "bottom_up.stage5
.OSA5_3.layers.3.OSA5_3_3/norm.running_var", "bottom_up.stage5.OSA5_3.layers.4.OSA5_3_4/conv.weight", "bottom_up.stage5.OSA5_3.layers.4.OSA5_3_4/norm.weight", "bottom_u
p.stage5.OSA5_3.layers.4.OSA5_3_4/norm.bias", "bottom_up.stage5.OSA5_3.layers.4.OSA5_3_4/norm.running_mean", "bottom_up.stage5.OSA5_3.layers.4.OSA5_3_4/norm.running_var
", "bottom_up.stage5.OSA5_3.concat.OSA5_3_concat/conv.weight", "bottom_up.stage5.OSA5_3.concat.OSA5_3_concat/norm.weight", "bottom_up.stage5.OSA5_3.concat.OSA5_3_concat
/norm.bias", "bottom_up.stage5.OSA5_3.concat.OSA5_3_concat/norm.running_mean", "bottom_up.stage5.OSA5_3.concat.OSA5_3_concat/norm.running_var", "bottom_up.stage5.OSA5_3
.ese.fc.weight", "bottom_up.stage5.OSA5_3.ese.fc.bias".                                                                                                                 
        Unexpected key(s) in state_dict: "model", "optimizer", "scheduler", "iteration".

I'd appreciate some help.

@LeopoldACC
Copy link
Author

LeopoldACC commented Jul 25, 2022

Maybe I solved it by edit the key name in pth file.

    model = build_vovnet_fpn_backbone(config,input_shape = ShapeSpec(channels=3, height=448, width=800, stride=None))
    pretrained_model_whole = torch.load('/data/CenterFusion0/models/vovnet99_dd3d15m.pth',map_location=torch.device('cpu'))
    pretrained_model =pretrained_model_whole['model']
    pretrained_model_with_new_key = OrderedDict([])
    
    keys2del = ["fpn_lateral2.norm.num_batches_tracked", "fpn_output2.norm.num_batches_tracked", "fpn_lateral3.norm.num_batches_tracked", "fpn_output3.norm.num_batches_tracked", "fpn_lateral4.norm.num_batches_tracked", "fpn_output4.norm.num_batches_tracked", "fpn_lateral5.norm.num_batches_tracked", "fpn_output5.norm.num_batches_tracked", "top_block.p6.weight", "top_block.p6.bias"]
    for key in pretrained_model:
        if 'backbone.' in key:
            new_key = key.replace('backbone.','')
            pretrained_model_with_new_key[new_key] = pretrained_model[key]
    for key in keys2del:
        del pretrained_model_with_new_key[key]
    # missing_keys, unexpected_keys  = model.load_state_dict(pretrained_model)
    missing_keys, unexpected_keys  = model.load_state_dict(pretrained_model_with_new_key)
    
    print("[missing_keys]:", *missing_keys, sep="\n")
    print("[unexpected_keys]:", *unexpected_keys, sep="\n")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant