Introducing Version 1.0 of the Trueface SDK
Featuring a whole lot of great updates
If you’ve been wondering why the Trueface team has been so quiet recently, it’s because the engineering team has been working diligently to release version 1.0 of our flagship SDK. This major update brings breaking changes to improve accuracy, speed, and overall SDK architecture. This blog post dives into said improvements. We’ll cover:
- A brand new face recognition model: TFV6
- New TensorRT backend for GPU inference
- A move to a stateless SDK
- Improved passive spoof
- Dynamic library support
Let’s dive right in!
TFV6: Our Most Accurate Model for Masked Faces
We have released a new TFV6 face recognition model which is our most accurate model for masked face images. This model has comparable CPU inference time and memory usage as our TFV5 model, but boasts a 24% improvement in accuracy for masked probe images, as reported by NIST FRVT.
Elect to use this model in situations where it is anticipated that the probe image contains a masked face (for 1 to N search) or where one or both face images are masked (for 1 to 1 comparisons).
Achieve Lower Latency & Higher Throughput With TensorRT
The GPU SDK has been modified to use TensorRT for inference. TensorRT is a high-performance GPU inference framework optimized for NVIDIA GPUs. This new backend option not only significantly reduces latency while increasing throughput, but also provides the user with more control over their design, such as allowing the user to choose their precision level, optimal batch size, and maximum GPU memory usage.
The above images show a comparison of the template generation time and GPU memory usage for our most accurate face recognition model with the previous and new versions of the SDK. As can be seen, the new TensorRT backend (denoted by SDK V1) has lower latency / higher throughput and uses less GPU memory for inference. When batching is used, we can achieve sub-millisecond average inference times. Consult the benchmarks page for a full breakdown of performance.
This backend is available for TFV6 and newer models. It is worth noting that it can take up to one minute or longer to generate the TensorRT engine file the first time inference is run (learn more here).
SDK Architecture: A Move To Stateless
This is probably the most significant change made to our API to date. The SDK has been refactored to remove state. In the previous architecture, the SDK would internally store the image and any subsequent inference operations would be applied to said image. This design had serious limitations and forced the user to be mindful of thread safety. In the new design, the SDK no longer stores images internally; instead, the preprocessed image must be passed to each inference function.
With respect to the SDK API, this means that
Trueface::SDK::setImage() has been replaced by
Trueface::SDK::preprocessImage() which returns a
Trueface::TFImage containing the pre-processed CPU or GPU image. This
Trueface::TFImage must then be passed to the various inference functions.
By removing state from the SDK, the CPU SDK is now completely threadsafe. Additionally, the user of the SDK can now employ more versatile design patterns. For example, the user can consume video from one thread, call the
Trueface::SDK::preprocessImage method and enqueue the resulting
Trueface::TFImage, and then from a separate thread, consume the pre-processed images from the queue for running inference. Consult the C++ and Python sample code for a demonstration of how to use this new API.
Improved Passive Spoof Model
We have improved our passive spoof model in the SDK. As a refresher, passive spoof is able to detect presentation attacks, such as a malicious user holding a face image or face recording up to a camera in an attempt to gain access to a system. Unlike active spoof which requires multiple input images and specific action from the end user, passive spoof only requires a single unconstrained input image. Add passive spoof to your face recognition pipeline in order to protect against presentation attacks.
Dynamic Library Support
Some of you asked for this, and we listened! The SDK is now shipped as both a static and dynamic library for Linux. Linking against the dynamic library allows you to swap out the SDK with an upgraded version without needing to re-compile your application (so long as there were no breaking changes to the API).
Although upgrading from V0 to V1 will take some development effort on your end, we certainly hope that by now you can see why it is worthwhile. If you are an existing client and require support with this transition process, please feel free to open a support ticket here and our engineering team will be happy to assist.