sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.42k stars 668 forks source link

Quick start error #5

Closed 0xprincess closed 6 years ago

0xprincess commented 6 years ago

When I run the demo I get an error: python main.py --model EDSR --scale 3 --save EDSR_baseline_x3 --reset --pre_train ../experiment/model/EDSR_baseline_x4.pt --test_only

Preparing binary packages... Loading ../../../dataset/DIV2K_decoded\DIV2K_train_HR\packv.pt Traceback (most recent call last): File "main.py", line 12, in my_loader = data(args).get_loader() File "D:\Projects\SR\EDSR-PyTorch-master\code\data__init__.py", line 25, in get_loader self.args, train=False) File "D:\Projects\SR\EDSR-PyTorch-master\code\data\DIV2K.py", line 32, in init self.pack_tar = torch.load(name_tar) File "C:\Program Files\Anaconda3\lib\site-packages\torch\serialization.py", line 259, in load f = open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '../../../dataset/DIV2K_decoded\DIV2K_train_HR\packv.pt'

Do I really need this file for just running a demo?

OS: Win10 Also, your link to DIV2K dataset is unavaliable. Can you update it, please?

sanghyun-son commented 6 years ago

I have some comments.

First, you are testing EDSR_x3 using pre-trained EDSR_x4.

If you run above script, upsampling layers of EDSR_x4 will be replaced to new layers, that are suitable for scale 3 super-resolution.

Although you can test x3 super-resolution without any additional training, results will be very bad.

Second, you should prepare DIV2K because --test_only configuration will load validation pairs from the dataset.

Use [--ext png] argument if you cannot, or do not want to prepare pack.pt files.

Also, I checked the link to the dataset is not broken.

However, if you have troubles getting DIV2K, please notice me.

If you want to test with your own image, please refer to README and demo.sh.

Thank you.

Sanghyun

0xprincess commented 6 years ago

Thank you for your answer! Recently I modified some code to make it work on windows, also I prepared my own dataset so that it looks like DIV2K by its structure, and packed it with png2binary tool. In my dataset all HR images have size from 2k to 4k resolution and now I trying to train baseline x4 model from scratch (with batch size 1, because all images have differen size). But after first epoch, at the test stage, pytorch fails with cuda out of memory error. I have gtx 1060 with 6G of memory, so I was surprised, that the baseline model is failing. So, my question is: What hardware did you use for training your models? What part of the model can allocate so much memory?

sanghyun-son commented 6 years ago

Actually, 2K input images are quite challenging in recent CNNs.

An input 2K image will consume ~1GB GPU memory for each Conv in the baseline model, because the size of feature map is very large.

You can think that memory consumption is proportional to (input image size)^2

I use 12GB GPU memory, but I cannot guarantee that your configuration works on my device.

Currently, I am preparing some codes for evaluating very large images.

The function chop_forward in utils.py is that one, and it is almost done.

I will complete it quickly so that you can evaluate 2K images.

Thank you!

Sanghyun.

0xprincess commented 6 years ago

Thank you very much! Please, let me know, when this function will be completed!

suke27 commented 6 years ago

Hi, I am interesting for memory problem, based on network analysis, the top memory should be upsampler layer, it has 64 input channel 576 out channels. if input image is 700x500, the feature map size is 700x500x3x4x576, it is about 2300M, but when I test it in my side using CPU mode, it will reach 7G memory, even add input feature maps, 7G is too much, any one know well about this problem? is it related to pytorch?

sanghyun-son commented 6 years ago

The memory-efficient forward function is implemented.

Please check it out, and let me know if there is any bug.