xinntao / ESRGAN

ECCV18 Workshops - Enhanced SRGAN. Champion PIRM Challenge on Perceptual Super-Resolution. The training codes are in BasicSR.
https://github.com/xinntao/BasicSR
Apache License 2.0
5.86k stars 1.04k forks source link

ESRGAN doesnt run in new version #95

Open patrikspacek opened 4 years ago

patrikspacek commented 4 years ago

I updated new version and I got this error... any help?

Traceback (most recent call last): File "test.py", line 15, in model.load_state_dict(torch.load(model_path), strict=True) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 769, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for RRDBNet: Missing key(s) in state_dict: "conv_first.weight", "conv_first.bias", "RRDB_trunk.0.RDB1.conv1.weight", "RRDB_trunk.0.RDB1.conv1.bias", "RRDB_trunk.0.RDB1.conv2.weight", "RRDB_trunk.0.RDB1.conv2.bias", "RRDB_trunk.0.RDB1.conv3.weight", "RRDB_trunk.0.RDB1.conv3.bias", "RRDB_trunk.0.RDB1.conv4.weight", "RRDB_trunk.0.RDB1.conv4.bias", "RRDB_trunk.0.RDB1.conv5.weight",.... etc. .... "model.6.bias", "model.8.weight", "model.8.bias", "model.10.weight", "model.10.bias".

rlaphoenix commented 4 years ago

The model isn't matching the architecture, your probably using an old-arch created model on the current arch. (or the other way around)

Try run transfer_RRDB_models.py on the model

actionless commented 8 months ago

i was trying to convert 4x or 8x upscalers from here (https://nmkd.de/?esrgan) using the transfer script, but these 4 lines are failing, so i guess it's some 3rd new format of ESRGAN network? or just model params should be adjusted in the beginning of the convert script?

crt_net['HRconv.weight'] = pretrained_net['model.8.weight']
crt_net['HRconv.bias'] = pretrained_net['model.8.bias']
crt_net['conv_last.weight'] = pretrained_net['model.10.weight']
crt_net['conv_last.bias'] = pretrained_net['model.10.bias']

UPD: it works in this fork: https://github.com/JoeyBallentine/ESRGAN directly without converting

crapthings commented 4 months ago

i was trying to convert 4x or 8x upscalers from here (nmkd.de/?esrgan) using the transfer script, but these 4 lines are failing, so i guess it's some 3rd new format of ESRGAN network? or just model params should be adjusted in the beginning of the convert script?

crt_net['HRconv.weight'] = pretrained_net['model.8.weight']
crt_net['HRconv.bias'] = pretrained_net['model.8.bias']
crt_net['conv_last.weight'] = pretrained_net['model.10.weight']
crt_net['conv_last.bias'] = pretrained_net['model.10.bias']

UPD: it works in this fork: JoeyBallentine/ESRGAN directly without converting

GOAT