PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

Overview

About PyTorch 1.2.0

  • Now the master branch supports PyTorch 1.2.0 by default.
  • Due to the serious version problem (especially torch.utils.data.dataloader), MDSR functions are temporarily disabled. If you have to train/evaluate the MDSR model, please use legacy branches.

EDSR-PyTorch

About PyTorch 1.1.0

  • There have been minor changes with the 1.1.0 update. Now we support PyTorch 1.1.0 by default, and please use the legacy branch if you prefer older version.

This repository is an official PyTorch implementation of the paper "Enhanced Deep Residual Networks for Single Image Super-Resolution" from CVPRW 2017, 2nd NTIRE. You can find the original code and more information from here.

If you find our work useful in your research or publication, please cite our work:

[1] Bee Lim, Sanghyun Son, Heewon Kim, Seungjun Nah, and Kyoung Mu Lee, "Enhanced Deep Residual Networks for Single Image Super-Resolution," 2nd NTIRE: New Trends in Image Restoration and Enhancement workshop and challenge on image super-resolution in conjunction with CVPR 2017. [PDF] [arXiv] [Slide]

@InProceedings{Lim_2017_CVPR_Workshops,
  author = {Lim, Bee and Son, Sanghyun and Kim, Heewon and Nah, Seungjun and Lee, Kyoung Mu},
  title = {Enhanced Deep Residual Networks for Single Image Super-Resolution},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
  month = {July},
  year = {2017}
}

We provide scripts for reproducing all the results from our paper. You can train your model from scratch, or use a pre-trained model to enlarge your images.

Differences between Torch version

  • Codes are much more compact. (Removed all unnecessary parts.)
  • Models are smaller. (About half.)
  • Slightly better performances.
  • Training and evaluation requires less memory.
  • Python-based.

Dependencies

  • Python 3.6
  • PyTorch >= 1.0.0
  • numpy
  • skimage
  • imageio
  • matplotlib
  • tqdm
  • cv2 >= 3.xx (Only if you want to use video input/output)

Code

Clone this repository into any place you want.

git clone https://github.com/thstkdgus35/EDSR-PyTorch
cd EDSR-PyTorch

Quickstart (Demo)

You can test our super-resolution algorithm with your images. Place your images in test folder. (like test/<your_image>) We support png and jpeg files.

Run the script in src folder. Before you run the demo, please uncomment the appropriate line in demo.sh that you want to execute.

cd src       # You are now in */EDSR-PyTorch/src
sh demo.sh

You can find the result images from experiment/test/results folder.

Model Scale File name (.pt) Parameters **PSNR
EDSR 2 EDSR_baseline_x2 1.37 M 34.61 dB
*EDSR_x2 40.7 M 35.03 dB
3 EDSR_baseline_x3 1.55 M 30.92 dB
*EDSR_x3 43.7 M 31.26 dB
4 EDSR_baseline_x4 1.52 M 28.95 dB
*EDSR_x4 43.1 M 29.25 dB
MDSR 2 MDSR_baseline 3.23 M 34.63 dB
*MDSR 7.95 M 34.92 dB
3 MDSR_baseline 30.94 dB
*MDSR 31.22 dB
4 MDSR_baseline 28.97 dB
*MDSR 29.24 dB

*Baseline models are in experiment/model. Please download our final models from here (542MB) **We measured PSNR using DIV2K 0801 ~ 0900, RGB channels, without self-ensemble. (scale + 2) pixels from the image boundary are ignored.

You can evaluate your models with widely-used benchmark datasets:

Set5 - Bevilacqua et al. BMVC 2012,

Set14 - Zeyde et al. LNCS 2010,

B100 - Martin et al. ICCV 2001,

Urban100 - Huang et al. CVPR 2015.

For these datasets, we first convert the result images to YCbCr color space and evaluate PSNR on the Y channel only. You can download benchmark datasets (250MB). Set --dir_data <where_benchmark_folder_located> to evaluate the EDSR and MDSR with the benchmarks.

You can download some results from here. The link contains EDSR+_baseline_x4 and EDSR+_x4. Otherwise, you can easily generate result images with demo.sh scripts.

How to train EDSR and MDSR

We used DIV2K dataset to train our model. Please download it from here (7.1GB).

Unpack the tar file to any place you want. Then, change the dir_data argument in src/option.py to the place where DIV2K images are located.

We recommend you to pre-process the images before training. This step will decode all png files and save them as binaries. Use --ext sep_reset argument on your first run. You can skip the decoding part and use saved binaries with --ext sep argument.

If you have enough RAM (>= 32GB), you can use --ext bin argument to pack all DIV2K images in one binary file.

You can train EDSR and MDSR by yourself. All scripts are provided in the src/demo.sh. Note that EDSR (x3, x4) requires pre-trained EDSR (x2). You can ignore this constraint by removing --pre_train <x2 model> argument.

cd src       # You are now in */EDSR-PyTorch/src
sh demo.sh

Update log

  • Jan 04, 2018

    • Many parts are re-written. You cannot use previous scripts and models directly.
    • Pre-trained MDSR is temporarily disabled.
    • Training details are included.
  • Jan 09, 2018

    • Missing files are included (src/data/MyImage.py).
    • Some links are fixed.
  • Jan 16, 2018

    • Memory efficient forward function is implemented.
    • Add --chop_forward argument to your script to enable it.
    • Basically, this function first split a large image to small patches. Those images are merged after super-resolution. I checked this function with 12GB memory, 4000 x 2000 input image in scale 4. (Therefore, the output will be 16000 x 8000.)
  • Feb 21, 2018

    • Fixed the problem when loading pre-trained multi-GPU model.
    • Added pre-trained scale 2 baseline model.
    • This code now only saves the best-performing model by default. For MDSR, 'the best' can be ambiguous. Use --save_models argument to keep all the intermediate models.
    • PyTorch 0.3.1 changed their implementation of DataLoader function. Therefore, I also changed my implementation of MSDataLoader. You can find it on feature/dataloader branch.
  • Feb 23, 2018

    • Now PyTorch 0.3.1 is a default. Use legacy/0.3.0 branch if you use the old version.

    • With a new src/data/DIV2K.py code, one can easily create new data class for super-resolution.

    • New binary data pack. (Please remove the DIV2K_decoded folder from your dataset if you have.)

    • With --ext bin, this code will automatically generate and saves the binary data pack that corresponds to previous DIV2K_decoded. (This requires huge RAM (~45GB, Swap can be used.), so please be careful.)

    • If you cannot make the binary pack, use the default setting (--ext img).

    • Fixed a bug that PSNR in the log and PSNR calculated from the saved images does not match.

    • Now saved images have better quality! (PSNR is ~0.1dB higher than the original code.)

    • Added performance comparison between Torch7 model and PyTorch models.

  • Mar 5, 2018

    • All baseline models are uploaded.
    • Now supports half-precision at test time. Use --precision half to enable it. This does not degrade the output images.
  • Mar 11, 2018

    • Fixed some typos in the code and script.
    • Now --ext img is default setting. Although we recommend you to use --ext bin when training, please use --ext img when you use --test_only.
    • Skip_batch operation is implemented. Use --skip_threshold argument to skip the batch that you want to ignore. Although this function is not exactly the same with that of Torch7 version, it will work as you expected.
  • Mar 20, 2018

    • Use --ext sep-reset to pre-decode large png files. Those decoded files will be saved to the same directory with DIV2K png files. After the first run, you can use --ext sep to save time.
    • Now supports various benchmark datasets. For example, try --data_test Set5 to test your model on the Set5 images.
    • Changed the behavior of skip_batch.
  • Mar 29, 2018

    • We now provide all models from our paper.
    • We also provide MDSR_baseline_jpeg model that suppresses JPEG artifacts in the original low-resolution image. Please use it if you have any trouble.
    • MyImage dataset is changed to Demo dataset. Also, it works more efficient than before.
    • Some codes and script are re-written.
  • Apr 9, 2018

    • VGG and Adversarial loss is implemented based on SRGAN. WGAN and gradient penalty are also implemented, but they are not tested yet.
    • Many codes are refactored. If there exists a bug, please report it.
    • D-DBPN is implemented. The default setting is D-DBPN-L.
  • Apr 26, 2018

    • Compatible with PyTorch 0.4.0
    • Please use the legacy/0.3.1 branch if you are using the old version of PyTorch.
    • Minor bug fixes
  • July 22, 2018

    • Thanks for recent commits that contains RDN and RCAN. Please see code/demo.sh to train/test those models.
    • Now the dataloader is much stable than the previous version. Please erase DIV2K/bin folder that is created before this commit. Also, please avoid using --ext bin argument. Our code will automatically pre-decode png images before training. If you do not have enough spaces(~10GB) in your disk, we recommend --ext img(But SLOW!).
  • Oct 18, 2018

    • with --pre_train download, pretrained models will be automatically downloaded from the server.
    • Supports video input/output (inference only). Try with --data_test video --dir_demo [video file directory].
  • About PyTorch 1.0.0

    • We support PyTorch 1.0.0. If you prefer the previous versions of PyTorch, use legacy branches.
    • --ext bin is not supported. Also, please erase your bin files with --ext sep-reset. Once you successfully build those bin files, you can remove -reset from the argument.
Comments
  • ValueError: num_samples should be a positive integer value, but got num_samples=0

    ValueError: num_samples should be a positive integer value, but got num_samples=0

    RUNDIR: runs\seg_pascal\1980 Traceback (most recent call last): File "train.py", line 226, in <module> train(cfg, writer, logger) File "train.py", line 61, in train t_loader, batch_size=cfg["training"]["batch_size"], num_workers=cfg["training"]["n_workers"], shuffle=True File "C:\Users\yp\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 176, in __init__ sampler = RandomSampler(dataset) File "C:\Users\yp\Anaconda3\lib\site-packages\torch\utils\data\sampler.py", line 66, in __init__ "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0 How can I solve this problem?Thank you!

    opened by SonwYang 16
  • Error during learning

    Error during learning

    I was trying to learn using my own data set, but when executing the code the following There was an error.

    Traceback (most recent call last): File "main.py", line 4, in import data File "D:\EDSR-PyTorch-master\src\data_init_.py", line 2, in from dataloader import MSDataLoader File "D:\EDSR-PyTorch-master\src\dataloader.py", line 17, in from torch.utils.data.dataloader import _worker_manager_loop ImportError: cannot import name '_worker_manager_loop'

    I was allowed to learn according to read me, but it will not work. What should I do now

    opened by kikiki1121 15
  • How to train EDSR_baseline_x4 with WGAN-GP?

    How to train EDSR_baseline_x4 with WGAN-GP?

    Hi, I'm trying to train EDSR_baseline_x4 with WGAN-GP, but I don't know how to do it. I want to ask the following questions:

    1. In the discriminator, should batch normalization be removed? (I see that batch normalization has not been removed in your code )

    2. How to set (beta1, beta2, learning rate) of Adam for optimizing discriminator and generator?

    3. How to set the k value for adversarial loss? (I see that the default value of gan_k is 1 in your code )

    4. How to set the weights of VGG54 and generator loss?

    Can you give me some advice?

    Thank you!

    opened by gentleboy 11
  • Patch Modification

    Patch Modification

    Hi,

    I am interested in modifying the patch implementation here. I have a csv file that records all box location for my training images. And I only want these boxes to be the patch for training. I have found that I need to add an argument in option.py for my csv file and modify get_patch in common.pyto return the box coordinates. In addition, insrdata.py, I need to add another attribute for my csv file, also modifyget_patchto add one more parameter to callget_patchfromcommon.py`. What did I miss here? I wonder how you implemented the number of patches for each image, since the number of boxes for each image may be different.

    Thanks for your help !!

    opened by JadenLy 10
  • EDSR out of memory at test time

    EDSR out of memory at test time

    I get out of memory error (in 12GB GPU RAM) when running final model of EDSR.

    THCudaCheck FAIL file=/home/sibt/pytorch/aten/src/THC/generic/THCStorage.cu line=58 error=2 : out of memory
    Traceback (most recent call last):
      File "main.py", line 14, in <module>
        while not t.terminate():
      File "/home/sibt/muneeb/_superResolution/code/trainer.py", line 164, in terminate
        self.test()
      File "/home/sibt/muneeb/_superResolution/code/trainer.py", line 98, in test
        output = _test_forward(input, scale)
      File "/home/sibt/muneeb/_superResolution/code/trainer.py", line 87, in _test_forward
        self.args.chop_shave, self.args.chop_size)
      File "/home/sibt/muneeb/_superResolution/code/utils.py", line 240, in chop_forward
        output_batch = model(input_batch)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in __call__
        result = self.forward(*input, **kwargs)
      File "/home/sibt/muneeb/_superResolution/code/model/EDSR.py", line 49, in forward
        x = self.tail(res)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in __call__
        result = self.forward(*input, **kwargs)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/container.py", line 89, in forward
        input = module(input)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in __call__
        result = self.forward(*input, **kwargs)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/container.py", line 89, in forward
        input = module(input)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 357, in __call__
        result = self.forward(*input, **kwargs)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/modules/pixelshuffle.py", line 40, in forward
        return F.pixel_shuffle(input, self.upscale_factor)
      File "/datadrive/anaconda2/lib/python2.7/site-packages/torch/nn/functional.py", line 1688, in pixel_shuffle
        shuffle_out = input_view.permute(0, 1, 4, 2, 5, 3).contiguous()
    RuntimeError: cuda runtime error (2) : out of memory at /home/sibt/pytorch/aten/src/THC/generic/THCStorage.cu:58
    

    Python command is attached below for your reference

    python main.py --dir_data /datadrive --scale 4 --n_train 790 --n_val 10 --offset_val 790 --print_model --model EDSR --n_feats 256 --n_resblocks 32 --patch_size 96 --chop_forward --test_only
    
    opened by muneebaadil 9
  • It seems that there are some problems with --chop argument

    It seems that there are some problems with --chop argument

    Referenced #128 #138

    It seems that there are some problems with --chop argument, here are the instructions to reproduce the problem.

    I set the DIV2K test data_range to 801-802 and used the orginal model EDSR_x2.pt.

    python main.py --model edsr --scale 2 --save test --data_train DIV2K --dir_data . --save_results --epoch 2 --data_range 1-800/801-802 --data_test DIV2K --batch_size 16 --chop --patch_size 96 --test_only --pre_train D:\EDSR-PyTorch-master\models\downloaed_models\EDSR_x2.pt

    Then an runtimerrror occurs:

    It Expected 4-dimensional input for 4-dimensional weight 3 3 1, but got 3-dimensional input of size [1, 184, 270] instead.

    Traceback (most recent call last): File "D:/EDSR-PyTorch-master/src/main.py", line 35, in <module> main() File "D:/EDSR-PyTorch-master/src/main.py", line 28, in main while not t.terminate(): File "D:\EDSR-PyTorch-master\src\trainer.py", line 160, in terminate self.test() File "D:\EDSR-PyTorch-master\src\trainer.py", line 109, in test sr = self.model(lr, idx_scale) File "D:\Anaconda3\envs\python3.6SRDenseNet\lib\site-packages\torch\nn\modules\module.py", line 493, in __call__ result = self.forward(*input, **kwargs) File "D:\EDSR-PyTorch-master\src\model\__init__.py", line 57, in forward return forward_function(x) File "D:\EDSR-PyTorch-master\src\model\__init__.py", line 135, in forward_chop y = self.forward_chop(*p, shave=shave, min_size=min_size) File "D:\EDSR-PyTorch-master\src\model\__init__.py", line 126, in forward_chop y = P.data_parallel(self.model, *x, range(n_GPUs)) File "D:\Anaconda3\envs\python3.6SRDenseNet\lib\site-packages\torch\nn\parallel\data_parallel.py", line 204, in data_parallel return module(*inputs[0], **module_kwargs[0]) File "D:\Anaconda3\envs\python3.6SRDenseNet\lib\site-packages\torch\nn\modules\module.py", line 493, in __call__ result = self.forward(*input, **kwargs) File "D:\EDSR-PyTorch-master\src\model\edsr.py", line 56, in forward x = self.sub_mean(x) File "D:\Anaconda3\envs\python3.6SRDenseNet\lib\site-packages\torch\nn\modules\module.py", line 493, in __call__ result = self.forward(*input, **kwargs) File "D:\Anaconda3\envs\python3.6SRDenseNet\lib\site-packages\torch\nn\modules\conv.py", line 338, in forward self.padding, self.dilation, self.groups) RuntimeError: Expected 4-dimensional input for 4-dimensional weight 3 3 1, but got 3-dimensional input of size [1, 184, 270] instead

    Then I tried to determine the color space of DIV2K's 801-802 pictures using matlab, and find that it has 3 color channels (RGB) as excepted.

    I removed the --chop argument and rerun, it seems OK this time, however CUDA out of memory.

    In conclusion, it seems there are some problems with --chop argument when testing with DIV2K 801-900 images, guessing out of size?

    Hope somebody else can reproduce this issue and figure it out.

    opened by m732367606 7
  • Why test results of images in jpg format is very worse than images in png format ?

    Why test results of images in jpg format is very worse than images in png format ?

    Hi, thanks for you sharing.

    when I test the DIV2K validation dataset, the result is very good. But when I test the B100 dataset, the result is very bad and the value of psnr is 25.571 in scale 4. Both pre-trained model of the two tests are EDSR_baseline_x4.pt.

    The images in B100 dataset are jpg format and I get low resolution jpg images by bicubic downsampling.Then I used these jpg images to participate in the test. Howeve, the reconstruct result is bad and psnr is very low.

    Could you tell me how do you test on benchmark dataset such as B100? Thank you very much!

    opened by YongboLiang 7
  • I want to train the custom data set.

    I want to train the custom data set.

    https://github.com/thstkdgus35/EDSR-PyTorch/issues/51#issuecomment-409424414

    Follow the above method, create custom.py, and create dataset/CUSTOM/ folders.

    However, in the process of importing data, the following errors were encountered:

    ValueError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

    So, after checking the print, we found that there was a part that was zeroed, such as HR size = (192, 0, 3) during dataset loading. Do you know how to solve it?

    opened by DaehanKim-Korea 6
  • [Question] Why dump .png into binary for preprocessing?

    [Question] Why dump .png into binary for preprocessing?

    Dear Author(s)

    Thanks for sharing your codebase. Here I have got a question about pre processing: I see many binary ".pt" files are generated, what is the purpose of this operation?

    opened by Lyken17 6
  • Got error when running on Windows 10.

    Got error when running on Windows 10.

    Hi, I got some error when I ran the test process on Windows 10 system with python 3.6.5 + pytorch 0.4.1 + cuda9.2. I'm using this line of the demo file: python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results --n_threads 0

    The error message is:

    Making model... Download the model

    Evaluation: Traceback (most recent call last): File "main.py", line 23, in while not t.terminate(): File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate self.test() File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 83, in test if self.args.save_results: self.ckp.begin_background() File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background for p in self.process: p.start() File "C:\Users\Zz\Anaconda3\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target'

    (C:\Users\Zz\Anaconda3) D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src>Making model... Download the model

    Evaluation: Traceback (most recent call last): File "", line 1, in File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="mp_main") File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\main.py", line 23, in while not t.terminate(): File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate self.test() File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 83, in test if self.args.save_results: self.ckp.begin_background() File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background for p in self.process: p.start() File "C:\Users\Zz\Anaconda3\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:
    
            if __name__ == '__main__':
                freeze_support()
                ...
    
        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
    

    Please give some suggestion to help me deal with it. Thanks.

    opened by zzsmg 6
  • Got suspicious insufficient shared memory issue when Evaluation

    Got suspicious insufficient shared memory issue when Evaluation

    Dear author, I'm trying to train a EDSR_X2 model using DIV2K 1-80 images on Nvidia Tesla P100 GPU which has 16G memory. I used this command: python main.py --model EDSR --scale 2 --save EDSR_x2 --n_resblocks 32 --n_feats 256 --res_scale 0.1 --reset But get below error when evaluating after epoch 1: Making model... Preparing loss function: 1.000 * L1 [Epoch 1] Learning rate: 1.00e-4 [800/8000] [L1: 9.6905] 166.2+4.7s [1600/8000] [L1: 7.7327] 166.2+4.6s [2400/8000] [L1: 6.9817] 166.2+4.6s [3200/8000] [L1: 6.5375] 166.2+4.6s [4000/8000] [L1: 6.2981] 166.2+4.6s [4800/8000] [L1: 6.1586] 166.2+4.6s [5600/8000] [L1: 6.0399] 166.2+4.6s [6400/8000] [L1: 5.9229] 166.2+4.6s [7200/8000] [L1: 5.8188] 166.2+4.6s [8000/8000] [L1: 5.7089] 166.2+4.6s

    Evaluation: 0%| | 0/10 [00:00<?, ?it/s]ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). Traceback (most recent call last): File "main.py", line 20, in t.test() File "/notebooks/ai/EDSR-PyTorch-master/src/trainer.py", line 88, in test for idx_img, (lr, hr, filename, _) in enumerate(tqdm_test): File "/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py", line 979, in iter for obj in iterable: File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 330, in next idx, batch = self._get_batch() File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 309, in _get_batch return self.data_queue.get() File "/usr/lib/python3.6/queue.py", line 164, in get self.not_empty.wait() File "/usr/lib/python3.6/threading.py", line 295, in wait waiter.acquire() File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 227, in handler _error_if_any_worker_fails() RuntimeError: DataLoader worker (pid 6915) is killed by signal: Bus error. Details are lost due to multiprocessing. Rerunning with num_workers=0 may give better error trace. Could you please give some advises? Thanks.

    opened by elvis1423 6
  • PSNR is nan when test DIV2K data

    PSNR is nan when test DIV2K data

    I hava prepared the DIV2K dataset in '/home/zency/桌面/dataset',And I have set the parser.add_argument('--dir_data', type=str, default='/home/zency/桌面/dataset', help='dataset directory')

    After Then I run the Demo.sh python main.py --data_test DIV2K --data_range 801-900 --scale 4 --pre_train "../models/edsr_baseline_x4-6b446fab.pt" --test_only --self_ensemble The result is : `Making model... Load the model from ../models/edsr_baseline_x4-6b446fab.pt

    Evaluation: 0it [00:00, ?it/s] [DIV2K x4] PSNR: nan (Best: nan @epoch 1) Forward: 0.07s

    Saving... Total: 0.07s ` What is Wrong with me ? @sanghyun-son

    opened by Zency-Sun 0
  • IndentationError: unindent does not match any outer indentation level

    IndentationError: unindent does not match any outer indentation level

    Hello. I want to give some PNG images as input to EDSR model, at first I was faced with the error below: RuntimeError: Given groups=1, weight of size [3, 3, 1, 1], expected input[1, 4, 268, 300] to have 3 channels, but got 4 channels instead. and it was solved with the help of guide lr = lr[:, :3, :, :] after that I faced another error as below: RuntimeError: The size of tensor a (1070) must match the size of tensor b (698) at non-singleton dimension 3. and applied guide [issuecomment](Bug in testing Set5 X3 with args.chop=True · Issue #223 · sanghyun-son/EDSR-PyTorch · GitHub).

    I used this advice and replaced the code that put in this page with def forward_chop in the EDSR-PyTorch-master/src/model/__init__.py file. But I encountered a new error as below and i don't know how to fix it: IndentationError: unindent does not match any outer indentation level I would be very grateful if you could please tell me how I can solve this problem or guide me if I did something wrong. @HolmesShuan

    full error : Traceback (most recent call last): File "main.py", line 5, in <module> import model File "/content/EDSR-PyTorch/src/model/__init__.py", line 174 def forward_x8(self, *args, forward_function=None): ^ IndentationError: unindent does not match any outer indentation level

    opened by rezraz1 0
  • Using iamges that have been normalized already

    Using iamges that have been normalized already

    I want to use your pre-trained model's algorithm on images that have been normalized by0-1 already and I like the output to be in this range (0-1) too and not be 0-255. so which sections should I change?

    opened by abbasmazrouei 0
  • RuntimeError: CUDA out of memory.

    RuntimeError: CUDA out of memory.

    Hi, I tried to run the code with trained models (EDSR) and got an error about CUDA and GPU that is given below :

    RuntimeError: CUDA out of memory. Tried to allocate 2.64 GiB (GPU 0; 4.00 GiB to
    tal capacity; 1.15 GiB already allocated; 2.21 GiB free; 1.19 GiB reserved in to
    tal by PyTorch)
    
    

    Apparently this error occurs due to the GPU, now I want to know if there is a possibility for the code to run on the CPU? How can the code be changed? (If we consider that there is no memory problem.)

    @sanghyun-son Thank you very much for your guidance

    opened by rezraz1 0
  • Why the **psnr** is zero or nan?

    Why the **psnr** is zero or nan?

    Hi, I tried to run python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results I had a few errors that I was able to fix with the help of [https://github.com/sanghyun-son/EDSR-PyTorch/issues/105] and [https://github.com/sanghyun-son/EDSR-PyTorch/issues/91] but now I have this problem. What could be the reason for this?

    These are the works I have done so far to fix the errors :

    error 1: AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target' and E0FError: Ran out of input Resolved with : https://github.com/sanghyun-son/EDSR-PyTorch/issues/105#issuecomment-455825866 : It seems there are some conflicts between multiprocessing and your system. Remove this and these lines to disable multiprocessing.

    error 2 : AttributeError: 'checkpoint' object has no attribute 'queue' Resolved with : removing --save_results

    error 3 : [WinError 1455] The paging file is too small for this operation to complete. Resolved with : It is clear that --n_threads 0 is used to fix this error

    also my system settings :

    windows 8.1 python 3.8.5 base conda pytorch 1.8.2+cuda10.2

    The result i get now is this :

     Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.
    
    E:\EDSR-PyTorch-master\EDSR-PyTorch-master\src>python ma
    in.py --data_test Demo --scale 4 --pre_train download --test_only --n_threads 0
    Making model...
    Download the model
    
    Evaluation:
      0%|                                                     | 0/1 [00:00<?, ?it/s]
    100%|█████████████████████████████████████████████| 1/1 [00:02<00:00,  2.01s/it]
    100%|█████████████████████████████████████████████| 1/1 [00:02<00:00,  2.01s/it]
    
    [Demo x4]       PSNR: 0.000 (Best: 0.000 @epoch 1)
    Forward: 2.01s
    
    Saving...
    Total: 2.01s
    

    Question :

    Why the psnr is always zero even if I put a few images in the file or it would be nan if i use benchmark data? What is the problem and what should I do to fix it?

    Thank you for your help . . . @tabetomo @5496gaoziya @mylifeasazucchini I will be very thankful if help me, Best Regards

    opened by rezraz1 3
Owner
Sanghyun Son
BS: ECE, Seoul National University (2013.03 ~ 2017.02) Grad: ECE, Seoul National University (2017.03 ~)
Sanghyun Son
PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

Yulun Zhang 1.2k Sep 26, 2022
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 13 Sep 23, 2022
Pytorch implementation of Deep Recursive Residual Network for Super Resolution (DRRN)

DRRN-pytorch This is an unofficial implementation of "Deep Recursive Residual Network for Super Resolution (DRRN)", CVPR 2017 in Pytorch. [Paper] You

yun_yang 193 Sep 22, 2022
Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set (CVPRW 2019). A PyTorch implementation.

Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set —— PyTorch implementation This is an unofficial offici

Sicheng Xu 708 Sep 22, 2022
Project page of the paper 'Analyzing Perception-Distortion Tradeoff using Enhanced Perceptual Super-resolution Network' (ECCVW 2018)

EPSR (Enhanced Perceptual Super-resolution Network) paper This repo provides the test code, pretrained models, and results on benchmark datasets of ou

Subeesh Vasu 77 Aug 28, 2022
PyTorch implementation of the Deep SLDA method from our CVPRW-2020 paper "Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis"

Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis This is a PyTorch implementation of the Deep Streaming Linear Discriminant

Tyler Hayes 39 Aug 29, 2022
BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment

BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment

Holy Wu 31 Sep 19, 2022
EFENet: Reference-based Video Super-Resolution with Enhanced Flow Estimation

EFENet EFENet: Reference-based Video Super-Resolution with Enhanced Flow Estimation Code is a bit messy now. I woud clean up soon. For training the EF

Yaping Zhao 6 Oct 20, 2021
Official repository of "BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment"

BasicVSR_PlusPlus (CVPR 2022) [Paper] [Project Page] [Code] This is the official repository for BasicVSR++. Please feel free to raise issue related to

Kelvin C.K. Chan 184 Sep 22, 2022
PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network"

HAN PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network" This repository is for HAN introduced in the

五维空间 133 Sep 6, 2022
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 428 Sep 25, 2022
PyTorch code for 'Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning'

Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning This repository is for EMSRDPN introduced in the foll

null 7 Feb 10, 2022
Official PyTorch implementation of the paper "Deep Constrained Least Squares for Blind Image Super-Resolution", CVPR 2022.

Deep Constrained Least Squares for Blind Image Super-Resolution [Paper] This is the official implementation of 'Deep Constrained Least Squares for Bli

MEGVII Research 111 Sep 23, 2022
Code for Dual Contrastive Learning for Unsupervised Image-to-Image Translation, NTIRE, CVPRW 2021.

arXiv Dual Contrastive Learning Adversarial Generative Networks (DCLGAN) We provide our PyTorch implementation of DCLGAN, which is a simple yet powerf

null 111 Sep 21, 2022
Practical Single-Image Super-Resolution Using Look-Up Table

Practical Single-Image Super-Resolution Using Look-Up Table [Paper] Dependency Python 3.6 PyTorch glob numpy pillow tqdm tensorboardx 1. Training deep

Younghyun Jo 96 Sep 23, 2022
Augmentation for Single-Image-Super-Resolution

SRAugmentation Augmentation for Single-Image-Super-Resolution Implimentation CutBlur Cutout CutMix Cutup CutMixup Blend RGBPermutation Identity OneOf

Yubo 6 Jun 27, 2022
Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN

Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN Introduction Image super-resolution (SR) is the process of recovering high-resoluti

null 8 Apr 15, 2022
The PyTorch improved version of TPAMI 2017 paper: Face Alignment in Full Pose Range: A 3D Total Solution.

Face Alignment in Full Pose Range: A 3D Total Solution By Jianzhu Guo. [Updates] 2020.8.30: The pre-trained model and code of ECCV-20 are made public

Jianzhu Guo 3.3k Sep 27, 2022
[CVPRW 21] "BNN - BN = ? Training Binary Neural Networks without Batch Normalization", Tianlong Chen, Zhenyu Zhang, Xu Ouyang, Zechun Liu, Zhiqiang Shen, Zhangyang Wang

BNN - BN = ? Training Binary Neural Networks without Batch Normalization Codes for this paper BNN - BN = ? Training Binary Neural Networks without Bat

VITA 36 Aug 19, 2022