在对表格区域的独立裁剪进行 OCR 时,数值单元中的小数分隔符(逗号)会丢失,而对整页进行 OCR 时则不会丢失。
作者: textlastig创建于 2026年8月28日更新于 2026年9月22日
### System Info / 系统信息
- Backend: MLX (mlx_vlm), model mlx-community/GLM-OCR-bf16
- Served via the SDK's own glmocr server (/glmocr/parse), not vLLM
- Apple Silicon Mac, macOS
- Deterministic decoding configured: temperature: 0.0, top_p: 0.00001, top_k: 1 (per config.yaml)
### Who can help? / 谁可以帮助到您?
_No response_
### Information / 问题信息
- [ ] The official example scripts / 官方的示例脚本
- [x] My own modified scripts and tasks / 我自己修改的脚本和任务
### Reproduction / 复现过程
As a workaround for #240 (missing/garbled table footer rows during full-page OCR), we tried re-recognizing just the affected table region: cropping the page to the table's own detected bbox_2d (with modest padding), wrapping it as a single-page PDF, and submitting that alone to /glmocr/parse, e.g.:
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("mlx-community/GLM-OCR-bf16")
prompt = "Table Recognition:"
formatted_prompt = apply_chat_template(
processor, model.config, prompt, num_images=1)
result = generate(
model,
processor,
formatted_prompt,
image=["./invoice_table_crop_only.png"], # same table, but as an isolated crop instead of the full page
max_tokens=2048,
verbose=True,
)
Steps to reproduce the behavior:
Run OCR on the full page containing the table from #TODO-issue1-number — numeric cells come back with a decimal comma (10,72, 2,300, etc.), as shown there.
Crop the page down to just that table's own detected bbox_2d and run OCR again on the crop alone.
Compare the two outputs — every numeric cell in the crop has lost its decimal separator.
Full-page output for this table (from #TODO-issue1-number, line 1): 10,72, 13,41, 2,300, etc. — with commas.
Isolated-crop output for the identical table:
10,72 → 1072, 2,300 → 2300, and so on for every numeric cell, both in json_result and markdown_result. Note this run did recover the two footer rows from #240 (label and …
| Datum | GOÄ | Leistung | Anz. | Auslagen | Faktor | Honorar |
| 13.02.24 | 1 | Beratung(persönlich oder telefon.) | 1 | 2300 | 1072 | |
| 6 | UntersuchungOrgansystemAuge/HNO | 1 | 2300 | 1341 | ||
| 1201 | subj.Refraktionsphär.-zylindr.Gl. | 1 | 2300 | 1193 | ||
| 1202 | objektiveRefraktionsbestimmung | 1 | 2300 | 992 | ||
| 1207 | Prüfung./Bestimmung vonMehrstärken-o.Prismenbrille | 1 | 2300 | 938 | ||
| 1242 | Binoc.Unters.d.Augenhintergrundes | 1 | 2300 | 2038 | ||
| 1256 | Applanationstonometrie | 1 | 1800 | 1049 | ||
| SummeHonorarEUR: | 8623 | |||||
| RechnungsbetragEUR: | 8623 |
内容来源: zai-org/GLM-OCR