• Stars
    star
    238
  • Rank 169,306 (Top 4 %)
  • Language
    Jupyter Notebook
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Realistic Handwriting with Tensorflow

Scribe: Realistic Handwriting in Tensorflow

See blog post

Samples

"A project by Sam Greydanus" Sample output 1 "You know nothing Jon Snow" (print) Sample output 2 "You know nothing Jon Snow" (cursive) Sample output 3

"lowering the bias" Sample output 4 "makes the writing messier" Sample output 5 "but more random" Sample output 6

Jupyter Notebooks

For an easy intro to the code (along with equations and explanations) check out these Jupyter notebooks:

Getting started

  • install dependencies (see below).
  • download the repo
  • navigate to the repo in bash
  • download and unzip folder containing pretrained models: Google Drive link
    • place in this directory

Now you have two options:

  1. Run the sampler in bash: mkdir -p ./logs/figures && python run.py --sample --tsteps 700
  2. Open the sample.ipynb jupyter notebook and run cell-by-cell (it includes equations and text to explain how the model works)

About

This model is trained on the IAM handwriting dataset and was inspired by the model described by the famous 2014 Alex Graves paper. It consists of a three-layer recurrent neural network (LSTM cells) with a Gaussian Mixture Density Network (MDN) cap on top. I have also implemented the attention mechanism from the paper which allows the network to 'focus' on character at a time in a sequence as it draws them.

The model at one time step looks like this

Rolled model

Unrolling in time, we get Unrolled model

I've implemented the attention mechanism from the paper: Attention mechanism

Dependencies

  • All code is written in python 2.7. You will need:
  • Numpy
  • Matplotlib
  • TensorFlow 1.0
  • OPTIONAL: Jupyter (if you want to run sample.ipynb and dataloader.ipynb)

More Repositories

1

hamiltonian-nn

Code for our paper "Hamiltonian Neural Networks"
Jupyter Notebook
412
star
2

baby-a3c

A high-performance Atari A3C agent in 180 lines of PyTorch
Python
164
star
3

crypto-rnn

Learning the Enigma with Recurrent Neural Networks
Jupyter Notebook
156
star
4

visualize_atari

Code for our paper "Visualizing and Understanding Atari Agents" (https://goo.gl/AMAoSc)
Jupyter Notebook
115
star
5

mnist1d

A 1D analogue of the MNIST dataset for measuring spatial biases and answering Science of Deep Learning questions.
Jupyter Notebook
97
star
6

pythonic_ocr

A convolutional neural network implemented in pure numpy.
Python
68
star
7

excitationbp

Visualizing how deep networks make decisions
Jupyter Notebook
63
star
8

dnc

Differentiable Neural Computer in TensorFlow
Jupyter Notebook
29
star
9

optimize_wing

We simulate a wind tunnel, place a rectangular occlusion in it, and then use gradient descent to turn the occlusion into a wing.
Python
26
star
10

psi0nn

A neural network quantum ground state solver
Jupyter Notebook
26
star
11

ncf

Nature's Cost Function (NCF). Finding paths of least action with gradient descent.
Jupyter Notebook
12
star
12

greydanus.github.io

My academic blog
HTML
11
star
13

structural_optimization

Coding structural optimization, from scratch, in 200 lines of Python
Python
10
star
14

stereograms

Code for playing with random dot stereograms.
Jupyter Notebook
9
star
15

mr_london

A LSTM recurrent neural network implemented in pure numpy
Python
7
star
16

mnist-gan

Generative Adversarial Networks for the MNIST dataset
Jupyter Notebook
6
star
17

rlzoo

A central location for my reinforcement learning experiments
Jupyter Notebook
5
star
18

subspace-nn

Optimizing neural networks in subspaces
Jupyter Notebook
5
star
19

np_nets

Neural network experiments written purely in numpy
Jupyter Notebook
4
star
20

fractal_tree

A numerical model of fractal dynamics
Jupyter Notebook
4
star
21

studying_growth

Studying Cell Growth with Neural Cellular Automata
Python
4
star
22

piecewise_node

Temporal abstraction for autoregressive sampling
Python
3
star
23

regularization

I use a one-layer neural network trained on the MNIST dataset to give an intuition for how common regularization techniques affect learning.
Jupyter Notebook
3
star
24

dlfun

Forays into the world of deep learning using TensorFlow
Jupyter Notebook
2
star
25

compton

Exploring the quantum nature of light with compton scattering
Jupyter Notebook
2
star
26

friendly_qlearning

Exploring social behavior with qLearning agents
JavaScript
1
star
27

deep_thesaurus

Use a pretrained NLP model to rank thesaurus suggestions
HTML
1
star
28

artiste

The idea here was to teach an RNN to draw, pixel by pixel, over a template image using DDPG
Jupyter Notebook
1
star
29

baselines

Simple MNIST baselines for 1) numpy backprop 2) dense nns 3) cnns 3) seq2seq
Jupyter Notebook
1
star
30

billiards

A simple RL environment for studying planning.
Jupyter Notebook
1
star