lzx1413 / PytorchSSD

pytorch version of SSD and it's enhanced methods such as RFBSSD,FSSD and RefineDet
MIT License
708 stars 238 forks source link

Unexpected key(s) in state_dict: L2Norm.weight #105

Open linhl97 opened 4 years ago

linhl97 commented 4 years ago

Hi, I tried to using FSSD in live.py by adding the following code:

elif args.version == 'FSSD_vgg':  
    from models.FSSD_vgg import build_net

And I have downloaded the pretrained model FSSD_vgg_VOC_epoches_270.pth,but here comes the error:

RuntimeError: Error(s) in loading state_dict for FSSD:
        Unexpected key(s) in state_dict: "L2Norm.weight". 

How could I solve it?

imyangs commented 3 years ago

replace net.load_state_dict(new_state_dict) with net.load_state_dict(new_state_dict, strict=False) in the train_test.py works for me

linhl97 commented 3 years ago

replace net.load_state_dict(new_state_dict) with net.load_state_dict(new_state_dict, strict=False) in the train_test.py works for me

Thanks for your advice !