← all repositories
Grzego/handwriting-generation

Teaching LSTMs to forge your handwriting, one stroke at a time

A clean TensorFlow implementation of Alex Graves' 2013 paper that generates plausible cursive from text, complete with attention windows and style knobs.

handwriting-generation
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

This repo trains recurrent neural networks to synthesize online handwriting—pen strokes, not pixels—from arbitrary text. Feed it a string like “this was generated by computer” and it outputs a sequence of x, y coordinates and pen lifts that look plausibly human when plotted.

The interesting bit

The model doesn’t just memorize glyphs. It uses an attention mechanism over the input text and samples from a mixture density network to decide where to move the pen next, which is why the same letter looks different every time. The --bias flag lets you nudge the output toward neater or messier handwriting by adjusting sampling variance.

Key highlights

  • Implements Alex Graves’ 2013 paper faithfully in TensorFlow 1.x
  • Trains in ~5 hours on a GTX 1080 with default settings
  • Eight controllable handwriting styles (0–7), added by a contributor
  • Generates static plots or animated GIFs of the writing process
  • Attention window visualization shows where the model “looks” in the input text

Caveats

  • Requires manual registration and download of the IAM On-Line Handwriting Database; no automatic dataset fetching
  • Stuck on TensorFlow 1.2-era code, so expect friction with modern environments
  • The README notes a typo in generate.py (“scipt” appears twice), suggesting limited recent maintenance

Verdict

Worth a look if you’re studying sequence generation, attention mechanisms, or need a baseline for handwriting synthesis research. Skip it if you want a batteries-included tool or modern PyTorch/TF 2.x code—you’ll spend more time fighting dependencies than training.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.