SeungjunNah/DeepDeblur-PyTorch

how can I use pretrained model

choiyoungwook opened this issue · 5 comments

이 부분은 한국어로 작성하도록 하겠습니다. pretrain model을 사용하여 단일 이미지에 대한 deblur 결과값을 얻고싶은데 test할 이미지를 어떤식으로 넣어주어야하는지 알려주실 수 있으실까요?

I will answer in English so that others could also understand.

Basically, you can follow demo in README.

First, put the images to be deblurred in a folder.
For example, ~/blur_imgs
All the images under the directory will be deblurred by recursive search.

Second, download a trained model by extracting a zip file under DeepDeblur-Pytorch/experiment
It should look like:
DeepDeblur-Pytorch/experiment/GOPRO_L1/models/model-1000.pt, DeepDeblur-Pytorch/experiment/REDS_L1/models/model-200.pt

Then you can run a deblurring model as follows:

python main.py --save_dir GOPRO_L1 --demo true --demo_input_dir blur_imgs
# OR
python main.py --save_dir REDS_L1 --demo true --demo_input_dir blur_imgs

Traceback (most recent call last):
File "main.py", line 67, in
main()
File "main.py", line 64, in main
main_worker(args.rank, args)
File "main.py", line 29, in main_worker
trainer.evaluate(epoch=args.start_epoch, mode='demo')
File "/home/ubuntu/PycharmProjects/choi/yyyy/DeepDeblur-PyTorch/src/train.py", line 181, in evaluate
tq.set_description(self.criterion.get_loss_desc())
File "/home/ubuntu/PycharmProjects/choi/yyyy/DeepDeblur-PyTorch/src/loss/init.py", line 313, in get_loss_desc
loss = self.loss_stat[self.mode]['Total'][self.epoch]
KeyError: 1001

DeepDeblur-PyTorch/src/blur_imgs에 이미지를 넣었고 KeyError: 1001 결과를 얻었습니다.
도와주신다면 정말 감사드리겠습니다.

It seems like your demo_input_dir format was not correct.
You may want to refer to issue #9.

Try using an absolute path or relative path to your home directory for now.
This is due to the input path modification.
https://github.com/SeungjunNah/DeepDeblur-PyTorch/blob/master/src/option.py#L214

There are exceptions that reject some conventional relative path format.
I might need to change this path condition...

Now the updated code will follow the default ubuntu path convention.

thank you!!!!!!!!!!