libfacedetection is a CNN-based face detection library that achieves real-time performance through optimized C++ implementation with SIMD acceleration.
The library solves the problem of detecting faces in images by implementing a convolutional neural network model converted into static C++ arrays, eliminating external dependencies. The approach embeds the trained model directly in source code, allowing compilation on any platform with a C++ compiler. Detection speed is accelerated through SIMD instructions, with support for AVX2 on Intel CPUs and NEON on ARM processors. The model architecture is based on YuNet, available in ONNX format through OpenCV Zoo, and example code demonstrates integration for both static image and camera input scenarios.
Developers should choose this library when they need lightweight, dependency-free face detection that runs efficiently on resource-constrained environments including ARM devices. The self-contained nature makes it suitable for embedded systems and applications where minimizing external dependencies is critical. The library performs well on lower-resolution inputs, which is valuable for real-time processing on mobile and edge hardware. Those using OpenCV should be aware that OpenCV DNN does not support the latest YuNet version with dynamic input shapes, requiring exact input dimension matching. Compilation requires optimization flags such as -O3 with g++ or /O2 with Visual Studio to achieve stated performance levels.
The project maintains active engagement with implementation details, as evidenced by documented compilation guidance addressing platform-specific requirements and export header configuration. Development includes performance benchmarking across different CPU instruction sets and hardware platforms, with detailed timing metrics provided for both Intel and ARM architectures. The codebase supports multi-threaded execution patterns, with documentation recommending thread-based parallelization over OpenMP for optimal results. Training infrastructure is separated into a dedicated repository, indicating a structured approach to model development and library maintenance.