All Projects β†’ lengstrom β†’ Fast Style Transfer

lengstrom / Fast Style Transfer

TensorFlow CNN for fast style transfer ⚑πŸ–₯πŸŽ¨πŸ–Ό

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Fast Style Transfer

neural-style-pytorch
Neural Style implementation in PyTorch! 🎨
Stars: ✭ 50 (-99.51%)
Mutual labels:  style-transfer, neural-style
Neural Style Audio Tf
TensorFlow implementation for audio neural style.
Stars: ✭ 413 (-95.97%)
Mutual labels:  style-transfer, neural-style
Neural-Zoom-Legacy
Infinite Zoom For Style Transfer
Stars: ✭ 14 (-99.86%)
Mutual labels:  style-transfer, neural-style
Neural-Tile
A better tiling script for Neural-Style
Stars: ✭ 35 (-99.66%)
Mutual labels:  style-transfer, neural-style
Adain Style
Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization
Stars: ✭ 1,049 (-89.76%)
Mutual labels:  style-transfer, neural-style
MeuralPaint
TensorFlow implementation of CNN fast neural style transfer ⚑️ 🎨 🌌
Stars: ✭ 19 (-99.81%)
Mutual labels:  style-transfer, neural-style
Mace Models
Mobile AI Compute Engine Model Zoo
Stars: ✭ 329 (-96.79%)
Mutual labels:  neural-networks, style-transfer
Neural Tools
Tools made for usage alongside artistic style transfer projects
Stars: ✭ 150 (-98.54%)
Mutual labels:  style-transfer, neural-style
Py Style Transfer
🎨 Artistic neural style transfer with tweaks (pytorch).
Stars: ✭ 23 (-99.78%)
Mutual labels:  neural-networks, style-transfer
Tensorflow 101
TensorFlow 101: Introduction to Deep Learning for Python Within TensorFlow
Stars: ✭ 642 (-93.73%)
Mutual labels:  neural-networks, style-transfer
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-98.69%)
Mutual labels:  neural-networks, style-transfer
Torch Models
Stars: ✭ 65 (-99.37%)
Mutual labels:  style-transfer, neural-style
Tensorflow Fast Style Transfer
A simple, concise tensorflow implementation of fast style transfer
Stars: ✭ 224 (-97.81%)
Mutual labels:  style-transfer, neural-style
Keras-Style-Transfer
An implementation of "A Neural Algorithm of Artistic Style" in Keras
Stars: ✭ 36 (-99.65%)
Mutual labels:  style-transfer, neural-style
Faststyle
Tensorflow implementation of fast neural style transfer.
Stars: ✭ 170 (-98.34%)
Mutual labels:  style-transfer, neural-style
Tensorflow Style Transfer
A simple, concise tensorflow implementation of style transfer (neural style)
Stars: ✭ 278 (-97.29%)
Mutual labels:  style-transfer, neural-style
Style Transfer
A Keras Implementation of "A Neural Algorithm of Artistic Style"
Stars: ✭ 115 (-98.88%)
Mutual labels:  style-transfer, neural-style
Neural Style Audio Torch
Torch implementation for audio neural style.
Stars: ✭ 130 (-98.73%)
Mutual labels:  style-transfer, neural-style
Neural Style Pt
PyTorch implementation of neural style transfer algorithm
Stars: ✭ 456 (-95.55%)
Mutual labels:  style-transfer, neural-style
Cyclegan Qp
Official PyTorch implementation of "Artist Style Transfer Via Quadratic Potential"
Stars: ✭ 59 (-99.42%)
Mutual labels:  neural-networks, style-transfer

Fast Style Transfer in TensorFlow

Add styles from famous paintings to any photo in a fraction of a second! You can even style videos!

It takes 100ms on a 2015 Titan X to style the MIT Stata Center (1024Γ—680) like Udnie, by Francis Picabia.

Our implementation is based off of a combination of Gatys' A Neural Algorithm of Artistic Style, Johnson's Perceptual Losses for Real-Time Style Transfer and Super-Resolution, and Ulyanov's Instance Normalization.

Sponsorship

Please consider sponsoring my work on this project!

License

Copyright (c) 2016 Logan Engstrom. Contact me for commercial use (or rather any use that is not academic research) (email: engstrom at my university's domain dot edu). Free for research use, as long as proper attribution is given and this copyright notice is retained.

Video Stylization

Here we transformed every frame in a video, then combined the results. Click to go to the full demo on YouTube! The style here is Udnie, as above.

See how to generate these videos here!

Image Stylization

We added styles from various paintings to a photo of Chicago. Click on thumbnails to see full applied style images.



Implementation Details

Our implementation uses TensorFlow to train a fast style transfer network. We use roughly the same transformation network as described in Johnson, except that batch normalization is replaced with Ulyanov's instance normalization, and the scaling/offset of the output tanh layer is slightly different. We use a loss function close to the one described in Gatys, using VGG19 instead of VGG16 and typically using "shallower" layers than in Johnson's implementation (e.g. we use relu1_1 rather than relu1_2). Empirically, this results in larger scale style features in transformations.

Virtual Environment Setup (Anaconda) - Windows/Linux

Tested on

Spec
Operating System Windows 10 Home
GPU Nvidia GTX 2080 TI
CUDA Version 11.0
Driver Version 445.75

Step 1:Install Anaconda

https://docs.anaconda.com/anaconda/install/

Step 2:Build a virtual environment

Run the following commands in sequence in Anaconda Prompt:

conda create -n tf-gpu tensorflow-gpu=2.1.0
conda activate tf-gpu
conda install jupyterlab
jupyter lab

Run the following command in the notebook or just conda install the package:

!pip install moviepy==1.0.2

Follow the commands below to use fast-style-transfer

Documentation

Training Style Transfer Networks

Use style.py to train a new style transfer network. Run python style.py to view all the possible parameters. Training takes 4-6 hours on a Maxwell Titan X. More detailed documentation here. Before you run this, you should run setup.sh. Example usage:

python style.py --style path/to/style/img.jpg \
  --checkpoint-dir checkpoint/path \
  --test path/to/test/img.jpg \
  --test-dir path/to/test/dir \
  --content-weight 1.5e1 \
  --checkpoint-iterations 1000 \
  --batch-size 20

Evaluating Style Transfer Networks

Use evaluate.py to evaluate a style transfer network. Run python evaluate.py to view all the possible parameters. Evaluation takes 100 ms per frame (when batch size is 1) on a Maxwell Titan X. More detailed documentation here. Takes several seconds per frame on a CPU. Models for evaluation are located here. Example usage:

python evaluate.py --checkpoint path/to/style/model.ckpt \
  --in-path dir/of/test/imgs/ \
  --out-path dir/for/results/

Stylizing Video

Use transform_video.py to transfer style into a video. Run python transform_video.py to view all the possible parameters. Requires ffmpeg. More detailed documentation here. Example usage:

python transform_video.py --in-path path/to/input/vid.mp4 \
  --checkpoint path/to/style/model.ckpt \
  --out-path out/video.mp4 \
  --device /gpu:0 \
  --batch-size 4

Requirements

You will need the following to run the above:

  • TensorFlow 0.11.0
  • Python 2.7.9, Pillow 3.4.2, scipy 0.18.1, numpy 1.11.2
  • If you want to train (and don't want to wait for 4 months):
    • A decent GPU
    • All the required NVIDIA software to run TF on a GPU (cuda, etc)
  • ffmpeg 3.1.3 if you want to stylize video

Citation

  @misc{engstrom2016faststyletransfer,
    author = {Logan Engstrom},
    title = {Fast Style Transfer},
    year = {2016},
    howpublished = {\url{https://github.com/lengstrom/fast-style-transfer/}},
    note = {commit xxxxxxx}
  }

Attributions/Thanks

  • This project could not have happened without the advice (and GPU access) given by Anish Athalye.
    • The project also borrowed some code from Anish's Neural Style
  • Some readme/docs formatting was borrowed from Justin Johnson's Fast Neural Style
  • The image of the Stata Center at the very beginning of the README was taken by Juan Paulo

Related Work

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