Keyven commited on
Commit
fdf32e7
·
verified ·
1 Parent(s): 52517d2

Kopie von Keyven/german-ocr-3

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ german-ocr-3-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
37
+ german-ocr-3-nano-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Keyvan Hardani
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ German-OCR-3
2
+ Copyright 2026 Keyvan Hardani
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Model architecture: Qwen3.5 Small Series
7
+ Copyright (c) 2025-2026 Qwen Team, Alibaba Group · Apache License 2.0
8
+ https://huggingface.co/Qwen · https://qwen.ai
9
+
10
+ Third-party tools used in the build / serve pipeline:
11
+ - Ollama (MIT) — https://github.com/ollama/ollama
12
+ - llama.cpp (MIT) — https://github.com/ggml-org/llama.cpp
13
+ - vLLM (Apache 2.0) — https://github.com/vllm-project/vllm
14
+ - Hugging Face Transformers (Apache 2.0) — https://github.com/huggingface/transformers
README.md ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - de
4
+ - en
5
+ - fr
6
+ - es
7
+ - ar
8
+ - fa
9
+ - it
10
+ - sv
11
+ - ru
12
+ - zh
13
+ license: apache-2.0
14
+ library_name: transformers
15
+ pipeline_tag: image-text-to-text
16
+ tags:
17
+ - german
18
+ - deutsch
19
+ - ocr
20
+ - vision
21
+ - document-ai
22
+ - invoice
23
+ - rechnung
24
+ - structured-extraction
25
+ - json-extraction
26
+ - kie
27
+ - ollama
28
+ - vllm
29
+ - llama-cpp
30
+ - apache-2.0
31
+ inference: true
32
+ datasets:
33
+ - neuralabs/german-synth-ocr
34
+ - Aoschu/German_invoices_dataset_for_donut
35
+ base_model:
36
+ - Qwen/Qwen3.5-2B
37
+ new_version: Keyven/german-ocr-3
38
+ ---
39
+
40
+ <p align="center">
41
+ <img src="https://app.german-ocr.de/icon.png" alt="German-OCR-3" width="140" height="140" />
42
+ </p>
43
+
44
+ <h1 align="center">German-OCR-3</h1>
45
+
46
+ <p align="center"><strong>Deutsche Vision-OCR. Kompakt. Lokal. Open Source.</strong><br/>
47
+ <sub>Aus deutschem Dokument-Bild → strikt validiertes JSON. In unter 60 Sekunden lokal lauffähig.</sub></p>
48
+
49
+ <p align="center">
50
+ <a href="https://german-ocr.de"><img alt="Site" src="https://img.shields.io/badge/site-german--ocr.de-3B82F6?style=flat-square&labelColor=0B1220"/></a>
51
+ <a href="https://ollama.com/Keyvan/german-ocr-3"><img alt="Ollama" src="https://img.shields.io/badge/Ollama-Keyvan%2Fgerman--ocr--3-F59E0B?style=flat-square&labelColor=0B1220"/></a>
52
+ <a href="https://github.com/Keyvanhardani/German-OCR-3-Dev"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-181717?style=flat-square&labelColor=0B1220"/></a>
53
+ <a href="#license"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/License-Apache_2.0-22C55E?style=flat-square&labelColor=0B1220"/></a>
54
+ <img alt="Language" src="https://img.shields.io/badge/lang-Deutsch-3B82F6?style=flat-square&labelColor=0B1220"/>
55
+ <img alt="Hallucination" src="https://img.shields.io/badge/Halluzination-0%25-22C55E?style=flat-square&labelColor=0B1220"/>
56
+ </p>
57
+
58
+ ---
59
+
60
+ ## ⚡ At a glance
61
+
62
+ <table align="center">
63
+ <tr>
64
+ <td align="center" width="180"><h2>100 %</h2><sub>Gültiges JSON</sub></td>
65
+ <td align="center" width="180"><h2>95 %</h2><sub>Sender korrekt</sub></td>
66
+ <td align="center" width="180"><h2>0 %</h2><sub>Halluzination</sub></td>
67
+ <td align="center" width="180"><h2>5.0 s</h2><sub>Latenz / Doc</sub></td>
68
+ </tr>
69
+ </table>
70
+
71
+ <p align="center"><sub>Auf <strong>200+ echten anonymisierten deutschen Rechnungen</strong> (Default-Edition, 2.7 GB)</sub></p>
72
+
73
+ ---
74
+
75
+ ## Was ist German-OCR-3?
76
+
77
+ **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.
78
+
79
+ Zwei Editionen, beide Apache 2.0, beide unter 3 GB:
80
+
81
+ | Edition | Ollama | Größe | Zielhardware | Stärke |
82
+ |---|---|---:|---|---|
83
+ | **Nano** | `Keyvan/german-ocr-nano` | **1.0 GB** | CPU · Edge · Mobile | „läuft überall" |
84
+ | **Default** ⭐ | `Keyvan/german-ocr-3` | **2.7 GB** | 4–6 GB VRAM | beste Field-Erkennung |
85
+
86
+ > **Fine-tuned adapter** für deutsche Geschäftsdokument-Extraktion. Apache 2.0.
87
+
88
+ ---
89
+
90
+ ## 📊 Praxistest — 200+ echte deutsche Rechnungen (anonymisiert)
91
+
92
+ <p align="center">
93
+ <img src="https://huggingface.co/Keyven/german-ocr-3/resolve/main/charts/02_ionos_validity.png" alt="Praxistest" width="820"/>
94
+ </p>
95
+
96
+ | Edition | Valid JSON | Sender korrekt | **Halluzination** | Latenz |
97
+ |---|---:|---:|---:|---:|
98
+ | `Keyvan/german-ocr-nano` | 84 % | 79 % | **0 %** | 6.6 s |
99
+ | **`Keyvan/german-ocr-3`** ⭐ | **100 %** | **95 %** | **0 %** | **5.0 s** |
100
+
101
+ **Keine "Mustermann"-Defaults.** German-OCR-3 liest echte Firma, Kundenadresse, Produkte, Beträge — statt zu raten.
102
+
103
+ ---
104
+
105
+ ## 📐 Größenvergleich
106
+
107
+ <p align="center">
108
+ <img src="https://huggingface.co/Keyven/german-ocr-3/resolve/main/charts/01_size_vs_competitors.png" alt="Modellgrößen" width="820"/>
109
+ </p>
110
+
111
+ `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.
112
+
113
+ <p align="center">
114
+ <img src="https://huggingface.co/Keyven/german-ocr-3/resolve/main/charts/04_latency.png" alt="Latenz" width="620"/>
115
+ </p>
116
+
117
+ ---
118
+
119
+ ## 🚀 Quickstart
120
+
121
+ ### Ollama (empfohlen, eine Zeile)
122
+
123
+ ```bash
124
+ ollama pull Keyvan/german-ocr-3
125
+ ollama run Keyvan/german-ocr-3 "Extrahiere die Rechnung im Bild als JSON." ./meine_rechnung.png
126
+ ```
127
+
128
+ <details>
129
+ <summary><b>Beispiel-Output (anonymisiert, aus Praxistest)</b> — klicken zum Aufklappen</summary>
130
+
131
+ ```json
132
+ {
133
+ "document_type": "invoice",
134
+ "language": "de",
135
+ "invoice_number": "100137xXXXXX",
136
+ "invoice_date": "2024-01-22",
137
+ "due_date": "2024-01-27",
138
+ "sender": {
139
+ "name": "IONOS SE",
140
+ "address": "Elgendorfer Str. 57, 56410 Montabaur",
141
+ "vat_id": "DE81556XXX",
142
+ "iban": null
143
+ },
144
+ "recipient": {
145
+ "name": "Firma e.K.",
146
+ "address": "Muster Straße 32, 80335 München",
147
+ "customer_id": "5835XXX"
148
+ },
149
+ "line_items": [
150
+ {"position": 1, "description": "Mail Business 1 Liz.", "quantity": 1,
151
+ "unit": "Monat", "unit_price_net": 4.20, "amount_net": 4.20, "vat_rate": 19}
152
+ ],
153
+ "amount_net": 4.20,
154
+ "amount_vat": 0.80,
155
+ "amount_total": 5.00,
156
+ "currency": "EUR",
157
+ "notes": ["Entsprechend Ihrem SEPA-Lastschriftmandat ..."]
158
+ }
159
+ ```
160
+
161
+ </details>
162
+
163
+ ### Python (via Ollama HTTP API)
164
+
165
+ ```python
166
+ import base64, json, requests
167
+ from pathlib import Path
168
+
169
+ b64 = base64.b64encode(Path("rechnung.png").read_bytes()).decode()
170
+ resp = requests.post("http://localhost:11434/api/generate", json={
171
+ "model": "Keyvan/german-ocr-3",
172
+ "prompt": "Extrahiere die Rechnung im Bild als JSON.",
173
+ "images": [b64],
174
+ "stream": False,
175
+ "options": {"temperature": 0, "num_ctx": 32768},
176
+ })
177
+ data = json.loads(resp.json()["response"])
178
+ print(json.dumps(data, indent=2, ensure_ascii=False))
179
+ ```
180
+
181
+ ### Bundle herunterladen
182
+
183
+ ```bash
184
+ huggingface-cli download Keyven/german-ocr-3 --local-dir ./german-ocr-3
185
+ # Enthält: Modelfile · JSON-Schemas · System-Prompt · GGUF-Quants · Charts
186
+ ```
187
+
188
+ ### llama.cpp (GGUF direkt)
189
+
190
+ ```bash
191
+ llama-cli -m ./german-ocr-3/german-ocr-3-Q4_K_M.gguf \
192
+ --system-prompt-file ./german-ocr-3/system_prompt.txt \
193
+ -p "Extrahiere die Rechnung als JSON:" --temp 0
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 📚 Trainings- und Evaluations-Datensätze
199
+
200
+ | Datensatz | Umfang | Typ |
201
+ |---|---|---|
202
+ | [`neuralabs/german-synth-ocr`](https://huggingface.co/datasets/neuralabs/german-synth-ocr) | 4 500+ | Deutsche OCR-Samples (synthetisch, Apache-2.0) |
203
+ | [`Aoschu/German_invoices_dataset_for_donut`](https://huggingface.co/datasets/Aoschu/German_invoices_dataset_for_donut) | 129 | Echte deutsche Rechnungen (Donut-Format) |
204
+ | Eigenes synthetisches DE-Rechnungs-Set | 100 | Rechnungen mit Golden-JSON, deterministisch generiert |
205
+ | Anonymisierter DACH-Praxistest | 200+ | Echte Rechnungen verschiedener DACH-Anbieter (intern, DSGVO) |
206
+
207
+ ---
208
+
209
+ ## 🎯 Zielgruppen
210
+
211
+ - **Solo-Builder & Indies** — deutsche Dokumente lokal extrahieren, ohne Cloud-OCR-Kosten.
212
+ - **DACH-KMU mit Datenschutz-Anspruch** — lokal / on-prem hosten.
213
+ - **Agenturen & Studios** — Open-Source-Fundament unter der eigenen Pipeline.
214
+
215
+ Wer es **gemanagt** und mit noch größeren Modellen will:
216
+
217
+ > 🌐 **[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.
218
+
219
+ ---
220
+
221
+ ## ⚠️ Limitations
222
+
223
+ - Optimiert für **deutsche** Dokumente — andere Sprachen keine Garantie.
224
+ - Beste Qualität bei klaren, hochauflösenden Scans/Fotos.
225
+ - Handschriftliche Dokumente: nur begrenzt.
226
+ - Bei kritischen Vorgängen (Buchhaltung, Recht): **immer Human-in-the-Loop**.
227
+
228
+ ---
229
+
230
+ ## 🙏 Credit & Attribution
231
+
232
+ German-OCR-3 baut auf der hervorragenden Arbeit des **Qwen-Teams bei Alibaba Group** auf. Die zugrundeliegende Vision-Language-Architektur stammt aus der **Qwen 3.5 Small Series**, veröffentlicht unter Apache License 2.0. Ohne die offene Forschung und die saubere Veröffentlichung der Qwen-Weights wäre dieses Projekt nicht möglich.
233
+
234
+ - **Qwen 3.5** — https://huggingface.co/Qwen · https://qwen.ai
235
+ - **Apache License 2.0** (Weights) — © 2025–2026 Qwen Team, Alibaba Group
236
+ - **Qwen2.5-VL Technical Report** — [arXiv:2502.13923](https://arxiv.org/abs/2502.13923)
237
+
238
+ Vollständiger Attribution-Text in [`NOTICE`](NOTICE).
239
+
240
+ ---
241
+
242
+ ## <a id="license"></a>📄 License
243
+
244
+ **Apache License 2.0** für die gesamte German-OCR-3-Distribution (Modelfiles, System-Prompt, Schemas, Docs, GGUFs).
245
+
246
+ ---
247
+
248
+ ## 📑 Citation
249
+
250
+ Wenn du German-OCR-3 in Forschung oder Produktion verwendest, zitiere bitte **beides** — unsere Distribution und die Qwen-Basisarbeit:
251
+
252
+ ```bibtex
253
+ @misc{german_ocr_3_2026,
254
+ title = {German-OCR-3: A compact German document-OCR distribution},
255
+ author = {Hardani, Keyvan},
256
+ year = {2026},
257
+ url = {https://github.com/Keyvanhardani/German-OCR}
258
+ }
259
+
260
+ @misc{qwen35_2026,
261
+ title = {Qwen 3.5 Small Series},
262
+ author = {{Qwen Team, Alibaba Group}},
263
+ year = {2026},
264
+ howpublished = {\url{https://huggingface.co/Qwen}},
265
+ note = {Apache License 2.0}
266
+ }
267
+
268
+ @article{qwen25vl_2025,
269
+ title = {Qwen2.5-VL Technical Report},
270
+ author = {{Qwen Team, Alibaba Group}},
271
+ journal = {arXiv preprint arXiv:2502.13923},
272
+ year = {2025}
273
+ }
274
+ ```
275
+
276
+ ---
277
+
278
+ ## 👤 Author
279
+
280
+ **Keyvan Hardani**
281
+ · Website: [keyvan.ai](https://keyvan.ai)
282
+ · LinkedIn: [linkedin.com/in/keyvanhardani](https://linkedin.com/in/keyvanhardani)
283
+ · GitHub: [@Keyvanhardani](https://github.com/Keyvanhardani)
284
+ · Hosted Premium: [german-ocr.de](https://german-ocr.de)
charts/01_size_vs_competitors.png ADDED
charts/02_ionos_validity.png ADDED
charts/04_latency.png ADDED
german-ocr-3-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b452184be7339c85516c6c468f4f3dcedd7491b40af19750f971ed8d0090800d
3
+ size 1274396544
german-ocr-3-nano-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f5b3fd77990f44761275bb8d990d7fa0860c9aa8ad56e0559e402a1f1b03f54
3
+ size 529297312
logo.png ADDED
schemas/form.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "german-ocr-3/schemas/form.json",
4
+ "title": "GermanOCR3 Form (Formular)",
5
+ "description": "Generisches Schema fuer ausgefuellte deutsche Formulare. Felder werden als Liste von Label/Value-Paaren geliefert, plus optionale Checkbox-Liste und Unterschriften.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["document_type", "language", "fields"],
9
+ "properties": {
10
+ "document_type": {"const": "form"},
11
+ "language": {"type": "string", "default": "de"},
12
+ "form_title": {"type": ["string", "null"]},
13
+ "form_id": {"description": "z.B. Antragsnummer / Formularkennung", "type": ["string", "null"]},
14
+ "issuing_authority": {"type": ["string", "null"]},
15
+
16
+ "fields": {
17
+ "type": "array",
18
+ "description": "Erkannte Label/Wert-Paare in Lesereihenfolge.",
19
+ "items": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": ["label", "value"],
23
+ "properties": {
24
+ "label": {"type": "string"},
25
+ "value": {"type": ["string", "number", "boolean", "null"]},
26
+ "section": {"type": ["string", "null"]},
27
+ "page": {"type": ["integer", "null"]}
28
+ }
29
+ }
30
+ },
31
+
32
+ "checkboxes": {
33
+ "type": "array",
34
+ "default": [],
35
+ "items": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["label", "checked"],
39
+ "properties": {
40
+ "label": {"type": "string"},
41
+ "checked": {"type": "boolean"},
42
+ "section": {"type": ["string", "null"]}
43
+ }
44
+ }
45
+ },
46
+
47
+ "signatures": {
48
+ "type": "array",
49
+ "default": [],
50
+ "items": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "properties": {
54
+ "by": {"type": ["string", "null"]},
55
+ "place": {"type": ["string", "null"]},
56
+ "date": {"type": ["string", "null"]},
57
+ "present": {"type": "boolean"}
58
+ }
59
+ }
60
+ },
61
+
62
+ "raw_text": {"type": ["string", "null"]},
63
+ "confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
64
+ "notes": {"type": "array", "items": {"type": "string"}, "default": []}
65
+ }
66
+ }
schemas/generic_document.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "german-ocr-3/schemas/generic_document.json",
4
+ "title": "GermanOCR3 Generic Document",
5
+ "description": "Allgemeines deutsches Dokument-Extraktionsschema. Felder dürfen null sein, wenn nicht eindeutig erkennbar.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["document_type", "language", "raw_text", "confidence"],
9
+ "properties": {
10
+ "document_type": {
11
+ "description": "z.B. invoice, receipt, letter, form, contract, id_card, other, unknown",
12
+ "type": ["string", "null"]
13
+ },
14
+ "language": {
15
+ "description": "BCP-47 Sprachcode des Dokuments (typisch 'de').",
16
+ "type": "string",
17
+ "default": "de"
18
+ },
19
+ "sender": {
20
+ "type": ["object", "null"],
21
+ "additionalProperties": false,
22
+ "properties": {
23
+ "name": {"type": ["string", "null"]},
24
+ "address": {"type": ["string", "null"]},
25
+ "email": {"type": ["string", "null"]},
26
+ "phone": {"type": ["string", "null"]},
27
+ "tax_id": {"type": ["string", "null"]},
28
+ "vat_id": {"type": ["string", "null"]}
29
+ }
30
+ },
31
+ "recipient": {
32
+ "type": ["object", "null"],
33
+ "additionalProperties": false,
34
+ "properties": {
35
+ "name": {"type": ["string", "null"]},
36
+ "address": {"type": ["string", "null"]},
37
+ "customer_id": {"type": ["string", "null"]}
38
+ }
39
+ },
40
+ "date": {
41
+ "description": "Hauptdatum des Dokuments im Format YYYY-MM-DD, falls eindeutig erkennbar.",
42
+ "type": ["string", "null"]
43
+ },
44
+ "reference_numbers": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "required": ["label", "value"],
50
+ "properties": {
51
+ "label": {"type": "string"},
52
+ "value": {"type": "string"}
53
+ }
54
+ },
55
+ "default": []
56
+ },
57
+ "amounts": {
58
+ "type": "array",
59
+ "items": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "required": ["label", "value"],
63
+ "properties": {
64
+ "label": {"type": "string"},
65
+ "value": {"type": ["number", "string"]},
66
+ "currency": {"type": ["string", "null"]}
67
+ }
68
+ },
69
+ "default": []
70
+ },
71
+ "tables": {
72
+ "type": "array",
73
+ "default": [],
74
+ "items": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["headers", "rows"],
78
+ "properties": {
79
+ "title": {"type": ["string", "null"]},
80
+ "headers": {"type": "array", "items": {"type": "string"}},
81
+ "rows": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "array",
85
+ "items": {"type": ["string", "number", "null"]}
86
+ }
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "raw_text": {
92
+ "description": "Roher OCR-Text, möglichst layouterhaltend, deutsche Originalschreibweise behalten.",
93
+ "type": ["string", "null"]
94
+ },
95
+ "confidence": {
96
+ "description": "Subjektive Selbsteinschätzung 0..1.",
97
+ "type": ["number", "null"],
98
+ "minimum": 0,
99
+ "maximum": 1
100
+ },
101
+ "notes": {
102
+ "type": "array",
103
+ "items": {"type": "string"},
104
+ "default": []
105
+ }
106
+ }
107
+ }
schemas/invoice.json ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "german-ocr-3/schemas/invoice.json",
4
+ "title": "GermanOCR3 Invoice (Rechnung)",
5
+ "description": "Schema fuer deutsche Rechnungen. Pflichtangaben gemaess UStG § 14 sind beruecksichtigt; nicht erkennbare Felder bleiben null.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["document_type", "language", "invoice_number", "invoice_date", "amount_total", "currency"],
9
+ "properties": {
10
+ "document_type": {"const": "invoice"},
11
+ "language": {"type": "string", "default": "de"},
12
+
13
+ "invoice_number": {"type": ["string", "null"]},
14
+ "invoice_date": {
15
+ "description": "Rechnungsdatum YYYY-MM-DD",
16
+ "type": ["string", "null"]
17
+ },
18
+ "delivery_date": {
19
+ "description": "Liefer-/Leistungsdatum YYYY-MM-DD",
20
+ "type": ["string", "null"]
21
+ },
22
+ "due_date": {
23
+ "description": "Faelligkeitsdatum YYYY-MM-DD",
24
+ "type": ["string", "null"]
25
+ },
26
+
27
+ "sender": {
28
+ "type": ["object", "null"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "name": {"type": ["string", "null"]},
32
+ "address": {"type": ["string", "null"]},
33
+ "email": {"type": ["string", "null"]},
34
+ "phone": {"type": ["string", "null"]},
35
+ "tax_id": {"description": "Steuernummer", "type": ["string", "null"]},
36
+ "vat_id": {"description": "USt-IdNr / VAT ID (DE...)", "type": ["string", "null"]},
37
+ "iban": {"type": ["string", "null"]},
38
+ "bic": {"type": ["string", "null"]},
39
+ "bank": {"type": ["string", "null"]}
40
+ }
41
+ },
42
+ "recipient": {
43
+ "type": ["object", "null"],
44
+ "additionalProperties": false,
45
+ "properties": {
46
+ "name": {"type": ["string", "null"]},
47
+ "address": {"type": ["string", "null"]},
48
+ "customer_id": {"type": ["string", "null"]},
49
+ "vat_id": {"type": ["string", "null"]}
50
+ }
51
+ },
52
+
53
+ "line_items": {
54
+ "type": "array",
55
+ "default": [],
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": ["description", "amount_net"],
60
+ "properties": {
61
+ "position": {"type": ["integer", "null"]},
62
+ "article_number": {"type": ["string", "null"]},
63
+ "description": {"type": "string"},
64
+ "quantity": {"type": ["number", "null"]},
65
+ "unit": {"type": ["string", "null"]},
66
+ "unit_price_net": {"type": ["number", "null"]},
67
+ "amount_net": {"type": ["number", "null"]},
68
+ "vat_rate": {"description": "Prozent, z.B. 19 oder 7", "type": ["number", "null"]}
69
+ }
70
+ }
71
+ },
72
+
73
+ "amount_net": {"type": ["number", "null"]},
74
+ "amount_vat": {"type": ["number", "null"]},
75
+ "amount_total": {"type": ["number", "null"]},
76
+ "currency": {
77
+ "type": ["string", "null"],
78
+ "description": "ISO-4217, typisch EUR"
79
+ },
80
+
81
+ "vat_breakdown": {
82
+ "type": "array",
83
+ "default": [],
84
+ "items": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["rate", "net", "vat"],
88
+ "properties": {
89
+ "rate": {"type": "number"},
90
+ "net": {"type": "number"},
91
+ "vat": {"type": "number"}
92
+ }
93
+ }
94
+ },
95
+
96
+ "payment_terms": {"type": ["string", "null"]},
97
+ "notes": {"type": "array", "items": {"type": "string"}, "default": []},
98
+ "raw_text": {"type": ["string", "null"]},
99
+ "confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1}
100
+ }
101
+ }
schemas/letter.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "german-ocr-3/schemas/letter.json",
4
+ "title": "GermanOCR3 Letter (Brief)",
5
+ "description": "Schema fuer deutsche Geschaefts- oder Behoerdenbriefe (DIN-5008-naher Aufbau).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["document_type", "language", "subject", "body"],
9
+ "properties": {
10
+ "document_type": {"const": "letter"},
11
+ "language": {"type": "string", "default": "de"},
12
+
13
+ "sender": {
14
+ "type": ["object", "null"],
15
+ "additionalProperties": false,
16
+ "properties": {
17
+ "name": {"type": ["string", "null"]},
18
+ "address": {"type": ["string", "null"]},
19
+ "email": {"type": ["string", "null"]},
20
+ "phone": {"type": ["string", "null"]}
21
+ }
22
+ },
23
+ "recipient": {
24
+ "type": ["object", "null"],
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "name": {"type": ["string", "null"]},
28
+ "address": {"type": ["string", "null"]}
29
+ }
30
+ },
31
+
32
+ "place": {"type": ["string", "null"]},
33
+ "date": {"description": "Briefdatum YYYY-MM-DD", "type": ["string", "null"]},
34
+ "reference": {
35
+ "description": "Aktenzeichen / Ihr Zeichen / Unser Zeichen.",
36
+ "type": ["object", "null"],
37
+ "additionalProperties": false,
38
+ "properties": {
39
+ "ihr_zeichen": {"type": ["string", "null"]},
40
+ "ihre_nachricht_vom": {"type": ["string", "null"]},
41
+ "unser_zeichen": {"type": ["string", "null"]},
42
+ "unsere_nachricht_vom": {"type": ["string", "null"]}
43
+ }
44
+ },
45
+
46
+ "subject": {"type": ["string", "null"]},
47
+ "salutation": {"type": ["string", "null"]},
48
+ "body": {
49
+ "description": "Kompletter Brieftext, Absaetze mit \\n\\n getrennt.",
50
+ "type": ["string", "null"]
51
+ },
52
+ "closing": {"type": ["string", "null"]},
53
+ "signatory": {"type": ["string", "null"]},
54
+ "enclosures": {"type": "array", "items": {"type": "string"}, "default": []},
55
+
56
+ "deadlines_mentioned": {
57
+ "type": "array",
58
+ "default": [],
59
+ "items": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "date": {"type": ["string", "null"]},
64
+ "context": {"type": ["string", "null"]}
65
+ }
66
+ }
67
+ },
68
+
69
+ "raw_text": {"type": ["string", "null"]},
70
+ "confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
71
+ "notes": {"type": "array", "items": {"type": "string"}, "default": []}
72
+ }
73
+ }