Skip to content

Implement emotion recognition with static, dynamic, and video-based models#6

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/build-emotion-recognition-model
Draft

Implement emotion recognition with static, dynamic, and video-based models#6
Copilot wants to merge 5 commits intomasterfrom
copilot/build-emotion-recognition-model

Conversation

Copy link

Copilot AI commented Feb 12, 2026

Emotion recognition system comparing three temporal modeling approaches: static frame extraction, dynamic images via rank pooling, and LSTM-based video classification. Supports 7 emotion classes with face-focused detection.

Implementation

Three approaches, 9 model configurations:

  • Static: Single frame + CNN (ResNet18/50, MobileNet V2)
  • Dynamic: Rank pooling temporal aggregation + CNN
  • Video: 16-frame sequences + CNN features + LSTM

Data pipeline:

  • MTCNN face detection with Haar Cascade fallback
  • Automatic face cropping and normalization
  • Handles variable-length videos (3-16s)

Training infrastructure:

  • Early stopping, LR scheduling, GPU memory tracking
  • Per-epoch timing and resource monitoring
  • Automated training loop for all model combinations

Metrics & Analysis

Comprehensive evaluation:

  • Top-1 accuracy, Macro-F1, per-class ROC-AUC
  • Confusion matrices, classification reports
  • Error buckets by class and confusion pairs

XAI:

  • Grad-CAM visualization with dual overlays
  • Dynamic image temporal aggregation visualization
  • Model attention region analysis

Outputs:

  • CSV comparison table across all 9 models
  • Training curves (loss, accuracy, time, memory)
  • Per-class ROC curves
  • JSON results for programmatic access

Deliverables

Notebook: Emotion_Recognition_Model.ipynb (24 cells, automated training pipeline)

Utilities:

  • setup_dataset.py - Creates required directory structure
  • verify_dataset.py - Validates dataset before training
  • inference_example.py - Model usage demo

Documentation: Setup guide, technical summary, usage instructions (~30KB)

Usage

# Dataset structure
train/{neutral,surprise,sad,happy,fear,disgust,angry}/*.mp4
test/{neutral,surprise,sad,happy,fear,disgust,angry}/*.mp4

# Run notebook - trains all 9 models, generates full analysis
jupyter notebook Emotion_Recognition_Model.ipynb

Example dynamic image generation:

frames = extract_frames(video_path, max_frames=16)
faces = [detect_and_crop_face(f) for f in frames]
dynamic_img = generate_dynamic_image(faces, method='rank_pooling')

Model comparison output:

Mode Architecture Accuracy Macro-F1 neutral_AUC surprise_AUC ...
Static ResNet18 0.xxxx 0.xxxx 0.xxxx 0.xxxx ...
Dynamic ResNet50 0.xxxx 0.xxxx 0.xxxx 0.xxxx ...
Video MobileNet 0.xxxx 0.xxxx 0.xxxx 0.xxxx ...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 12, 2026 05:58
Co-authored-by: andrychowanda <2462691+andrychowanda@users.noreply.github.com>
Co-authored-by: andrychowanda <2462691+andrychowanda@users.noreply.github.com>
Co-authored-by: andrychowanda <2462691+andrychowanda@users.noreply.github.com>
…ings

Co-authored-by: andrychowanda <2462691+andrychowanda@users.noreply.github.com>
Copilot AI changed the title [WIP] Add emotion recognition model training and evaluation features Implement emotion recognition with static, dynamic, and video-based models Feb 12, 2026
Copilot AI requested a review from andrychowanda February 12, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants