/handwriting

Conditional handwriting generation in Theano

Primary LanguagePython

Conditional handwriting generation

img

Reproduces Alex Graves paper Generating Sequences With Recurrent Neural Networks.
Thanks to Jose Sotelo and Kyle Kastner for helpful discussions.

Requirements

  • Theano
  • Lasagne (just for the Adam optimizer)
  • Raccoon

Generate the data

Download the following files and unpack them in a directory named 'handwriting':

Add an environment variable $DATA_PATH containing the parent directory of 'handwriting'.

Train the model

Set an environment variable $TMP_PATH to a folder where the intermediate results, parameters, plots will be saved during training.

If you want to change the training configuration, modify the beginning of main_cond.py. Run main_cond.py. By default, it is a one-layer GRU network with 400 hidden units.
There is no ending condition, so you will have to stop training by doing ctrl+c.

It takes a few hours to train the model on a high-end GPU.

Generate sequences

Run python sample_model.py -f $TMP_PATH/handwriting/EXP_ID/f_sampling.pkl -s 'Sous le pont Mirabeau coule la Seine.' -b 0.7 -n 2 where EXP_ID is the generated id of the experiment you launched.

img