Git Product home page Git Product logo

keras-rtst's Introduction

Real-Time Style Transfer with Keras

Brick nuke gif

This is an attempt at implementing something like Real-Time Style Transfer with the Keras framework.

Install

  • pip install keras-rtst
  • Download pre-trained VGG16 weights You'll need to pass its path as a parameter to the scripts.
  • Training currently only supported on Theano backend, but texturing can be done with either.

Usage

After installation you'll find train-rtst.sh, render-rtst.sh and rtst.py on your path. The shell scripts are just wrappers around rtst.py to demonstrate usage and maybe be a little convenient. There's also a script rtst-download-training-images.sh that will download a small batch of images randomly selected from a subset of ImageNet 2012.

Examples

There's an examples folder. Example of an example:

Train a brick texturizer: ./make-example-texturizer.sh bricks0 path/to/training/images path/to/evaluation/images path/to/vgg16/weights.h5

Texturize a gif with that brick texturizer: VGG_WEIGHTS=/path/to/vgg.h5 ./texturize-gif.sh path/to/your.gif bricks0 out/bricks0gif

Differences from the paper

  • This code doesn't use strided convolutions for upsampling as it doesn't seem to be implemented in Keras/Theano.
  • The learning rate starts at 0.1 and decays at a rate of 0.9 every 200 iterations until it reaches 0.001.
  • Also similarly to "Texture Networks" I'm using a really small training set.
  • I've added MRFRegularizer and AnalogyRegularizer which add losses for patch-wise markov random fields and image analogies. Use --style-map-path=/your/image.jpg to specify "image A" in image analogy parlance (--style-path corresponds to "Image A prime")
  • --model=girthy adds a series of residual blocks at each depth instead of just the bottom-most scale. Set maximum depth with --depth and the peak number of convolution filters with --num-res-filters. The number of filters is halved at each larger scale.

keras-rtst's People

Contributors

awentzonline avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.