This project detects emotion from a single video clip by combining three independent models:
- Audio — the soundtrack is extracted and classified by a CNN over spectrograms;
- Face — a key frame is extracted and classified by MobileNet-V3-Small;
- Motion — a 16-frame sequence is classified by a 3D-ResNet-18 (R3D-18).
Their probabilities are late-fused with configurable weights (default audio 0.4, face 0.3, video 0.3) into one of
eight emotions: angry, calm, disgust, fear, happy, neutral, sad, surprise. Training runs on Kaggle GPUs over RAVDESS
(speech + video), CREMA-D and FER2013; the weights are published to Hugging Face and served by a Streamlit Space
and a native Android app.
- Three modalities, one clip — audio, face and temporal video branches
- Weighted late fusion configured in
fusion_config.json - Live demo on Hugging Face Spaces · model
- Automation scripts for Kaggle training, GPU-retry, HF upload, Space publish and APK release
| Feature | What it does |
|---|---|
| Audio branch | AudioCNN — 3 conv blocks over log-mel spectrograms |
| Face branch | MobileNet-V3-Small fine-tuned on FER2013 (numeric labels mapped to classes) |
| Video branch | R3D-18 over 16 sampled frames (RAVDESS video) |
| Fusion engine | MultiModalEmotionEngine.predict — weighted sum of branch probabilities |
| Streamlit app | app.py downloads artefacts from the HF model repo and runs inference |
| Kaggle pipeline | kaggle_kernel/train_multimodal.py + start/check/wait/relaunch scripts |
| Android app | android_app/ (Kotlin) with release workflow |
| Publishing | upload_to_hf.py, publish_space.py, upload_apk_release.py |
| Layer | Technology |
|---|---|
| Modelling | PyTorch, torchvision (MobileNet-V3, R3D-18), torchaudio |
| Data | RAVDESS speech + video, CREMA-D, FER2013 |
| Training | Kaggle GPU kernels |
| Serving | Streamlit on Hugging Face Spaces |
| Mobile | Android (Kotlin, Gradle KTS) |
| CI | GitHub Actions — Android release, Space publish |
Each modality is a separate model; fusion happens at the probability level, so any branch can be missing.
flowchart LR
V[Video clip] --> AX[Extract audio] --> AU[AudioCNN<br/>spectrogram]
V --> FX[Middle frame] --> FA[MobileNet-V3<br/>face]
V --> SX[16 frames] --> VI[R3D-18<br/>motion]
AU -- p·0.4 --> F((Weighted<br/>fusion))
FA -- p·0.3 --> F
VI -- p·0.3 --> F
F --> E[Emotion<br/>8 classes]
➡️ Full design notes, data flow and design decisions: docs/ARCHITECTURE.md
emotion-multimodal-hybrid-app/
├── src/mmemotion/ # models.py, infer.py, data_utils.py
├── app.py # Streamlit app
├── kaggle_kernel/ # train_multimodal.py + kernel-metadata.json
├── train_multimodal_allinone.py
├── scripts/ # Kaggle, HF, Space and APK automation
├── android_app/ # Kotlin Android client
└── assets/ # icons
- Python 3.10+, ffmpeg
- Optional: Kaggle API + Hugging Face token for training/publishing
Pick whichever method suits you:
| Method | Command |
|---|---|
| HTTPS | git clone https://github.com/shiroonigami23-ui/emotion-multimodal-hybrid-app.git |
| SSH | git clone git@github.com:shiroonigami23-ui/emotion-multimodal-hybrid-app.git |
| GitHub CLI | gh repo clone shiroonigami23-ui/emotion-multimodal-hybrid-app |
| ZIP | Download and extract |
| Codespaces | Open in browser — zero local setup, dev container preconfigured |
🔑 Using SSH for the first time? Generate a key with
ssh-keygen -t ed25519 -C "you@example.com", add the.pubcontents at GitHub → Settings → SSH and GPG keys, then test withssh -T git@github.com.
cd emotion-multimodal-hybrid-app
pip install -r requirements.txtstreamlit run app.py # local app (downloads weights from HF)
python scripts/start_kaggle_training.py --owner <kaggle-user>
python scripts/check_kaggle_status.py --owner <kaggle-user>
python scripts/upload_to_hf.py --model-repo-id <user>/emotion-multimodal-engine --outputs-dir kaggle_pullUpload a short clip of a person speaking. The app shows per-branch probabilities and the fused result. You can also upload just audio or just an image — missing branches are skipped and the remaining weights are used.
Training outputs: audio_model.pt, face_model.pt, video_model.pt, fusion_config.json, metrics.json, run_version.json.
v1 — Hybrid engine (done)
- Audio, face and video branches
- Weighted late fusion
- Kaggle training automation, HF model + Space, Android app
v1.1 — Accuracy
- Learned fusion head / attention over branch embeddings
- Per-dataset and per-class metrics published in the README
- Face detection + alignment before the face branch
v1.2 — Real-time
- Webcam + microphone streaming mode
- On-device TFLite/ONNX models for the Android app
v2.0
- Text branch (speech-to-text + sentiment) for a fourth modality
- Bias and fairness evaluation across demographics
➡️ Detailed plan, milestones and long-term vision: docs/ROADMAP.md
Contributions, issues and feature requests are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m "feat: add amazing feature" - Push the branch:
git push origin feature/amazing-feature - Open a Pull Request against
main
Check the issues page and the roadmap for ideas on where to help.
See CHANGELOG.md for the release history.
Distributed under the MIT license. See LICENSE for details.
Aryan Singh Chandel (Shiro)
⭐ If you find this project useful, consider giving it a star! ⭐
