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 20
  • 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
  • Got errors when running demo.sh

    Got errors when running demo.sh

    I follow the steps from the readme file to run the demo file with Windows 10 x64 + python 3.6.6 + pytorch 0.4.1 cuda92. Firstly I got a division by zero exception. And I place DIV2K to the database folder. It cause another error. It prints error messages here:

    PS D:\Document\Python\EDSR-PyTorch\code> sh demo.sh Making model... Preparing loss function: 1.000 * L1 [Epoch 1] Learning rate: 1.00e-4 rm: cannot remove '../experiment/RCAN_BIX2_G10R20P48/log.txt': Device or resource busy Making model... Preparing loss function: 1.000 * L1 [Epoch 1] Learning rate: 1.00e-4 Traceback (most recent call last): File "", line 1, in Traceback (most recent call last): File "main.py", line 19, in t.train() File "D:\Document\Python\EDSR-PyTorch\code\trainer.py", line 45, in train for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train): File "D:\Document\Python\EDSR-PyTorch\code\dataloader.py", line 144, in iter File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main return _MSDataLoaderIter(self) File "D:\Document\Python\EDSR-PyTorch\code\dataloader.py", line 117, in init exitcode = _main(fd) File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 114, in _main w.start() File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 105, in start prepare(preparation_data) File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 225, in prepare self._popen = self._Popen(self) _fixup_main_from_path(data['init_main_from_path']) File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path return _default_context.get_context().Process._Popen(process_obj) run_name="mp_main") File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen

    File "C:\ProgramData\Anaconda3\lib\runpy.py", line 263, in run_path return Popen(process_obj) File "C:\ProgramData\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in init pkg_name=pkg_name, script_name=fname) File "C:\ProgramData\Anaconda3\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code reduction.dump(process_obj, to_child) exec(code, run_globals) File "C:\ProgramData\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump

    File "D:\Document\Python\EDSR-PyTorch\code\main.py", line 19, in ForkingPickler(file, protocol).dump(obj) BrokenPipeErrort.train(): [Errno 32] Broken pipe File "D:\Document\Python\EDSR-PyTorch\code\trainer.py", line 45, in train

    for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train):
    

    File "D:\Document\Python\EDSR-PyTorch\code\dataloader.py", line 144, in iter return _MSDataLoaderIter(self) File "D:\Document\Python\EDSR-PyTorch\code\dataloader.py", line 117, in init w.start() File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\ProgramData\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\ProgramData\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "C:\ProgramData\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.
    

    I do not know the code, so I can not modify by myself. I would be thankful if you could give me some advice. Thanks.

    opened by dragove 13
  • 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
  • how should i do when i want to test a tif which >255?

    how should i do when i want to test a tif which >255?

    Hi,i want to test a picture which pixel >255,if i use demo.sh directly,i got a white result,how should i change the code?

    Did you use unit8?how should i do if i want t use unit16?I dong't find method.

    i will appreciate for your help!

    opened by quankainwafu 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
  • transfer learning / finetune

    transfer learning / finetune

    Hello. I want to do EDSR transfer learning with my data. Can you guide me on how to do it?

    #transferlearning #transfer_learning #fine_tune #fine-tune #finetune

    opened by rezraz1 1
  • TypeError:list indices must be integers or slices, not tuple

    TypeError:list indices must be integers or slices, not tuple

    please help me, i am a beginner and i have no idea about this error!!! Thank you for you to give me some information

    Traceback (most recent call last): File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/main.py", line 33, in main() File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/main.py", line 27, in main t.train() File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/trainer.py", line 42, in train for batch, (lr, hr, _,) in enumerate(self.loader_train): File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/Husiyu2022/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/dataset.py", line 218, in getitem return self.datasets[dataset_idx][sample_idx] File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/data/srdata.py", line 100, in getitem pair = self.get_patch(lr, hr) File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/data/srdata.py", line 138, in get_patch lr, hr = common.get_patch( File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/data/common.py", line 29, in get_patch *[a[ty:ty + tp, tx:tx + tp, :] for a in args[1:]] File "/home/Husiyu2022/PycharmProjects/EDSR-PyTorch/src/data/common.py", line 29, in *[a[ty:ty + tp, tx:tx + tp, :] for a in args[1:]] TypeError: list indices must be integers or slices, not tuple

    opened by Hsssy 0
  • Mean Shift Function for Gray Image dataset

    Mean Shift Function for Gray Image dataset

    The dataset I'm working that contains 1-channel gray images. Is this mean shift function necessary to apply on gray images? if so, how to change the below code for 1-channel gray images.

    https://github.com/sanghyun-son/EDSR-PyTorch/blob/9a9d7d74a5a7e010e34bc9784f0e83d6055d85e7/src/model/common.py#L12

    opened by Kamin90 0
  • Why does EDSR enlarge the image twice and only low pixel images work well?

    Why does EDSR enlarge the image twice and only low pixel images work well?

    I use batchsize=1 to train the model, but only dozens of K images can produce results when reasoning. For example, 2M images will show insufficient memory. Why is this? image image

    opened by liujie316316 3
  • 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
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 Dec 26, 2022
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 14 Oct 14, 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 192 Dec 12, 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 833 Dec 28, 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 78 Nov 19, 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

五维空间 140 Nov 23, 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 41 Dec 25, 2022
BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment

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

Holy Wu 35 Jan 1, 2023
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 227 Jan 1, 2023
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 436 Jan 9, 2023
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 141 Dec 30, 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.4k Jan 2, 2023
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 116 Dec 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
PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021.

GCResNet PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021. The code will

null 11 May 19, 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 119 Dec 4, 2022