Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only Test in SRGAN #18

Closed
yxldd opened this issue Nov 7, 2023 · 5 comments
Closed

Only Test in SRGAN #18

yxldd opened this issue Nov 7, 2023 · 5 comments

Comments

@yxldd
Copy link

yxldd commented Nov 7, 2023

Because of the limitation of computing resources, I want to just use the pre-trained model and test on my privative datasheet, but I put the model in the ./experiment and modify the test_DiffIRS2_GAN_x4.yml, but when I run test.sh, it said
"Traceback (most recent call last):
File "D:\DL_ws\DiffIR-SRGAN\test.py", line 15, in
test_pipeline(root_path)
File "E:\Develop\Anaconda\envs\dl_envs\Lib\site-packages\basicsr\test.py", line 40, in test_pipeline
model.validation(test_loader, current_iter=opt['name'], tb_logger=None, save_img=opt['val']['save_img'])
File "E:\Develop\Anaconda\envs\dl_envs\Lib\site-packages\basicsr\models\base_model.py", line 48, in validation
self.nondist_validation(dataloader, current_iter, tb_logger, save_img)
File "D:\DL_ws\DiffIR-SRGAN\DiffIR\models\DiffIR_GAN_S2_model.py", line 74, in nondist_validation
super(DiffIRGANS2Model, self).nondist_validation(dataloader, current_iter, tb_logger, save_img)
File "E:\Develop\Anaconda\envs\dl_envs\Lib\site-packages\basicsr\models\sr_model.py", line 156, in nondist_validation
self.feed_data(val_data)
File "E:\Develop\Anaconda\envs\dl_envs\Lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\DL_ws\DiffIR-SRGAN\DiffIR\models\DiffIR_GAN_S2_model.py", line 65, in feed_data
self.gt = data['gt'].to(self.device)
~~~~^^^^^^
KeyError: 'gt'
"
But isn't it just use SingleImageDataset and just use LQ as the only input? How can I input ST properly?
Looking forward to reply.

@Zj-BinXia
Copy link
Owner

I add a inference_diffir.py under SRGAN folder. You can use it to inference diffir-srgan without GT.

@yxldd
Copy link
Author

yxldd commented Nov 9, 2023

I add a inference_diffir.py under SRGAN folder. You can use it to inference diffir-srgan without GT.

Thanks a lot!

@yxldd yxldd closed this as completed Nov 9, 2023
@tzayuan
Copy link

tzayuan commented Nov 16, 2023

Hi, @Zj-BinXia
I follow your comment and run python inference_diffir.py, the pretrained model is official link provided in SISR, but I got the follow traceback:

Traceback (most recent call last):
  File "inference_diffir.py", line 45, in <module>
    loadnet = torch.load(args.model_path, map_location=torch.device('cpu'))
  File "/root/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 600, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "/root/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 242, in __init__
    super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Looking forward to reply.

BRs
zeyuan

@Zj-BinXia
Copy link
Owner

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

You file is not downloaded completely, You should download the model again

@tzayuan
Copy link

tzayuan commented Nov 17, 2023

@Zj-BinXia , Problem solved, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants