SDK TechnicalGuide v2.0 Daubango AI
SDK TechnicalGuide v2.0 Daubango AI
Doubango AI
State of the art ANPR/ALPR implementation for embedded devices (ARM) and
desktops (X86) using deep learning
https://github.com/DoubangoTelecom/ultimateALPR-SDK
1
UltimateALPR-SDK version 3.2.0
Table of Contents
1 Intro..................................................................................................................................................6
2 Features.............................................................................................................................................7
2.1 Image Enhancement for Night-Vision (IENV).........................................................................7
2.1.1 Anti-Overexposure............................................................................................................7
2.1.2 Debugging.........................................................................................................................7
2.2 License Plate Recognition (LPR).............................................................................................7
2.2.1 Supported countries...........................................................................................................8
2.3 License Plate Country Identification (LPCI)............................................................................8
2.3.1 Supported countries...........................................................................................................9
2.4 Vehicle Color Recognition (VCR)..........................................................................................11
2.4.1 Supported colors.............................................................................................................12
2.5 Vehicle Make Model Recognition (VMMR)..........................................................................12
2.5.1 Supported Makes.............................................................................................................13
2.5.2 Supported Models and Years...........................................................................................13
2.6 Vehicle Body Style Recognition (VBSR)...............................................................................13
2.6.1 Supported body styles.....................................................................................................13
2.7 Vehicle Direction Tracking (VDT).........................................................................................14
2.8 Vehicle Speed Estimation (VSE)............................................................................................14
3 Architecture overview....................................................................................................................15
3.1 Supported operating systems..................................................................................................15
3.2 Supported CPUs......................................................................................................................15
3.3 Supported GPUs.....................................................................................................................15
3.4 Supported VPUs.....................................................................................................................15
3.5 Supported FPGAs...................................................................................................................16
3.6 Supported programming languages........................................................................................16
3.7 Supported raw formats............................................................................................................16
3.8 Optimizations..........................................................................................................................16
3.9 Thread safety...........................................................................................................................16
4 Device-based versus Cloud-based solution....................................................................................18
5 Configuration options.....................................................................................................................19
6 Sample applications........................................................................................................................27
6.1 Benchmark..............................................................................................................................27
6.2 VideoParallel...........................................................................................................................28
6.3 VideoSequential......................................................................................................................28
6.4 ImageSnap..............................................................................................................................28
6.5 Trying the samples..................................................................................................................28
7 Getting started................................................................................................................................31
7.1 Adding the SDK to your project.............................................................................................31
7.2 Using the API..........................................................................................................................31
8 Parallel versus sequential processing ............................................................................................33
9 Rectification layer..........................................................................................................................35
9.1 Polarity....................................................................................................................................35
10 Pyramidal search..........................................................................................................................36
11 Muti-threading design...................................................................................................................42
12 Memory management design.......................................................................................................43
12.1 Memory pooling...................................................................................................................43
2
UltimateALPR-SDK version 3.2.0
3
UltimateALPR-SDK version 3.2.0
4
UltimateALPR-SDK version 3.2.0
This is a short technical guide to help developers and integrators take the best from our
ALPR/ANPR SDK. You don't need to be a developer or expert in deep learning to understand and
follow the recommendations defined in this guide.
5
UltimateALPR-SDK version 3.2.0
1 Intro
Have you ever seen a deep learning based ANPR/ALPR (Automatic Number/License Plate
Recognition) engine running at 47fps on ARM device (Android, Snapdragon 855, 720p video
resolution) ?
With an average frame rate as high as 47 fps on ARM devices (Snapdragon 855) this is the fastest
ANPR/ALPR implementation you'll find on the market. Being fast is important but being accurate
is crucial. We use state of the art deep learning techniques to offer unmatched accuracy and
precision. As a comparison this is #33 times faster than OpenALPR on Android (see benchmark
section for more information).
No need for special or dedicated GPUs, everything is running on CPU with SIMD ARM NEON
optimizations, fixed-point math operations and multithreading.
This opens the doors for the possibilities of running fully featured ITS (Intelligent Transportation
System) solutions on a camera without soliciting a cloud. Being able to run all ITS applications on
the device will significantly lower the cost to acquire, deploy and maintain such systems. Please
check “Device-based versus Cloud-based solution” section for more information about how this
would reduce the cost.
The code is accelerated on CPU, GPU, VPU and FPGA, thanks to CUDA and OpenVINO.
In addition to License Plate Recognition (LPR) we support License Plate Country Identification
(LPCI), Vehicle Color Recognition (VCR), Vehicle Make Model Recognition (VMMR), Vehicle
Direction Tracking (VDT) and Vehicle Speed Estimation (VSE).
On high-end NVIDIA GPUs like the Tesla V100 the frame rate is 315 fps which means 3.17
millisecond inference time. On high-end CPUs like Intel Xeon the maximum frame rate could be
up to 237fps, thanks to OpenVINO. On low-end CPUs like the Raspberry Pi 4 the average frame
rate is 12fps.
Don't take our word for it, come check our implementation. No registration, license key or
internet connection is needed, just clone the code from Github and start coding/testing:
https://github.com/DoubangoTelecom/ultimateALPR-SDK. Everything runs on the device, no data
is leaving your computer. The code released on Github comes with many ready-to-use samples to
help you get started easily. You can also check our online cloud-based implementation (no
registration required) at https://www.doubango.org/webapps/alpr/ to check out the accuracy and
precision before starting to play with the SDK.
6
UltimateALPR-SDK version 3.2.0
2 Features
Our ANPR products support multiple core features required to implement advanced solutions.
Feature Availability
Image Enhancement for Night-Vision (IENV) UltimateALPR 3.2.0, UltimateITS 2.0.0
License Plate Recognition (LPR) UltimateALPR 2.0.0, UltimateITS 2.0.0
License Plate Country Identification (LPCI) UltimateALPR 3.0.0, UltimateITS 2.0.0
Vehicle Color Recognition (VCR) UltimateALPR 3.0.0, UltimateITS 2.0.0
Vehicle Make Model Recognition (VMMR) UltimateALPR 3.0.0, UltimateITS 2.0.0
Vehicle Body Style Recognition (VBSR) UltimateALPR 3.2.0, UltimateITS 2.0.0
Vehicle Direction Tracking (VDT) UltimateITS 2.0.0
Vehicle Speed Estimation (VSE) UltimateITS 2.0.0
IENV is CPU intensive but we made it fully SIMD accelerated (SSE, AVX, NEON) and massively
multithreaded to reduce the latency. Using 720p images (1280x720) you can expect up to 2
milliseconds latency (500fps throughput) on Intel i7-4790K (x86-64). This feature is also
optimized on ARM CPUs (thanks to NEON) but we only recommend it on high-end device.
2.1.1 Anti-Overexposure
IENV contains an anti-overexposure module (always enabled) which means it can be enabled day
and night regardless the luminosity.
2.1.2 Debugging
IENV is a filter applied on the images before any other function. You can dump the output of the
filter to a local file as explained in the debugging section.
7
UltimateALPR-SDK version 3.2.0
706YCQ
MXC808E
P001AM77
D8878
서울31 바5533
8
UltimateALPR-SDK version 3.2.0
Germany -- Classification
9
UltimateALPR-SDK version 3.2.0
• DNK-Denmark
• ESP-Spain
• EST-Estonia
• FIN-Finland
• FRA-France
• GBR-United_Kingdom_of_Great_Britain_and_Northern_Ireland
• GEO-Georgia
• GRC-Greece
• HRV-Croatia
• HUN-Hungary
• IND-India
• IRL-Ireland
• ISL-Iceland
• ISR-Israel
• ITA-Italy
• KAZ-Kazakhstan
• KGZ-Kyrgyzstan
• KOR-Republic_of_Korea
• LIE-Liechtenstein
• LTU-Lithuania
• LUX-Luxembourg
• LVA-Latvia
• MCO-Monaco
• MDA-Republic_of_Moldova
• MKD-North_Macedonia
• MLT-Malta
• MNE-Montenegro
• NLD-Netherlands
• NOR-Norway
• NZL-New_Zealand
• POL-Poland
• PRT-Portugal
10
UltimateALPR-SDK version 3.2.0
• ROU-Romania
• RUS-Russian_Federation
• SRB-Serbia
• SVK-Slovakia
• SVN-Slovenia
• SWE-Sweden
• TJK-Tajikistan
• TKM-Turkmenistan
• TUR-Turkey
• TWN-Taiwan
• UKR-Ukraine
• USA-United_States_of_America + 51 states (Alabama, Alaska, Arizona, Arkansas,
California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois,
Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan,
Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New_Hampshire,
New_Jersey, New_Mexico, New_York, North_Carolina, North_Dakota, Ohio, Oklahoma,
Oregon, Pennsylvania, Rhode_Island, South_Carolina, South_Dakota, Tennessee, Texas,
Utah, Vermont, Virginia, Washington, Washington_DC, West_Virginia, Wisconsin,
Wyoming)
• UZB-Uzbekistan
white
silver
11
UltimateALPR-SDK version 3.2.0
bmw x6 2019
12
UltimateALPR-SDK version 3.2.0
13
UltimateALPR-SDK version 3.2.0
• heavytruck
• motorcycle
• mpv
• pickup
• sedan
• suv
• van
14
UltimateALPR-SDK version 3.2.0
3 Architecture overview
Note: Full GPGPU acceleration was added on version 3.1.0 for NVIDIA Jetson devices.
15
UltimateALPR-SDK version 3.2.0
3.8 Optimizations
The SDK contains the following optimizations to make it run as fast as possible:
• Hand-written assembler
• SIMD (SSE, AVX, NEON) using intrinsics or assembler
• GPGPU (CUDA, TensorRT, TF-TRT, OpenVINO, OpenCL, OpenGL, NNAPI and Metal)
• Smart multithreading (minimal context switch, no false-sharing, no boundaries crossing...)
• Smart memory access (data alignment, cache pre-load, cache blocking, non-temporal
load/store for minimal cache pollution, smart reference counting...)
• Fixed-point math
• Quantized inference
• ... and many more
Many functions have been open sourced and included in CompV project:
https://github.com/DoubangoTelecom/CompV. More functions from deep learning parts will be
open sourced in the coming months. You can contact us to get some closed-source code we're
planning to open.
All the functions in the SDK are thread safe which means you can invoke them in
concurrent from multiple threads. But, you should not do it for many reasons:
• You'll end up saturating the CPU and making everything run slower. The threading
16
UltimateALPR-SDK version 3.2.0
model makes sure the SDK will never use more threads than the number of virtual
CPU cores. Calling the engine from different threads will break this rule as we
cannot control the threads created outside the SDK.
• Unless you have access to the private API the engine uses a single context which
means concurrent calls are locked when they try to write to a shared resource.
17
UltimateALPR-SDK version 3.2.0
18
UltimateALPR-SDK version 3.2.0
5 Configuration options
The configuration options are provided when the engine is initialized and they are case-sensitive.
Name Type values Description
debug_level STRING verbose Defines the debug level to output on the console.
info You should use verbose for diagnostic, info
warn in development stage and warn in production.
error Default: info
fatal
debug_write_in BOOLEAN true Whether to write the transformed input image to
put_image_enab false the disk. This could be useful for debugging.
led Default: false
debug_internal STRING Folder Path to the folder where to write the transformed
_data_path path input image. Used only if
debug_write_input_image_enabled is
true.
Default: “”
license_token_ STRING File Path to the file containing the license token. First
file path you need to generate a Runtime Key using
requestRuntimeLicenseKey() function then activate
the key to get a token.
You should use license_token_file or
license_token_data but not both.
license_token_ STRING BASE64 Base64 string representing the license token.
data First you need to generate a Runtime Key using
requestRuntimeLicenseKey() function then activate
the key to get a token.
You should use license_token_file or
license_token_data but not both.
19
UltimateALPR-SDK version 3.2.0
20
UltimateALPR-SDK version 3.2.0
detect_roi FLOAT[4] Any Defines the Region Of Interest (ROI) for the
detector. Any pixels outside region of interest
will be ignored by the detector. Defining an
WxH region of interest instead of resizing the
image at WxH is very important as you'll keep
the same quality when you define a ROI while
you'll lose in quality when using the later.
Format: [left, right, top, bottom]
Default: [0.f, 0.f, 0.f, 0.f]
detect_minscor FLOAT [0.f, Defines a threshold for the detection score. Any
e 1.f] detection with a score below that threshold will
be ignored.
Range: [0.f, 1.f]
Default: 0.3f
0.f being poor confidence and 1.f excellent
confidence.
detect_gpu_bac STRING opengl Defines the GPU backend to use. This entry is
kend opencl only meaningful when
nnapi gpgpu_enabled=true . You should not set
metal this value and must let the SDK choose the right
none value based on the system information. On
desktop implementation, this entry will be
ignored if support for CUDA is found.This value
is also ignore when
detect_quantization_enabled=true
as quantized operations are never executed on a
GPU.
detect_quantiz BOOLEAN true Whether to enable quantization on ARM devices.
ation_enabled false Please note that quantized functions never run on
GPU as such devices are not suitable for integer
operations. GPUs are designed and optimized for
floating point math. Any function with dual
21
UltimateALPR-SDK version 3.2.0
22
UltimateALPR-SDK version 3.2.0
23
UltimateALPR-SDK version 3.2.0
recogn_score_t STRING min Defines the overall score type. The recognizer
ype mean outputs a recognition score ([0.f, 1.f]) for every
median character in the license plate. The score type
max defines how to compute the overall score.
minmax min: Takes the minimum score.
mean: Takes the average score.
median: Takes the median score.
max: Takes the maximum score.
minmax: Takes (max + min) * 0.5f
The min score is the more robust type as it
ensure that every character have at least a certain
confidence value.
The median score is the default type as it
provide a higher recall. In production we
recommend using min type.
Default: median.
Recommended: min
recogn_minscor FLOAT ]0.f, Define a threshold for the overall recognition
e 1.f] score. Any recognition with a score below that
threshold will be ignored. The overall score is
computed based on recogn_score_type.
Range: ]0.f, 1.f]
Default: 0.3f
0.f being poor confidence and 1.f excellent
confidence.
recogn_rectify BOOLEAN true Whether to add rectification layer between the
_enabled detector's output and the recognizer's input. A
false rectification layer is used to suppress the
distortion. A plate is distorted when it's skewed
and/or slanted. The rectification layer will
deslant and deskew the plate to make it straight
which make the recognition more accurate.
Please note that you only need to enable this
feature when the license plates are highly
distorted. The implementation can handle
moderate distortion without a rectification layer.
The rectification layer adds many CPU intensive
operations to the pipeline which decrease the
frame rate.
Default: false
24
UltimateALPR-SDK version 3.2.0
25
UltimateALPR-SDK version 3.2.0
26
UltimateALPR-SDK version 3.2.0
6 Sample applications
The source code comes with #4 sample applications: Benchmark, VideoParallel, VideoSequential
and ImageSnap.
6.1 Benchmark
This application is used to check everything is ok and running as fast as expected. The imformation
about the maximum frame rate (47fps) on Snapdragon 855 devices could be checked using this
application. It's open source and doesn't require registration or license key.
27
UltimateALPR-SDK version 3.2.0
6.2 VideoParallel
This application should be used as reference code by any developer trying to add ultimateALPR to
their products. It shows how to detect and recognize license plates in realtime using live video
stream from the camera.
6.3 VideoSequential
Same as VideoParallel but working on sequential mode which means slower. This application is
provided to ease comparing the modes: Parallel versus Sequential.
6.4 ImageSnap
This application reads and display the live video stream from the camera but only recognize an
image from the stream on demand.
28
UltimateALPR-SDK version 3.2.0
29
UltimateALPR-SDK version 3.2.0
3. Select the sample you want to try (e.g. "videoparallel") and press "run". Make sure to have
the device on landscape mode for better experience.
30
UltimateALPR-SDK version 3.2.0
7 Getting started
The SDK works on many platforms using many programming languages but this section focus
Android and Java. Please check the previously section for more information on how to use the
sample applications.
sourceSets {
main {
jniLibs.srcDirs += ['path-to-your-ultimateALPR-SDK/binaries/android/jniLibs']
java.srcDirs += ['path-to-your-ultimateALPR-SDK/java/android']
assets.srcDirs += ['path-to-your-ultimateALPR-SDK/assets/models']
}
}
....
}
If you prefer adding the SDK as reference, then we assume you're an experimented
developer and will find how to do it by yourself or just check the sample applications (they
are referencing the SDK project instead of including the sources).
It's hard to be lost when you try to use the API as there are only 3 useful functions: init,
process and deInit.
31
UltimateALPR-SDK version 3.2.0
32
UltimateALPR-SDK version 3.2.0
33
UltimateALPR-SDK version 3.2.0
On Android devices we have noticed that parallel processing can speedup the pipeline by up
to 120% on some devices while on Raspberry Pi there the gain is marginal.
On RockPi 4B (ARM64) the code is 5 times faster when parallel processing is enabled.
Please note that enabling parallel processing increase memory usage as more threads are used. We
recommend using OpenVINO instead of Tensorflow to decrease memory usage.
34
UltimateALPR-SDK version 3.2.0
9 Rectification layer
The rectification layer is a dynamic module you can plug/unplug between the detector's output and
the recognizer's input to rectify a license plate in order to suppress the distortion. A plate is distorted
if it's slanted or skewed.
A license plate is attached on a moving car and is supposed to be undeformable. The camera could
be also moving even if this is not the case for most scenarios. In such situation, every position the
plate can take could be estimated using a 3x3 matrice. This is the homography matrice.
The goal for the rectification layer is to estimate the homography matrice using linear regression,
compute it's inverse, multiply it with every pixel from the detector's output and provide the warped
pixels to the recognizer's input.
As you may expect, this process is time consuming and is disabled by default when the SDK is
running on ARM devices. You should not worry about its absence as the default code can already
handle moderately distorted plates.
See the configuration section on how to enable/disable the rectification layer.
The next image shows how the rectification layer transforms an image to remove the skew and
slant.
9.1 Polarity
There are two polarities: DarkOnBright and BrightOnDark.
DarkOnBright: The numbers on the license plate are darker than the background. Example: Black
numbers on white background (European license plates).
BrightOnDark: The numbers on the license plate are brighter than the background. Example: White
numbers on blue background (Chinese license plates).
Unlike other implementations we don't use the four corners from the license plate to estimate the
homography matrice because such implemention wouldn't be robust to high distortions or heavy
noise. Instead, we use every edge on the plate to estimate the skew and shear/slant angles. Theses
angles are combined with the x/y scales (size normalization) to build a 3x3 rectification matrice
(our homography matrice).
The edges directions are very important and this is why we need to know what the polarity. The
code contains a polarifier which can estimate the polarity but it's not immune to errors. To help the
polarifier you can define a preferred polarity and even better you can restrict it if your country uses
single polarity. See the configuration section for more info.
See the configuration section on how to give a “hint” for the polarity.
35
UltimateALPR-SDK version 3.2.0
10 Pyramidal search
As explained in the previous sections, the detector uses a Convolutional Neural Network with a
[300, 300, 3] input layer. This means any image presented to the detection pipeline will be resized
to 300x300 and converted to RGB_888 format regardless its resolution.
Using a low resolution speedup the inference function and using a fixed shape instead of ratio-based
scaling improves generalization and speedup the training process. This is obviously an issue when
the image is very large and the license plates very small or far away. Small or far away license
plates on large images tend to disappear when the image is downscaled with a 2+ factor.
To fix the above issue we could choose an input layer with higher resolution (e.g. [512, 512, 3]
instead of [300, 300, 3]) as done by many ANPR solutions. The problem is that higher resolution
comes with higher latency and memory usage. The ANPR solutions we tried barely reach 1fps
(detection only) on Raspberry Pi 4 while our implementation can run at 12fps. To keep this
frame rate while being able to accurately detect small and far away plates we spent huge amount of
time in R&D to come with a very fast and accurate solution. To make it short: Scale the features
not the image.
You don't need to understand how the pyramidal search works in order to use it (see
“pyramidal_search_enabled” config to enable/disable) but some basic technical
information may help you debug issues:
1. The features are extracted from the input image and defined as base layer.
2. If quantization is enabled, then the features are converted from float32 to int8 and
normalized ([-127, 128]).
3. The detection pipeline is partially executed on the base layer without the Non-max
Suppression (NMS) step. The variable n is initialized with integer value 1. This is the first
pass (1st-pass).
4. A refinement function with binary output is done on the result (bounding boxes and scores)
from nth-pass. If the output is 0 or n>6 then, the process is stopped and we move to step 7.
Otherwise (output is 1 and n <=6), we move to step 5.
5. The features from nth-pass are scaled by X and the detection pipeline is partially executed
again. This execution is almost 7 times faster than nth-pass as there are less layers and
neurons (lower depth multiplier).
6. Variable n is incremented and we loop back to step 4.
7. Resume the detection pipeline with NMS and other post-processing operations.
For example, you can use pyramidal search to monitor at realtime a 5-lane highway using a
single long-range camera.
Let's be very concrete and try with a sample image. The next image is from The Verge article titled
“Privacy advocate held at gunpoint after license plate reader database mistake, lawsuit alleges”. You
can find it here.
36
UltimateALPR-SDK version 3.2.0
Original image:
37
UltimateALPR-SDK version 3.2.0
38
UltimateALPR-SDK version 3.2.0
39
UltimateALPR-SDK version 3.2.0
40
UltimateALPR-SDK version 3.2.0
You can clearly see that we miss the two furthest plates when pyramidal search is disabled.
The same test could be done using our online cloud-based demo web application hosted at
https://www.doubango.org/webapps/alpr/ . You can also use the original image with ALPR / ANPR
products provided by other companies for comparison.
41
UltimateALPR-SDK version 3.2.0
11 Muti-threading design
No forking, minimal context switch. Doubango vs Others
42
UltimateALPR-SDK version 3.2.0
43
UltimateALPR-SDK version 3.2.0
13.1 Detector
This section explains how to increase the accuracy for the detection layer.
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:
44
UltimateALPR-SDK version 3.2.0
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:
45
UltimateALPR-SDK version 3.2.0
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:
Then, resizing the car at 300x300 and detecting the license plate:
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.
46
UltimateALPR-SDK version 3.2.0
While detecting the license plate on the next image will be done with very low accuracy or even
fail:
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
47
UltimateALPR-SDK version 3.2.0
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.
13.3.1 Fuse
The SDK supports White, Silver, Gray and many other colors but not LightSilver and DarkSilver.
When the confidence score for the Top #1 result is less than a certain threshold (80%
recommended) then, you can combine the Top #2 to form a new color.
1. You can assume the color to be LightSilver when the Top #2 is “White, Silver” and the
sum of the confidence scores is higher than a certain threshold.
2. You can assume the color to be DarkSilver when the Top #2 is “Gray, Silver” and the sum
of the confidence scores is higher than a certain threshold.
Please check the source code to see how the fusion is done.
0.75 (darker)
48
UltimateALPR-SDK version 3.2.0
1.5 (lighter)
2.0 (lighter)
You'll have the next top-5 results from the VCR classifier:
Rank Make Model Year Score
1 renault clio 2012 45.00%
2 renault clio 2019 36.00%
3 renault grand scenic 2004 0.87%
4 renault clio 2005 0.80%
5 renault grand scenic 2013 0.27%
49
UltimateALPR-SDK version 3.2.0
Please note that we support more than 15k models but only returning the top-5 and the sum of all
scores is always equal to 100%.
If you check the top-1 result (renault, clio, 2012) you see that the confidence is low (45%). But, if
you check the top-5 results you understand that the make is clearly “renault” and the model “clio”.
This is why fuse and defuse technique is needed to improve the top-1 score.
After fuse and defuse technique is applied to the top-5 result, you'll have the following:
Make Score
renault 82.94%
Model Score
clio 81.80%
grand scenic 1.14%
Now we clearly see that the make (82.94%) and model (81.80%) are predicted with high score.
For the year, we can assume it's the same as top-1 (2012).
Please check the source for more information on how the fuse and defuse technique is
implemented.
50
UltimateALPR-SDK version 3.2.0
51
UltimateALPR-SDK version 3.2.0
15.1 OpenVINO
OpenVINO is always faster than Tensorflow on Intel products (CPU, GPU, VPU, FPGA). We
recommend enabling OpenVINO if not already done. Check the console logs to make sure
OpenVINO plugin is loaded and used.
For now (version 3.0), OpenVINO is only supported on Linux and Windows x86-64.
15.2.1 Desktops
On desktops (x86_64) we support GPGPU acceleration via TensorRT (NVIDIA CUDA) and
OpenVINO.
• For NVIDIA GPUs: https://github.com/DoubangoTelecom/ultimateALPR-
SDK/tree/master/samples/c%2B%2B#gpu-acceleration
• For Intel GPUs, VPUs, FPGAs: Enable OpenVINO and set the device type using JSON
config entry “openvino_device” as explained in the configuration section.
15.2.2Mobiles
On mobile devices (ARM) we support GPGPU acceleration via TensorflowLite backends (OpenGL
shaders, Metal and NNAPI) . For now we prefer using I8 quantized models instead of F32/F16
GPGPU accelerated models. Quantized models work in highly predictable ways on any ARM CPU
while GPGPU accelerated models via TensorflowLite (OpenGL or NNAPI) tend to be fast on some
devices and horribly slow on others.
52
UltimateALPR-SDK version 3.2.0
devices the image could also be horizontally/vertically mirrored in addition to being rotated.
Our deep leaning model can natively handle rotations up to 45 degree but not 90, 180 or 270. There
is a pre-processing operation to rotate the image back to 0 degree and remove the mirroring effect
but such operation is time consuming on mobile devices. We recommend using the device on
landscape mode to avoid the pre-processing operation.
53
UltimateALPR-SDK version 3.2.0
54
UltimateALPR-SDK version 3.2.0
16 Benchmark
It's easy to assert that our implementation is the fastest you can find without backing our claim with
numbers and source code freely available to everyone to check.
See the next section for more information.
Rules:
• We're using Samsung Galaxy S10+ (Snapdragon 855)
• For every implementation we're running the recognition function within a loop for #1000
times.
• The positive rate defines the percentage of images with a plate. For example, 20% positives
means we will have #800 negative images (no plate) and #200 positives (with a plate) out of
the #1000 total images. This percentage is important as it allows timing both the detector
and recognizer.
• All positive images contain a single plate.
• Both implementations are initialized outside the loop.
55
UltimateALPR-SDK version 3.2.0
ultimateALPR 21344 millis 25815 millis 29712 millis 33352 millis 37825 millis
46.85 fps 38.73 fps 33.65 fps 29.98 fps 26.43 fps
OpenALPR 715800 millis 758300 millis 819500 millis 849100 millis 899900 millis
1.39 fps 1.31 fps 1.22 fps 1.17 fps 1.11 fps
One important note from the above table is that the detector in OpenALPR is very slow and 80% of
the time is spent trying to detect the license plates. This could be problematic as most of the time
there is no plate on the video stream (negative images) from a camera filming a street/road and in
such situations an application must run as fast as possible (above the camera maximum frame rate)
to avoid dropping frames and loosing positive frames. Also, the detection part should burn as less as
possible CPU cycles which means more energy efficient.
The above table shows that ultimateALPR is up to 33 times faster than OpenALPR.
To be fair to OpenALPR:
1. The API only allows providing a file path which means for every loop they are reading and
decoding the input while ultimateALPR accepts raw bytes.
2. There is no ARM64 binaries provided and the app is loading the ARMv7 versions.
Again, our benchmark application is open source and doesn't require registration or license key to
try. You can try to make the same test on your own device and please don't hesitate to share your
numbers or any feedback if you think we missed something.
16.2 Intel® Xeon® E3 1230v5 CPU with GTX 1070 GPU (Untuntu 18)
We recommend using a computer with a GPU unleash ultimateALPR speed. Next numbers are
obtained using GeForce GTX 1070 GPU and Intel® Xeon® E3 1230v5 CPU on Ubuntu 18.
0% 20% positives 50% positives 70% positives 100% positives
positives
Intel® Xeon® E3 1230v5 711 millis 828 millis 1004 millis 1127 millis 1292 millis
(NVIDIA GTX 1070) 140.51 fps 120.76 fps 99.53 fps 88.70 fps 77.38 fps
(Ubuntu 18)
(OpenVINO Disabled)
Intel® Xeon® E3 1230v5 737 millis 809 millis 903 millis 968 millis 1063 millis
(NVIDIA GTX 1070) 135.62 fps 123.55 fps 110.72 fps 103.22 fps 94.07 fps
(Ubuntu 18)
(OpenVINO Enabled)
The above numbers show that the best case is “Intel® Xeon® E3 1230v5 + GTX 1070 +
OpenVINO enabled”. In such case the GPU (TensorRT, CUDA) and the CPU (OpenVINO) are
used in parallel. The CPU is used for detection and the GPU for recognition/OCR.
56
UltimateALPR-SDK version 3.2.0
57
UltimateALPR-SDK version 3.2.0
The Github repository contains Raspberry Pi benchmark application to evaluate the performance pi
version 3 and later.
More information on how to build and use the application could be found at
https://github.com/DoubangoTelecom/ultimateALPR-SDK/blob/master/samples/c+
+/benchmark/README.md.
Please note that even if Raspberry Pi 4 have a 64-bit CPU Raspbian OS uses a 32-bit kernel which
means we're loosing many SIMD optimizations.
0% positives 20% positives 50% positives 70% positives 100% positives
Raspberry Pi 4 81890 millis 89770 millis 115190 millis 122950 millis 141460 millis
(Buster) 12.21 fps 11.13 fps 8.68 fps 8.13 fps 7.06 fps
RockPi 4B 7588 millis 8008 millis 8606 millis 9213 millis 9798 millis
(Ubuntu 18.04 Server) 13.17 fps 12.48 fps 11.61 fps 10.85fps 10.20 fps
58
UltimateALPR-SDK version 3.2.0
59
UltimateALPR-SDK version 3.2.0
60
UltimateALPR-SDK version 3.2.0
19.3 Why does the detector fail to accurately detect far away or very
small plates?
As explained in the documentation, the input layer will resize any image to a fixed 300x300x3
resolution and small or far away plates may become undetectable after such process. You can enable
pyramidal search feature (will add some delay to the detection pipeline) to fix such issue.
61
UltimateALPR-SDK version 3.2.0
20 Known issues
62