|
| None | __init__ (self, str model_name) |
| Tuple[List[str], np.ndarray] | classify_emotions (self, np.ndarray features, bool logits=True) |
| | classify_engagement (self, np.ndarray features, int sliding_window_width=128) |
| np.ndarray | extract_features (self, Union[np.ndarray, List[np.ndarray]] face_img) |
| Tuple[List[str], np.ndarray] | predict_emotions (self, Union[np.ndarray, List[np.ndarray]] face_img, bool logits=True) |
| | predict_engagement (self, List[np.ndarray] face_imgs, int sliding_window_width=128) |
Abstract class for emotion recognizer classes
Definition at line 70 of file facial_analysis.py.
◆ __init__()
| None emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.__init__ |
( |
| self, |
|
|
str | model_name ) |
◆ _get_probab()
| np.ndarray emotiefflib.facial_analysis.EmotiEffLibRecognizerBase._get_probab |
( |
| self, |
|
|
np.ndarray | features ) |
|
protected |
Compute the final classification scores for the given feature representations.
Args:
features (np.ndarray): The extracted feature vectors.
Returns:
np.ndarray: The raw classification scores (logits) before applying any activation
function.
Definition at line 120 of file facial_analysis.py.
◆ _preprocess()
| np.ndarray emotiefflib.facial_analysis.EmotiEffLibRecognizerBase._preprocess |
( |
| self, |
|
|
np.ndarray | img ) |
|
protected |
◆ classify_emotions()
| Tuple[List[str], np.ndarray] emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.classify_emotions |
( |
| self, |
|
|
np.ndarray | features, |
|
|
bool | logits = True ) |
Classify emotions based on extracted feature representations.
Args:
features (np.ndarray): The extracted feature vectors.
logits (bool, optional):
If True, returns raw model scores (logits). If False, applies softmax normalization
to obtain probability distributions. Defaults to True.
Returns:
Tuple[List[str], np.ndarray]:
- A list of predicted emotion labels.
- The corresponding model output scores (logits or probabilities), as a NumPy array.
Definition at line 161 of file facial_analysis.py.
◆ classify_engagement()
| emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.classify_engagement |
( |
| self, |
|
|
np.ndarray | features, |
|
|
int | sliding_window_width = 128 ) |
Classify engagement levels based on extracted feature representations using a sliding
window approach.
Args:
features (np.ndarray): The extracted feature vectors from a video sequence.
sliding_window_width (int, optional):
The width of the sliding window used for engagement classification. Defaults to 128.
Returns:
Tuple[List[str], np.ndarray]:
- A list of predicted engagement levels.
- The corresponding model output scores.
Raises:
ValueError: If the number of frames in the video is smaller than the sliding window
width.
Definition at line 195 of file facial_analysis.py.
◆ extract_features()
| np.ndarray emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.extract_features |
( |
| self, |
|
|
Union[np.ndarray, List[np.ndarray]] | face_img ) |
◆ predict_emotions()
| Tuple[List[str], np.ndarray] emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.predict_emotions |
( |
| self, |
|
|
Union[np.ndarray, List[np.ndarray]] | face_img, |
|
|
bool | logits = True ) |
Predict the emotions presented on a given facial image or a list of facial images.
Args:
face_img (Union[np.ndarray, List[np.ndarray]]):
A single face image (as a NumPy array) or a list of face images.
logits (bool, optional):
If True, returns raw model scores (logits). If False, applies softmax normalization
to obtain probability distributions. Defaults to True.
Returns:
Tuple[Union[str, List[str]], np.ndarray]:
- The predicted emotion label(s) as a list of strings (for single image only with
one element).
- The corresponding model output scores (logits or probabilities), as a NumPy array.
Definition at line 257 of file facial_analysis.py.
◆ predict_engagement()
| emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.predict_engagement |
( |
| self, |
|
|
List[np.ndarray] | face_imgs, |
|
|
int | sliding_window_width = 128 ) |
Predict the engagement presented on a sequence of facial images.
Args:
face_imgs (List[np.ndarray]):
A sequence of face images.
sliding_window_width (int, optional):
The width of the sliding window used for engagement classification. Defaults to 128.
Returns:
Tuple[List[str], np.ndarray]:
- A list of predicted engagement levels.
- The corresponding model output scores.
Raises:
ValueError: If the number of frames in the video is smaller than the sliding window
width.
Definition at line 235 of file facial_analysis.py.
◆ classifier_bias
| emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.classifier_bias = None |
◆ classifier_weights
| emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.classifier_weights = None |
◆ idx_to_emotion_class
| dict emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.idx_to_emotion_class |
Initial value:= {
0: "Anger",
1: "Disgust",
2: "Fear",
3: "Happiness",
4: "Neutral",
5: "Sadness",
6: "Surprise",
}
Definition at line 82 of file facial_analysis.py.
◆ idx_to_engagement_class
| dict emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.idx_to_engagement_class |
Initial value:= {
0: "Distracted",
1: "Engaged",
}
Definition at line 77 of file facial_analysis.py.
◆ img_size
| int emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.img_size = 112 |
◆ is_mtl
| str emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.is_mtl = "_mtl" in model_name |
◆ mean
| list emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.mean = [0.5, 0.5, 0.5] |
◆ std
| list emotiefflib.facial_analysis.EmotiEffLibRecognizerBase.std = [0.5, 0.5, 0.5] |
The documentation for this class was generated from the following file: