Loading…
Loading…
Modified by otoro si. This is NOT an official OpenBMB release. A community fine-tune of openbmb/MiniCPM-OCR-1.0 (Apache-2.0), trained to stop dropping Polish diacritics.
PL (skrót): MiniCPM-OCR 1.0 gubił polskie ogonki (ł→l, ą→a, ę→e, Ź→Z…). Douczyliśmy go metodą LoRA wyłącznie na danych syntetycznych (bez żadnych prywatnych dokumentów). Odsetek zachowanych polskich liter wzrósł z ok. 69% do 94% na obrazach testowych i z ok. 82% do 96% na prawdziwych skanach. Model nie jest lepszy od Tesseracta ani PP-OCRv6 na czytelnym druku i nie nadaje się do pisma odręcznego (szczegóły niżej).
| Base model | openbmb/MiniCPM-OCR-1.0 (1.3B: SigLIP vision encoder + Qwen3.5-style language model) |
| Change | LoRA (rank 16) on the language model only, merged into the weights; vision encoder and projector untouched |
| Format | GGUF, Q8_0 (LLM, 0.8 GB) + the original, unmodified vision projector (mmproj, BF16, 0.9 GB) |
| Prompt | Text Recognition: (as in the base model; Table Recognition: still works, see limitations) |
| Languages | Polish (improved), English / Chinese / German / French / Czech (no measurable regression) |
| License | Apache-2.0 (same as the base model) |
Files:
MiniCPM-OCR-1.0-PL-otoro-si-Q8_0.gguf - the fine-tuned language modelmmproj-MiniCPM-OCR-1.0-BF16.gguf - vision projector, byte-identical to the one shipped by OpenBMB (sha256 ceed8226…4444682)Modelfile - Ollama recipe (two FROM lines + TEMPLATE {{ .Prompt }})The embedded chat template is the one from the official GGUF (thinking mode disabled). A template taken from the Hugging Face repo makes Ollama put the answer in the thinking field, so do not replace it.
# put the three files in one folder, then:
ollama create minicpm-ocr-pl -f Modelfile
import base64, requests
img = base64.b64encode(open("page.jpg", "rb").read()).decode()
r = requests.post("http://localhost:11434/api/chat", json={
"model": "minicpm-ocr-pl", "stream": False,
"messages": [{"role": "user", "content": "Text Recognition:", "images": [img]}],
"options": {"temperature": 0, "num_ctx": 8192, "num_predict": 1500}})
print(r.json()["message"]["content"])
Feed the model one paragraph or text block at a time (crops of about 0.6 MP worked well). It was fine-tuned on crops up to ~0.22 MP and evaluated on crops up to ~0.6 MP; whole pages are not tested. The official pipeline of the base model uses a layout detector (PP-DocLayoutV3) plus per-region recognition. llama.cpp directly was not tested by us.
Speed on our machine (RTX 5060 Laptop 8 GB): about 3.3 s per paragraph on GPU, about 15 s per 0.6 MP crop on CPU only (16-core Ryzen 9). Memory in Ollama about 1 GB (LLM) plus the projector.
All numbers below are ours, produced with the same scoring script for every engine. CER = character error rate after whitespace normalisation (lower is better). PL letters = share of Polish diacritic letters (ąćęłńóśźż and capitals) of the reference that appear correctly in the output (higher is better). Word err. = reference words missing from the output.
| Engine | CER | PL letters | Word err. |
|---|---|---|---|
| MiniCPM-OCR 1.0 (base, Q8_0) | 2.63% | 68.9% | 14.1% |
| This model (Q8_0) | 1.08% | 94.0% | 4.8% |
Tesseract 5.4 (pol, psm 6, no preprocessing) |
14.16% | 86.3% | 15.3% |
PP-OCRv6 (pl, medium) |
1.61% | 88.3% | 5.3% |
The set includes clean renders, scan-like and photo-like degradations, all-caps lines and decorative fonts. Tesseract fails mostly on the photo-like images (CER 37% without any preprocessing); with proper preprocessing it would do much better.
| Engine | CER | PL letters | Word err. |
|---|---|---|---|
| MiniCPM-OCR 1.0 (base, Q8_0) | 1.40% | 81.5% | 10.1% |
| This model (Q8_0) | 0.55% | 96.4% | 2.5% |
Tesseract 5.4 (pol, psm 6) |
0.25% | 100% | 1.2% |
PP-OCRv6 (pl, medium) |
0.32% | 96.4% | 1.9% |
On clean printed text, Tesseract and PP-OCRv6 are at least as good as this model, and much faster and lighter. A re-run of this model on another day gave 0.62% CER (Ollama output varies slightly between sessions; one crop changed). The reference transcriptions were typed by hand while also looking at this model's draft output, which may slightly favour it. Eleven crops from four documents is a small sample.
CER of the base model 0.21%, after fine-tuning 0.18% (BF16, transformers pipeline). Table recognition (OTSL) was unchanged on our 10 synthetic tables in BF16/Q8_0.
Tested on six pages of a blurred microfilm scan with handwriting: only 8 of 339 reference words were found (about 2%), and on two pages the model hallucinated fluent but non-existent English/Latin-looking text. Do not use this model for handwriting or very poor scans, and verify numbers, dates and names against the original in any important document.
general.name and general.description metadata (all 320 tensors identical).ł and Ą (about 86-87% kept on the synthetic set; fewer errors on real scans), word-final ć occasionally.LICENSE). The weights are a derivative of the base model; changes are described above. This is a community modification and is not endorsed by or affiliated with OpenBMB.openbmb/MiniCPM-OCR-1.0