Improving the accuracy

The code provided on Github comes with default configuration to make everyone almost happy. You may want to increase the speed our accuracy to match your use case.

Detector

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

Far away or very small plates

This section explains how to improve accuracy on very small or far away plates.

Region of interest

As explained in the previous sections, the detector expects a 300x300 image as input. Regardless the input size the detector will always downscale it at 300x300 and convert it to RGB_888.

When a plate is far away or very small and the image too large, then downscaling it to 300x300 make such plates almost disappear.

Let’s consider the next 1280x720 image:

1280x720 image with far away plate

1280x720 image with far away plate

The license plates on the Renault and Mercedes-Benz are correctly detected but not the one on the volkswagen (VW). The issue is that the license plate on the VW is far away or relatively small compared to the image size. Let’s resize the image at 300x300 and see what the CNN have as input:

1280x720 image with far away plate resized at 300x300

1280x720 image with far away plate resized at 300x300

We can clearly see that at 300x300 the plate on the VW is undetectable. In fact the issue isn’t that the plate is small in terms of pixels but in percentage relative to the image size. To fix the issue, select a region of interest (see configuration section on how to define a ROI) to make the plate size in percentage higher. Let’s take a 1100x333 ROI:

1280x720 image with far away plate with 1100x300 ROI

1280x720 image with far away plate with 1100x300 ROI

The 1100x333 ROI defines a region where we expect to have a license plate and ignore everything else (the sky, the buildings…). Let’s crop the ROI:

1100x300 ROI cropped from 1280x720 image

1100x300 ROI cropped from 1280x720 image

Let’s resize the cropped ROI at 300x300:

1100x300 ROI cropped from 1280x720 image and resized at 300x300

1100x300 ROI cropped from 1280x720 image and resized at 300x300

Now you can see that the license plate on the VW is clear and can be reliably detected.

Another solution would be detecting the car first which will always work as its size is large relative to the overall image:

Car detection

Car detection

Then, resizing the car at 300x300 and detecting the license plate:

Car detection resized at 300x300

Car detection resized at 300x300

All the steps described in this section are automatically done by the SDK when you define a ROI. You don’t need to write a single line of code to crop or resize the input image.

Another elegant way to detect license plates with any size is to enable pyramidal search. See next section for more information.

Detection score threshold

The configuration section explains how to set the minimum detection score.

  • If you have too many false-positives, then increase the detection score in order to increase the precision.

  • If you have too many false-negatives, then decrease the detection score in order to increase the recall.

Matching training data

The training data for the detection predominantly contains license plate mounted on a car. There are very few images of license plates alone. To increase the detection accuracy you should provide images showing both the license plate and the car.

For example, detecting license plate on the next image will be done with the highest accuracy possible (99.99%):

Plate mounted on car

Plate mounted on car

While detecting the license plate on the next image will be done with very low accuracy or even fail:

Plate alone

Plate alone

The fact that the training data predominantly contains images showing both the license plate and the car while there are few images with isolated plates is done on purpose. When you’re filming an outdoor scene, then there are many traffic signs or billboards looking very similar to license plates (strong borders with regular text inside). Adding a car as precondition helps get ride of false positives. When the SDK is correctly configured you’ll almost never see false-positives.

Recognizer

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

Adding rectification layer

When the license plates are highly distorted (skewed and/or slanted) you’ll need to activate the rectification layer to remove the distortion. The configuration section explains how to activate to rectification layer.

Check the section about rectification for more info about this feature.

Recognition score threshold

The configuration section explains how to set the minimum recognition score.

  • If you have too many false-positives, then increase the detection score in order to increase the precision.

  • If you have too many false-negatives, then decrease the detection score in order to increase the recall.

Restrictive score type

The configuration section explains the different supported score types: “min”, “mean”, “median”, “max” and “minmax”.

  • The “min” score type is the more restrictive one as it ensures that every character on the license plate have at least the minimum target score.

  • The “max” score type is the less restrictive one as it only ensures that a least one of the characters on the license plate have the minimum target score.

  • The “median” score type is a good trade-off between the “min” and “max” types.

We recommend using “min” score type. See the configuration section for more info on how to set the score type.