Face + Iris Landmarks Real-time Detection in C++ (OpenCV + Tensorflow Lite)
(Note: This guide is for Windows OS, but the code should work fine on other OS, too)
This project runs on Mediapipe TFLite models without using Mediapipe framework. For more information:
This project runs on Mediapipe TFLite models without using Mediapipe framework. It can run at 90+ FPS on CPU. I perform the test on an AMD Ryzen 7 3700U Pro and the app takes about 5% CPU while running. For more information:
- Face detection: https://google.github.io/mediapipe/solutions/face_detection.html
- Face landmarks: https://google.github.io/mediapipe/solutions/face_mesh.html
- Iris landmarks: https://google.github.io/mediapipe/solutions/iris.html
⚠️ Why not using GPU ?
Because Mediapipe models cannot run on Windows GPU. For more information: https://google.github.io/mediapipe/getting_started/gpu_support.html
💻 Requirements:
Hardware: Windows 10 64-bit
Visual Studio 2019
CMake >= 3.16
How to set CMake compiler options
Follow instructions at https://www.40tude.fr/compile-cpp-code-with-vscode-cmake-nmake/You can follow instructions at https://www.40tude.fr/compile-cpp-code-with-vscode-cmake-nmake/
OpenCV (for Demo)
Tensorflow Lite
How to use pre-built library
- Download and extract third_party.zip from https://github.com/iwatake2222/InferenceHelper/releases
- Change
TFLite_PATH
in CMakeLists.txt - Add
TFLite_LIBS
to PATH
How to use pre-built library
- Download and extract third_party.zip from https://github.com/iwatake2222/InferenceHelper/releases
- Change
TFLite_PATH
in CMakeLists.txt - Add
TFLite_LIBS
to PATH
🔑 How to use:
- Clone this repo and go to FaceMeshCpp folder
- Run
cmake -S . -B build
- Run
cmake --build build --config Release --target FaceMeshCpp
- Now it will build an
.exe
at~/build/Release
. Make sure to copymodel
folder to~/build/Release/
before running.