All Projects → bhar92 → Neuralsuperresolution

bhar92 / Neuralsuperresolution

Real-time video quality improvement for applications such as video-chat using Perceptual Losses

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Neuralsuperresolution

Build Deep Learning Env With Tensorflow Python Opencv
Tutorial on how to build your own research envirorment for Deep Learning with OpenCV, Python, Tensorfow
Stars: ✭ 66 (+266.67%)
Mutual labels:  opencv, cuda
Object Detection And Location Realsensed435
Use the Intel D435 real-sensing camera to realize target detection based on the Yolov3 framework under the Opencv DNN framework, and realize the 3D positioning of the Objection according to the depth information. Real-time display of the coordinates in the camera coordinate system.ADD--Using Yolov5 By TensorRT model,AGX-Xavier,RealTime Object Detection
Stars: ✭ 36 (+100%)
Mutual labels:  opencv, cuda
Dokai
Collection of Docker images for ML/DL and video processing projects
Stars: ✭ 58 (+222.22%)
Mutual labels:  opencv, cuda
Pine
🌲 Aimbot powered by real-time object detection with neural networks, GPU accelerated with Nvidia. Optimized for use with CS:GO.
Stars: ✭ 202 (+1022.22%)
Mutual labels:  opencv, cuda
Dynamicfusion
Implementation of Newcombe et al. CVPR 2015 DynamicFusion paper
Stars: ✭ 267 (+1383.33%)
Mutual labels:  opencv, cuda
Tensorflow Cmake
TensorFlow examples in C, C++, Go and Python without bazel but with cmake and FindTensorFlow.cmake
Stars: ✭ 418 (+2222.22%)
Mutual labels:  opencv, cuda
Gocv
Go package for computer vision using OpenCV 4 and beyond.
Stars: ✭ 4,511 (+24961.11%)
Mutual labels:  opencv, cuda
Caer
High-performance Vision library in Python. Scale your research, not boilerplate.
Stars: ✭ 452 (+2411.11%)
Mutual labels:  opencv, cuda
Opencv contrib
Repository for OpenCV's extra modules
Stars: ✭ 7,085 (+39261.11%)
Mutual labels:  opencv
Cudadbclustering
Clustering via Graphics Processor, using NVIDIA CUDA sdk to preform database clustering on the massively parallel graphics card processor
Stars: ✭ 6 (-66.67%)
Mutual labels:  cuda
Arraymancer
A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends
Stars: ✭ 793 (+4305.56%)
Mutual labels:  cuda
Quickdraw
Implementation of Quickdraw - an online game developed by Google
Stars: ✭ 805 (+4372.22%)
Mutual labels:  opencv
Vivalasvenus
@viva_las_venus -- This project is to learn, teach and awareness about privacy and security in the digital life, to build a better, more open and more inclusive world together!
Stars: ✭ 16 (-11.11%)
Mutual labels:  opencv
Blocksparse
Efficient GPU kernels for block-sparse matrix multiplication and convolution
Stars: ✭ 797 (+4327.78%)
Mutual labels:  cuda
Yolo annotation tool
Annotation tool for YOLO in opencv
Stars: ✭ 17 (-5.56%)
Mutual labels:  opencv
Pyopencl
OpenCL integration for Python, plus shiny features
Stars: ✭ 790 (+4288.89%)
Mutual labels:  cuda
Numba
NumPy aware dynamic Python compiler using LLVM
Stars: ✭ 7,090 (+39288.89%)
Mutual labels:  cuda
Computer Vision
Computer vision exercise with Python and OpenCV.
Stars: ✭ 17 (-5.56%)
Mutual labels:  opencv
Wheels
Performance-optimized wheels for TensorFlow (SSE, AVX, FMA, XLA, MPI)
Stars: ✭ 891 (+4850%)
Mutual labels:  cuda
Facepixeler
A simple C# program that can automatically detect and blur faces in images. Uses OpenCV and EmguCV.
Stars: ✭ 5 (-72.22%)
Mutual labels:  opencv

Real-time Super-Resolution for Video Quality Improvement

Table of Contents:

Introduction

This repository contains a pytorch implementation of an algorithm for single image super-resolution applied to frames from a web-cam. The model uses the method described in Perceptual Losses for Real-Time Style Transfer and Super-Resolution along with Instance Normalization. The code is based on the PyTorch Example code for fast-neural-style.

The program is written in Python, and uses the Pytorch library for generating and loading the CNN models.

Examples

An example of 4x super-resolution: Shrek 4x Super-Resolution

An example of 8x super-resolution: Shrek 8x Super-Resolution

Setup Instructions

All the programs were tested on the following setup:

Training Machine details:

  • CPU: 4x Intel Core i5-7300HQ CPU with 8GB RAM
  • GPU: Nvidia GeForce GTX 1050 Ti with 4GB VRAM
  • Operating System: Ubuntu 16.04.3 LTS
  • CUDA version: release 8.0, V8.0.61
  • CuDNN: 6.0.21
  • OpenCV: 3.3.0

Note: While a good GPU will help immensely with training the networks, it is not absolutely required to evaluate these programs.

Software Installation:

OpenCV Installation

Install the recommended packages
$ sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran python2.7-dev python3.5-dev
Download OpenCV source:
$ cd ~
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip
$ unzip opencv.zip
$ cd ~
$ wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.3.0.zip
$ unzip opencv_contrib.zip
Setup the Python virtualenv:
  1. Install the latest version of pip:
$ sudo apt-get install python-pip && pip install --upgrade pip
  1. Install virtualenv and virtualenvwrapper:
$ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/.cache/pip
  1. Add the following lines to your ~/.bashrc file:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
  1. Now source your ~/.bashrc:
source ~/.bashrc
  1. Next create a virtual environment:
mkvirtualenv supres -p python3
  1. To get back into the virtualenv, just type:
workon supres
  1. Now, install numpy:
pip install numpy
Building OpenCV:
  1. Perform the cmake:
$ cd ~/opencv-3.3.0/
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D INSTALL_C_EXAMPLES=OFF \
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
      -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
      -D BUILD_EXAMPLES=ON ..
  1. Build OpenCV!
$ make -j4
  1. Now install OpenCV:
$ sudo make install
$ sudo ldconfig
  1. Some OpenCV bookkeeping:
$ cd /usr/local/lib/python3.5/site-packages/
$ ls -l

Here, you should see a file like cv2.cpython-35m-x86_64-linux-gnu.so Go ahead and bravely rename it to cv2.so:

sudo mv cv2.cpython-35m-x86_64-linux-gnu.so cv2.so
  1. Create a symlink in your virtual env:
$ cd ~/.virtualenvs/supres/lib/python3.5/site-packages/
$ ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so

Install the other dependencies:

  1. Install pytorch
pip3 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl 
pip3 install torchvision
  1. Install the other requirements
pip install -r requirements.txt

Usage

Running the live webcam demo

The code supports two scales of super-resolution: 4x and 8x. Packaged with the code are two pretrained models:

  1. saved_models/coco4x_epoch_20.model for 4x Super-Resolution
  2. saved_models/coco8x_epoch_20.model for 8x Super-Resolution

In order to run the live demo for 4x Super-Resolution, run the following command:

python super-resolution.py eval --model saved_models/coco4x_epoch_20.model --downsample-scale 4

In order to run the live demo for 8x Super-Resolution, run the following command:

python super-resolution.py eval --model saved_models/coco8x_epoch_20.model --downsample-scale 8

These are all the options available in eval mode:

$ python super-resolution.py eval --help
usage: super-resolution.py eval [-h] --model MODEL --downsample-scale
                                DOWNSAMPLE_SCALE

optional arguments:
  -h, --help            show this help message and exit
  --model MODEL         saved model to be used for super resolution
  --downsample-scale DOWNSAMPLE_SCALE
                        amount that you wish to downsample by. Default = 8

Training your own models

It is possible to train your own models with the super-resolution.py's train mode.

The packaged models were trained with MS COCO dataset. In order to download the dataset and set aside 10k images for training, please run the download_dataset.sh script.

Once downloaded, you can run the following example command to train a model for 4x Super-Resolution:

python super-resolution.py train --epochs 20 --dataset data/ --save-model-dir saved_models/ --checkpoint-model-dir checkpoints/ --downsample-scale 4

The full set of help options for train mode are as follows:

$ python super-resolution.py train --help
usage: super-resolution.py train [-h] [--epochs EPOCHS]
                                 [--batch-size BATCH_SIZE] [--dataset DATASET]
                                 --save-model-dir SAVE_MODEL_DIR
                                 [--checkpoint-model-dir CHECKPOINT_MODEL_DIR]
                                 [--lr LR] [--log-interval LOG_INTERVAL]
                                 [--checkpoint-interval CHECKPOINT_INTERVAL]
                                 [--downsample-scale DOWNSAMPLE_SCALE]

optional arguments:
  -h, --help            show this help message and exit
  --epochs EPOCHS       number of training epochs, default is 2
  --batch-size BATCH_SIZE
                        batch size for training, default is 4
  --dataset DATASET     path to training dataset, the path should point to a
                        folder containing another folder with all the training
                        images
  --save-model-dir SAVE_MODEL_DIR
                        path to folder where trained model will be saved.
  --checkpoint-model-dir CHECKPOINT_MODEL_DIR
                        path to folder where checkpoints of trained models
                        will be saved
  --lr LR               learning rate, default is 1e-3
  --log-interval LOG_INTERVAL
                        number of images after which the training loss is
                        logged, default is 500
  --checkpoint-interval CHECKPOINT_INTERVAL
                        number of batches after which a checkpoint of the
                        trained model will be created
  --downsample-scale DOWNSAMPLE_SCALE
                        amount that you wish to downsample by. Default = 8
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].