Git Product home page Git Product logo

handwriting-generation's Introduction

Handwriting generation

Implementation of handwriting generation with use of recurrent neural networks in tensorflow. Based on Alex Graves paper (https://arxiv.org/abs/1308.0850).

How to train a model and generate handwriting

1. Download dataset

First you need to download dataset. This requires you to register on this page ("Download" section). After registration you will be able to download the data/original-xml-part.tar.gz. Unpack it in repository directory.

2. Preprocess dataset

python preprocess.py

This scipt searches local directory for xml files with handwriting data and does some preprocessing like normalizing data and spliting strokes in lines. As a result it should create data directory with preprocessed dataset.

3. Train model

python train.py

This will launch training with default settings (for experimentation look at argparse options). By default it creates summary directory with separate experiment directories for each run. If you want to restore training provide a path to the experiment you want to continue. Like:

python train.py --restore=summary\experiment-0

You can lookup losses in command line or with tensorboard. Example loss plot:

Loss plot

With default settings training took about 5h (using tensorflow 1.2, with GTX 1080).

4. Generate handwriting!

python generate.py --model=path_to_model

When model is trained you can use generate.py scipt to test how it works. Without providing --text argument this script will ask you what to generate in a loop.

Additional options for generation:

  • --bias (float) - with higher bias generated handwriting is more clear so to speak (read paper for more info)
  • --noinfo - plots only generated handwriting (without attention window)
  • --animation - animation of writing
  • --style - style of handwriting, int from 0 to 7 (functionality added thanks to @kristofbc, you can look how each style looks like in imgs folder)

Examples

python generate.py --noinfo --text="this was generated by computer" --bias=1.

example-1

python generate.py --noinfo --animation --text="example of animation " --bias=1.

example-2

Any feedback is welcome ๐Ÿ˜„

handwriting-generation's People

Contributors

grzego avatar kristofbc 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.