Guide · OCR training data

Build OCR training data you can explain

Create varied documents with clean source text, word annotations and controlled delivery conditions. Save the recipe, organize train/test splits and export labels for your OCR workflow.

What the dataset contains

Start from authored documents and preserve the source

V2 automatically varies purpose-specific content and layouts across your selected document types. It records clean source text before applying rendering or delivery changes. A run writes manifest.jsonl, canonical annotations, page images for PDFs, source text sidecars when needed, and a dataset_recipe.json for replay.

The catalog has 33 separate generators: 28 PDF types and five native formats. The native types are DOCX, XLSX, EML, CSV, and plain text. Native output is useful for file-container or preview tests; it retains its native format and is not admitted to the current parser scorer.

A reproducible run

Generate a labeled training set

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type invoice letter --count 3 --seed 42 --output output/ocr-train-small --export coco layoutlm funsd docvqa --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type invoice letter --count 3 --seed 42 --output output/ocr-train-small --export coco layoutlm funsd docvqa --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type invoice letter --count 3 --seed 42 --output output/ocr-train-small --export coco layoutlm funsd docvqa --validate

This requests three invoices plus three letters. The exports are derived from the canonical annotations and are written under exports/. --validate re-reads the manifest and annotations and checks the requested export references. Use a fresh destination for a new dataset.

For one of every document type, choose Select all in the desktop app and set the quantity to 1. For a planned mix, use Advanced options → Run a prepared suite… or the command line. Counts apply to each selected type.

What “quality” means here

Measure generated text corruption separately from OCR accuracy

Generation target

--quality sets a 0–100 text-quality target. Quality 100 keeps the text clean; lower values introduce character errors measured against the original source text.

Parser result

OCR accuracy is measured only after a parser receives a neutral bundle and returns predictions. The evaluator reports CER/WER for a supported task. A quality value is not a vendor score, and a valid export is not a parser benchmark.

For a matched study, use a paired SuiteSpec at quality 100 and vary delivery conditions such as image-only or scan presets. Use a mixture suite when you need visible character corruption. Scan transforms can change page geometry. Use delivered boxes with delivered images, and inspect source-to-delivered token alignments when visible substitutions are part of the test.

Choose an export

Match the representation to the consumer

ExportWhat it providesUse it for
COCOPage images and word objects with pixel-space boxes, text, categories, and split metadata.Word/text detection experiments.
LayoutLMOne JSONL record per page with tokens, 0–1000 normalized boxes, labels, image path, and split.Token classification loaders that expect page records.
FUNSD-shapedWord roles and key/value links derived from generated annotations, with normalized boxes.Form-understanding loader or schema integration tests.
DocVQA-shapedDocument-type and grounded printed-field questions that the adapter can actually answer.Question schema plumbing; see the coverage limit below.

COCO and LayoutLM use delivered pages when a run has a delivered rendition. FUNSD and DocVQA retain pristine source semantics and geometry. Label Studio is available as --export labelstudio and has its own review workflow.

Limitations to plan around

Generation is broader than evaluation

  • The generator can create all 33 types and native previews, but parser evaluation currently admits supported PDF inputs at quality 100, including clean, image-only, and current scan presets. Native files, visible corruption, corrupt hidden text, watermarks, Bates overlays, and table extraction are outside that scorer.
  • Document splits are deterministic and keep source, fixture, linked-case, and packet relationships together. They do not guarantee unseen scenarios or writing styles across train and test.
  • Coherent business content has grounded scalar targets for the fields task. The current DocVQA adapter does not turn every content target into a question.
  • For exact recipe replay, keep the same application build and resources. Byte-for-byte output can differ between builds.

Continue with a concrete workflow

Start with the first run, then use SuiteSpec preflight for paired data and the evaluator guide when a parser must be scored. For delivery-specific examples, see degraded datasets and OCR test documents.