Here you can find examples of using EmotiEffLib in C++.
Here is a list of examples:
- One image emotion recognition.ipynb describes how to use EmotiEffLib to recognize facial emotions on images.
- Predict emotions on video.ipynb describes how to use EmotiEffLib for predicting facial emotions on videos.
- Predict engagement and emotions on video.ipynb describes how to use EmotiEffLib for predicting facial expressions and recognizing a person's engagement in a video.
To run the examples locally you need to do the following:
- Install python dependencies:
pip install -r requirements.txt
- Build EmotiEffCppLib with Libtorch and ONNXRuntime. It is important to
build EmotiEffCppLib with flag:
-DBUILD_TESTS=ONbecause we need to reuse one library which builds for tests. Also, it is required to build EmotiEffCppLib with flag:-DBUILD_SHARED_LIBS=ONbecause xeus-cling works only with shared libraries. - Install xeus-cling. Instruction how to build xeus-cling can be found here.
After installing xeus-cling, you should be able to check available kernels and see xcpp17 kernel:
$ jupyter kernelspec list
Available kernels:
python3 /opt/anaconda3/envs/emotiefflib/share/jupyter/kernels/python3
xcpp11 /opt/anaconda3/envs/emotiefflib/share/jupyter/kernels/xcpp11
xcpp14 /opt/anaconda3/envs/emotiefflib/share/jupyter/kernels/xcpp14
xcpp17 /opt/anaconda3/envs/emotiefflib/share/jupyter/kernels/xcpp17
- Prepare models for cpp runtime:
python3 <EmotiEffLib_root>/models/prepare_models_for_emotieffcpplib.py
- Download and unpack test data:
cd <EmotiEffLib_root>/tests
./download_test_data.sh
tar -xzf data.tar.gz
- Run jupyter notebook and select C++ kernel.