Abstract
Researchers at Lendbuzz have developed MRZNet, a specialized two-stage convolutional neural network (CNN) designed to detect and read the Machine-Readable Zone (MRZ) on passports and visas. By combining a coarse-to-fine localization strategy with Atrous Spatial Pyramid Pooling (ASPP), the system achieves a 100% detection rate and over 99% character recognition accuracy, significantly outperforming general-purpose OCR and scene-text detection models.
Introduction
Every modern passport and visa contains a Machine-Readable Zone (MRZ)—two lines of alphanumeric characters and "<<" symbols at the bottom of the identity page. While designed for machines, reading these from digital photos (rather than flatbed scans) is surprisingly difficult.
In real-world scenarios, such as a customer uploading a photo to a fintech app, images are often poorly lit, rotated, or taken at low resolution. General Optical Character Recognition (OCR) tools like Tesseract often fail because they aren't optimized for the specific fixed-width font and rigid structure of the MRZ. Meanwhile, state-of-the-art "scene text" detectors struggle with the long, dense strings of characters found in travel documents. MRZNet bridges this gap with a model that is both lightweight enough for production and robust enough for "in-the-wild" photography.
Methodology
The Two-Stage Pipeline
MRZNet utilizes a two-stage pipeline to balance computational efficiency with high precision. The system first processes a downsampled version of the full image to roughly locate the MRZ bounding box and determine its orientation. Once localized, the original high-resolution image is rotated and cropped to that specific region for fine-grained refinement and character recognition.
Network Architecture and ASPP
The model uses a MobileNetV2 backbone, chosen for its efficiency on CPUs. To handle MRZ regions of varying sizes and capture multi-scale context, the authors integrated Atrous Spatial Pyramid Pooling (ASPP) layers. These layers use dilated convolutions to allow the network to see both individual characters and the broader structure of the text block simultaneously.
Instead of using traditional Recurrent Neural Networks (RNNs) for sequence modeling, MRZNet employs a CNN-based recognition branch. It uses bilinear sampling to map the detected MRZ into a fixed grid, which is then processed by convolutional layers to classify each of the 88 characters (2 lines of 44 characters).
Datasets
The study utilized three primary datasets to train and validate the model:
- Internal Dataset: 4,820 real-world images (2,687 passports, 2,133 visas) from 85 countries, including both scans and smartphone photos with various distortions.
- MIDV-500: A public dataset for identity document analysis.
- SyntheticMRZ: A dataset of 17,113 generated images used to test the limits of the recognition engine.
Key Results
MRZNet demonstrated state-of-the-art performance across several benchmarks:
- Detection Rate: Achieved a 100% MRZ detection rate on the internal test set.
- Accuracy: Reached a 99.25% character recognition macro-F1 score, outperforming specialized tools like PassportEye (84.47%) and MRZ-Detection (95.01%).
- Speed: On a single GPU, the system processes an image in approximately 0.51 seconds, making it viable for real-time applications.
- Robustness: Even on the challenging MIDV-500 dataset, it maintained an 85.18% recognition score, significantly higher than its competitors.
Conclusion
The success of MRZNet highlights that specialized models can significantly outperform general scene-text detectors when the target format is rigid and well-defined. The coarse-to-fine strategy ensures high resolution where it matters most, while ASPP provides the necessary context for robust localization. Future work will focus on handling "warped" text lines caused by the curvature of thick passport books and improving robustness against environmental factors like smoke or water damage.
Summary updated