How arianharashchi-lang/facialemotionai works
FacialEmotionAI is a webcam-based facial emotion recognition research system. Its live workflow captures frames, detects faces, screens them with a Real/Fake discriminator, then classifies sampled face features over a rolling 20-frame sequence; class fusion and a confidence-gated Sad/Neutral adapter produce the five-class result, which the app displays and logs. Training, dataset preparation, and evaluation are represented as distinct supporting capabilities. Runtime links follow the README and shown imports/calls; the detailed persistence wiring and unsampled training-stage links are not inferred.
Main entry points: emotion_detector_5class.py Temporal emotion inference · main_5class.py Frame and face capture · prepare_emotion_dataset.py Emotion dataset preparation · fake_detector.py Real/Fake screening
Components 24
Live inference
- Frame and face capture
main_5class.py - Live result display
main_5class.py
Inference models
- Real/Fake screening
fake_detector.py - Temporal emotion inference
emotion_detector_5class.py - CNN feature extractor
models/cnn_feature_extractor.keras - BiLSTM attention model
models/lstm_attention_v1_best.keras - Seven-to-five fusion
emotion_logic.py - Sad/Neutral adapter
models/sad_neutral_adapter.keras
Research pipeline
- Dataset acquisition
download_prepare_ravdess.py - Emotion dataset preparation
prepare_emotion_dataset.py - RAVDESS sequence preparation
prepare_ravdess_sequences.py - Actor-wise CNN split
prepare_cnn_actor_split.py - Temporal feature extraction
extract_lstm_features.py - CNN training
train_emotion_cnn.py - V1 temporal training
train_lstm_attention_v1_rebuild.py - Discriminator training
train_fake_detector.py - Adapter training
train_sad_neutral_adapter.py - Webcam adaptation collection
collect_webcam_emotions.py - Webcam feature extraction
extract_webcam_features.py - Five-class benchmark
benchmark_final_5class.py - Fake-data collection
collect_fake_data.py
Runtime records
- SQLite runtime log
main_5class.py
Other components
- Webcam user
- RAVDESS dataset
Connections 27
- Webcam user → Frame and face capture: provides video
README.md - Frame and face capture → Real/Fake screening: screens faces
main_5class.py - Frame and face capture → Temporal emotion inference: updates faces
main_5class.py - Real/Fake screening → Temporal emotion inference: gates inference
README.md - Temporal emotion inference → CNN feature extractor: extracts features
README.md - Temporal emotion inference → BiLSTM attention model: classifies sequence
README.md - Temporal emotion inference → Seven-to-five fusion: merges probabilities
emotion_detector_5class.py - Temporal emotion inference → Sad/Neutral adapter: refines Sad/Neutral
emotion_detector_5class.py - Seven-to-five fusion → Live result display: provides five classes
README.md - Sad/Neutral adapter → Live result display: refines output
README.md - Temporal emotion inference → Live result display: returns state
main_5class.py - Frame and face capture → SQLite runtime log: logs detections
README.md - RAVDESS dataset → Dataset acquisition: supplies source data
README.md - Dataset acquisition → Emotion dataset preparation: prepares data
- Emotion dataset preparation → RAVDESS sequence preparation: prepares sequences
- Emotion dataset preparation → Actor-wise CNN split: prepares split
- RAVDESS sequence preparation → Temporal feature extraction: provides sequences
- Actor-wise CNN split → CNN training: provides split
- Temporal feature extraction → V1 temporal training: provides features
- CNN training → CNN feature extractor: produces extractor
- V1 temporal training → BiLSTM attention model: produces model
- Discriminator training → Real/Fake screening: trains discriminator
README.md - Adapter training → Sad/Neutral adapter: trains adapter
- Webcam adaptation collection → Webcam feature extraction: supports adaptation
- Webcam feature extraction → Adapter training: provides features
- Five-class benchmark → Temporal emotion inference: evaluates inference
benchmark_final_5class.py - Fake-data collection → Discriminator training: supports training