All Projects → abhiskk → Fast Neural Style

abhiskk / Fast Neural Style

Licence: mit
pytorch implementation of fast-neural-style

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fast Neural Style

Style Transfer
A Keras Implementation of "A Neural Algorithm of Artistic Style"
Stars: ✭ 115 (-68.49%)
Mutual labels:  neural-style
MeuralPaint
TensorFlow implementation of CNN fast neural style transfer ⚡️ 🎨 🌌
Stars: ✭ 19 (-94.79%)
Mutual labels:  neural-style
neural-style-pytorch
Neural Style implementation in PyTorch! 🎨
Stars: ✭ 50 (-86.3%)
Mutual labels:  neural-style
Neural Tools
Tools made for usage alongside artistic style transfer projects
Stars: ✭ 150 (-58.9%)
Mutual labels:  neural-style
Tensorflow Fast Style Transfer
A simple, concise tensorflow implementation of fast style transfer
Stars: ✭ 224 (-38.63%)
Mutual labels:  neural-style
cs20si
My solutions to Stanford's CS20si: Tensorflow for Deep Learning Research.
Stars: ✭ 15 (-95.89%)
Mutual labels:  neural-style
Neural Style Docker
A dockerized version of neural style transfer algorithms
Stars: ✭ 100 (-72.6%)
Mutual labels:  neural-style
Fast Neural Doodle
Faster neural doodle
Stars: ✭ 339 (-7.12%)
Mutual labels:  neural-style
Neural-Tile
A better tiling script for Neural-Style
Stars: ✭ 35 (-90.41%)
Mutual labels:  neural-style
cyclegan keras
cyclegan reimplimented in keras
Stars: ✭ 18 (-95.07%)
Mutual labels:  neural-style
Tensorflowprojects
Deep learning using tensorflow
Stars: ✭ 167 (-54.25%)
Mutual labels:  neural-style
Online Neural Doodle
Feedforward neural doodle
Stars: ✭ 183 (-49.86%)
Mutual labels:  neural-style
Neural-Style-MMD
MXNet Code For Demystifying Neural Style Transfer (IJCAI 2017)
Stars: ✭ 82 (-77.53%)
Mutual labels:  neural-style
Neural Style Audio Torch
Torch implementation for audio neural style.
Stars: ✭ 130 (-64.38%)
Mutual labels:  neural-style
Neural-Zoom-Legacy
Infinite Zoom For Style Transfer
Stars: ✭ 14 (-96.16%)
Mutual labels:  neural-style
Fast Style Transfer
TensorFlow CNN for fast style transfer ⚡🖥🎨🖼
Stars: ✭ 10,240 (+2705.48%)
Mutual labels:  neural-style
Keras-Style-Transfer
An implementation of "A Neural Algorithm of Artistic Style" in Keras
Stars: ✭ 36 (-90.14%)
Mutual labels:  neural-style
Torch2coreml
Torch7 -> CoreML
Stars: ✭ 363 (-0.55%)
Mutual labels:  neural-style
Tensorflow Style Transfer
A simple, concise tensorflow implementation of style transfer (neural style)
Stars: ✭ 278 (-23.84%)
Mutual labels:  neural-style
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-90.68%)
Mutual labels:  neural-style

fast-neural-style 🌇 🚀

NOTICE: This codebase is no longer maintained, please use the codebase from pytorch examples repository available at pytorch/examples/fast_neural_style.

This repository contains a pytorch implementation of an algorithm for artistic style transfer. The algorithm can be used to mix the content of an image with the style of another image. For example, here is a photograph of a door arch rendered in the style of a stained glass painting.

The model uses the method described in Perceptual Losses for Real-Time Style Transfer and Super-Resolution along with Instance Normalization. The saved-models for examples shown in the README can be downloaded from here.

DISCLAIMER: This implementation is also a part of the pytorch examples repository. Implementation in this repository uses pretrained Caffe2 VGG whereas the pytorch examples repository implementation uses pretrained Pytorch VGG. The two VGGs have different preprocessings which results in different --content-weight and --style-weight parameters. The styled output images also look slightly different.

Requirements

The program is written in Python, and uses pytorch, scipy. A GPU is not necessary, but can provide a significant speed up especially for training a new model. Regular sized images can be styled on a laptop, desktop using saved models.

Setup the environnment

Run with virtualenv

Create a virtualenv with python3.5 or python3.6. Older versions are not supported due to a lack of compatibilty with pytorch.

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Run with Docker

Build the image:

docker build . -t fast-neural-style

Run the container:

docker run --rm --volume "$(pwd)/:/data" style eval --content-image /data/image.jpg --model /app/saved-models/mosaic.pth --output-image /data/output.jpg --cuda 0

Usage

Stylize image

python neural_style/neural_style.py eval --content-image </path/to/content/image> --model </path/to/saved/model> --output-image </path/to/output/image> --cuda 0
  • --content-image: path to content image you want to stylize.
  • --model: saved model to be used for stylizing the image (eg: mosaic.pth)
  • --output-image: path for saving the output image.
  • --content-scale: factor for scaling down the content image if memory is an issue (eg: value of 2 will halve the height and width of content-image)
  • --cuda: set it to 1 for running on GPU, 0 for CPU.

Train model

python neural_style/neural_style.py train --dataset </path/to/train-dataset> --style-image </path/to/style/image> --vgg-model-dir </path/to/vgg/folder> --save-model-dir </path/to/save-model/folder> --epochs 2 --cuda 1

There are several command line arguments, the important ones are listed below

  • --dataset: path to training dataset, the path should point to a folder containing another folder with all the training images. I used COCO 2014 Training images dataset [80K/13GB] (download).
  • --style-image: path to style-image.
  • --vgg-model-dir: path to folder where the vgg model will be downloaded.
  • --save-model-dir: path to folder where trained model will be saved.
  • --cuda: set it to 1 for running on GPU, 0 for CPU.

Refer to neural_style/neural_style.py for other command line arguments.

Models

Models for the examples shown below can be downloaded from here or by running the script download_styling_models.sh.


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