• Stars
    star
    155
  • Rank 239,368 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

"Real-Time Style Transfer" with Keras

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.

More Repositories

1

image-analogies

Generate image analogies using neural matching and blending.
Python
3,524
star
2

deepascii

Generate ASCII art with convolutional neural networks
Python
39
star
3

keras-vgg-buddy

A real pal when you want to add VGG16 to your Keras model.
Python
27
star
4

pytorch-cns

Generalized Compressed Network Search with PyTorch
Python
26
star
5

keras-visual-semantic-embedding

Mostly for using the trained weights from https://github.com/ryankiros/visual-semantic-embedding in Keras
Python
20
star
6

coolmit

Don't just commit--coolmit.
Python
11
star
7

UnityVRHands

VR hands for use in Unity3D
C#
5
star
8

doppelchat

Awful P2P video chat with React/Peer.js/webpack
JavaScript
5
star
9

hubot-drudgesiren

Hubot script that alerts a room when some serious shit is going down on drudgereport.com
CoffeeScript
4
star
10

stereo-selfie

Make a 3D picture with your webcam.
JavaScript
3
star
11

vgg-deception

Alters images to be wrongly classified by VGG16
Python
2
star
12

buttfeetdmca

What's left of ButtFeet.com
JavaScript
2
star
13

SLAK

DISRUPTIVE CHAT PROGRAM
Python
2
star
14

guyfieristarmap

Guy Fieri Star Map website
HTML
2
star
15

botbits

Some bits for building bots
Python
1
star
16

phaser-tunnel-runner

Phaser game where you run in a tunnel
JavaScript
1
star
17

bigmouth

Let BigGAN speak
Python
1
star
18

crs

Python
1
star
19

hubot-parking-cop

Bust whoever's parking in your spot
CoffeeScript
1
star
20

foldimate

Printable animations with not many frames
JavaScript
1
star
21

lolpersec

Tweets stats about how frequently people tweet "lol" on twitter
Python
1
star
22

helltower

Hell Tower: The Game
JavaScript
1
star
23

gtwittools

Some tools for making twitter-related things with gevent.
Python
1
star
24

generator-voxel-hello-world

Yeoman generator adapted from generator-webapp-watchify and voxel-hello-world
JavaScript
1
star
25

nyeat

NEAT/CPPN stuff
Python
1
star