EmotiEffCppLib
Cpp implementation of Emotion Efficient Library
Loading...
Searching...
No Matches
facial_analysis.h
Go to the documentation of this file.
1
5
6#ifndef BACKENDS_ONNX_FACIAL_ANALYSIS_H
7#define BACKENDS_ONNX_FACIAL_ANALYSIS_H
8
10
11#include <onnxruntime_cxx_api.h>
12
13namespace EmotiEffLib {
14
21public:
27 EmotiEffLibRecognizerOnnx(const std::string& fullPipelineModelPath);
28
35
42 xt::xarray<float> extractFeatures(const cv::Mat& faceImg) override;
43
51 EmotiEffLibRes classifyEmotions(const xt::xarray<float>& features, bool logits = true) override;
52
59 EmotiEffLibRes classifyEngagement(const xt::xarray<float>& features) override;
60
68 EmotiEffLibRes predictEmotions(const cv::Mat& faceImg, bool logits = true) override;
69
76 EmotiEffLibRes predictEngagement(const std::vector<cv::Mat>& faceImgs) override;
77
78private:
84 void initRecognizer(const std::string& modelPath) override;
85
91 void configParser(const EmotiEffLibConfig& config) override;
92
99 xt::xarray<float> preprocess(const cv::Mat& img) override;
100
108 std::vector<Ort::Value> modelRunWrapper(int modelIdx, const std::vector<Ort::Value>& inputs);
109
110private:
112 std::vector<float> mean_;
114 std::vector<float> std_;
116 Ort::Env env_ = {ORT_LOGGING_LEVEL_WARNING, "EmotiEffLib"};
118 Ort::AllocatorWithDefaultOptions allocator_;
120 std::vector<Ort::Session> models_;
121};
122} // namespace EmotiEffLib
123
124#endif
EmotiEffLibRes classifyEngagement(const xt::xarray< float > &features) override
Classifies engagement based on extracted features.
EmotiEffLibRes predictEngagement(const std::vector< cv::Mat > &faceImgs) override
Predicts engagement for a sequence of face images.
EmotiEffLibRes classifyEmotions(const xt::xarray< float > &features, bool logits=true) override
Classifies emotions based on extracted features.
xt::xarray< float > extractFeatures(const cv::Mat &faceImg) override
Extracts features from a single face image.
EmotiEffLibRecognizerOnnx(const std::string &fullPipelineModelPath)
Constructs an EmotiEffLibRecognizerOnnx instance with the specified model path.
EmotiEffLibRes predictEmotions(const cv::Mat &faceImg, bool logits=true) override
Predicts emotions for a single face image.
Base class for emotion and engagement recognition.
Header file for the EmotiEffLib library, providing emotion and engagement recognition functionality.
Configuration structure for the EmotiEffLibRecognizer.
Structure to store the results of EmotiEffLib.