Official implementation of Deep Burst Super-Resolution

Overview

Deep-Burst-SR

Official implementation of Deep Burst Super-Resolution

Publication: Deep Burst Super-Resolution. Goutam Bhat, Martin Danelljan, Luc Van Gool, and Radu Timofte. CVPR 2021 [Arxiv]

Overview

While single-image super-resolution (SISR) has attracted substantial interest in recent years, the proposed approaches are limited to learning image priors in order to add high frequency details. In contrast, multi-frame superresolution (MFSR) offers the possibility of reconstructing rich details by combining signal information from multiple shifted images. This key advantage, along with the increasing popularity of burst photography, have made MFSR an important problem for real-world applications. We propose a novel architecture for the burst superresolution task. Our network takes multiple noisy RAW images as input, and generates a denoised, super-resolved RGB image as output. This is achieved by explicitly aligning deep embeddings of the input frames using pixel-wise optical flow. The information from all frames are then adaptively merged using an attention-based fusion module. In order to enable training and evaluation on real-world data, we additionally introduce the BurstSR dataset, consisting of smartphone bursts and high-resolution DSLR ground-truth.

dbsr overview figure [Comparison of our Deep Burst SR apporach with Single Image baseline for 4x super-resolution of RAW burst captured from Samsung Galaxy S8]

Table of Contents

Installation

Clone the Git repository.

git clone https://github.com/goutamgmb/deep-burst-sr.git

Install dependencies

Run the installation script to install all the dependencies. You need to provide the conda install path (e.g. ~/anaconda3) and the name for the created conda environment (here env-dbsr).

bash install.sh conda_install_path env-dbsr

This script will also download the default DBSR networks and create default environment settings.

Update environment settings

The environment setting file admin/local.py contains the paths for pre-trained networks, datasets etc. Update the paths in local.py according to your local environment.

Toolkit Overview

The toolkit consists of the following sub-modules.

  • admin: Includes functions for loading networks, tensorboard etc. and also contains environment settings.
  • data: Contains functions for generating synthetic bursts, camera pipeline, processing data (e.g. loading images, data augmentations).
  • data_specs: Information about train/val splits of different datasets.
  • dataset: Contains integration of datasets such as BurstSR, SyntheticBurst, ZurichRAW2RGB.
  • evaluation: Scripts to run and evaluate models on standard datasets.
  • external: External dependencies, e.g. PWCNet.
  • models: Contains different layers and network definitions.
  • util_scripts: Util scripts to e.g. download datasets.
  • utils: General utility functions for e.g. plotting, data type conversions, loading networks.

Datasets

The toolkit provides integration for following datasets which can be used to train/evaluate the models.

Zurich RAW to RGB Canon set

The RGB images from the training split of the Zurich RAW to RGB mapping dataset can be used to generate synthetic bursts for training using the SyntheticBurstProcessing class in data/processing.py.

Preparation: Download the Zurich RAW to RGB canon set from here and unpack the zip folder. Set the zurichraw2rgb_dir variable in admin/local.py to point to the unpacked dataset directory.

SyntheticBurst validation set

The pre-generated synthetic validation set used for evaluating the models. The dataset contains 300 synthetic bursts, each containing 14 RAW images. The synthetic bursts are generated from the RGB images from the test split of the Zurich RAW to RGB mapping dataset. The dataset can be loaded using SyntheticBurstVal class in dataset/synthetic_burst_val_set.py file.

Preparation: Downloaded the dataset here and unpack the zip file. Set the synburstval_dir variable in admin/local.py to point to the unpacked dataset directory.

BurstSR dataset (cropped)

The BurstSR dataset containing RAW bursts captured from Samsung Galaxy S8 and corresponding HR ground truths captured using a DSLR camera. This is the pre-processed version of the dataset that contains roughly aligned crops from the original images. The dataset can be loaded using BurstSRDataset class in dataset/burstsr_dataset.py file. Please check the DBSR paper for more details.

Preparation: The dataset has been split into 10 parts and can be downloaded and unpacked using the util_scripts/download_burstsr_dataset.py script. Set the burstsr_dir variable in admin/local.py to point to the unpacked BurstSR dataset directory.

BurstSR dataset (full)

The BurstSR dataset containing RAW bursts captured from Samsung Galaxy S8 and corresponding HR ground truths captured using a DSLR camera. This is the raw version of the dataset containing the full burst images in dng format.

Preparation: The dataset can be downloaded and unpacked using the util_scripts/download_raw_burstsr_data.py script.

Evaluation

You can run the trained model on RAW bursts to generate HR RGB images and compute the quality of predictions using the evaluation module.

Note: Please prepare the necessary datasets as explained in Datasets section before running the models.

Evaluate on SyntheticBurst validation set

You can evaluate the models on SyntheticBurst validation set using evaluation/synburst package. First create an experiment setting in evaluation/synburst/experiments containing the list of models to evaluate. You can start with the provided setting dbsr_default.py as a reference. Please refer to network_param.py for examples on how to specify a model for evaluation.

Save network predictions

You can save the predictions of a model on bursts from SyntheticBurst dataset by running

python evaluation/synburst/save_results.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting you want to use (e.g. dbsr_default). The script will save the predictions of the model in the directory pointed by the save_data_path variable in admin/local.py.

Note The network predictions are saved in linear sensor color space (i.e. color space of input RAW burst), as 16 bit pngs.

Compute performance metrics

You can obtain the standard performance metrics (e.g. PSNR, MS-SSIM, LPIPS) using the compute_score.py script

python evaluation/synburst/compute_score.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting you want to use (e.g. dbsr_default). The script will run the models to generate the predictions and compute the scores. In case you want to compute performance metrics for results saved using save_results.py, you can run compute_score.py with additonal --load_saved argument.

python evaluation/synburst/compute_score.py EXPERIMENT_NAME --load_saved

In this case, the script will load pre-saved predictions whenever available. If saved predictions are not available, it will run the model to first generate the predictions and then compute the scores.

Qualitative comparison

You can perform qualitative analysis of the model by visualizing the saved network predictions, along with ground truth, in sRGB format using the visualize_results.py script.

python evaluation/synburst/visualize_results.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting containing the list of models you want to use (e.g. dbsr_default). The script will display the predictions of each model in sRGB format, along with the ground truth. You can toggle between images, zoom in on particular image regions using the UI. See visualize_results.py for details.

Note: You need to first save the network predictions using save_results.py script, before you can visualize them using visualize_results.py.

Evaluate on BurstSR validation set

You can evaluate the models on BurstSR validation set using evaluation/burstsr package. First create an experiment setting in evaluation/burstsr/experiments containing the list of models to evaluate. You can start with the provided setting dbsr_default.py as a reference. Please refer to network_param.py for examples on how to specify a model for evaluation.

Save network predictions

You can save the predictions of a model on bursts from BurstSR val dataset by running

python evaluation/burstsr/save_results.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting you want to use (e.g. dbsr_default). The script will save the predictions of the model in the directory pointed by the save_data_path variable in admin/local.py.

Note The network predictions are saved in linear sensor color space (i.e. color space of input RAW burst), as 16 bit pngs.

Compute performance metrics

You can obtain the standard performance metrics (e.g. PSNR, MS-SSIM, LPIPS) after spatial and color alignment (see paper for details) using the compute_score.py script

python evaluation/burstsr/compute_score.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting you want to use (e.g. dbsr_default). The script will run the models to generate the predictions and compute the scores. In case you want to compute performance metrics for results saved using save_results.py, you can run compute_score.py with additonal --load_saved argument.

python evaluation/burstsr/compute_score.py EXPERIMENT_NAME --load_saved

In this case, the script will load pre-saved predictions whenever available. If saved predictions are not available, it will run the model to first generate the predictions and then compute the scores.

Qualitative comparison

You can perform qualitative analysis of the model by visualizing the saved network predictions, along with ground truth, in sRGB format using the visualize_results.py script.

python evaluation/burstsr/visualize_results.py EXPERIMENT_NAME

Here, EXPERIMENT_NAME is the name of the experiment setting containing the list of models you want to use (e.g. dbsr_default). The script will display the predictions of each model in sRGB format, along with the ground truth. You can toggle between images, zoom in on particular image regions using the UI. See visualize_results.py for details.

Note: You need to first save the network predictions using save_results.py script, before you can visualize them using visualize_results.py.

Model Zoo

Here, we provide pre-trained network weights and report their performance.

Note: The models have been retrained using the cleaned up code, and thus can have small performance differences compared to the models used for the paper.

SyntheticBurst models

The models are evaluated using all 14 burst images.

Model PSNR MS-SSIM LPIPS Links Notes
CVPR2021 39.09 0.945 0.084 - CVPR2021 results
dbsr_synthetic_default 39.17 0.946 0.081 model Official retrained model
BurstSR models

The models are evaluated using all 14 burst images. The metrics are computed after spatial and color alignment, as described in DBSR paper.

Model PSNR MS-SSIM LPIPS Links Notes
CVPR2021 47.76 0.984 0.030 - CVPR2021 results
dbsr_burstsr_default 47.70 0.984 0.029 model Official retrained model

Training

We are still waiting for approval from our project sponsors to release the training codes. Hopefully we can soon release it. Meanwhile, please free to contact us in case of any questions regarding training.

Acknowledgement

The toolkit uses code from the following projects:

Comments
  • Can't download the PWC-Net

    Can't download the PWC-Net

    Hi @goutamgmb I can't download the pretrained pwc-net using the install.sh and the 'gdown' command, and I also can't open the google drive link you provide. Could you please give some advice?

    opened by susan-sun1999 7
  • Overfitting on the training dataset

    Overfitting on the training dataset

    Thanks for your wonderful work. I have some problems when I try to fine-tune DBSR on the BurstSR dataset for a burst size of 14.

    I firstly train it on the synthetic dataset and it finally achieves 40.95 dB on the synthetic validation dataset. Then I try to fine-tune it on the BurstSR dataset. While the validation result only grows at the beginning but drops gradually after it achieves 47.86 dB. It seems that the training set of BurstSR is overfitted.

    Have you met the same problem? Is it because the training set is too small or there is a domain gap between the training and validation set? I have been confused by this problem for months. I would appreciate it a lot if you could help me figure this out.

    Thanks.

    opened by greatlog 6
  • The trained model of PWC-Net can't download

    The trained model of PWC-Net can't download

    gdown https://drive.google.com/uc?id=1s11Ud1UMipk2AbZZAypLPRpnXOS9Y1KO -O pretrained_networks/pwcnet-network-default.pth

    The URL given above cannot be accessed directly, and the complete trained .pth model cannot be downloaded using the 'gdown' command. did i wrote wrong code?

    opened by CJ0109 4
  • view raw images

    view raw images

    hi thanks for your nice work, can you please help me in knowing as to which part of code to be used to view generated synthetic raw images and how to view it

    opened by nan-rock 3
  • PSNR changes after CanonImage.generate_processed_image

    PSNR changes after CanonImage.generate_processed_image

    Hi, @goutamgmb I train the model using the burstsr dataset, and then I use the provided compute_score.py to compute the psnr between net_pred_warped_m and gt. The computed PSNR is around 46dB. https://github.com/goutamgmb/deep-burst-sr/blob/73d4f347cdb7ca41992ac66a7e3d312bd9b17298/evaluation/burstsr/compute_score.py#L126-L128

    And then I use the provided visualize_result.py to see the SR result. But I find the SR results seem to be kind of blurry. So I calculate the PSNR result between the pred_proc_np and frame_gt_np. And the PSNR decreases to around 29 dB. https://github.com/goutamgmb/deep-burst-sr/blob/73d4f347cdb7ca41992ac66a7e3d312bd9b17298/evaluation/burstsr/visualize_results.py#L71-L75

    My guess is the Canon.generate_process_image operation somehow influences the visulization. So I wonder could you please give me some advice?

    opened by susan-sun1999 3
  • local.py file missing

    local.py file missing

    Update environment settings The environment setting file admin/local.py contains the paths for pre-trained networks, datasets etc. Update the paths in local.py according to your local environment.

    The admin/local.py file is missing. Is this file still required?

    opened by wallematthias 3
  • The checkpoints can not be loaded

    The checkpoints can not be loaded

    It seems that you have saved the structure of this directory into the checkpoints. However, the directory has been changed. The "local" module in the admin directory has been removed. Consequently, the checkpoints can not be properly loaded. Would you mind providing new checkpoints?

    opened by greatlog 2
  • How to avoid checkerboard artifacts?

    How to avoid checkerboard artifacts?

    Hi, thanks for the excellent work. When I tried to test your pretrained model on my captured RAW bursts, I prepared my testing datasets as your evaluation datasets —— RAW bursts captured from Samsung Galaxy S8, 4 channels 'png' format and uint16 type. However, I found that there exists checkerboard artifacts in the output super resolution image. How to avoid these checkerboard artifacts?

    The input sample and the output image are shown in the https://drive.google.com/drive/folders/15ya_CuvVZ65gjBwXqfjTd1pgqi3da8cO?usp=sharing

    opened by SolskyPan 2
  • Ground truth bayer data size is 640x640x3?

    Ground truth bayer data size is 640x640x3?

    When I load canon bayer data(im_raw.png), it has size 640x640x3 If I want to transfer it to bayer size (EX: NxNx1), should I just sample the data point in 640x640x3?

    opened by sky135410 2
  • Example on how to convert {sRGB} to {RAW BURST} please

    Example on how to convert {sRGB} to {RAW BURST} please

    Hello

    An example on what's the proper way to create a script that takes as input: str:'path_to_img.jpg' and returns as output: folder with dng files

    thanks

    opened by orilifs 1
  • How to crop raw images in training dataset?

    How to crop raw images in training dataset?

    Hi, @goutamgmb ! Thanks a lot for your wonderful work in DBSR. In the BurstSR Dataset, you mention that the cropped images in training dataset are generated from the burst images. I guess it means that you use the original raw image to crop into the resized training raw images. So my question is, how to crop the RAW image?

    Again, thanks a lot for your excellent job! Look forward to your reply :)

    opened by doooooithey 1
  • Is it possible that you could share the code of pre-processing the BurstSR dataset? Thanks!

    Is it possible that you could share the code of pre-processing the BurstSR dataset? Thanks!

    Hi, thank you for your great work. Is it possible that you could also share the code of pre-processing the BurstSR dataset, which roughly align the crops from the original images? I am doing similar research which requires taking advantage of image pairs of different views and it would be really helpful if you could share the code. Thank you.

    opened by Melody-doudou 0
  • How to crop a BurstSR Dataset with any size from BurstSR dataset (full)

    How to crop a BurstSR Dataset with any size from BurstSR dataset (full)

    Hi, @goutamgmb ! Thanks a lot for your amazing work in DBSR.

    Now I want to train a Burst-SR Model which could adapt real-world image data with larger size, like 512512, instead of 160160. So how can I crop a BurSR Dataset with any size from BurstSR dataset (full).

    If possible, could you please share your codes used to obtain pre-processed version of the BurstSR dataset that contains roughly aligned crops from the original images. If not, could you share more details about cropping and alignment to help me reproduce this part of work.

    Thank you again!

    opened by Gaojian-0523 1
  • Is there something specific about the test set in synthetic burst dataset?

    Is there something specific about the test set in synthetic burst dataset?

    After downloading the test dataset from the official website, there is actually 22G of the data. Is the 1204 images selected for the validation set specific? Is that randomly chosen or others?

    If there is no test dataset for val, here should have some changes: from:

        if split in ['train', 'test']:
              self.img_pth = os.path.join(root, split, 'canon')
    

    to:

            if split in ['train', 'test']:
                self.img_pth = os.path.join(root, 'train', 'canon')
    

    Am I right?

    opened by pokaaa 0
  • Quick Start Guide

    Quick Start Guide

    This looks like a powerful group of functions. Do you have a quick start tutorial or code example where someone can supply a set of images and see the results? I am having a hard time grasping where to start will all this great information here.

    opened by cdt59 1
  • MAGMA not initialised during training

    MAGMA not initialised during training

    Hi,

    when I train the dbsr model on the default_realworld setting I get the following error during training:

    Error in magma getdevice arch: MAGMA not initialized (call magma init() first) or bad device First, I thought this was due to multiprocessing start method, but it is already set to spawn.

    Any Ideas?

    Best, Matthias

    opened by wallematthias 3
Owner
Goutam Bhat
Goutam Bhat
The official codes of our CVPR2022 paper: A Differentiable Two-stage Alignment Scheme for Burst Image Reconstruction with Large Shift

TwoStageAlign The official codes of our CVPR2022 paper: A Differentiable Two-stage Alignment Scheme for Burst Image Reconstruction with Large Shift Pa

Shi Guo 32 Dec 15, 2022
Official implementation of Unfolded Deep Kernel Estimation for Blind Image Super-resolution.

Unfolded Deep Kernel Estimation for Blind Image Super-resolution Hongyi Zheng, Hongwei Yong, Lei Zhang, "Unfolded Deep Kernel Estimation for Blind Ima

Z80 15 Dec 26, 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
Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution

Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution Figure: Example visualization of the method and baseline as a

Oliver Hahn 16 Dec 23, 2022
The official implementation of the Interspeech 2021 paper WSRGlow: A Glow-based Waveform Generative Model for Audio Super-Resolution.

WSRGlow The official implementation of the Interspeech 2021 paper WSRGlow: A Glow-based Waveform Generative Model for Audio Super-Resolution. Audio sa

Kexun Zhang 96 Jan 3, 2023
[CVPR 2022] Official PyTorch Implementation for "Reference-based Video Super-Resolution Using Multi-Camera Video Triplets"

Reference-based Video Super-Resolution (RefVSR) Official PyTorch Implementation of the CVPR 2022 Paper Project | arXiv | RealMCVSR Dataset This repo c

Junyong Lee 151 Dec 30, 2022
Official implementation of the paper 'Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution'

DASR Paper Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution Jie Liang, Hui Zeng, and Lei Zhang. In arxiv preprint. Abs

null 81 Dec 28, 2022
Official implementation of the paper 'Details or Artifacts: A Locally Discriminative Learning Approach to Realistic Image Super-Resolution' in CVPR 2022

LDL Paper | Supplementary Material Details or Artifacts: A Locally Discriminative Learning Approach to Realistic Image Super-Resolution Jie Liang*, Hu

null 150 Dec 26, 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
PyTorch implementation of 1712.06087 "Zero-Shot" Super-Resolution using Deep Internal Learning

Unofficial PyTorch implementation of "Zero-Shot" Super-Resolution using Deep Internal Learning Unofficial Implementation of 1712.06087 "Zero-Shot" Sup

Jacob Gildenblat 196 Nov 27, 2022
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"

NTIRE2017 Super-resolution Challenge: SNU_CVLab Introduction This is our project repository for CVPR 2017 Workshop (2nd NTIRE). We, Team SNU_CVLab, (B

Bee Lim 625 Dec 30, 2022
The official pytorch implemention of the CVPR paper "Temporal Modulation Network for Controllable Space-Time Video Super-Resolution".

This is the official PyTorch implementation of TMNet in the CVPR 2021 paper "Temporal Modulation Network for Controllable Space-Time VideoSuper-Resolu

Gang Xu 95 Oct 24, 2022
Official PyTorch code for Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021)

Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021) This repository is the official P

Jingyun Liang 159 Dec 30, 2022
Official PyTorch code for Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021)

Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021) This repository is the official P

Jingyun Liang 159 Dec 30, 2022
Official PyTorch code for Mutual Affine Network for Spatially Variant Kernel Estimation in Blind Image Super-Resolution (MANet, ICCV2021)

Mutual Affine Network for Spatially Variant Kernel Estimation in Blind Image Super-Resolution (MANet, ICCV2021) This repository is the official PyTorc

Jingyun Liang 139 Dec 29, 2022
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 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
PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

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.dataloade

Sanghyun Son 2.1k Jan 1, 2023
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