zhilin007 / FFA-Net

FFA-Net: Feature Fusion Attention Network for Single Image Dehazing
601 stars 141 forks source link

Problem of pre-trained model #21

Open XBSong opened 3 years ago

XBSong commented 3 years ago

Hi, thank you for releasing the code and pre-trained models.

When I test the pre-trained model ('its_train_ffa_3_19.pk') downloaded from the released website, I got "loading state_dict for DataParallel: Unexpected key(s) in state_dict: "module.g1.la.gamma", "module.g1.last.weight", "module.g1.last.bias", "module.g2.la.gamma", "module.g2.last.weight", "module.g2.last.bias", "module.g3.la.gamma", "module.g3.last.weight", "module.g3.last.bias"."

Do you know why?

Thanks a lot!

Regards.

SkevyHoo commented 1 year ago

Oh,I meet the same issue

peace-dove commented 1 year ago

use code

    ffa = None
    gps = 3
    blocks = 19
    model_dir = '.../its_train_ffa_3_19.pk'
    ckp=torch.load(model_dir, map_location = 'cuda')
    ffa = FFA.FFA(gps = gps, blocks = blocks)

    ckpt = ckp['model']
    newckpt = {}
    for k,v in ckpt.items():
        k = (".").join(k.split(".")[1:])
        newckpt[k] = v
    ffa.load_state_dict(newckpt)

that's fine.