Giter VIP home page Giter VIP logo

adaptive-downsampling-model's Introduction

Adaptive-Downsampling-Model

This repository is an official PyTorch implementation of the paper "Toward Real-World Super-Resolution via Adaptive Downsampling Models" which is accepted at TPAMI(link).

Dependencies

  • Python 3.7
  • PyTorch >= 1.6.0
  • matplotlib
  • imageio
  • pyyaml
  • scipy
  • numpy
  • tqdm
  • PIL

In this project, we learn the adaptive downsampling model(ADM) with an unpaired dataset consisting of HR and LR images but not pixel aligned.

๐Ÿš‰: Dataset preperation

As HR is not responsible to pixel aligned with LR, we recommend to use DIV2K dataset as HR dataset, which is consist of clean and high-resolution images. You can download it from here (7.1GB). We note that experiments conducted on our paper used 400 HR images('0001.png'-'0400.png') as HR.

For LR datasets, you should put a bunch of images that undergo a similar downsampling process. (e.g. DPED, RealSR, or you own images from same camera setting)

Please put HR and LR datasets in datasets/. Again, different lengths between each dataset are acceptable, as we noted that two datasets are not responsible for pixel-aligned. However, we also note that total iterations of 1 epoch can differ along with your dataset size. Since our ADM learns average downsampling kernel along with LR datasets, please use available LR images with scene variety as much as possible for stable training(we recommend to use more than 200 for HD scale images). For more details on the effect of the number of training samples, please refer to our paper.

๐Ÿš‹: Training

Learning to Downsample

Let denote filename of HR dataset as Source, and LR dataset as Target.

Our ADM will retrieve downsampling between two datasets Source and Target, and generate downsampled version of Source with retrieved downsampling kernel. Basic usage of training is following:

cd src
CUDA_VISIBLE_DEVICES=0 python train.py --source Source --target Target --name save_name --make_down

Generated downsampled version of Source will be saved at ./experiments/save_name/down_results/. Note that you can use Source and generated downsampled version of Source as paired dataset in conventional SR settings.

Joint training with Image super-resolution (Optional)

Here we additionally support joint training with SR network, which use intermediate generated image as paired dataset hence does not require additional SR network training step. Usage of joint training is following:

cd src
CUDA_VISIBLE_DEVICES=0 python train.py --source Source --target Target --name save_name --joint

Default SR model is 'EDSR-baseline', but you can change with --sr_model.

If you have validation datasets for evaluating perforamce of SR, please locate them in datasets/. After then, you can measure performance of SR network by measuring PSNR on validation datasets. You can specify it with --test_lr filename_lr --test_hr filename_hr, where filename_hr and filename_lr should be paired images.

In case that you don't have validation paired datasets as common in real-world, you can visualize SR results by --test_lr filename_lr --realsr --save_results, and then SR results will be saved in ./experiments/save_name/sr_results/. Note that filename_lr can be same with Target.

You can check detailed usage of this repo in demo.sh .

Please note that experimental results reported in our paper are conducted in separate manner(i.e., we only generate downsampled images and train SR network with corresponding official implementation), so the results in joint training may slightly differs with number in the paper.

BibTeX

@ARTICLE{9521710,
    author={Son, Sanghyun and Kim, Jaeha and Lai, Wei-Sheng and Yang, Ming-Hsuan and Lee, Kyoung Mu},
    journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, 
    title={Toward Real-World Super-Resolution via Adaptive Downsampling Models}, 
    year={2021},
    volume={},
    number={},
    pages={1-1},
    doi={10.1109/TPAMI.2021.3106790}
 }

๐Ÿ“ง Contact

If you have any question, please email [email protected].

adaptive-downsampling-model's People

Contributors

jaehakim97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

adaptive-downsampling-model's Issues

Questions about the model

Thanks for your great work.
I have several questions about the model.
For the training, may I know that the DIV2k HR is used for I_hr and my camera photos are used for I_lr (which I_hr and I_lr are completely different photos), is that right?
Also, is that the ADL learn the kernel from I_lr (my camera photos), and apply that kernel to downsample the I_hr(DIV2K HR) into a downsample version (DIV2K HR)?
In the paper, is that the Oracle experiment use the paired RealSR HR and LR to train, which the HR and LR are the real one, not downsample one?
Thanks a lot.

Question about model

hello @JaehaKim97 ,I want to talk about some question about the model.Can the model convert high resolution images to low resolution adaptively?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.