Skip to content

Latest commit

 

History

History
119 lines (99 loc) · 9.46 KB

File metadata and controls

119 lines (99 loc) · 9.46 KB

This application is used as reference code for developers to show how to use the Python bindings for the C++ API and could be used to easily check the accuracy. The application accepts path to a JPEG/PNG/BMP file as input. This is not the recommended way to use the API. We recommend reading the data directly from the camera and feeding the SDK with the uncompressed YUV data without saving it to a file or converting it to RGB.

If you don't want to build this sample and is looking for a quick way to check the accuracy then, try our cloud-based solution at https://www.doubango.org/webapps/alpr/.

This sample is open source and doesn't require registration or license key.

Dependencies

The SDK is developed in C++11 and you'll need glibc 2.27+ on Linux and Visual C++ Redistributable for Visual Studio 2015 (any later version is ok) on Windows. You most likely already have these dependencies on you machine as almost every program require it.

If you're planning to use OpenVINO, then you'll need Intel C++ Compiler Redistributable (choose newest). Please note that OpenVINO is packaged in the SDK as plugin and loaded (dlopen) at runtime. The engine will fail to load the plugin if Intel C++ Compiler Redistributable is missing on your machine but the program will work as expected with Tensorflow as fallback. We highly recommend using OpenVINO to speedup the inference time. See benchmark numbers with/without OpenVINO at https://www.doubango.org/SDKs/anpr/docs/Benchmark.html#core-i7-windows.

Debugging missing dependencies

To check if all dependencies are present:

GPGPU acceleration

By default GPGPU acceleration is disabled. Check here for more information on how to enable it.

Prerequisite

You must build the Python extension before trying to run this sample. More information on how to build the extension could be found here

Usage

recognizer.py is a Python command line application with the following usage:

recognizer.py \
      --image <path-to-image-with-plate-to-process> \
      [--assets <path-to-assets-folder>] \
      [--parallel <whether-to-enable-parallel-mode:True/False>] \
      [--charset <recognition-charset:latin/korean/chinese>] \
      [--car_noplate_detect_enabled <whether-to-enable-detecting-cars-with-no-plate:True/False>] \
      [--ienv_enabled <whether-to-enable-IENV:True/False>] \
      [--openvino_enabled <whether-to-enable-OpenVINO:True/False>] \
      [--openvino_device <openvino-device-to-use>] \
      [--npu_enabled <whether-to-enable-NPU-acceleration:true/false>] \
      [--klass_lpci_enabled <whether-to-enable-LPCI:True/False>] \
      [--klass_vcr_enabled <whether-to-enable-VCR:True/False>] \
      [--klass_vmmr_enabled <whether-to-enable-VMMR:True/False>] \
      [--klass_vbsr_enabled <whether-to-enable-VBSR:True/False>] \
      [--tokenfile <path-to-license-token-file>] \
      [--tokendata <base64-license-token-data>]

Options surrounded with [] are optional.

Examples

Move to the binaries folder

Before trying the next examples you have to navigate to the folder containing the binaries:

cd ultimateALPR-SDK/binaries/<<os>>/<<arch>>

For example:

Try

  • On Linux and Raspberry Pi, you may use the next command:
PYTHONPATH=$PYTHONPATH:.:../../../python \
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
python ../../../samples/python/recognizer/recognizer.py --image ../../../assets/images/lic_us_1280x720.jpg --assets ../../../assets

Before trying to run the program on Linux x86_64 you'll need to download libtensorflow.so as explained here.

  • On Windows x86_64, you may use the next command:
setlocal
set PYTHONPATH=%PYTHONPATH%;.;../../../python
set PATH=%PATH%;%~dp0
python ../../../samples/python/recognizer/recognizer.py --image ../../../assets/images/lic_us_1280x720.jpg --assets ../../../assets
endlocal

If you want to make your life easier run python_recognizer.bat to test on Windows. You can edit the file using Notepad to change the parameters.

Please note that if you're cross compiling the application then you've to make sure to copy the application and both the assets and binaries folders to the target device.

Know issues

If you get undefined symbol: PyUnicode_FromFormat error message, then make sure you're using Python 3 and same version as the one used to buid the extension. We tested the code on version 3.6.9 (Windows 8), 3.6.8 (Ubuntu 18) and 3.7.3 (Raspbian Buster). Run python --version to print your Python version. You may use python3 instead of python to make sure you're using version 3.