C++ Addon for fast and efficient facial analytics on Nodejs/TypeScript.
Nodoface is the backbone of Poor Man's Rekognition being developed under Google Summer of Code 2019 for CCExtractor Development.
This Addon provides bindings to all OpenFace 2.0 features except the visualization utilities and FaceAnalyser class. Face detection can be easily run in realtime on any modern CPU. The Addon is built using node-addon-api.
CLNF also provides HOG-based and Haar Cascades face detector. GazeAnalysis is a namespace with static classes in OpenFace but GazeAnalyser is a class in Nodoface.
cv::putText()) (not working)
cv::VideoWriter) Note: All methods return RGB image instead of BGR unlike OpenCV OpenCV classes are partial bindings just sufficient for passing underlying Mat to/from nodejs and C++.
Step 1: Install OpenCV 3.4.x.
If opencv is already installed, ensure it is recognised by pkg-config by executing:
$ pkg-config --modversion opencv
$ pkg-config --modversion dlib
Step 3: Install OpenFace. The original repo has some issues. It can only compile as static library. So use my OpenFace fork instead. I have modified CMakelists.txt to compile OpenFace as shared lib.
$ git clone https://github.com/sziraqui/OpenFace.git && cd OpenFace $ git checkout dynamic-compile $ ./download_models.sh $ mkdir build && cd build $ cmake -D CMAKE_BUILD_TYPE=RELEASE CMAKE_CXX_FLAGS="-std=c++11" -D CMAKE_EXE_LINKER_FLAGS="-std=c++11" $ make -j2 $ sudo make install
Step 4: Compile the bindings.
$ git clone https://github.com/sziraqui/nodoface.git && cd nodoface $ npm install
Step 5 (Optional): Run tests
$ npm test
This will execute mocha tests. Some tests generate image outputs which can be checked in ./tests/outputs directory
To clear all files generated by tests, execute
npm run clean:test
If you encounter errors, see my gsoc notes for some assistance. The addon is exported from ./api/nodoface.js
Run some samples to test if everything is working.
$ node examples/mtcnn_on_video.js path/to/a/video/file <OpenFace_REPO_DIR>/lib/local/LandmarkDetector/model/mtcnn_detector/MTCNN_detector.txt
GNU General Public License 3.0 (GPL-v3.0)
Please carefully read OpenFace 2.0 license. You must also respect opencv and dlib license.