Improving the accuracy

The code provided on Github (https://github.com/DoubangoTelecom/ultimateMRZ-SDK) comes with default configuration to make everyone almost happy. You may want to increase the speed or accuracy to match your use case.

Detector

This section explains how to increase the accuracy for the detection layer.

Segmenter accuracy

As explained in the configuration section the segmenter accuracy accepts 5 values (JSON strings): veryhigh, high, medim, low, and verylow. The default value is high. If the SDK fails to detect some MRZ lines then, consider using veryhigh accuracy. With veryhigh value the detection accuracy will increase but this comes with a cost: high CPU usage and slow detection. We recommend increasing the image resolution and making sure that the MRZ lines are as straight as possible instead of changing the accuracy level.

Configuration entry: segmenter_accuracy

Backpropagation

Enable backpropagation to increase the recall score.

Configuration entry: backpropagation_enabled

Minimum number of MRZ lines

If you’re trying to detect MRZ data with at least 2 lines which is the case for all standard formats then, say it loudly by setting the corresponding JSON configuration entry. In addition to removing some orphans (single MRZ lines) it will improve the speed. Removing the orphans increase the precision score without decreasing the recall value.

Configuration entry: min_num_lines

Region of interest

Unlike other applications you can find on the market we don’t define a region of interest (ROI), the entire frame is processed to look for MRZ lines. Setting a ROI could decrease the false-positives and improve the precision score without decreasing the recall value. The deep learning model used for the detection is very accurate (high precision and high recall) and should not output false-positives if you’re using the default recommended values.

Configuration entry: roi

Recognizer

This section explains how to increase the accuracy for the recognizer layer.

Data validation

In the previous sections we explained how to use the check digits to validate the most important fields (e.g. document number, expiry date, date of birth…) from the MRZ data.

When you’re processing images from a video stream you can use the data validation process to make sure the result from the SDK is correct. If the validation fails for one frame then, just drop it and process the next one until you get something valid. You can also use the recognition scores/confidences values to ensure that other fields (e.g. holder’s name, optional data…) without check digits are also valid.

Interpolation

As explained in the configuration section, the interpolation operation accepts 3 values (JSON strings): bicubic, bilinear, and nearest. The default value is bilinear. The interpolation operations are used when pixels are scaled, deskewed or deslanted. bicubic offers the best quality but is slow as there is no SIMD or GPU acceleration yet. bilinear and nearest interpolations are multithreaded and SIMD accelerated.

For most scenarios bilinear interpolation is good enough to provide high accuracy/precision results while the code still runs very fast. Change the interpolation value to bicubic if you’re having low recognition score.

Configuration entry: interpolation

Score threshold

The SDK returns a score/confidence value for each MRZ line. These scores are in percentage and within [0.0, 100.0]. When the score is >=90% then, you’re sure that every character in the MRZ line is correct. A score >=70% means almost every character in the MRZ line is correct.

We recommend using a threshold value equal to 70% and using the validation process to make sure everything is correct.

Configuration entry: min_score