Skip to main content

GOCR — schnelle, kleine deutsche OCR-/Vision-Schicht für Dokumente (CPU, kein GPU): ganzes Dokument → Text + Position (bbox) als JSON. Bilder + PDF.

Project description

GOCR — schnelle, kleine deutsche OCR-/Vision-Schicht (CPU)

Liest ein ganzes Dokument zu Text + Position (bbox) als strukturiertes JSON — ~30 MB, reine CPU, kein GPU. Gedacht als OCR-/Vision-Schicht für (text-only) LLM-Pipelines und als Tooling: präzise Layout-Boxen + Text rein → dein LLM macht Verständnis/Extraktion.

pip install g-ocr           # Bilder: png/jpg/webp/tiff/bmp ...
pip install "g-ocr[pdf]"    # + PDF-Support (optionales Plugin)
import g_ocr
ocr = g_ocr.from_pretrained()
res = ocr.read("dokument.png")            # ein Bild      -> {text, regions:[{text, box, quad, score}]}
doc = ocr.read_document("rechnung.pdf")   # PDF/mehrseitig -> {n_pages, pages:[...], text}

Node / JavaScript (npm install g-ocr):

const gocr = require("g-ocr");
const ocr = await gocr.fromPretrained();
const res = await ocr.read("dokument.png");   // { text, regions:[{ text, box, quad, score }] }

Stärken

  • 🎯 Präzise Bounding-Boxes, ganzes Dokument, Lesereihenfolge → strukturiertes JSON
  • CPU, bis ~16× schneller als EasyOCR — kein GPU
  • 📦 ~30 MB (Detektor ~12 + Recognizer ~18) · 🧱 Fraktur-robust · on-prem/DSGVO · 🤖 LLM-ready
  • 🗂️ Bilder (png/jpg/webp/tiff/bmp …) + PDF (bis ~500 Seiten) → ein API-Aufruf, JSON pro Seite

Benchmarks (deutsche Eval-Sets, CPU)

KSVTRv3-de — deutscher Recognizer, eigene deutsche Eval-Sets (NED ↑ = Zeichen-Ähnlichkeit, höher = besser):

Set NED ↑ ~CER
Modernes Deutsch (clean) 0,91 ~9 %
Degradierte Scans (Augraphy) 0,85 ~15 %
Fraktur (NewsEye, real) 0,74 ~26 %

KSVTRv3-de ist ein deutscher Spezialist — robust auf echten/verrauschten Scans und Fraktur (Augraphy-Realismus im Training), trainiert auf deutschen Korpora (Leipzig) + Domänenfeldern (Rechnung/IBAN/USt-IdNr) + 2642 Dokument-Fonts. Auf sauberem modernem Deutsch sind dedizierte Engines (z. B. Tesseract) bei reiner Zeichengenauigkeit teils vorn; GOCRs Stärke ist die robuste, on-prem, integrierte Dokument→JSON-Schicht (CPU, klein, LLM-ready).

Architektur

GOCR-Detektor (DB-basiert) + KSVTRv3-de-Recognizer (SVTR-Encoder + CTC, deutscher Charset) — reines ONNX/CPU.

GOCR Architektur

So entsteht der deutsche Recognizer (Daten-Foundation → Training → Deploy):

GOCR Training-Pipeline

CLI

g-ocr dokument.png              # JSON (text + box + quad)
g-ocr rechnung.pdf              # PDF -> JSON je Seite (Plugin: g-ocr[pdf])
g-ocr dokument.png --text-only  # nur Text (Lesereihenfolge)

Links

Credits & Upstream

GOCR baut auf hervorragender Open-Source-Arbeit auf (jeweils Apache-2.0):

  • OpenOCR (Topdu/OpenOCR) — Detektor (DB) + Recognizer (RepSVTR / SVTR-Familie) + Trainings-Framework.
  • PaddleOCR (PaddlePaddle/PaddleOCR) — Zeichen-Dictionary (ppocr_keys_v1).

Beide stehen unter Apache-2.0; die Lizenz- und Urheberhinweise gelten fort (siehe NOTICE).

Lizenz

Apache-2.0 — siehe LICENSE und NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g_ocr-0.2.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

g_ocr-0.2.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file g_ocr-0.2.0.tar.gz.

File metadata

  • Download URL: g_ocr-0.2.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for g_ocr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0271da5084dec14ca1b33718be5baf99da6802eb7a8bf50b9df2f60ac3d17fa8
MD5 09ea6726218fe5be838988140b43bac2
BLAKE2b-256 9779cab4d4f9214b5761014016b6e752b33caad389e0f0e37e2a253199ff6e13

See more details on using hashes here.

Provenance

The following attestation bundles were made for g_ocr-0.2.0.tar.gz:

Publisher: workflow.yml on Keyvanhardani/g-ocr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file g_ocr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: g_ocr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for g_ocr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c171fb6171fa14eaf7e31a4fa00727a67c9def8231150cd37d6e569c66b14a3
MD5 8764591213312ff725f9d6a440a556d8
BLAKE2b-256 5467e962797036bbf7de5c31c50d4f8d7e0633369f6c4ceefbfce2f36cf8b63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for g_ocr-0.2.0-py3-none-any.whl:

Publisher: workflow.yml on Keyvanhardani/g-ocr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page