Keyven commited on
Commit
436b8d3
·
verified ·
1 Parent(s): 01d0305

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +185 -0
README.md ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - de
4
+ - en
5
+ license: apache-2.0
6
+ library_name: transformers
7
+ pipeline_tag: image-text-to-text
8
+ tags:
9
+ - german
10
+ - deutsch
11
+ - ocr
12
+ - vision
13
+ - document-ai
14
+ - invoice
15
+ - rechnung
16
+ - structured-extraction
17
+ - json-extraction
18
+ - kie
19
+ - ollama
20
+ - vllm
21
+ - llama-cpp
22
+ - apache-2.0
23
+ inference: true
24
+ ---
25
+
26
+ <p align="center">
27
+ <img src="https://app.german-ocr.de/icon.png" alt="German-OCR-3" width="128" height="128" />
28
+ </p>
29
+
30
+ <h1 align="center">German-OCR-3</h1>
31
+
32
+ <p align="center"><strong>Deutsche Vision-OCR. Kompakt. Lokal. Open Source.</strong></p>
33
+
34
+ <p align="center">
35
+ <a href="https://german-ocr.de"><img alt="Site" src="https://img.shields.io/badge/site-german--ocr.de-3B82F6?style=flat-square"/></a>
36
+ <a href="https://ollama.com/Keyvan/german-ocr-3"><img alt="Ollama" src="https://img.shields.io/badge/Ollama-Keyvan%2Fgerman--ocr--3-orange?style=flat-square"/></a>
37
+ <a href="https://github.com/Keyvanhardani/German-OCR-3-Dev"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-black?style=flat-square"/></a>
38
+ <a href="LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/License-Apache_2.0-green?style=flat-square"/></a>
39
+ </p>
40
+
41
+ ---
42
+
43
+ ## Was ist German-OCR-3?
44
+
45
+ **German-OCR-3** ist eine kompakte, schnelle und voll lokal lauffähige **Vision-OCR-Distribution für deutsche Geschäftsdokumente** — Rechnungen, Briefe, Formulare, Quittungen, Bescheide. Aus dem Bild kommt **strikt validiertes JSON nach unserem deutschen Extraktions-Schema**, ohne Cloud-Pflicht, ohne Vendor-Lock-in.
46
+
47
+ Zwei Editionen, beide Apache-2.0, beide unter 3 GB:
48
+
49
+ | Edition | Größe (Ollama) | Zielhardware | Stärke |
50
+ |---|---:|---|---|
51
+ | **`german-ocr-3:nano`** | **1.0 GB** | CPU / Edge / Mobile | „läuft überall" |
52
+ | **`german-ocr-3` ⭐** | **2.7 GB** | 4–6 GB VRAM | empfohlene Default-Edition |
53
+
54
+ ⭐ Auf unserem Praxistest mit **19 echten anonymisierten deutschen Rechnungen**: **100 % gültiges JSON · 95 % Sender korrekt erkannt · 0 % Halluzination**.
55
+
56
+ > **Fine-tuned adapter** für deutsche Geschäftsdokument-Extraktion. Apache 2.0.
57
+
58
+ ## Trainings- und Evaluations-Datensätze
59
+
60
+ * [`neuralabs/german-synth-ocr`](https://huggingface.co/datasets/neuralabs/german-synth-ocr) — 4 500+ deutsche OCR-Samples (synthetisch, Apache-2.0)
61
+ * `Aoschu/German_invoices_dataset_for_donut` — 129 echte deutsche Rechnungen (Donut-Format)
62
+ * **Eigenes synthetisches DE-Rechnungs-Set** — 100 Rechnungen mit Golden-JSON, deterministisch generiert (`eval/fixtures/synth_de_invoices/`)
63
+ * **IONOS-Praxistest** (anonymisiert) — 19 echte 1&1/IONOS-Rechnungen, intern, nicht im Repo (DSGVO)
64
+
65
+ ---
66
+
67
+ ## Praxistest: 19 deutsche Rechnungen
68
+
69
+ ![IONOS Praxistest](https://raw.githubusercontent.com/Keyvanhardani/German-OCR-3-Dev/main/assets/charts/02_ionos_validity.png)
70
+
71
+ | Edition | Valid JSON | Sender korrekt | **Halluzination** | Latenz |
72
+ |---|---:|---:|---:|---:|
73
+ | `german-ocr-3-nano` | 16 / 19 (84 %) | 15 / 19 (79 %) | **0 %** | 6.6 s |
74
+ | **`german-ocr-3` ⭐** | **19 / 19 (100 %)** | **18 / 19 (95 %)** | **0 %** | **5.0 s** |
75
+
76
+ Datenquelle: 19 anonymisierte, real existierende deutsche Rechnungen einer großen DACH-Hosting-Marke. Beide Editionen lesen die echten Daten — Firmenname, USt-IdNr, Kundenadresse, Produkte, Beträge — **statt deutsche Defaults zu raten** (typischer Fehler kleiner Vision-LLMs ohne strict-prompt).
77
+
78
+ ## Größenvergleich
79
+
80
+ ![Modellgrößen](https://raw.githubusercontent.com/Keyvanhardani/German-OCR-3-Dev/main/assets/charts/01_size_vs_competitors.png)
81
+
82
+ `german-ocr-3` (2.7 GB) ist **6× kleiner** als ein typischer 7B-OCR-VLM, läuft auf einer **8 GB-Gaming-GPU** oder über CPU auf einem normalen Laptop.
83
+
84
+ ---
85
+
86
+ ## Quickstart
87
+
88
+ ### Ollama (empfohlen, eine Zeile)
89
+
90
+ ```bash
91
+ ollama pull Keyvan/german-ocr-3
92
+ ollama run Keyvan/german-ocr-3 "Extrahiere die Rechnung im Bild als JSON." ./meine_rechnung.png
93
+ ```
94
+
95
+ Erwartetes Ergebnis (echter Output):
96
+
97
+ ```json
98
+ {
99
+ "document_type": "invoice",
100
+ "language": "de",
101
+ "invoice_number": "100137157949",
102
+ "invoice_date": "2024-01-22",
103
+ "due_date": "2024-01-27",
104
+ "sender": {
105
+ "name": "IONOS SE",
106
+ "address": "Elgendorfer Str. 57, 56410 Montabaur",
107
+ "vat_id": "DE815563912",
108
+ "iban": null
109
+ },
110
+ "recipient": {
111
+ "name": "Persepolis Travel e.K.",
112
+ "address": "Dachauer Straße 32, 80335 München",
113
+ "customer_id": "583534778"
114
+ },
115
+ "line_items": [
116
+ {"position": 1, "description": "Mail Business 1 Liz.", "quantity": 1,
117
+ "unit": "Monat", "unit_price_net": 4.20, "amount_net": 4.20, "vat_rate": 19}
118
+ ],
119
+ "amount_net": 4.20,
120
+ "amount_vat": 0.80,
121
+ "amount_total": 5.00,
122
+ "currency": "EUR",
123
+ "notes": ["Entsprechend Ihrem SEPA-Lastschriftmandat ..."]
124
+ }
125
+ ```
126
+
127
+ ### Python (via Ollama HTTP API)
128
+
129
+ ```python
130
+ import base64, json, requests
131
+ from pathlib import Path
132
+
133
+ b64 = base64.b64encode(Path("rechnung.png").read_bytes()).decode()
134
+ resp = requests.post("http://localhost:11434/api/generate", json={
135
+ "model": "Keyvan/german-ocr-3",
136
+ "prompt": "Extrahiere die Rechnung im Bild als JSON.",
137
+ "images": [b64],
138
+ "stream": False,
139
+ "options": {"temperature": 0, "num_ctx": 32768},
140
+ })
141
+ data = json.loads(resp.json()["response"])
142
+ print(json.dumps(data, indent=2, ensure_ascii=False))
143
+ ```
144
+
145
+ ### Bundle herunterladen
146
+
147
+ ```bash
148
+ huggingface-cli download Keyven/german-ocr-3 --local-dir ./german-ocr-3
149
+ # Enthält: Modelfile · JSON-Schemas · System-Prompt · GGUF-Quants · Charts
150
+ ```
151
+
152
+ ### llama.cpp (GGUF direkt)
153
+
154
+ ```bash
155
+ llama-cli -m ./german-ocr-3/german-ocr-3-Q4_K_M.gguf \
156
+ --system-prompt-file ./german-ocr-3/system_prompt.txt \
157
+ -p "Extrahiere die Rechnung als JSON:" --temp 0
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Zielgruppen
163
+
164
+ * **Solo-Builder & Indies** die deutsche Dokumente lokal extrahieren wollen, ohne Cloud-OCR-Kosten.
165
+ * **DACH-KMU** mit Datenschutz-Anspruch, die lokal/on-prem hosten wollen.
166
+ * **Agenturen & Studios** die ein Open-Source-Fundament unter ihrer eigenen Pipeline wollen.
167
+
168
+ Wer es **gemanagt** und mit größeren Modellen will:
169
+
170
+ > 🌐 **[german-ocr.de](https://german-ocr.de)** — gehostete deutsche OCR-API mit Premium-Modellen, höherer Genauigkeit, ohne eigene Hardware. Daten bleiben in der EU.
171
+
172
+ ## Lizenz
173
+
174
+ Apache License 2.0. Vollständige Attribution (inkl. Architektur-Credit) in [`NOTICE`](NOTICE).
175
+
176
+ ## Zitation
177
+
178
+ ```bibtex
179
+ @misc{german_ocr_3_2026,
180
+ title = {German-OCR-3: A compact German document-OCR distribution},
181
+ author = {Hardani, Keyvan},
182
+ year = {2026},
183
+ url = {https://github.com/Keyvanhardani/German-OCR-3-Dev}
184
+ }
185
+ ```