Code Monkey home page Code Monkey logo

srwarp's Introduction

SRWarp

demo

This repository contains an official implementation of the following CVPR 2021 paper:

Sanghyun Son and Kyoung Mu Lee, "SRWarp: Generalized Image Super-Resolution under Arbitrary Transformation."

Requirements

This repository is tested under:

  • Ubuntu 18.04
  • CUDA 10.1 (Compute Capability 7.5)
  • >= PyTorch 1.6

We have found some issues with CUDA 10.0 version. Please use a proper CUDA version for building this repository.

Also, please install the following CUDA extension. More details are described in this repository.

$ git clone https://github.com/sanghyun-son/pysrwarp
$ cd pysrwarp
$ make

We also recommend using the attached environment.yaml file to easily set up the environment.

$ conda env create --file environment.yaml
$ conda activate srwarp

Setup

Browse to the pretrained directory and download the pretrained checkpoints by following:

$ bash download.sh

Otherwise, download them manually. Please note that those files are ~3x larger than the original model due to the saved optimizers.

SRWarp (MDSR) SRWarp (MRDB)
Download (36MB) Download (212MB)

Demo

Browse to the src directory and run interactive.py to open an interactive session. We note that this requires a large amount of GPU memory, especially with the MRDB backbone. We will release a memory-friendly version soon.

$ cd src
# With the MDSR backbone
$ python interactive.py --pretrained ../pretrained/srwarp_mdsr-c66c4715.ckpt
# With the MRDB backbone
$ python interactive.py --pretrained ../pretrained/srwarp_mrdb-908878d3.ckpt --backbone mrdb

# Use --img [image_path] to test your own image.

You can freely drag blue dots around the image for real-time interaction. Type 2 and 3 repeatedly to compare our results with the conventional interpolation-based warping algorithm.

We also provide some scripts to reproduce several experiments in our paper. For baseline methods in Table 3, please prepare SR results from existing methods first. Then, use the following scripts:

$ python main.py --dtest srwarp.demo --dpath $1 --data_path_test $2 --trainer srwarp.cv2 --loss loss/srwarp.txt --save srwarp/edsr_x4_cv2 --cv2_interpolation bicubic --cv2_naive --scale 4 --test_only

$1: Path to the DIV2K validation HR images.
$2: Path to the 100 SR results on DIV2K validation dataset and the corresponding forward transformation matrices (`.pth`).
An example directory structure of `$2`
|-- 0801.pth
|-- 0801_x4.png
|-- 0802.pth
|-- 0802_x4.png
`-- ...

Assets

Please download the DIV2KW datasets from the links below

Each dataset contains 100 test inputs and corresponding 100 forward transformation matrices (.pth).

Training

We are currently reorganizing the code. The training script will be released soon!

Reference

If you find our paper and repository useful in your research, please use the following BibTeX form:

@inproceedings{
  title={{SRW}arp: Generalized Image Super-Resolution under Arbitrary Transformation},
  author={Son, Sanghyun and Lee, Kyoung Mu},
  booktitle={CVPR},
  year={2021}
}

srwarp's People

Contributors

sanghyun-son avatar

Watchers

James Cloos avatar

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.