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
6.04k stars 1.07k forks source link

Using trained "ESRGAN_PSNR_SRx4_DF2K_official-150ff491" #106

Open wolfam0108 opened 4 years ago

wolfam0108 commented 4 years ago

I will duplicate here. Wrote here by mistake. My model based on "ESRGAN_PSNR_SRx4_DF2K_official-150ff491.pth" has finished training. The files net_g_XXX and net_d_XXX appeared in the folder experiments \ model name \ model.

I don't understand python at all. How can I apply the trained model, for example, in your ESRGAN project?

If I put in "test.py" ESRGAN the path to net_g_XXX.pth, this should work for image processing?

When I apply the model, I get this:

(base) vova@wolfram-pc:/tmp/ESRGAN$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 16, in <module>
    model.load_state_dict(torch.load(model_path), strict=True)
  File "/home/vova/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 847, 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", "RRDB_trunk.0.RDB1.conv5.bias", "RRDB_trunk.0.RDB2.conv1.weight", "RRDB_trunk.0.RDB2.conv1.bias", "RRDB_trunk.0.RDB2.conv2.weight", "RRDB_trunk.0.RDB2.conv2.bias", "RRDB_trunk.0.RDB2.conv3.weight", "RRDB_trunk.0.RDB2.conv3.bias", "RRDB_trunk.0.RDB2.conv4.weight", "RRDB_trunk.0.RDB2.conv4.bias", "RRDB_trunk.0.RDB2.conv5.weight", "RRDB_trunk.0.RDB2.conv5.bias", "RRDB_trunk.0.RDB3.conv1.weight", "RRDB_trunk.0.RDB3.conv1.bias", "RRDB_trunk.0.RDB3.conv2.weight", "RRDB_trunk.0.RDB3.conv2.bias", "RRDB_trunk.0.RDB3.conv3.weight", "RRDB_trunk.0.RDB3.conv3.bias", "RRDB_trunk.0.RDB3.conv4.weight", "RRDB_trunk.0.RDB3.conv4.bias", "RRDB_trunk.0.RDB3.conv5.weight", "RRDB_trunk.0.RDB3.conv5.bias", "RRDB_trunk.1.RDB1.conv1.weight", "RRDB_trunk.1.RDB1.conv1.bias", "RRDB_trunk.1.RDB1.conv2.weight", "RRDB_trunk.1.RDB1.conv2.bias", "RRDB_trunk.1.RDB1.conv3.weight", "RRDB_trunk.1.RDB1.conv3.bias", "RRDB_trunk.1.RDB1.conv4.weight", "RRDB_trunk.1.RDB1.conv4.bias", "RRDB_trunk.1.RDB1.conv5.weight", "RRDB_trunk.1.RDB1.conv5.bias", "RRDB_trunk.1.RDB2.conv1.weight", "RRDB_trunk.1.RDB2.conv1.bias", "RRDB_trunk.1.RDB2.conv2.weight", "RRDB_trunk.1.RDB2.conv2.bias", "RRDB_trunk.1.RDB2.conv3.weight", "RRDB_trunk.1.RDB2.conv3.bias", "RRDB_trunk.1.RDB2.conv4.weight", "RRDB_trunk.1.RDB2.conv4.bias", "RRDB_trunk.1.RDB2.conv5.weight", "RRDB_trunk.1.RDB2.conv5.bias", "RRDB_trunk.1.RDB3.conv1.weight", "RRDB_trunk.1.RDB3.conv1.bias", "RRDB_trunk.1.RDB3.conv2.weight", "RRDB_trunk.1.RDB3.conv2.bias", "RRDB_trunk.1.RDB3.conv3.weight", "RRDB_trunk.1.RDB3.conv3.bias", "RRDB_trunk.1.RDB3.conv4.weight", "RRDB_trunk.1.RDB3.conv4.bias", "RRDB_trunk.1.RDB3.conv5.weight", "RRDB_trunk.1.RDB3.conv5.bias", "RRDB_trunk.2.RDB1.conv1.weight", "RRDB_trunk.2.RDB1.conv1.bias", "RRDB_trunk.2.RDB1.conv2.weight", "RRDB_trunk.2.RDB1.conv2.bias", "RRDB_trunk.2.RDB1.conv3.weight", "RRDB_trunk.2.RDB1.conv3.bias", "RRDB_trunk.2.RDB1.conv4.weight", "RRDB_trunk.2.RDB1.conv4.bias", "RRDB_trunk.2.RDB1.conv5.weight", "RRDB_trunk.2.RDB1.conv5.bias", "RRDB_trunk.2.RDB2.conv1.weight", "RRDB_trunk.2.RDB2.conv1.bias", "RRDB_trunk.2.RDB2.conv2.weight", "RRDB_trunk.2.RDB2.conv2.bias", "RRDB_trunk.2.RDB2.conv3.weight", "RRDB_trunk.2.RDB2.conv3.bias", "RRDB_trunk.2.RDB2.conv4.weight", "RRDB_trunk.2.RDB2.conv4.bias", "RRDB_trunk.2.RDB2.conv5.weight", "RRDB_trunk.2.RDB2.conv5.bias", "RRDB_trunk.2.RDB3.conv1.weight", "RRDB_trunk.2.RDB3.conv1.bias", "RRDB_trunk.2.RDB3.conv2.weight", "RRDB_trunk.2.RDB3.conv2.bias", "RRDB_trunk.2.RDB3.conv3.weight", "RRDB_trunk.2.RDB3.conv3.bias", "RRDB_trunk.2.RDB3.conv4.weight", "RRDB_trunk.2.RDB3.conv4.bias", "RRDB_trunk.2.RDB3.conv5.weight", "RRDB_trunk.2.RDB3.conv5.bias", "RRDB_trunk.3.RDB1.conv1.weight", "RRDB_trunk.3.RDB1.conv1.bias", "RRDB_trunk.3.RDB1.conv2.weight", "RRDB_trunk.3.RDB1.conv2.bias", "RRDB_trunk.3.RDB1.conv3.weight", "RRDB_trunk.3.RDB1.conv3.bias", "RRDB_trunk.3.RDB1.conv4.weight", "RRDB_trunk.3.RDB1.conv4.bias", "RRDB_trunk.3.RDB1.conv5.weight", "RRDB_trunk.3.RDB1.conv5.bias", "RRDB_trunk.3.RDB2.conv1.weight", "RRDB_trunk.3.RDB2.conv1.bias", "RRDB_trunk.3.RDB2.conv2.weight", "RRDB_trunk.3.RDB2.conv2.bias", "RRDB_trunk.3.RDB2.conv3.weight", "RRDB_trunk.3.RDB2.conv3.bias", "RRDB_trunk.3.RDB2.conv4.weight", "RRDB_trunk.3.RDB2.conv4.bias", "RRDB_trunk.3.RDB2.conv5.weight", "RRDB_trunk.3.RDB2.conv5.bias", "RRDB_trunk.3.RDB3.conv1.weight", "RRDB_trunk.3.RDB3.conv1.bias", "RRDB_trunk.3.RDB3.conv2.weight", "RRDB_trunk.3.RDB3.conv2.bias", "RRDB_trunk.3.RDB3.conv3.weight", "RRDB_trunk.3.RDB3.conv3.bias", "RRDB_trunk.3.RDB3.conv4.weight", "RRDB_trunk.3.RDB3.conv4.bias", "RRDB_trunk.3.RDB3.conv5.weight", "RRDB_trunk.3.RDB3.conv5.bias", "RRDB_trunk.4.RDB1.conv1.weight", "RRDB_trunk.4.RDB1.conv1.bias", "RRDB_trunk.4.RDB1.conv2.weight", "RRDB_trunk.4.RDB1.conv2.bias", "RRDB_trunk.4.RDB1.conv3.weight", "RRDB_trunk.4.RDB1.conv3.bias", "RRDB_trunk.4.RDB1.conv4.weight", "RRDB_trunk.4.RDB1.conv4.bias", "RRDB_trunk.4.RDB1.conv5.weight", "RRDB_trunk.4.RDB1.conv5.bias", "RRDB_trunk.4.RDB2.conv1.weight", "RRDB_trunk.4.RDB2.conv1.bias", "RRDB_trunk.4.RDB2.conv2.weight", "RRDB_trunk.4.RDB2.conv2.bias", "RRDB_trunk.4.RDB2.conv3.weight", "RRDB_trunk.4.RDB2.conv3.bias", "RRDB_trunk.4.RDB2.conv4.weight", "RRDB_trunk.4.RDB2.conv4.bias", "RRDB_trunk.4.RDB2.conv5.weight", "RRDB_trunk.4.RDB2.conv5.bias", "RRDB_trunk.4.RDB3.conv1.weight", "RRDB_trunk.4.RDB3.conv1.bias", "RRDB_trunk.4.RDB3.conv2.weight", "RRDB_trunk.4.RDB3.conv2.bias", "RRDB_trunk.4.RDB3.conv3.weight", "RRDB_trunk.4.RDB3.conv3.bias", "RRDB_trunk.4.RDB3.conv4.weight", "RRDB_trunk.4.RDB3.conv4.bias", "RRDB_trunk.4.RDB3.conv5.weight", "RRDB_trunk.4.RDB3.conv5.bias", "RRDB_trunk.5.RDB1.conv1.weight", "RRDB_trunk.5.RDB1.conv1.bias", "RRDB_trunk.5.RDB1.conv2.weight", "RRDB_trunk.5.RDB1.conv2.bias", "RRDB_trunk.5.RDB1.conv3.weight", "RRDB_trunk.5.RDB1.conv3.bias", "RRDB_trunk.5.RDB1.conv4.weight", "RRDB_trunk.5.RDB1.conv4.bias", "RRDB_trunk.5.RDB1.conv5.weight", "RRDB_trunk.5.RDB1.conv5.bias", "RRDB_trunk.5.RDB2.conv1.weight", "RRDB_trunk.5.RDB2.conv1.bias", "RRDB_trunk.5.RDB2.conv2.weight", "RRDB_trunk.5.RDB2.conv2.bias", "RRDB_trunk.5.RDB2.conv3.weight", "RRDB_trunk.5.RDB2.conv3.bias", "RRDB_trunk.5.RDB2.conv4.weight", "RRDB_trunk.5.RDB2.conv4.bias", "RRDB_trunk.5.RDB2.conv5.weight", "RRDB_trunk.5.RDB2.conv5.bias", "RRDB_trunk.5.RDB3.conv1.weight", "RRDB_trunk.5.RDB3.conv1.bias", "RRDB_trunk.5.RDB3.conv2.weight", "RRDB_trunk.5.RDB3.conv2.bias", "RRDB_trunk.5.RDB3.conv3.weight", "RRDB_trunk.5.RDB3.conv3.bias", "RRDB_trunk.5.RDB3.conv4.weight", "RRDB_trunk.5.RDB3.conv4.bias", "RRDB_trunk.5.RDB3.conv5.weight", "RRDB_trunk.5.RDB3.conv5.bias", "RRDB_trunk.6.RDB1.conv1.weight", "RRDB_trunk.6.RDB1.conv1.bias", "RRDB_trunk.6.RDB1.conv2.weight", "RRDB_trunk.6.RDB1.conv2.bias", "RRDB_trunk.6.RDB1.conv3.weight", "RRDB_trunk.6.RDB1.conv3.bias", "RRDB_trunk.6.RDB1.conv4.weight", "RRDB_trunk.6.RDB1.conv4.bias", "RRDB_trunk.6.RDB1.conv5.weight", "RRDB_trunk.6.RDB1.conv5.bias", "RRDB_trunk.6.RDB2.conv1.weight", "RRDB_trunk.6.RDB2.conv1.bias", "RRDB_trunk.6.RDB2.conv2.weight", "RRDB_trunk.6.RDB2.conv2.bias", "RRDB_trunk.6.RDB2.conv3.weight", "RRDB_trunk.6.RDB2.conv3.bias", "RRDB_trunk.6.RDB2.conv4.weight", "RRDB_trunk.6.RDB2.conv4.bias", "RRDB_trunk.6.RDB2.conv5.weight", "RRDB_trunk.6.RDB2.conv5.bias", "RRDB_trunk.6.RDB3.conv1.weight", "RRDB_trunk.6.RDB3.conv1.bias", "RRDB_trunk.6.RDB3.conv2.weight", "RRDB_trunk.6.RDB3.conv2.bias", "RRDB_trunk.6.RDB3.conv3.weight", "RRDB_trunk.6.RDB3.conv3.bias", "RRDB_trunk.6.RDB3.conv4.weight", "RRDB_trunk.6.RDB3.conv4.bias", "RRDB_trunk.6.RDB3.conv5.weight", "RRDB_trunk.6.RDB3.conv5.bias", "RRDB_trunk.7.RDB1.conv1.weight", "RRDB_trunk.7.RDB1.conv1.bias", "RRDB_trunk.7.RDB1.conv2.weight", "RRDB_trunk.7.RDB1.conv2.bias", "RRDB_trunk.7.RDB1.conv3.weight", "RRDB_trunk.7.RDB1.conv3.bias", "RRDB_trunk.7.RDB1.conv4.weight", "RRDB_trunk.7.RDB1.conv4.bias", "RRDB_trunk.7.RDB1.conv5.weight", "RRDB_trunk.7.RDB1.conv5.bias", "RRDB_trunk.7.RDB2.conv1.weight", "RRDB_trunk.7.RDB2.conv1.bias", "RRDB_trunk.7.RDB2.conv2.weight", "RRDB_trunk.7.RDB2.conv2.bias", "RRDB_trunk.7.RDB2.conv3.weight", "RRDB_trunk.7.RDB2.conv3.bias", "RRDB_trunk.7.RDB2.conv4.weight", "RRDB_trunk.7.RDB2.conv4.bias", "RRDB_trunk.7.RDB2.conv5.weight", "RRDB_trunk.7.RDB2.conv5.bias", "RRDB_trunk.7.RDB3.conv1.weight", "RRDB_trunk.7.RDB3.conv1.bias", "RRDB_trunk.7.RDB3.conv2.weight", "RRDB_trunk.7.RDB3.conv2.bias", "RRDB_trunk.7.RDB3.conv3.weight", "RRDB_trunk.7.RDB3.conv3.bias", "RRDB_trunk.7.RDB3.conv4.weight", "RRDB_trunk.7.RDB3.conv4.bias", "RRDB_trunk.7.RDB3.conv5.weight", "RRDB_trunk.7.RDB3.conv5.bias", "RRDB_trunk.8.RDB1.conv1.weight", "RRDB_trunk.8.RDB1.conv1.bias", "RRDB_trunk.8.RDB1.conv2.weight", "RRDB_trunk.8.RDB1.conv2.bias", "RRDB_trunk.8.RDB1.conv3.weight", "RRDB_trunk.8.RDB1.conv3.bias", "RRDB_trunk.8.RDB1.conv4.weight", "RRDB_trunk.8.RDB1.conv4.bias", "RRDB_trunk.8.RDB1.conv5.weight", "RRDB_trunk.8.RDB1.conv5.bias", "RRDB_trunk.8.RDB2.conv1.weight", "RRDB_trunk.8.RDB2.conv1.bias", "RRDB_trunk.8.RDB2.conv2.weight", "RRDB_trunk.8.RDB2.conv2.bias", "RRDB_trunk.8.RDB2.conv3.weight", "RRDB_trunk.8.RDB2.conv3.bias", "RRDB_trunk.8.RDB2.conv4.weight", "RRDB_trunk.8.RDB2.conv4.bias", "RRDB_trunk.8.RDB2.conv5.weight", "RRDB_trunk.8.RDB2.conv5.bias", "RRDB_trunk.8.RDB3.conv1.weight", "RRDB_trunk.8.RDB3.conv1.bias", "RRDB_trunk.8.RDB3.conv2.weight", "RRDB_trunk.8.RDB3.conv2.bias", "RRDB_trunk.8.RDB3.conv3.weight", "RRDB_trunk.8.RDB3.conv3.bias", "RRDB_trunk.8.RDB3.conv4.weight", "RRDB_trunk.8.RDB3.conv4.bias", "RRDB_trunk.8.RDB3.conv5.weight", "RRDB_trunk.8.RDB3.conv5.bias", "RRDB_trunk.9.RDB1.conv1.weight", "RRDB_trunk.9.RDB1.conv1.bias", "RRDB_trunk.9.RDB1.conv2.weight", "RRDB_trunk.9.RDB1.conv2.bias", "RRDB_trunk.9.RDB1.conv3.weight", "RRDB_trunk.9.RDB1.conv3.bias", "RRDB_trunk.9.RDB1.conv4.weight", "RRDB_trunk.9.RDB1.conv4.bias", "RRDB_trunk.9.RDB1.conv5.weight", "RRDB_trunk.9.RDB1.conv5.bias", "RRDB_trunk.9.RDB2.conv1.weight", "RRDB_trunk.9.RDB2.conv1.bias", "RRDB_trunk.9.RDB2.conv2.weight", "RRDB_trunk.9.RDB2.conv2.bias", "RRDB_trunk.9.RDB2.conv3.weight", "RRDB_trunk.9.RDB2.conv3.bias", "RRDB_trunk.9.RDB2.conv4.weight", "RRDB_trunk.9.RDB2.conv4.bias", "RRDB_trunk.9.RDB2.conv5.weight", "RRDB_trunk.9.RDB2.conv5.bias", "RRDB_trunk.9.RDB3.conv1.weight", "RRDB_trunk.9.RDB3.conv1.bias", "RRDB_trunk.9.RDB3.conv2.weight", "RRDB_trunk.9.RDB3.conv2.bias", "RRDB_trunk.9.RDB3.conv3.weight", "RRDB_trunk.9.RDB3.conv3.bias", "RRDB_trunk.9.RDB3.conv4.weight", "RRDB_trunk.9.RDB3.conv4.bias", "RRDB_trunk.9.RDB3.conv5.weight", "RRDB_trunk.9.RDB3.conv5.bias", "RRDB_trunk.10.RDB1.conv1.weight", "RRDB_trunk.10.RDB1.conv1.bias", "RRDB_trunk.10.RDB1.conv2.weight", "RRDB_trunk.10.RDB1.conv2.bias", "RRDB_trunk.10.RDB1.conv3.weight", "RRDB_trunk.10.RDB1.conv3.bias", "RRDB_trunk.10.RDB1.conv4.weight", "RRDB_trunk.10.RDB1.conv4.bias", "RRDB_trunk.10.RDB1.conv5.weight", "RRDB_trunk.10.RDB1.conv5.bias", "RRDB_trunk.10.RDB2.conv1.weight", "RRDB_trunk.10.RDB2.conv1.bias", "RRDB_trunk.10.RDB2.conv2.weight", "RRDB_trunk.10.RDB2.conv2.bias", "RRDB_trunk.10.RDB2.conv3.weight", "RRDB_trunk.10.RDB2.conv3.bias", "RRDB_trunk.10.RDB2.conv4.weight", "RRDB_trunk.10.RDB2.conv4.bias", "RRDB_trunk.10.RDB2.conv5.weight", "RRDB_trunk.10.RDB2.conv5.bias", "RRDB_trunk.10.RDB3.conv1.weight", "RRDB_trunk.10.RDB3.conv1.bias", "RRDB_trunk.10.RDB3.conv2.weight", "RRDB_trunk.10.RDB3.conv2.bias", "RRDB_trunk.10.RDB3.conv3.weight", "RRDB_trunk.10.RDB3.conv3.bias", "RRDB_trunk.10.RDB3.conv4.weight", "RRDB_trunk.10.RDB3.conv4.bias", "RRDB_trunk.10.RDB3.conv5.weight", "RRDB_trunk.10.RDB3.conv5.bias", "RRDB_trunk.11.RDB1.conv1.weight", "RRDB_trunk.11.RDB1.conv1.bias", "RRDB_trunk.11.RDB1.conv2.weight", "RRDB_trunk.11.RDB1.conv2.bias", "RRDB_trunk.11.RDB1.conv3.weight", "RRDB_trunk.11.RDB1.conv3.bias", "RRDB_trunk.11.RDB1.conv4.weight", "RRDB_trunk.11.RDB1.conv4.bias", "RRDB_trunk.11.RDB1.conv5.weight", "RRDB_trunk.11.RDB1.conv5.bias", "RRDB_trunk.11.RDB2.conv1.weight", "RRDB_trunk.11.RDB2.conv1.bias", "RRDB_trunk.11.RDB2.conv2.weight", "RRDB_trunk.11.RDB2.conv2.bias", "RRDB_trunk.11.RDB2.conv3.weight", "RRDB_trunk.11.RDB2.conv3.bias", "RRDB_trunk.11.RDB2.conv4.weight", "RRDB_trunk.11.RDB2.conv4.bias", "RRDB_trunk.11.RDB2.conv5.weight", "RRDB_trunk.11.RDB2.conv5.bias", "RRDB_trunk.11.RDB3.conv1.weight", "RRDB_trunk.11.RDB3.conv1.bias", "RRDB_trunk.11.RDB3.conv2.weight", "RRDB_trunk.11.RDB3.conv2.bias", "RRDB_trunk.11.RDB3.conv3.weight", "RRDB_trunk.11.RDB3.conv3.bias", "RRDB_trunk.11.RDB3.conv4.weight", "RRDB_trunk.11.RDB3.conv4.bias", "RRDB_trunk.11.RDB3.conv5.weight", "RRDB_trunk.11.RDB3.conv5.bias", "RRDB_trunk.12.RDB1.conv1.weight", "RRDB_trunk.12.RDB1.conv1.bias", "RRDB_trunk.12.RDB1.conv2.weight", "RRDB_trunk.12.RDB1.conv2.bias", "RRDB_trunk.12.RDB1.conv3.weight", "RRDB_trunk.12.RDB1.conv3.bias", "RRDB_trunk.12.RDB1.conv4.weight", "RRDB_trunk.12.RDB1.conv4.bias", "RRDB_trunk.12.RDB1.conv5.weight", "RRDB_trunk.12.RDB1.conv5.bias", "RRDB_trunk.12.RDB2.conv1.weight", "RRDB_trunk.12.RDB2.conv1.bias", "RRDB_trunk.12.RDB2.conv2.weight", "RRDB_trunk.12.RDB2.conv2.bias", "RRDB_trunk.12.RDB2.conv3.weight", "RRDB_trunk.12.RDB2.conv3.bias", "RRDB_trunk.12.RDB2.conv4.weight", "RRDB_trunk.12.RDB2.conv4.bias", "RRDB_trunk.12.RDB2.conv5.weight", "RRDB_trunk.12.RDB2.conv5.bias", "RRDB_trunk.12.RDB3.conv1.weight", "RRDB_trunk.12.RDB3.conv1.bias", "RRDB_trunk.12.RDB3.conv2.weight", "RRDB_trunk.12.RDB3.conv2.bias", "RRDB_trunk.12.RDB3.conv3.weight", "RRDB_trunk.12.RDB3.conv3.bias", "RRDB_trunk.12.RDB3.conv4.weight", "RRDB_trunk.12.RDB3.conv4.bias", "RRDB_trunk.12.RDB3.conv5.weight", "RRDB_trunk.12.RDB3.conv5.bias", "RRDB_trunk.13.RDB1.conv1.weight", "RRDB_trunk.13.RDB1.conv1.bias", "RRDB_trunk.13.RDB1.conv2.weight", "RRDB_trunk.13.RDB1.conv2.bias", "RRDB_trunk.13.RDB1.conv3.weight", "RRDB_trunk.13.RDB1.conv3.bias", "RRDB_trunk.13.RDB1.conv4.weight", "RRDB_trunk.13.RDB1.conv4.bias", "RRDB_trunk.13.RDB1.conv5.weight", "RRDB_trunk.13.RDB1.conv5.bias", "RRDB_trunk.13.RDB2.conv1.weight", "RRDB_trunk.13.RDB2.conv1.bias", "RRDB_trunk.13.RDB2.conv2.weight", "RRDB_trunk.13.RDB2.conv2.bias", "RRDB_trunk.13.RDB2.conv3.weight", "RRDB_trunk.13.RDB2.conv3.bias", "RRDB_trunk.13.RDB2.conv4.weight", "RRDB_trunk.13.RDB2.conv4.bias", "RRDB_trunk.13.RDB2.conv5.weight", "RRDB_trunk.13.RDB2.conv5.bias", "RRDB_trunk.13.RDB3.conv1.weight", "RRDB_trunk.13.RDB3.conv1.bias", "RRDB_trunk.13.RDB3.conv2.weight", "RRDB_trunk.13.RDB3.conv2.bias", "RRDB_trunk.13.RDB3.conv3.weight", "RRDB_trunk.13.RDB3.conv3.bias", "RRDB_trunk.13.RDB3.conv4.weight", "RRDB_trunk.13.RDB3.conv4.bias", "RRDB_trunk.13.RDB3.conv5.weight", "RRDB_trunk.13.RDB3.conv5.bias", "RRDB_trunk.14.RDB1.conv1.weight", "RRDB_trunk.14.RDB1.conv1.bias", "RRDB_trunk.14.RDB1.conv2.weight", "RRDB_trunk.14.RDB1.conv2.bias", "RRDB_trunk.14.RDB1.conv3.weight", "RRDB_trunk.14.RDB1.conv3.bias", "RRDB_trunk.14.RDB1.conv4.weight", "RRDB_trunk.14.RDB1.conv4.bias", "RRDB_trunk.14.RDB1.conv5.weight", "RRDB_trunk.14.RDB1.conv5.bias", "RRDB_trunk.14.RDB2.conv1.weight", "RRDB_trunk.14.RDB2.conv1.bias", "RRDB_trunk.14.RDB2.conv2.weight", "RRDB_trunk.14.RDB2.conv2.bias", "RRDB_trunk.14.RDB2.conv3.weight", "RRDB_trunk.14.RDB2.conv3.bias", "RRDB_trunk.14.RDB2.conv4.weight", "RRDB_trunk.14.RDB2.conv4.bias", "RRDB_trunk.14.RDB2.conv5.weight", "RRDB_trunk.14.RDB2.conv5.bias", "RRDB_trunk.14.RDB3.conv1.weight", "RRDB_trunk.14.RDB3.conv1.bias", "RRDB_trunk.14.RDB3.conv2.weight", "RRDB_trunk.14.RDB3.conv2.bias", "RRDB_trunk.14.RDB3.conv3.weight", "RRDB_trunk.14.RDB3.conv3.bias", "RRDB_trunk.14.RDB3.conv4.weight", "RRDB_trunk.14.RDB3.conv4.bias", "RRDB_trunk.14.RDB3.conv5.weight", "RRDB_trunk.14.RDB3.conv5.bias", "RRDB_trunk.15.RDB1.conv1.weight", "RRDB_trunk.15.RDB1.conv1.bias", "RRDB_trunk.15.RDB1.conv2.weight", "RRDB_trunk.15.RDB1.conv2.bias", "RRDB_trunk.15.RDB1.conv3.weight", "RRDB_trunk.15.RDB1.conv3.bias", "RRDB_trunk.15.RDB1.conv4.weight", "RRDB_trunk.15.RDB1.conv4.bias", "RRDB_trunk.15.RDB1.conv5.weight", "RRDB_trunk.15.RDB1.conv5.bias", "RRDB_trunk.15.RDB2.conv1.weight", "RRDB_trunk.15.RDB2.conv1.bias", "RRDB_trunk.15.RDB2.conv2.weight", "RRDB_trunk.15.RDB2.conv2.bias", "RRDB_trunk.15.RDB2.conv3.weight", "RRDB_trunk.15.RDB2.conv3.bias", "RRDB_trunk.15.RDB2.conv4.weight", "RRDB_trunk.15.RDB2.conv4.bias", "RRDB_trunk.15.RDB2.conv5.weight", "RRDB_trunk.15.RDB2.conv5.bias", "RRDB_trunk.15.RDB3.conv1.weight", "RRDB_trunk.15.RDB3.conv1.bias", "RRDB_trunk.15.RDB3.conv2.weight", "RRDB_trunk.15.RDB3.conv2.bias", "RRDB_trunk.15.RDB3.conv3.weight", "RRDB_trunk.15.RDB3.conv3.bias", "RRDB_trunk.15.RDB3.conv4.weight", "RRDB_trunk.15.RDB3.conv4.bias", "RRDB_trunk.15.RDB3.conv5.weight", "RRDB_trunk.15.RDB3.conv5.bias", "RRDB_trunk.16.RDB1.conv1.weight", "RRDB_trunk.16.RDB1.conv1.bias", "RRDB_trunk.16.RDB1.conv2.weight", "RRDB_trunk.16.RDB1.conv2.bias", "RRDB_trunk.16.RDB1.conv3.weight", "RRDB_trunk.16.RDB1.conv3.bias", "RRDB_trunk.16.RDB1.conv4.weight", "RRDB_trunk.16.RDB1.conv4.bias", "RRDB_trunk.16.RDB1.conv5.weight", "RRDB_trunk.16.RDB1.conv5.bias", "RRDB_trunk.16.RDB2.conv1.weight", "RRDB_trunk.16.RDB2.conv1.bias", "RRDB_trunk.16.RDB2.conv2.weight", "RRDB_trunk.16.RDB2.conv2.bias", "RRDB_trunk.16.RDB2.conv3.weight", "RRDB_trunk.16.RDB2.conv3.bias", "RRDB_trunk.16.RDB2.conv4.weight", "RRDB_trunk.16.RDB2.conv4.bias", "RRDB_trunk.16.RDB2.conv5.weight", "RRDB_trunk.16.RDB2.conv5.bias", "RRDB_trunk.16.RDB3.conv1.weight", "RRDB_trunk.16.RDB3.conv1.bias", "RRDB_trunk.16.RDB3.conv2.weight", "RRDB_trunk.16.RDB3.conv2.bias", "RRDB_trunk.16.RDB3.conv3.weight", "RRDB_trunk.16.RDB3.conv3.bias", "RRDB_trunk.16.RDB3.conv4.weight", "RRDB_trunk.16.RDB3.conv4.bias", "RRDB_trunk.16.RDB3.conv5.weight", "RRDB_trunk.16.RDB3.conv5.bias", "RRDB_trunk.17.RDB1.conv1.weight", "RRDB_trunk.17.RDB1.conv1.bias", "RRDB_trunk.17.RDB1.conv2.weight", "RRDB_trunk.17.RDB1.conv2.bias", "RRDB_trunk.17.RDB1.conv3.weight", "RRDB_trunk.17.RDB1.conv3.bias", "RRDB_trunk.17.RDB1.conv4.weight", "RRDB_trunk.17.RDB1.conv4.bias", "RRDB_trunk.17.RDB1.conv5.weight", "RRDB_trunk.17.RDB1.conv5.bias", "RRDB_trunk.17.RDB2.conv1.weight", "RRDB_trunk.17.RDB2.conv1.bias", "RRDB_trunk.17.RDB2.conv2.weight", "RRDB_trunk.17.RDB2.conv2.bias", "RRDB_trunk.17.RDB2.conv3.weight", "RRDB_trunk.17.RDB2.conv3.bias", "RRDB_trunk.17.RDB2.conv4.weight", "RRDB_trunk.17.RDB2.conv4.bias", "RRDB_trunk.17.RDB2.conv5.weight", "RRDB_trunk.17.RDB2.conv5.bias", "RRDB_trunk.17.RDB3.conv1.weight", "RRDB_trunk.17.RDB3.conv1.bias", "RRDB_trunk.17.RDB3.conv2.weight", "RRDB_trunk.17.RDB3.conv2.bias", "RRDB_trunk.17.RDB3.conv3.weight", "RRDB_trunk.17.RDB3.conv3.bias", "RRDB_trunk.17.RDB3.conv4.weight", "RRDB_trunk.17.RDB3.conv4.bias", "RRDB_trunk.17.RDB3.conv5.weight", "RRDB_trunk.17.RDB3.conv5.bias", "RRDB_trunk.18.RDB1.conv1.weight", "RRDB_trunk.18.RDB1.conv1.bias", "RRDB_trunk.18.RDB1.conv2.weight", "RRDB_trunk.18.RDB1.conv2.bias", "RRDB_trunk.18.RDB1.conv3.weight", "RRDB_trunk.18.RDB1.conv3.bias", "RRDB_trunk.18.RDB1.conv4.weight", "RRDB_trunk.18.RDB1.conv4.bias", "RRDB_trunk.18.RDB1.conv5.weight", "RRDB_trunk.18.RDB1.conv5.bias", "RRDB_trunk.18.RDB2.conv1.weight", "RRDB_trunk.18.RDB2.conv1.bias", "RRDB_trunk.18.RDB2.conv2.weight", "RRDB_trunk.18.RDB2.conv2.bias", "RRDB_trunk.18.RDB2.conv3.weight", "RRDB_trunk.18.RDB2.conv3.bias", "RRDB_trunk.18.RDB2.conv4.weight", "RRDB_trunk.18.RDB2.conv4.bias", "RRDB_trunk.18.RDB2.conv5.weight", "RRDB_trunk.18.RDB2.conv5.bias", "RRDB_trunk.18.RDB3.conv1.weight", "RRDB_trunk.18.RDB3.conv1.bias", "RRDB_trunk.18.RDB3.conv2.weight", "RRDB_trunk.18.RDB3.conv2.bias", "RRDB_trunk.18.RDB3.conv3.weight", "RRDB_trunk.18.RDB3.conv3.bias", "RRDB_trunk.18.RDB3.conv4.weight", "RRDB_trunk.18.RDB3.conv4.bias", "RRDB_trunk.18.RDB3.conv5.weight", "RRDB_trunk.18.RDB3.conv5.bias", "RRDB_trunk.19.RDB1.conv1.weight", "RRDB_trunk.19.RDB1.conv1.bias", "RRDB_trunk.19.RDB1.conv2.weight", "RRDB_trunk.19.RDB1.conv2.bias", "RRDB_trunk.19.RDB1.conv3.weight", "RRDB_trunk.19.RDB1.conv3.bias", "RRDB_trunk.19.RDB1.conv4.weight", "RRDB_trunk.19.RDB1.conv4.bias", "RRDB_trunk.19.RDB1.conv5.weight", "RRDB_trunk.19.RDB1.conv5.bias", "RRDB_trunk.19.RDB2.conv1.weight", "RRDB_trunk.19.RDB2.conv1.bias", "RRDB_trunk.19.RDB2.conv2.weight", "RRDB_trunk.19.RDB2.conv2.bias", "RRDB_trunk.19.RDB2.conv3.weight", "RRDB_trunk.19.RDB2.conv3.bias", "RRDB_trunk.19.RDB2.conv4.weight", "RRDB_trunk.19.RDB2.conv4.bias", "RRDB_trunk.19.RDB2.conv5.weight", "RRDB_trunk.19.RDB2.conv5.bias", "RRDB_trunk.19.RDB3.conv1.weight", "RRDB_trunk.19.RDB3.conv1.bias", "RRDB_trunk.19.RDB3.conv2.weight", "RRDB_trunk.19.RDB3.conv2.bias", "RRDB_trunk.19.RDB3.conv3.weight", "RRDB_trunk.19.RDB3.conv3.bias", "RRDB_trunk.19.RDB3.conv4.weight", "RRDB_trunk.19.RDB3.conv4.bias", "RRDB_trunk.19.RDB3.conv5.weight", "RRDB_trunk.19.RDB3.conv5.bias", "RRDB_trunk.20.RDB1.conv1.weight", "RRDB_trunk.20.RDB1.conv1.bias", "RRDB_trunk.20.RDB1.conv2.weight", "RRDB_trunk.20.RDB1.conv2.bias", "RRDB_trunk.20.RDB1.conv3.weight", "RRDB_trunk.20.RDB1.conv3.bias", "RRDB_trunk.20.RDB1.conv4.weight", "RRDB_trunk.20.RDB1.conv4.bias", "RRDB_trunk.20.RDB1.conv5.weight", "RRDB_trunk.20.RDB1.conv5.bias", "RRDB_trunk.20.RDB2.conv1.weight", "RRDB_trunk.20.RDB2.conv1.bias", "RRDB_trunk.20.RDB2.conv2.weight", "RRDB_trunk.20.RDB2.conv2.bias", "RRDB_trunk.20.RDB2.conv3.weight", "RRDB_trunk.20.RDB2.conv3.bias", "RRDB_trunk.20.RDB2.conv4.weight", "RRDB_trunk.20.RDB2.conv4.bias", "RRDB_trunk.20.RDB2.conv5.weight", "RRDB_trunk.20.RDB2.conv5.bias", "RRDB_trunk.20.RDB3.conv1.weight", "RRDB_trunk.20.RDB3.conv1.bias", "RRDB_trunk.20.RDB3.conv2.weight", "RRDB_trunk.20.RDB3.conv2.bias", "RRDB_trunk.20.RDB3.conv3.weight", "RRDB_trunk.20.RDB3.conv3.bias", "RRDB_trunk.20.RDB3.conv4.weight", "RRDB_trunk.20.RDB3.conv4.bias", "RRDB_trunk.20.RDB3.conv5.weight", "RRDB_trunk.20.RDB3.conv5.bias", "RRDB_trunk.21.RDB1.conv1.weight", "RRDB_trunk.21.RDB1.conv1.bias", "RRDB_trunk.21.RDB1.conv2.weight", "RRDB_trunk.21.RDB1.conv2.bias", "RRDB_trunk.21.RDB1.conv3.weight", "RRDB_trunk.21.RDB1.conv3.bias", "RRDB_trunk.21.RDB1.conv4.weight", "RRDB_trunk.21.RDB1.conv4.bias", "RRDB_trunk.21.RDB1.conv5.weight", "RRDB_trunk.21.RDB1.conv5.bias", "RRDB_trunk.21.RDB2.conv1.weight", "RRDB_trunk.21.RDB2.conv1.bias", "RRDB_trunk.21.RDB2.conv2.weight", "RRDB_trunk.21.RDB2.conv2.bias", "RRDB_trunk.21.RDB2.conv3.weight", "RRDB_trunk.21.RDB2.conv3.bias", "RRDB_trunk.21.RDB2.conv4.weight", "RRDB_trunk.21.RDB2.conv4.bias", "RRDB_trunk.21.RDB2.conv5.weight", "RRDB_trunk.21.RDB2.conv5.bias", "RRDB_trunk.21.RDB3.conv1.weight", "RRDB_trunk.21.RDB3.conv1.bias", "RRDB_trunk.21.RDB3.conv2.weight", "RRDB_trunk.21.RDB3.conv2.bias", "RRDB_trunk.21.RDB3.conv3.weight", "RRDB_trunk.21.RDB3.conv3.bias", "RRDB_trunk.21.RDB3.conv4.weight", "RRDB_trunk.21.RDB3.conv4.bias", "RRDB_trunk.21.RDB3.conv5.weight", "RRDB_trunk.21.RDB3.conv5.bias", "RRDB_trunk.22.RDB1.conv1.weight", "RRDB_trunk.22.RDB1.conv1.bias", "RRDB_trunk.22.RDB1.conv2.weight", "RRDB_trunk.22.RDB1.conv2.bias", "RRDB_trunk.22.RDB1.conv3.weight", "RRDB_trunk.22.RDB1.conv3.bias", "RRDB_trunk.22.RDB1.conv4.weight", "RRDB_trunk.22.RDB1.conv4.bias", "RRDB_trunk.22.RDB1.conv5.weight", "RRDB_trunk.22.RDB1.conv5.bias", "RRDB_trunk.22.RDB2.conv1.weight", "RRDB_trunk.22.RDB2.conv1.bias", "RRDB_trunk.22.RDB2.conv2.weight", "RRDB_trunk.22.RDB2.conv2.bias", "RRDB_trunk.22.RDB2.conv3.weight", "RRDB_trunk.22.RDB2.conv3.bias", "RRDB_trunk.22.RDB2.conv4.weight", "RRDB_trunk.22.RDB2.conv4.bias", "RRDB_trunk.22.RDB2.conv5.weight", "RRDB_trunk.22.RDB2.conv5.bias", "RRDB_trunk.22.RDB3.conv1.weight", "RRDB_trunk.22.RDB3.conv1.bias", "RRDB_trunk.22.RDB3.conv2.weight", "RRDB_trunk.22.RDB3.conv2.bias", "RRDB_trunk.22.RDB3.conv3.weight", "RRDB_trunk.22.RDB3.conv3.bias", "RRDB_trunk.22.RDB3.conv4.weight", "RRDB_trunk.22.RDB3.conv4.bias", "RRDB_trunk.22.RDB3.conv5.weight", "RRDB_trunk.22.RDB3.conv5.bias", "trunk_conv.weight", "trunk_conv.bias", "upconv1.weight", "upconv1.bias", "upconv2.weight", "upconv2.bias", "HRconv.weight", "HRconv.bias", "conv_last.weight", "conv_last.bias".
        Unexpected key(s) in state_dict: "params".

File "test.py" from ESRGAN project:

import os.path as osp
import glob
import cv2
import numpy as np
import torch
import RRDBNet_arch as arch

model_path = 'models/net_g_18000.pth'  # models/RRDB_ESRGAN_x4.pth OR models/RRDB_PSNR_x4.pth
device = torch.device('cuda')  # if you want to run on CPU, change 'cuda' -> cpu
# device = torch.device('cpu')

test_img_folder = '/mnt/e/test/006/IN/*'

model = arch.RRDBNet(3, 3, 64, 23, gc=32)
model.load_state_dict(torch.load(model_path), strict=True)
model.eval()
model = model.to(device)

print('Model path {:s}. \nTesting...'.format(model_path))

idx = 0
for path in glob.glob(test_img_folder):
    idx += 1
    base = osp.splitext(osp.basename(path))[0]
    print(idx, base)
    # read images
    img = cv2.imread(path, cv2.IMREAD_COLOR)
    img = img * 1.0 / 255
    img = torch.from_numpy(np.transpose(img[:, :, [2, 1, 0]], (2, 0, 1))).float()
    img_LR = img.unsqueeze(0)
    img_LR = img_LR.to(device)

    with torch.no_grad():
        output = model(img_LR).data.squeeze().float().cpu().clamp_(0, 1).numpy()
    output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
    output = (output * 255.0).round()
    cv2.imwrite('/mnt/e/test/006/OUT/{:s}_rlt.png'.format(base), output)
wolfam0108 commented 4 years ago

I tried running transer_RRDB_models.py. But the result:

(base) vova@wolfram-pc:/tmp/ESRGAN$ python3 ./transer_RRDB_models.py
###################################

Traceback (most recent call last):
  File "./transer_RRDB_models.py", line 31, in <module>
    crt_net['conv_first.weight'] = pretrained_net['model.0.weight']
KeyError: 'model.0.weight'
ai-Ilike commented 3 years ago

BasicSR的“ESRGAN_PSNR_SRx4_DF2K_official-150ff491.pth”和这里的的RRDB_PSNR_x4.pth有什么不同呢???能否互相转换呢???