Coder Social home page Coder Social logo

ishanashastri / vsrnet_pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from usstdqq/vsrnet_pytorch

0.0 1.0 0.0 53 KB

PyTorch implementation of paper "Video super-resolution with convolutional neural networks"

License: GNU General Public License v3.0

Python 56.86% MATLAB 43.14%

vsrnet_pytorch's Introduction

VSRNet

A PyTorch implementation of VSRNet [Video super-resolution with convolutional neural networks] (https://ieeexplore.ieee.org/abstract/document/7444187/)

Requirements

conda install pytorch torchvision -c soumith
conda install pytorch torchvision cuda80 -c soumith # install it if you have installed cuda 8.0
  • PyTorchNet
pip install git+https://github.com/pytorch/tnt.git@master
  • tqdm
pip install tqdm
  • opencv
conda install -c conda-forge opencv
  • tensorboard_logger
pip install tensorboard_logger
  • h5py
conda install h5py

Datasets

Train, Val, Test Video Dataset

The train and val datasets are sampled from CDVL dataset. We choose this dataset because we want to extend single frame based SRCNN to multi frame based VSRNet.

Train dataset (uf_X, X=2,3,4) is composed of multiple h5 files:

  • Data_CDVL_LR_uf_4_ps_72_fn_5_tpn_225000.h5: patches sampled from LR frames, 225243x5x(72/X)x(72/X)
  • Data_CDVL_HR_uf_4_ps_72_fn_5_tpn_225000.h5: patches sampled from HR frames, 225243x5x72x72
  • Data_CDVL_LR_Bic_uf_4_ps_72_fn_5_tpn_225000.h5: patches sampled from Matlab bicubic interpolation upscaled frames, 225243x5x72x72
  • Data_CDVL_LR_Bic_MC_uf_4_ps_72_fn_5_tpn_225000.h5: patches sampled from Matlab bicubic interpolation upscaled and optical flow motion compensated frames, 225243x5x72x72

Val dataset (uf_X, X=2,3,4) is composed of multiple h5 files:

  • Data_CDVL_LR_uf_4_ps_72_fn_5_tpn_45000.h5: patches sampled from LR frames, 45159x5x(72/X)x(72/X)
  • Data_CDVL_HR_uf_4_ps_72_fn_5_tpn_45000.h5: patches sampled from HR frames, 45159x5x72x72
  • Data_CDVL_LR_Bic_uf_4_ps_72_fn_5_tpn_45000.h5: patches sampled from Matlab bicubic interpolation upscaled frames, 45159x5x72x72
  • Data_CDVL_LR_Bic_MC_uf_4_ps_72_fn_5_tpn_45000.h5: patches sampled from Matlab bicubic interpolation upscaled and optical flow motion compensated frames, 45159x5x72x72

Test dataset (uf_X, X=2,3,4) is composed of multiple h5 folders:

  • LR: LR frames of a scene, (1920/X)x(1080/X)x5xframe_number
  • HR: HR frames of a scene, 1920x1080x1xframe_number
  • LR_Bic: Matlab Bicubic upscaled LR frames of a scene, 1920x1080x5xframe_number
  • LR_Bic_MC: Matlab Bicubic upscaled and Celiu optical flow motion compensated LR frames of a scene, 1920x1080x5xframe_number
  • LR_MC: Celiu optical flow motion compensated LR frames of a scene, (1920/X)x(1080/X)x5xframe_number

Download the pre-processed h5 files from Dropbox here or Baidu Yun here with code: apkw , and then setup the path in the codes.

If you want to prepare your own train/val/test h5 files, please check the Matlab scripts in the matlab_pre_processing folder. Notice that you would need to install Celiu optical flow to run the Matlab code.

Test Image Dataset

The test image dataset are sampled from | Set 5 | Bevilacqua et al. BMVC 2012 | Set 14 | Zeyde et al. LNCS 2010 | BSD 100 | Martin et al. ICCV 2001 | Sun-Hays 80 | Sun and Hays ICCP 2012 | Urban 100 | Huang et al. CVPR 2015. Download the preprocessed H5 files from here, and then setup the path in test_image.py file.

Usage

Train SRCNN

SRCNN need to be trained to initialize VSRNet

python train_SRCNN.py

optional arguments:
--upscale_factor      super resolution upscale factor [default value is 4]
--num_epochs          super resolution epochs number [default value is 800]

Train VSRNet

python train_VSRNet.py

optional arguments:
--upscale_factor      super resolution upscale factor [default value is 4]
--num_epochs          super resolution epochs number [default value is 400]

Test Image

python test_image_SRCNN.py

optional arguments:
--upscale_factor      super resolution upscale factor [default value is 3]
--model_name          super resolution model name [default value is epochs_SRCNN/model_epoch_800.pth]

The output high resolution images are on results directory.

Test CDVL Video (preprocessed H5 files) using SRCNN

python test_video_CDVL_SRCNN.py

optional arguments:
--upscale_factor      super resolution upscale factor [default value is 3]
--model_name          SRCNN model name [default value is epochs_SRCNN/model_epoch_800.pth]
--is_real_time        whether to save results into video file or not [default value is False]
--delay_time          display delay time [default value is 1]

The output high resolution images are on results directory.

Test CDVL Video (preprocessed H5 files) using VSRNet

python test_video_CDVL_VSRNet.py

optional arguments:
--upscale_factor      super resolution upscale factor [default value is 3]
--vsrnet_model_name   VSRNet model name [default value is epochs_SRCNN/model_epoch_800.pth]
--srcnn_model_name    SRCNN model name [default value is epochs_SRCNN/model_epoch_800.pth]
--is_real_time        whether to save results into video file or not [default value is False]
--delay_time          display delay time [default value is 1]

The output high resolution images are on results directory.

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.