nishchaychawla / fast_neural_style_transfer

Neural Style transfer with webcam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast Style Transfer in Pytorch!

An implementation of fast-neural-style in PyTorch! Style Transfer learns the aesthetic style of a style image, usually an art work, and applies it on another content image. This repository contains codes the can be used for:

  1. image-to-video aesthetic style transfer, and for
  2. training style-learning transformation network

This implemention follows the style transfer approach outlined in Perceptual Losses for Real-Time Style Transfer and Super-Resolution paper by Justin Johnson, Alexandre Alahi, and Fei-Fei Li, along with the supplementary paper detailing the exact model architecture of the mentioned paper. The idea is to train a separate feed-forward neural network (called Transformation Network) to transform/stylize an image and use backpropagation to learn its parameters, instead of directly manipulating the pixels of the generated image as discussed in A Neural Algorithm of Artistic Style aka neural-style paper by Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. The use of feed-forward transformation network allows for fast stylization of images, around 1000x faster than neural style.

The original caffe pretrained weights of VGG16 were used for this implementation, instead of the pretrained VGG16's in PyTorch's model zoo.

Webcam Demo

Webcam Demo

Requirements

Most of the codes here assume that the user have access to CUDA capable GPU, at least a GTX 1050 ti or a GTX 1060

Data Files

Dependecies

python webcam.py -m model_path

Options

  • n : next model
  • q: quit
  • y: capture image

Files and Folder Structure

master_folder
 ~ dataset 
    ~ orignal_images
        *.jpg
        
 ~ images
    ~ out
        *.jpg
      *.jpg
    ~ capture
 ~ models
    *.pth
 ~ transforms
    *.pth
 ~ model_path
    *.pth
 *.py

Todo!

  • Web-app deployment of fast-neural-style (ONNX)

Attribution

This implementation borrows markdown content, formatting and many implementation details from:

About

Neural Style transfer with webcam


Languages

Language:Python 100.0%