← all repositories
Belval/TextRecognitionDataGenerator

Procedural text images for OCR training, no scanner required

TextRecognitionDataGenerator synthesizes labeled text images—complete with blur, skew, and noisy backgrounds—so you can train OCR models without manually scanning documents.

3.7k stars Python Data ToolingComputer Vision
TextRecognitionDataGenerator
Not currently ranked — collecting fresh signals.
star history

What it does

It procedurally generates labeled images of text for training OCR systems. You feed it dictionaries, strings, or Wikipedia snippets, and it renders them as images with randomized fonts, backgrounds, and distortions like skewing and Gaussian blur. It works as both a command-line tool and a set of Python generators you can embed directly in a training pipeline.

The interesting bit

The generator treats realism as a dial, not a default: you can crank up blur, distortion, or quasicrystal backgrounds to simulate terrible scanners, or keep it clean for baseline testing. It also supports non-Latin scripts including Chinese, Japanese, Korean, and Thai, and can even spit out character-level segmentation masks if you need pixel-perfect labels.

Key highlights

  • Ships with four generator classes (GeneratorFromDict, GeneratorFromRandom, GeneratorFromStrings, GeneratorFromWikipedia) for pipeline integration.
  • Supports Latin, Chinese (simplified and traditional), Japanese, Korean, and Thai text out of the box.
  • Background options include Gaussian noise, plain white, quasicrystal patterns, and random image overlays.
  • Optional handwritten-style output via an experimental TensorFlow-based model; the core tool runs without TensorFlow if you skip that feature.
  • Exposes knobs for stroke width, character spacing, text orientation, margins, and per-character masks.

Caveats

  • Handwritten generation is marked experimental, and the authors note that both background and handwritten generation need improvement.
  • Only .ttf fonts are supported, so you may need to convert typefaces before adding new languages.
  • Adding a new non-Latin language requires manually editing run.py to register the font folder.

Verdict

Worth a look if you are building or fine-tuning an OCR model and need bulk labeled images faster than you can photograph receipts. Skip it if you already have a pristine, perfectly annotated real-world dataset and no interest in synthetic augmentation.

Frequently asked

What is Belval/TextRecognitionDataGenerator?
TextRecognitionDataGenerator synthesizes labeled text images—complete with blur, skew, and noisy backgrounds—so you can train OCR models without manually scanning documents.
Is TextRecognitionDataGenerator open source?
Yes — Belval/TextRecognitionDataGenerator is open source, released under the MIT license.
What language is TextRecognitionDataGenerator written in?
Belval/TextRecognitionDataGenerator is primarily written in Python.
How popular is TextRecognitionDataGenerator?
Belval/TextRecognitionDataGenerator has 3.7k stars on GitHub.
Where can I find TextRecognitionDataGenerator?
Belval/TextRecognitionDataGenerator is on GitHub at https://github.com/Belval/TextRecognitionDataGenerator.

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