Skip to content
プロジェクト

Grzego/handwriting-generation

GitHubで見る

概要

TensorFlow で再帰型ニューラルネットワークを使って手書き文字を生成する実装です。Alex Graves の論文(https://arxiv.org/abs/1308.0850)に基づいています。

システム・インフラ

この数値の測り方

計測したスター増加

24時間
-1
7日間
-1
15日間
-1
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

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 :smile:

関連プロジェクトを探す

読み込み中…