AliaksandrSiarohin / motion-cosegmentation

Reference code for "Motion-supervised Co-Part Segmentation" paper
Other
653 stars 142 forks source link

Segmentation part initialized at random? #29

Closed Qiulin-W closed 3 years ago

Qiulin-W commented 3 years ago

Thanks for the great work! I have a question about checkpoint loading as below:

def load_segmentation_module(module, checkpoint):
    if 'kp_detector' in checkpoint:
        partial_state_dict_load(module, checkpoint['kp_detector'])
        module.state_dict()['affine.weight'].copy_(checkpoint['kp_detector']['jacobian.weight'])
        module.state_dict()['affine.bias'].copy_(checkpoint['kp_detector']['jacobian.bias'])
        module.state_dict()['shift.weight'].copy_(checkpoint['kp_detector']['kp.weight'])
        module.state_dict()['shift.bias'].copy_(checkpoint['kp_detector']['kp.bias'])

        if 'semantic_seg.weight' in checkpoint['kp_detector']:
            module.state_dict()['segmentation.weight'].copy_(checkpoint['kp_detector']['semantic_seg.weight'])
            module.state_dict()['segmentation.bias'].copy_(checkpoint['kp_detector']['semantic_seg.bias'])
        else:
            print ('Segmentation part initialized at random.')
    else:
        module.load_state_dict(checkpoint['segmentation_module'])

Since your provided pre-trained model only has the weights of the kp-detector in first-order-motion-model, the segmentation part will be initialized at random and the estimated dense motion field will be wrong. Are you going to provide the pre-trained model for the segmentation module in the future?

Thanks!

AliaksandrSiarohin commented 3 years ago

What do mean? Checkpoints is provided here https://yadi.sk/d/2hTyhEcqo_5ruA

Qiulin-W commented 3 years ago

OK I see the segment model, thanks!