WeilanAnnn/FD-GAN

Error(s) in loading state_dict for FDGAN

Opened this issue · 4 comments

When load model you provided , the error raises. It seems that code don't load dense121 model.
image

I made the following changes and it loaded successfully. Operation has not been verified.

  • PyTorch 1.10.0
  • netG_epoch_real.pth
# create new OrderedDict that does not contain `module.`
from collections import OrderedDict
new_state_dict = OrderedDict()
for k, v in state_dict.items():
    name = k[7:] # remove `module.`
    # ==========================================
    name = name.replace('.norm.1.', '.norm1.')
    name = name.replace('.norm.2.', '.norm2.')
    name = name.replace('.conv.1.', '.conv1.')
    name = name.replace('.conv.2.', '.conv2.')
    # ==========================================
    new_state_dict[name] = v
# load params
netG.load_state_dict(new_state_dict)
  • ONNX inference
    ezgif com-gif-maker (3)

@PINTO0309 hey can you tell me the source code changes needed for this repo to run. I tried on my machine but was unable to get clean-haze free images.