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:
image-to-video
aesthetic style transfer, and for- 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.
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
- Pre-trained VGG16 network weights - put it in
models/
directory - Specs Of Faces - 57MB - put
orignal_images
directory indataset/
directory - torchvision -
torchvision.models
contains the VGG16 and VGG19 model skeleton
python webcam.py -m model_path
Options
n
: next modelq
: quity
: capture image
master_folder
~ dataset
~ orignal_images
*.jpg
~ images
~ out
*.jpg
*.jpg
~ capture
~ models
*.pth
~ transforms
*.pth
~ model_path
*.pth
*.py
- Web-app deployment of fast-neural-style (ONNX)
This implementation borrows markdown content, formatting and many implementation details from:
- Rusty Mina's fast-neural-style in Torch, and
- the PyTorch Team's PyTorch Examples: fast-neural-style