Source-linked AI summary

Py-Feat: Python Facial Expression Analysis Toolbox

Jin Hyun Cheong, Eshin Jolly, Tiankang Xie, Sophie Byrne, Matthew Kenney, Luke J. Chang

arXiv:2104.03509v4cs.CVcs.LGeess.IV

TL;DR

Facial-expression research remains difficult to disseminate in psychology because advanced models require substantial expertise and comprehensive open-source tools are scarce. Py-Feat is an open-source Python toolbox for detecting, preprocessing, analyzing, visualizing, and benchmarking facial-expression data. The authors present it as a platform intended to make these workflows more accessible while supporting model developers and end users.

  • Problem

    Facial-expression research faces slow manual coding, high barriers to using advanced computer-vision models, and a lack of comprehensive free open-source software.

  • Method

    Py-Feat combines facial-feature detection with preprocessing, analysis, visualization, and benchmark evaluation in an open-source Python toolbox.

  • Results

    The paper presents Py-Feat as a full-stack framework supporting facial-expression analysis from detection through preprocessing, analysis, and visualization.

  • Takeaways & Limitations

    Py-Feat is intended to connect computer-vision model developers with researchers who need accessible tools for facial-expression analysis.

  • Takeaways & Limitations

    Some Py-Feat model implementations do not perform as well as the original versions, with differences attributed to optimization, random seeds, and benchmark datasets.

Abstract

from arXiv · show

Studying facial expressions is a notoriously difficult endeavor. Recent advances in the field of affective computing have yielded impressive progress in automatically detecting facial expressions from pictures and videos. However, much of this work has yet to be widely disseminated in social science domains such as psychology. Current state of the art models require considerable domain expertise that is not traditionally incorporated into social science training programs. Furthermore, there is a notable absence of user-friendly and open-source software that provides a comprehensive set of tools and functions that support facial expression research. In this paper, we introduce Py-Feat, an open-source Python toolbox that provides support for detecting, preprocessing, analyzing, and visualizing facial expression data. Py-Feat makes it easy for domain experts to disseminate and benchmark computer vision models and also for end users to quickly process, analyze, and visualize face expression data. We hope this platform will facilitate increased use of facial expression data in human behavior research.

Introduction

Facial-expression research is constrained by labor-intensive manual coding, difficult-to-access and benchmark computer-vision models, and limited comprehensive open-source software. Py-Feat addresses these barriers with an open Python toolbox spanning detection, preprocessing, analysis, visualization, and model benchmarking.

  • Motivation: Manual FACS coding quantifies facial-muscle action units but requires extensive training and is slow for video labeling.FACS certification requires 100 hours of training, and one minute of video can take an hour to label.
  • Barriers: Psychology has adopted automated facial-expression methods slowly because state-of-the-art models require computer-vision expertise, labeled datasets, GPUs, and inconsistent preprocessing.Models also lack generally agreed standards for dissemination and benchmarking, complicating model selection.
  • Software gap: Existing software does not provide an accessible, comprehensive free toolkit covering facial-expression detection, preprocessing, analysis, and visualization.Commercial tools can be expensive or limited, while OpenFace lacks a full suite for preprocessing, analysis, and visualization.
  • Contribution: Py-Feat is a free, open-source Python package that supports facial-feature extraction alongside preprocessing, statistical analysis, visualization, and model dissemination.The toolbox is intended both for computer-vision researchers benchmarking models and social-science researchers processing expression data.
  • Evaluation: Py-Feat benchmarks detectors on established datasets, including face detection, landmarks, head pose, and action units.The reported evaluations use WIDER FACE, 300W, and Extended DISFA Plus, with Feat-MobileFaceNet performing best on the landmark benchmark.

Emotion detection

Py-Feat provides emotion detectors for seven categories and benchmarks both deep and statistical models on naturalistic AffectNet images. The paper also shows that detector performance varies with lighting and occlusion, while cautioning that emotion labels do not directly establish internal emotional states.

  • Interpretation: Emotion categories inferred from facial configurations do not necessarily indicate a person’s internal subjective emotional state.The paper notes that static-image inferences require contextual information beyond the facial image.
  • Emotion models: Py-Feat detects anger, disgust, fear, happiness, sadness, surprise, and neutral using ResMaskNet and Linear SVM models.ResMaskNet combines residual networks with masking blocks, while the statistical model follows the AU-model procedure.
  • Benchmarking: On 500 AffectNet images, ResMaskNet achieved the highest F1 score, followed by FACET-iMotions and HOG-based statistical models.AffectNet contains unposed emotional expressions collected in naturalistic, out-of-laboratory settings.
  • Robustness: Most deep-learning detectors were fairly robust to luminance changes, whereas HOG-based shallow detectors were more strongly affected.The robustness experiments varied image brightness across low and high luminance conditions.
  • Robustness: Facial occlusion reduced face detection substantially and selectively lowered action-unit and emotion detection for masked eyes, nose, or mouth.Pose and landmark models were comparatively robust, while particular action units were affected according to the occluded facial structure.

Robustness against Head Rotation

Py-Feat evaluates AU detection under rotated head poses and finds that performance generally declines as rotation increases, with substantial drops for selected AUs at 45°. The toolbox also supports visualization and analysis of detected facial-expression features.

  • Robustness against Head Rotation: AU detection performance generally decreases as head rotation increases.The evaluation used images recorded at 0°, 15°, 30°, and 45° rotation angles.
  • Robustness against Head Rotation: At 45° rotation, py-feat-XGB performance drops substantially for AUs 9, 12, 17, and 26.The XGB model remains fairly robust to rotation for most other AUs.
  • Visualization and Analysis: Py-Feat overlays detected faces, landmarks, action units, and emotions to help validate results at each frame or image.Its plotting tools support inspection during the facial-feature detection stage.
  • Visualization and Analysis: The toolbox can reconstruct stylized facial expressions from combinations of AU activations and visualize their associated landmark deformations.The visualization model supports both single reconstructed images and animated transitions between expressions.
  • Toolbox Scope: Py-Feat combines facial-expression detection with preprocessing, analysis, and visualization in an open-source Python framework.The package is intended to connect model developers with researchers using facial-expression data.

Datasets

Py-Feat was evaluated across diverse datasets covering facial action units, emotions, landmarks, face detection, and pose-related variation. The datasets span posed and spontaneous expressions, laboratory and in-the-wild images, and varied participant demographics and recording conditions.

  • Action Unit Datasets: The toolbox uses datasets for facial action unit detection, including BP4D, BP4D+, DISFA, DISFA+, CK+, and NAMBA.These datasets include expert FACS annotations, with DISFA+ containing over 57,000 annotated frames and NAMBA varying head angles from 0° to 45°.
  • Action Unit Datasets: DISFA+ combines posed and spontaneous expressions, with AU intensities rated on a 0-to-5 ordinal scale by a trained FACS coder.Participants watched an emotion-eliciting video, imitated individual or combined AUs, and produced emotion-related expressions.
  • Emotion Datasets: The collection includes emotion datasets AffectNet and EmotioNet, covering eight emotion categories and approximately one million facial-expression images, respectively.AffectNet contains 440,000 images collected in the wild, while EmotioNet combines trained and automatically generated AU annotations.
  • Detection Datasets: WIDER FACE supports face detection using 32,203 images and 393,703 labeled faces, including small, occluded, and upside-down faces.The images were collected in the wild and manually annotated with face bounding boxes.
  • Landmark and Pose Variation: The 300W and NAMBA datasets provide variation for landmark and pose-related analysis through changes in luminance, pose, identity, expression, occlusion, face size, and head rotation.300W contains indoor and in-the-wild images with semi-automatically annotated landmarks, while NAMBA includes facial images recorded at four head angles.

Robustness Tests

Robustness testing examined Py-Feat detectors under luminance changes, facial-region occlusion, and head rotation, using benchmark datasets and task-specific metrics. The supplementary results organize performance by detector, perturbation, and benchmark task.

  • Test Design: Robustness tests evaluated detector models under luminance variation, facial-region occlusion, and head rotation in addition to standard benchmark testing.The tests targeted real-world conditions known to create problems for computer vision models.
  • Face Detection: Face bounding-box robustness on WIDER FACE is reported with Average Precision across easy, medium, and hard image-difficulty levels.Higher Average Precision indicates better performance, and each algorithm is compared across the original test set and five robustness tests.
  • Landmark Detection: Face-landmark robustness on 300W is reported using normalized mean squared error, where lower values indicate better performance.The five tests vary luminance or mask the eyes, nose, or mouth.
  • Expression Detection: Action Unit and emotion robustness are reported with F1 scores, where higher values indicate better performance across facial masking and luminance conditions.The Action Unit results use DISFA+, while the emotion results use a subset of AffectNet.
  • Head Rotation: Head-rotation robustness for Action Unit detection is evaluated on NAMBA across rotations from 0° to 45° using per-AU F1 scores.Each bar represents an algorithm’s performance at a different degree of head rotation.
Loading 2104.03509v4…