All Projects → fperazzi → Prosr

fperazzi / Prosr

Licence: gpl-3.0
Repository containing an independent implementation of the paper: "A Fully Progressive Approach to Single-Image Super-Resolution"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Prosr

Bert Multitask Learning
BERT for Multitask Learning
Stars: ✭ 380 (-58.83%)
Mutual labels:  pretrained-models
Breast cancer classifier
Deep Neural Networks Improve Radiologists' Performance in Breast Cancer Screening
Stars: ✭ 614 (-33.48%)
Mutual labels:  pretrained-models
Efficientnet Pytorch
A PyTorch implementation of EfficientNet and EfficientNetV2 (coming soon!)
Stars: ✭ 6,685 (+624.27%)
Mutual labels:  pretrained-models
Mmf
A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)
Stars: ✭ 4,713 (+410.62%)
Mutual labels:  pretrained-models
Self Driving Car In Video Games
A deep neural network that learns to drive in video games
Stars: ✭ 559 (-39.44%)
Mutual labels:  pretrained-models
Pinto model zoo
A repository that shares tuning results of trained models generated by TensorFlow / Keras. Post-training quantization (Weight Quantization, Integer Quantization, Full Integer Quantization, Float16 Quantization), Quantization-aware training. TensorFlow Lite. OpenVINO. CoreML. TensorFlow.js. TF-TRT. MediaPipe. ONNX. [.tflite,.h5,.pb,saved_model,tfjs,tftrt,mlmodel,.xml/.bin, .onnx]
Stars: ✭ 634 (-31.31%)
Mutual labels:  pretrained-models
Fbrs interactive segmentation
[CVPR2020] f-BRS: Rethinking Backpropagating Refinement for Interactive Segmentation https://arxiv.org/abs/2001.10331
Stars: ✭ 366 (-60.35%)
Mutual labels:  pretrained-models
Bert Keras
Keras implementation of BERT with pre-trained weights
Stars: ✭ 820 (-11.16%)
Mutual labels:  pretrained-models
Functional Zoo
PyTorch and Tensorflow functional model definitions
Stars: ✭ 577 (-37.49%)
Mutual labels:  pretrained-models
Pytorch Cnn Finetune
Fine-tune pretrained Convolutional Neural Networks with PyTorch
Stars: ✭ 653 (-29.25%)
Mutual labels:  pretrained-models
Cluepretrainedmodels
高质量中文预训练模型集合:最先进大模型、最快小模型、相似度专门模型
Stars: ✭ 493 (-46.59%)
Mutual labels:  pretrained-models
Trt pose
Real-time pose estimation accelerated with NVIDIA TensorRT
Stars: ✭ 525 (-43.12%)
Mutual labels:  pretrained-models
Nlp Recipes
Natural Language Processing Best Practices & Examples
Stars: ✭ 5,783 (+526.54%)
Mutual labels:  pretrained-models
Neural Backed Decision Trees
Making decision trees competitive with neural networks on CIFAR10, CIFAR100, TinyImagenet200, Imagenet
Stars: ✭ 411 (-55.47%)
Mutual labels:  pretrained-models
Pytorchinsight
a pytorch lib with state-of-the-art architectures, pretrained models and real-time updated results
Stars: ✭ 713 (-22.75%)
Mutual labels:  pretrained-models
Mobilenetv2.pytorch
72.8% MobileNetV2 1.0 model on ImageNet and a spectrum of pre-trained MobileNetV2 models
Stars: ✭ 369 (-60.02%)
Mutual labels:  pretrained-models
Gensim Data
Data repository for pretrained NLP models and NLP corpora.
Stars: ✭ 622 (-32.61%)
Mutual labels:  pretrained-models
Bert Ner
Pytorch-Named-Entity-Recognition-with-BERT
Stars: ✭ 829 (-10.18%)
Mutual labels:  pretrained-models
Srgan Tensorflow
Tensorflow implementation of the SRGAN algorithm for single image super-resolution
Stars: ✭ 754 (-18.31%)
Mutual labels:  pretrained-models
Conv Emotion
This repo contains implementation of different architectures for emotion recognition in conversations.
Stars: ✭ 646 (-30.01%)
Mutual labels:  pretrained-models

ProSR

A Fully Progressive Approach to Single-Image Super-Resolution

Co-winner of the NTIRE Super-Resolution Challenge 2018

ProSR is a Single Image Super-Resolution (SISR) method designed upon the principle of multi-scale progressiveness. The architecture resembles an asymmetric pyramidal structure with more layers in the upper levels, to enable high upsampling ratios while remaining efficient. The training procedure implements the paradigm of curriculum learning by gradually increasing the difficulty of the task.

[Paper][ArXiv]

Installation

Follow the instructions below to get ProSR up and running on your machine, both for development and testing purposes.

ProSR is developed under Ubuntu 16.04 with CUDA 9.1, cuDNN v7.0 and pytorch-0.4.0. We tested the program on Nvidia Titan X and Tesla K40c GPUs. Parallel processing on multiple GPUs is supported during training.

System Requirements

Dependencies

  • python 3.x
  • pytorch 0.4.0
  • cuda91
  • torch
  • torchvision
  • scikit-image
  • pillow
  • easydict

Install Dependencies

# Create virtual environment
conda create -n proSR

# Install torch
conda install pytorch=0.4.1 torchvision cuda91 -c pytorch

# Install image libraries
conda install scikit-image cython

# Install visdom
conda install visdom dominate -c conda-forge

# Install python dependencies
python3.7 -m pip install easydict pillow

Search Path

export PYTHONPATH=$PROJECT_ROOT/lib:$PYTHONPATH to include proSR into the search path.

Getting the Data

We provide a script data/get_data.sh to download the pretrained models and datasets that we used in this project. This is a large download of approximately 10GB that might take a while to complete. Individual links to the models and datasets are available in the next sections.

Datasets

The results reported in the paper are trained on DIV2K. Improved performance, at the expenses of longer training time, can be obtained adding Flickr2K to the training set. The pretrained models released in this repository have been trained with DIV2K and Flickr2K.

We evaluated the performance of ProSR on the following benchmark datasets:

A package containing all of the above benchmark datasets was made available by the EDSR colleagues: benchmark.tar

Pretrained Models

We release the following models:

  • proSR - This is the full size model that ranked 2nd and 4th place respectively in terms of PSNR and SSIM on the "Track 1" of the NTIRE Super-Resolution Challenge 2018.
  • proSRs - A lightweight version of ProSR. Best speed / accuracy tradeoff.
  • proSRGAN - ProSR trained with an adversarial loss. Lower PSNR but higher details.

The above models perform well across different upscaling ratios [2,4,8]. However, best performance is achieved using scale specific models. These models are available in the same folder and are post-fixed with _xSCALE (e.g. proSR_x8.pth) to indicate at which regime they perform best.

Results

Following wide-spread protocol, the quantitative results are obtained converting RGB images to YCbCr and evaluating the PSNR and SSIM on the Y channel only.

proSRs DIV2K Set14 BSD100 Urban100 proSR DIV2K Set14 BSD100 Urban100
x2 35.88 33.52 32.00 31.61 x2 36.37 34.12 32.23 32.68
x4 30.39 28.64 27.50 26.02 x4 30.78 28.94 27.68 26.74
x8 26.89 24.92 24.71 22.44 x8 27.18 25.25 24.86 22.91

Results slightly differ from those reported in the paper for several reasons: this is an independent re-implementation; differently from the paper we trained on on DIV2K and Flickr2K; I picked the best performers validating on Set14 instead of DIV2K.

Training

Train your own model using the script train.py:

# Train using default params
python train.py --model MODEL --output DIR

# Train with configuration file
python train.py --config CONFIG.yaml

MODEL is one of prosr or prosrs. The configuration is defined in prosr/config.py. Checkpoints and log files are stored in DIR. Alternatively, the --config flag reads configuration files in yaml format. In PROJECT_ROOT/options we provide config files corresponding to the architectures proposed in the paper.

See train.py for more options.

Training Paper Experiments

# Train ProSRs from params dict
python train.py --model prosrs --output data/checkpoints/proSRs

# ProSR from configuration file
python train.py --config options/prosr.yaml --output data/checkpoints/proSR

Loading the dataset

Set the path to the dataset in configs.py:prosr_params.train.path{source,target}. To train on multiple datasets create a new folder containing soft links to the datasets, you want to use for training. For example: ensemble/{DIV2K_train_HR,Flickr2K}.

train.path.source is optional. If left empty, the dataloader will downsample the target images found in train.path.target to the predefined lower resolution.

Resume Training

To resume training from a checkpoint, e.g. data/checkpoints/PRETRAINED_net_G.pth:

python train.py --checkpoint data/checkpoints/PRETRAINED

MultiGPU Training

By default, all available GPUs are used. To use specific GPUs use CUDA_VISIBLE_DEVICES, e.g. export CUDA_VISIBLE_DEVICES=0,1

Visualization

To visualize intermediate results (optional) run the visdom.server in a separate terminal and enable visualization passing the command line arguments: --visdom --visdom-port PORT-NUMBER.

# Run the server in a separate terminal
python -m visdom.server -port 8067

Testing

Run:

python test.py -i LR_INPUT (optional) -t HR_INPUT (optional) --checkpoint CHECKPOINT --scale NUMBER

LR_INPUT is the low-resolution input and can be a folder, an image or a list of images. If high-resolution images are provided (HR_INPUT), the script will compute the resulting PSNR and SSIM. Alternatively, if only high-resolution images are given as argument, the script will scale HR_INPUT by the inverse of the upscale factor NUMBER and use the result as LR_INPUT.

CHECKPOINT is the path to the pretrained *.pth file.

Example

# ProSR: Replicate x8 results
python test.py --checkpoint data/checkpoints/proSR.pth --target data/datasets/DIV2K/DIV2K_valid_HR --scale 8

Docker example

# Build the image with GPU support
nvidia-docker build -t prosr .

# Scale a folder by 8x
nvidia-docker run -it --name prosr --shm-size=4G -v INPUT_DATA/:/data prosr \
    python test.py -i /data --checkpoint data/proSR/proSR_x8.pth --scale 8 -o /data/output

Additional Tools

Configuration

The configuration file and the command-line options are embedded as a dictionary in the respective *.pth. file. Print the configuration file using the command:

python tools/print_info.py data/checkpoints/proSR.pth

Downscaling

The models available for download have been trained on images downscaled with a bicubic filter. To replicate the same type of downsampling we provide the script tools/scale.py.

python scale.py -i HR_INPUT -o LR_OUTPUT --ratio 8

Evaluation

Results can be evaluated in terms of PSNR and SSIM using the script tools/eval.py. The command-line is similar to test.py:

python tools/eval.py -i LR_INPUT -t HR_INPUT --scale NUMBER

The input can be either a folder, an image or a list of images. The upsampling factor is required since the boundary cropping depends on it.

Publication

If this code helps your research, please consider citing the following paper.

A Fully Progressive Approach to Single-Image Super-Resolution - Y. Wang, F. Perazzi, B. McWilliams, A. Sorkine-Hornung, O. Sorkine-Hornung, C. Schroers - CVPR Workshops NTIRE 2018.

@InProceedings{Wang_2018_CVPR_Workshops,
    author = {
      Yifan, W. and
      Perazzi, F. and
      McWilliams, B. and
      Sorkine-Hornung, A. and
      Sorkine-Hornung, O and
      Schroers, C.},
  title = {A Fully Progressive Approach to Single-Image Super-Resolution},
  booktitle = {CVPR Workshops},
  month = {June},
  year = {2018}
}

Contacts

If you have any question, please contact Yifan Wang and Federico Perazzi.

Update Log

  • Sept. 10, 2018
    • Upload ProSR models.
    • Add ProSR evaluation in README.
  • Sept. 16, 2018
    • Upload proSRGAN models.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].