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_TORCH_FACIAL_ANALYSIS_H
7#define BACKENDS_TORCH_FACIAL_ANALYSIS_H
8
10
11#include <torch/script.h>
12
13namespace EmotiEffLib {
14
21public:
27 EmotiEffLibRecognizerTorch(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
101private:
103 std::vector<torch::jit::script::Module> models_;
104};
105} // namespace EmotiEffLib
106
107#endif
EmotiEffLibRes predictEmotions(const cv::Mat &faceImg, bool logits=true) override
Predicts emotions for a single face image.
xt::xarray< float > extractFeatures(const cv::Mat &faceImg) override
Extracts features from a single face image.
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.
EmotiEffLibRecognizerTorch(const std::string &fullPipelineModelPath)
Constructs an EmotiEffLibRecognizerOnnx instance with the specified model path.
EmotiEffLibRes classifyEmotions(const xt::xarray< float > &features, bool logits=true) override
Classifies emotions based on extracted features.
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.