This application is used to check everything is ok and running as fast as expected. It's open source and doesn't require registration or license key.
More information about the benchmark rules at https://www.doubango.org/SDKs/face-liveness/docs/Benchmark.html.
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. See benchmark numbers with/without OpenVINO at https://www.doubango.org/SDKs/face-liveness/docs/Benchmark.html#core-i7-windows.
To check if all dependencies are present:
- Windows x86_64: Use Dependency Walker on binaries/windows/x86_64/FaceLivenessDetectionSDK.dll and binaries/windows/x86_64/ultimatePluginOpenVINO.dll if you're planning to use OpenVINO.
- Linux x86_64: Use
ldd <your-shared-lib>
on binaries/linux/x86_64/libFaceLivenessDetectionSDK.so and binaries/linux/x86_64/libultimatePluginOpenVINO.so if you're planning to use OpenVINO.
- On x86-64, GPGPU acceleration is disabled by default. Check here for more information on how to enable it.
These performance numbers are obtained using version 0.5.0. You can use any later version.
We ran the benchmark application for #100 times (loops) on 720p (1280x720) images. The number of milliseconds reported is for #100 frames which means you have to divide by 100 to get the time it takes to process a single frame. For example, 2140 millis
in the below table means it takes 21 milliseconds to process a single frame
, in terms of frame rate it means we can process 46 frames per second
.
Spoof (Parallel) | Spoof (Sequential) | Disguise (P) | Disguise (S) | |
---|---|---|---|---|
AMD Ryzen 7 3700X 8-Core RTX 3060 Ubuntu 20 |
2140 millis 46.70 fps |
2977 millis 33.58 fps |
2062 millis 48.48 fps |
4130 millis 24.20 fps |
Intel(R) Xeon(R) E3-1230 v6 @ 3.50GHz GTX 1070 Ubuntu 18 |
2655 millis 37.65 fps |
3553 millis 28.13 fps |
2721 millis 36.73 fps |
4436 millis 22.54 fps |
Intel(R) i7-4790K @4.40GHz No GPU Windows 8 |
7197 millis 13.89 fps |
7281 millis 13.73 fps |
11480 millis 8.71 fps |
11643 millis 8.58 fps |
Some important notes:
- You can increase the speed (significantly) by choosing higher value for
detect_face_minsize
JSON config entry (default is 128). - The engine is faster on spoofs. That's normal as there is more checks on disguises and genuines.
- Parallel mode is faster than sequential mode on GPU. When parallel mode is enabled we perform detection and liveness check in //.
The test image looks like this:
If you don't want to build this sample by yourself, then use the pre-built versions:
- Windows x86_64: benchmark.exe under binaries/windows/x86_64
- Linux x86_64: benchmark under binaries/linux/x86_64. Built on Ubuntu 18. You'll need to download libtensorflow.so as explained here.
On Windows, the easiest way to try this sample is to navigate to binaries/windows/x86_64 and run binaries/windows/x86_64/benchmark.bat. You can edit these files to use your own images and configuration options.
You'll need CMake to build this sample.
- Create build folder and move into it:
mkdir build && cd build
To generate the build files:
- Windows (Visual Studio files):
cmake .. -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Release
- Linux (Makefile):
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
To build the project:
- Windows: Open the VS solution and build the projet
- Linux: Run
make
to build the project
After building the application you can test it on your local machine.
Benchmark is a command line application with the following usage:
benchmark \
--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.
--image
Path to an image (JPEG/PNG/BMP) to process. This image will be used to evaluate the liveness detector. You can use default image at ../../../assets/images/disguise.jpg.--assets
Path to the assets folder containing the configuration files and models.--tokenfile
Path to the file containing the base64 license token if you have one. If not provided, then the application will act like a trial version. Default: null.--tokendata
Base64 license token if you have one. If not provided, then the application will act like a trial version. Default: null.
- On Linux x86_64, you may use the next command:
LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./benchmark \
--image ../../../assets/images/disguise.jpg \
--assets ../../../assets \
--loops 100 \
--parallel true
- On Windows x86_64, you may use the next command:
benchmark.exe ^
--image ../../../assets/images/disguise.jpg ^
--assets ../../../assets ^
--loops 100 ^
--parallel true