Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

This application is a reference implementation for developers to show how to use the Python API and could be used to easily check the accuracy. The Python API is a wrapper around the C++ API defined at https://www.doubango.org/SDKs/kyc-documents-verif/docs/cpp-api.html. A C++ twin sample application is at cpp/verify.

The application accepts path to a JPEG/PNG/BMP/... file as input.

If you don't want to build this sample and is looking for a quick way to check the accuracy then try our online webapp demo at https://www.doubango.org/webapps/kyc-documents-verif.

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 Microsoft Visual C++ 2015 Redistributable(x64) - 14.0.24123 (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 and reduce memory usage.

Debugging missing dependencies

To check if all dependencies are present:

GPGPU acceleration

  • On x86-64, GPGPU acceleration is disabled by default. 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

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

verify.py \
      --image <path-to-image-to-process> \
      --assets <path-to-assets-folder> \
      [--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 KYC-Documents-Verif-SDK/binaries/<<os>>/<<arch>>

For example:

Try

  • On Linux x86_64, you may use the next command:
PYTHONPATH=$PYTHONPATH:.:../../../python \
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
python ../../../samples/python/verify/verify.py --image "../../../assets/images/United States - California Driving License (2017).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/liveness/verify.py --image "../../../assets/images/United States - California Driving License (2017).jpg" --assets ../../../assets
endlocal

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

The test image looks like this:

Test image

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.