How docsaidlab/mrzscanner works
MRZScanner is a Python library for locating and reading machine-readable zones in travel-document images. Its main workflow accepts an image, selects a spotting, detection, recognition, or two-stage mode, and returns MRZ text and, where applicable, a polygon; optional cropping and text postprocessing are handled by the scanner. The repository also contains synthetic detection-data generation and MIDV2020 fine-tuning/benchmark datasets. Edges reflect the sampled scanner and inference calls, plus documented usage; training execution and some dataset workflows are not shown in the excerpts.
Main entry points: scanner.py MRZScanner · rec/infer.py Recognition inference · spotting/infer.py Spotting inference · det/infer.py Detection inference
Components 13
Scanner API
- MRZScanner
mrzscanner/scanner.py - MRZ correction
mrzscanner/scanner.py
Model Inference
- Spotting inference
mrzscanner/spotting/infer.py - Detection inference
mrzscanner/det/infer.py - Recognition inference
mrzscanner/rec/infer.py - ONNX runtime
Text Decoding
- Text decoder
mrzscanner/utils.py
Dataset Preparation
- Synthetic MRZ data
dataset/train_dataset.py - Fine-tuning data
dataset/finetune_dataset.py
Other components
- Image caller
- Model hosting
- MRZ generator
- Background images
Connections 17
- Image caller → MRZScanner: submits image
README.md - MRZScanner → Spotting inference: runs spotting
mrzscanner/scanner.py - MRZScanner → Detection inference: runs detection
mrzscanner/scanner.py - MRZScanner → Recognition inference: runs recognition
mrzscanner/scanner.py - MRZScanner → Detection inference: gets polygon
mrzscanner/scanner.py - MRZScanner → Recognition inference: passes warped image
mrzscanner/scanner.py - MRZScanner → MRZ correction: optionally corrects
mrzscanner/scanner.py - Spotting inference → ONNX runtime: runs model
mrzscanner/spotting/infer.py - Detection inference → ONNX runtime: runs model
mrzscanner/det/infer.py - Recognition inference → ONNX runtime: runs model
mrzscanner/rec/infer.py - Spotting inference → Text decoder: decodes output
mrzscanner/spotting/infer.py - Recognition inference → Text decoder: decodes output
mrzscanner/rec/infer.py - Spotting inference → Model hosting: downloads missing model
mrzscanner/spotting/infer.py - Detection inference → Model hosting: downloads missing model
mrzscanner/det/infer.py - Recognition inference → Model hosting: downloads missing model
mrzscanner/rec/infer.py - Synthetic MRZ data → MRZ generator: generates MRZ
dataset/train_dataset.py - Synthetic MRZ data → Background images: reads backgrounds
dataset/train_dataset.py