hellloxiaotian / ESRGCNN

Image Super-resolution with An Enhanced Group Convolutional Neural Network (Neural Networks, 2022)
https://github.com/hellloxiaotian/ESRGCNN
60 stars 5 forks source link

能否提供单张图片推理的最小demo? #3

Open Baiyuetribe opened 2 years ago

Baiyuetribe commented 2 years ago

已提供的都跑不起来

PS C:\Users\baiyue\Desktop\ESRGCNN-main> python a.py --model esrgcnn --test_data_dir dataset/Urban100 --scale 2 --ckpt_path checkpoint/esrgcnn.pth --sample_dir samples_singlemodel_urban100_x2
{
    "ckpt_path": "checkpoint/esrgcnn.pth",
    "cuda": false,
    "group": 1,
    "model": "esrgcnn",
    "sample_dir": "samples_singlemodel_urban100_x2",
    "scale": 2,
    "shave": 20,
    "test_data_dir": "dataset/Urban100"
}
Traceback (most recent call last):
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\a.py", line 297, in <module>
    main(cfg)
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\a.py", line 284, in main
    net.load_state_dict(new_state_dict)
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Net:
        Unexpected key(s) in state_dict: "upsample.up2.body.0.weight", "upsample.up2.body.0.bias", "upsample.up3.body.0.weight", "upsample.up3.body.0.bias", "upsample.up4.body.0.weight", "upsample.up4.body.0.bias", "upsample.up4.body.2.weight", "upsample.up4.body.2.bias". 
hellloxiaotian commented 2 years ago

We have updated our code, please download our code again. Then use (python tcw_sample_b.py --model esrgcnn --test_data_dir dataset/Set5 --scale 2 --ckpt_path checkpoint/esrgcnn.pth --sampledir samples singlemodel_urban100_x2) for testing.

Baiyuetribe commented 2 years ago

还是报错

PS C:\Users\baiyue\Desktop\ESRGCNN-main> python tcw_sample_b.py --model esrgcnn --test_data_dir dataset/Set5 --scale 2 --ckpt_path checkpoint/esrgcnn.pth --sample_dir samples_singlemodel_urban100_x2 
{
    "ckpt_path": "checkpoint/esrgcnn.pth",
    "cuda": false,
    "group": 1,
    "model": "esrgcnn",
    "sample_dir": "samples_singlemodel_urban100_x2",
    "scale": 2,
    "shave": 20,
    "test_data_dir": "dataset/Set5"
}
Traceback (most recent call last):
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\tcw_sample_b.py", line 296, in <module>
    main(cfg)
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\tcw_sample_b.py", line 291, in main
    sample(net, device, dataset, cfg)
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\tcw_sample_b.py", line 167, in sample
    sr = net(lr, cfg.scale).detach().squeeze(0)  # detach() break the reversed transformation.
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\model\esrgcnn.py", line 113, in forward
    b1 = self.b1(x1)
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\baiyue\Desktop\ESRGCNN-main\model\esrgcnn.py", line 53, in forward
    out1_r = self.ReLU(remain1)
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\activation.py", line 98, in forward
    return F.relu(input, inplace=self.inplace)
  File "C:\Users\baiyue\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\functional.py", line 1440, in relu
    result = torch.relu_(input)
RuntimeError: Output 1 of SplitWithSizesBackward0 is a view and is being modified inplace. This view is the output of a function that returns multiple views. Such functions do not allow the output views to be modified inplace. You should replace the inplace operation by an out-of-place one.

就不能简简单单处理一下单张图片的放大demo吗?建议简化下运行demo

hellloxiaotian commented 2 years ago

请检查一下你的环境是否和我们的环境相同。此外,建议使用Ubuntu系统。

                                                                                                                                                                            田春伟
                                                                                                                                                                            西北工业大学
Baiyuetribe commented 2 years ago

环境问题,放弃了!能否发布下onnx或torchscript格式的预训练模型文件?另外这个与常见的超分辨都无关联,请问效果比realSR或RealESRGAN强吗?如果不强可以放弃折腾了

hellloxiaotian commented 2 years ago

你好:

我们没有用预训练模型,是直接训练得到模型的。这个模型已和主流的超分辨方法进行比较了,具体的实验结果请看论文!

祝好! 田春伟副教授 西北工业大学

在 2022-06-15 16:59:25,"佰阅" @.***> 写道:

环境问题,放弃了!能否发布下onnx或torchscript格式的预训练模型文件?另外这个与常见的超分辨都无关联,请问效果比realSR或RealESRGAN强吗?如果不强可以放弃折腾了

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Baiyuetribe commented 2 years ago

讨论陷入了误区。我期望的是将现有的模型转换为onnx或torchscipt,这样就可以尝试转换为ncnn,开发出真正全平台普及的应用。之前我已开发过多个GUI系列,希望能将该文献转换为实际APP。也许您可以看下我这个Paper2GUI。假如您觉得ESRGCNN超分效果不错,可以尝试转换一下,否则该方法可能就一直停在文献层面了。

hellloxiaotian commented 1 year ago

你好: 我们准备没有用预训练模型,是直接训练得到模型。这个模型已和主流的超分辨方法进行比较了,实验结果请看论文!

祝好! 田春伟副教授 西北工业大学

在 2022-06-15 16:59:25,"佰阅" @.***> 写道:

环境问题,放弃了!能否发布下onnx或torchscript格式的预训练模型文件?另外这个与常见的超分辨都无关联,请问效果比realSR或RealESRGAN强吗?如果不强可以放弃折腾了

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>