PAUL GUERRERO software engineer
← projects

vlm-dni-ocr

  • python
  • doctr
  • qwen-vl
  • fastapi

Classic OCR is good until reality musses it up. A photo of an ID card with bad lighting, a tilted document or a folded corner, and the text it extracts stops making sense before anyone even tries to read the fields.

Here the vision model earns its place: instead of reading already-degraded text, it looks at the image directly, the way a person would. The OCR doesn’t disappear, but it changes role: from being the source of truth to being a hint. The model itself is told to trust what it sees in the image over what the OCR whispers to it.

And underneath it all, a safety net. Every field the model produces goes through deterministic validation: the date format, the ID’s check digit. If something doesn’t add up, the field goes null instead of to a made-up value. On an identity document, a wrong value does more damage than a gap: a person fills the gap; the error slips through unnoticed.


How it’s built — Python · docTR · Qwen3-VL · FastAPI · field-by-field validation