Open source single image super-resolution toolbox containing various functionality for training a diverse number of state-of-the-art super-resolution models. Also acts as the companion code for the IEEE signal processing letters paper titled 'Improving Super-Resolution Performance using Meta-Attention Layers’.

Overview

Deep-FIR Codebase - Super Resolution Meta Attention Networks macOS Linux Windows License: GPL v3

About

This repository contains the main coding framework accompanying our work on meta-attention in Single Image Super-Resolution (SISR), which has been published in the IEEE Signal Processing Letters (SPL) here. A sample of the results obtained by our metadata-enhanced models is provided below:

training_system

Installation

Python and Virtual Environments

If installing from scratch, it is first recommended to set up a new Python virtual environment prior to installing this code. With Conda, this can be achieved through the following:

conda create -n *environment_name* python=3.7 (Python 3.7 recommended but not essential).

conda activate *environment_name*

Code testing was conducted in Python 3.7, but the code should work fine with Python 3.6+.

Local Installation

Run the following commands from the repo base directory to fully install the package and all requirements:

cd Code

If using CPU only: conda install --file requirements.txt --channel pytorch --channel conda-forge

If using CPU + GPU: First install Pytorch and Cudatoolkit for your specific configuration using instructions here. Then, install requirements as above.

If using Aim for metrics logging, install via pip install aim. The Aim GUI does not work on Windows, but metrics should still be logged in the .aim folder.

Finally:

pip install -e . This installs all the command-line functions from Code/setup.py.

All functionality has been tested on Linux (CPU & GPU), Mac OS (CPU) and Windows (CPU & GPU).

Requirements installation is only meant as a guide and all requirements can be installed using alternative means (e.g. using pip).

Guidelines for Generating SR Data

Setting up CelebA Dataset

Create a folder 'celeba' in the Data directory. In here, download all files from the celeba source.
Unpack all archives in this location. Run image_manipulate to generate LR images and corresponding metadata (check details in Documentation/data_prep.md for more info on how to do this).

Setting up CelebA-HQ Dataset

CelebA-HQ files can be easily downloaded from here. To generate LR images, check Documentation/data_prep.md as with CelebA. For our IEEE SPL paper (super-resolving by 4x), we generated images using the following two commands:

To generate 512x512 HR images: image_manipulate --source_dir *path_to_original_images* --output_dir *path_to_new_folder* --pipeline downscale --scale 2

To generate 128x128 LR images: image_manipulate --source_dir *path_to_512x512_images* --output_dir *path_to_new_folder* --pipeline blur-downscale --scale 4

To generate pre-upscaled 512x512 LR images for SPARNet: image_manipulate --source_dir *path_to_128x128_images* --output_dir *path_to_new_folder* --pipeline upscale --scale 4

Setting up DIV2K/Flickr2K Datasets

DIV2K training/validation downloadable from here.
Flickr2K dataset downloadable from here.

Similar to CelebA-HQ, for our IEEE SPL paper (super-resolving by 4x), we generated LR images using the following command:

image_manipulate --source_dir *path_to_original_HR_images* --output_dir *path_to_new_folder* --pipeline blur-downscale --scale 4

For blurred & compressed images, we used the following command (make sure to first install JM to be able to compress the images, as detailed here):

image_manipulate --source_dir *path_to_original_HR_images* --output_dir *path_to_new_folder* --pipeline blur-downscale-jm_compress --scale 4 --random_compression

Setting up SR testing Datasets

All SR testing datasets are available for download from the LapSRN main page here. Generate LR versions of each image using the same commands as used for the DIV2K/Flickr2K datasets.

Additional Options

Further detail on generating LR data provided in Documentation/data_prep.md.

Training/Evaluating Models

Training

To train models, prepare a configuration file (details in Documentation/model_training.md) and run:

train_sisr --parameters *path_to_config_file*

Evaluation

Similarly, for evaluation, prepare an eval config file (details in Documentation/model_eval.md) and run:

eval_sisr --config *path_to_config_file*

Standard SISR models available (code for each adapted from their official repository - linked within source code):

  1. SRCNN
  2. VDSR
  3. EDSR
  4. RCAN
  5. SPARNet
  6. SFTMD
  7. SRMD
  8. SAN
  9. HAN

Custom models available (all meta-models are marked with a Q-):

  1. Q-RCAN (meta-RCAN)
  2. Q-EDSR
  3. Q-SAN
  4. Q-HAN
  5. Q-SPARNet
  6. Various SFTMD variants (check SFTMD architectures file for options)

IEEE SPL Pre-Trained Model Weights

All weights for the models presented in our paper are available for download here. The models are split into three folders:

  • Models trained on blurry general images: These models were all trained on DIV2K/Flickr2K blurred/downsampled images. These include:
    • SRMD
    • SFTMD
    • RCAN
    • EDSR
    • SAN
    • HAN
    • Meta-RCAN
    • Meta-EDSR
    • Meta-SAN
    • Meta-HAN
  • Models trained on blurry and compressed general images: These models were all trained on DIV2K/Flickr2K blurred/downsampled/compressed images. These include:
    • RCAN
    • Meta-RCAN (accepting blur kernel data only)
    • Meta-RCAN (accepting compression QPI data only)
    • Meta-RCAN (accepting both blur kernels and compression QPI)
  • Models trained on blurry face images: These models were all trained on CelebA-HQ blurred/downsampled images. These include:
    • RCAN
    • SPARNet (note that SPARNET only accepts pre-upsampled images)
    • Meta-RCAN
    • Meta-SPARNet
  • Testing config files for all of these models are available in Documentation/SPL_testing_files. To use these, you need to first download and prepare the relevant datasets as shown here. Place the downloaded model folders in ./Results to use the config files as is, or adjust the model_loc parameter to point towards the directory containing the models.

Once downloaded, these models can be used directly with the eval command (```eval_sisr``) on any other input dataset as discussed in the evaluation documentation (Documentation/model_eval.md).

Replicating SPL Results from Scratch

All training config files for models presented in our SPL paper are provided in Documentation/sample_config_files. These configurations assume that your training/eval data is stored in the relevant directory within ./Data, so please check that you have downloaded and prepared your datasets (as detailed above) before training.

Additional/Advanced Setup

Setting up JM (for compressing images)

Download the reference software from here. Place the software in the directory ./JM. cd into this directory and compile the software using the commands . unixprep.sh and make. Some changes might be required for different OS versions.
To compress images, simply add the jm_compress argument when specifying image_manipulate's pipeline.

Setting up VGGFace (Pytorch)

Download pre-trained weights for the VGGFace model from here (scroll to VGGFace). Place the weights file in the directory ./external_packages/VGGFace/. The weights file should be called vgg_face_dag.pth.

Setting up lightCNN

Download pre-trained weights for the lightCNN model from here (LightCNN-29 v1). Place the weights file in the directory ./external_packages/LightCNN/. The weights file should be called LightCNN_29Layers_checkpoint.pth.tar.

Creating Custom Models

Information on how to develop and train your own models is available in Documentation/framework_development.md.

Full List of Commands Available

The entire list of commands available with this repository is:

  • train_sisr - main model training function.
  • eval_sisr - main model evaluation function.
  • image_manipulate - main bulk image converter.
  • images_to_video - Helper function to convert a folder of images into a video.
  • extract_best_model - Helper function to extract model config and best model checkpoint from a folder to a target location.
  • clean_models - Helper function to remove unnecessary model checkpoints.
  • model_report - Helper function to report on models available in specified directory.

Each command can be run with the --help parameter, which will print out the available options and docstrings.

Uninstall

Simply run:

pip uninstall Deep-FIR-SR

from any directory, with the relevant virtual environment activated.

Citation

Paper currently still in early-access, will update once fully published.

@ARTICLE{Meta-Attention,
author={Aquilina, Matthew and Galea, Christian and Abela, John and Camilleri, Kenneth P. and Farrugia, Reuben},
journal={IEEE Signal Processing Letters},
title={Improving Super-Resolution Performance using Meta-Attention Layers},
year={2021},
volume={},
number={},
pages={1-1},
doi={10.1109/LSP.2021.3116518}}

License/Further Development

This code has been released via the GNU GPLv3 open-source license. However, this code can also be made available via an alternative closed, permissive license. Third-parties interested in this form of licensing should contact us separately.

Usages of code from other repositories is properly referenced within the code itself.

We are working on a number of different research tasks in super-resolution, we'll be updating this repo as we make further advancements!

Short-term upgrades planned:

  • CI automated testing (alongside Pytest)
  • Release of packaged version
  • Other upgrades TBA
Stock-history-display - something like a easy yearly review for your stock performance

Stock History Display Available on Heroku: https://stock-history-display.herokua

LiaoJJ 1 Jan 07, 2022
Code of the paper "Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition"

SEW (Squeezed and Efficient Wav2vec) The repo contains the code of the paper "Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speec

ASAPP Research 67 Dec 01, 2022
SpinalNet: Deep Neural Network with Gradual Input

SpinalNet: Deep Neural Network with Gradual Input This repository contains scripts for training different variations of the SpinalNet and its counterp

H M Dipu Kabir 142 Dec 30, 2022
FasterAI: A library to make smaller and faster models with FastAI.

Fasterai fasterai is a library created to make neural network smaller and faster. It essentially relies on common compression techniques for networks

Nathan Hubens 193 Jan 01, 2023
Real-Time Semantic Segmentation in Mobile device

Real-Time Semantic Segmentation in Mobile device This project is an example project of semantic segmentation for mobile real-time app. The architectur

708 Jan 01, 2023
Tutorial on active learning with the Nvidia Transfer Learning Toolkit (TLT).

Active Learning with the Nvidia TLT Tutorial on active learning with the Nvidia Transfer Learning Toolkit (TLT). In this tutorial, we will show you ho

Lightly 25 Dec 03, 2022
Multi-Output Gaussian Process Toolkit

Multi-Output Gaussian Process Toolkit Paper - API Documentation - Tutorials & Examples The Multi-Output Gaussian Process Toolkit is a Python toolkit f

GAMES 113 Nov 25, 2022
Pytorch implementations of the paper Value Functions Factorization with Latent State Information Sharing in Decentralized Multi-Agent Policy Gradients

LSF-SAC Pytorch implementations of the paper Value Functions Factorization with Latent State Information Sharing in Decentralized Multi-Agent Policy G

Hanhan 2 Aug 14, 2022
PyTorch implementaton of our CVPR 2021 paper "Bridging the Visual Gap: Wide-Range Image Blending"

Bridging the Visual Gap: Wide-Range Image Blending PyTorch implementaton of our CVPR 2021 paper "Bridging the Visual Gap: Wide-Range Image Blending".

Chia-Ni Lu 69 Dec 20, 2022
Tackling data scarcity in Speech Translation using zero-shot multilingual Machine Translation techniques

Tackling data scarcity in Speech Translation using zero-shot multilingual Machine Translation techniques This repository is derived from the NMTGMinor

Tu Anh Dinh 1 Sep 07, 2022
Multi-robot collaborative exploration and mapping through Voronoi partition and DRL in unknown environment

Voronoi Multi_Robot Collaborate Exploration Introduction In the unknown environment, the cooperative exploration of multiple robots is completed by Vo

PeaceWord 6 Nov 22, 2022
Vit-ImageClassification - Pytorch ViT for Image classification on the CIFAR10 dataset

Vit-ImageClassification Introduction This project uses ViT to perform image clas

Kaicheng Yang 4 Jun 01, 2022
pytorch bert intent classification and slot filling

pytorch_bert_intent_classification_and_slot_filling 基于pytorch的中文意图识别和槽位填充 说明 基本思路就是:分类+序列标注(命名实体识别)同时训练。 使用的预训练模型:hugging face上的chinese-bert-wwm-ext 依

西西嘛呦 33 Dec 15, 2022
Unimodal Face Classification with Multimodal Training

Unimodal Face Classification with Multimodal Training This is a PyTorch implementation of the following paper: Unimodal Face Classification with Multi

Wenbin Teng 3 Jul 06, 2022
Relative Human dataset, CVPR 2022

Relative Human (RH) contains multi-person in-the-wild RGB images with rich human annotations, including: Depth layers (DLs): relative depth relationsh

Yu Sun 112 Dec 02, 2022
A simple Python library for stochastic graphical ecological models

What is Viridicle? Viridicle is a library for simulating stochastic graphical ecological models. It implements the continuous time models described in

Theorem Engine 0 Dec 04, 2021
A Data Annotation Tool for Semantic Segmentation, Object Detection and Lane Line Detection.(In Development Stage)

Data-Annotation-Tool How to Run this Tool? To run this software, follow the steps: git clone https://github.com/Autonomous-Car-Project/Data-Annotation

TiVRA AI 13 Aug 18, 2022
Deep Dual Consecutive Network for Human Pose Estimation (CVPR2021)

Beanie - is an asynchronous ODM for MongoDB, based on Motor and Pydantic. It uses an abstraction over Pydantic models and Motor collections to work wi

295 Dec 29, 2022
This is the source code of the 1st place solution for segmentation task (with Dice 90.32%) in 2021 CCF BDCI challenge.

1st place solution in CCF BDCI 2021 ULSEG challenge This is the source code of the 1st place solution for ultrasound image angioma segmentation task (

Chenxu Peng 30 Nov 22, 2022
Blender scripts for computing geodesic distance

GeoDoodle Geodesic distance computation for Blender meshes Table of Contents Overivew Usage Implementation Overview This addon provides an operator fo

20 Jun 08, 2022