Skip to content

Fast image style transfer implemented with TensorFlow.

License

Notifications You must be signed in to change notification settings

tonypeng/tensorstyle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9d7f270 · Mar 19, 2017

History

30 Commits
Mar 19, 2017
Aug 21, 2016
Aug 21, 2016
Aug 21, 2016
Aug 21, 2016
Dec 31, 2016
Mar 19, 2017
Aug 21, 2016
Mar 15, 2017
Mar 16, 2017
Mar 16, 2017
Mar 15, 2017

Repository files navigation

tensorstyle

Fast image style transfer using TensorFlow!

Both the "slow," iterative method described in the paper A Neural Algorithm of Artistic Style by Gatys et al. and the "fast" feed-forward version described in the paper Perceptual Losses for Real-Time Style Transfer and Super-Resolution by Johnson et al. with modifications (e.g. replication border padding, instance normalization described in Instance Normalization: The Missing Ingredient for Fast Stylization by Ulyanov et al, etc.) are implemented.

To run, download the VGG-19 network into models/vgg and the COCO dataset, then edit the parameters in train.py (should be self-explanatory), then run python3 train.py. To run the iterative method, uncomment the relevant sections in the code as indicated by the comments.

Note: Minimal hyperparameter tuning was performed. You can probably get much better results by tuning the parameters (e.g. loss function coefficients, layers/layer weights, etc.).

Differences from Paper

  • ELU instead of ReLU (experimental)
  • Resize convolution layers instead of transpose convolution layers (experimental)
  • VGG-19 and content/style layers specified in Gatys et al.
  • Instance normalization for all convolutional layers including those in residual blocks
  • Output tanh activation is scaled by 150 then centered around 127.5 and clipped to [0, 255]
  • Border replication padding (reflection padding is planned)
  • Batch size 16 for 2 epochs (~10000 iterations)

Samples

White Line, Fast, Content 5:Style 85:Denoise 5

Udnie, Fast, Content 5:Style 85:Denoise 1

Red Canna, Fast, Content 5:Style 85:Denoise 5

Udnie, Fast, Content 5:Style 50:Denoise 50 (ReLU, Transpose Convolution)

A Sunday on La Grande Jatte, Slow, Content 0.005:Style 1: Denoise 1

Playing around with patterns:

License

MIT

About

Fast image style transfer implemented with TensorFlow.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages