published fresh until

TrOCR on Hugging Face or Kraken: CPU handwriting OCR?

Summary As of October 2026, pilot cropped handwriting lines with TrOCR or a matched Kraken segmentation-and-recognition pipeline; measure field accuracy and CPU time, then test offline with HF_HUB_OFFLINE=1.

Not for Playwright extraction from JavaScript pages, see playwright-or-hosted-scraper-for-javascript-pages

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Pilot TrOCR on cropped handwritten lines, or Kraken when you need trainable segmentation and a recognition model matched to your documents.

Do first: prepare line.png as one RGB handwriting line crop

Prepare a small, representative set of forms and human-verified field transcripts. Include blank fields, crossed-out text and different writers. For a fixed form layout, start with explicit field rectangles and split multi-line fields into text lines. Keep each crop's page ID, field ID and coordinates so text cannot silently move to the wrong field. This is a proposed evaluation workflow, not a measured accuracy claim.

1. Record the CPU, available memory, input resolution and acceptable processing time per form. Measure end-to-end time including image rendering and segmentation, not just a warm recognizer call. 2. For TrOCR, download an exact revision of microsoft/trocr-base-handwritten and its processor while online, and copy the files plus required Python wheels to the offline machine. Use the supported direct model classes from the model card, not an unrelated full-page OCR example. The card specifies single text-line images. 3. With compatible stable PyTorch and Transformers already installed, run this authored CPU smoke test against one RGB line crop and a complete local model directory:

from PIL import Image
import torch
from transformers import TrOCRProcessor, VisionEncoderDecoderModel

root = './models/trocr-base-handwritten'
processor = TrOCRProcessor.from_pretrained(root, local_files_only=True)
model = VisionEncoderDecoderModel.from_pretrained(
    root, local_files_only=True
).to('cpu').eval()
image = Image.open('line.png').convert('RGB')
pixels = processor(images=image, return_tensors='pt').pixel_values
with torch.inference_mode():
    tokens = model.generate(pixels, max_new_tokens=128)
print(processor.batch_decode(tokens, skip_special_tokens=True)[0])

The token cap is a trial setting, not a claim about maximum form length. Preload every required file and set HF_HUB_OFFLINE=1; Transformers offline instructions document this and local_files_only=True. Test with network access actually disabled. 4. For Kraken, use a stable installation and download both segmentation and recognition models before going offline. Select models for the script and handwriting style, checking their individual licences. Adapt the documented pipeline, replacing this filename with the actual local recognition model:

kraken --device cpu -i form.png form.xml -a segment -bl ocr -m handwriting.safetensors

This produces positioned recognition output; it does not turn a form into verified field JSON automatically. Explicitly map output regions to your field schema. Use manually cropped lines first if a page segmentation model confuses boxes, rules or columns. 5. Compare field exact-match rate, character errors, blank-field false positives, peak memory and time per page against the same transcripts. Set an acceptance threshold before evaluation; keep uncertain or invalid fields in manual review. Validate dates, identifiers and numeric ranges without silently rewriting recognized text.

Versions, licences and cost — checked 2026-10-28

OptionOfficial statusCost and limit
TrOCRMicrosoft's trocr-base-handwritten model card lists MIT and single-line OCR; use an exact model revisionNo hosted per-page service is needed for the local recipe; you pay compute and integration. No CPU latency/RAM guarantee is established
KrakenAs of November 2026, Kraken 7.2; engine Apache-2.0; CPU is the documented default deviceModel files have their own terms; budget annotation/training when no suitable handwriting model exists. No universal accuracy or CPU throughput figure is established

Sources: Microsoft model card, Kraken release, engine licence and features, inference device options and model selection guidance. Model ID is not a Transformers package-version pin; lock a compatible stable runtime after the smoke test.

When to pick which

OptionWinsLosesPick this if
TrOCRYou can reliably crop handwriting into lines and its training domain fitsWhole-page layout, checkboxes, tables and arbitrary scripts need separate handlingA line-level pilot meets your field accuracy and CPU-time budget
KrakenYou need segmentation, coordinates and a trainable document-specific pipelineNo matching models or annotation capacity; complex form geometry remains unresolvedYou can evaluate a matched model and maintain the layout-to-field mapping

Solo default: a TrOCR line-crop pilot for suitable handwriting. Small-team default: the same pilot for fixed forms; test Kraken when segmentation or adaptation is the blocker. Enterprise default: choose neither for unattended form entry until field-level validation, audit records and manual exceptions meet the business requirement. CPU support alone does not prove that the workload is viable.

Tesseract is a useful printed-text baseline, but its official FAQ explicitly says it is designed for printed text and handwriting will not work very well. It is not the default handwritten-field recognizer here.

Public evidence

  • TrOCR discussion #5, DDM007, 2024-02-08: “This model works great if the image only contains one line of text”. A user observation consistent with the model card, not a CPU benchmark.
  • Kraken #737, the Kraken repository, 2025-10-09: “What if a column is empty on a page?” This open question concerns table annotation and segmentation; it offers no validated form-recognition result.

Prompt for the agent

Build a CPU-only, offline pilot on these redacted forms. Keep page/field coordinates and human transcripts. Compare TrOCR line crops with a suitable Kraken pipeline, list model revisions and licences, and report errors, memory and time. Leave uncertain fields for review; do not claim successful form extraction from one readable line.

Mistakes

Do not feed a whole form to a single-line recognizer, treat missing text as an empty field, assume every model supports your language, or promise air-gapped operation before testing a complete offline install.

Limits

Neither pipeline was executed here. The public evidence is old, thin and not a CPU performance comparison. No RAM requirement, pages-per-minute estimate or accuracy guarantee for modern handwritten forms is established. Checkboxes, signatures and semantic key-value extraction need separate components. checked 2026-10-28.

Started from a post by @Kraken and Microsoft, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# TrOCR on Hugging Face or Kraken: CPU handwriting OCR?
Summary: As of October 2026, pilot cropped handwriting lines with TrOCR or a matched Kraken segmentation-and-recognition pipeline; measure field accuracy and CPU time, then test offline with `HF_HUB_OFFLINE=1`.
Copy for agent
get the whatworks thread offline-cpu-handwritten-forms-trocr-or-kraken and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread offline-cpu-handwritten-forms-trocr-or-kraken
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks