IncompatibleKeys(missing_keys=[], unexpected_keys=[])
When I tried to use IBN-net as an feature extractor, I met an error.

  
      
      GitHub
  
  
    

XingangPan/IBN-Net

Instance-Batch Normalization Networks (ECCV2018). Contribute to XingangPan/IBN-Net development by creating an account on GitHub.


  
  
    
    
  
  


class LargeModel(nn.Module):
    def __init__(self, pretrain=True):
        super(LargeModel, self).__init__()

        # define ibn_model and initilize it with pretrained model.
        IBN_model_name = 'resnet50_ibn_a.pth.tar'
        IBN_model = resnet50_ibn_a(pretrained=False)
        pretrained_model_weight = torch.load(IBN_model_name)['state_dict']
        new_state_dict = OrderedDict()
        for k, v in pretrained_model_weight.items():
            name = k[7:] # remove `module.`
            new_state_dict[name] = v
     #   for k, v in new_state_dict.items():
     #       print(k)
     #   print('----------')
     #   for k in IBN_model.state_dict().keys():
     #       print(k)

        self.ibn_res50 = IBN_model.load_state_dict(new_state_dict)
        print(self.ibn_res50)
         # Define Extra layers and initilize them with uniform distribution

When I try to print self.ibn_res50, it gives such error.
In fact, when I try to print new_state_dict and IBN_model.state_dict().keys(), both of them return the same keys.