{"id":51001505,"url":"https://github.com/asherk7/memo","last_synced_at":"2026-06-20T14:33:24.187Z","repository":{"id":361219776,"uuid":"1237131347","full_name":"asherk7/memo","owner":"asherk7","description":"Lightweight multimodal emotion recognition","archived":false,"fork":false,"pushed_at":"2026-05-29T16:27:28.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T18:12:25.472Z","etag":null,"topics":["cpu-inference","edge-ai","facial-expression-recognition","knowledge-distillation","late-fusion","lora","mediapipe","minilm","ml","mobilenetv3","multimodal","peft","pytorch","sentiment-analysis","speech-emotion-recognition","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asherk7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-12T22:52:04.000Z","updated_at":"2026-05-29T16:27:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/asherk7/memo","commit_stats":null,"previous_names":["asherk7/memo"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/asherk7/memo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asherk7%2Fmemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asherk7%2Fmemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asherk7%2Fmemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asherk7%2Fmemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asherk7","download_url":"https://codeload.github.com/asherk7/memo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asherk7%2Fmemo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34573800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu-inference","edge-ai","facial-expression-recognition","knowledge-distillation","late-fusion","lora","mediapipe","minilm","ml","mobilenetv3","multimodal","peft","pytorch","sentiment-analysis","speech-emotion-recognition","transformers"],"created_at":"2026-06-20T14:33:22.586Z","updated_at":"2026-06-20T14:33:24.182Z","avatar_url":"https://github.com/asherk7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memo\n\nLightweight multimodal emotion recognition. Fuses face, text, and speech audio\nthrough a confidence-gated late-fusion layer calibrated to degrade gracefully\nwhen modalities are missing. Designed for CPU/edge inference — the full pipeline\nruns on a laptop with no GPU.\n\n[![CI](https://github.com/asherk7/memo/actions/workflows/ci.yml/badge.svg)](https://github.com/asherk7/memo/actions)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n\n---\n\n## Overview\n\n`memo` predicts one of Ekman's seven basic emotions (`anger`, `disgust`, `fear`,\n`happiness`, `sadness`, `surprise`, `neutral`) from any non-empty combination of\na face image, an utterance transcript, and a speech clip. Each modality has its\nown small encoder; a learned fusion layer combines their predictions and weights\neach one by how confident it is, so a missing or low-quality modality is\nautomatically down-weighted rather than corrupting the result.\n\n```\nface image  ──►  MobileNetV3-Small (~2.5M)   ──► logits ┐\ntext        ──►  MiniLM-L6 + MLP head (~22M)  ──► logits ├──►  confidence-gated  ──►  emotion\nspeech      ──►  log-mel CRNN + BiGRU (~0.5M) ──► logits ┘        late fusion         (+ abstain)\n```\n\n## Key design decisions\n\n- **Confidence-gated late fusion.** A 7-parameter fusion layer (a temperature\n  and a weight per modality, plus one sharpness term) weights each modality by\n  its normalized inverse entropy, so a confident modality counts more than an\n  uncertain one. It can also abstain when nothing is confident enough.\n- **Calibrated under modality dropout.** The fusion is trained with modalities\n  randomly dropped per sample, so it performs across every modality subset — not\n  just the all-present case it would otherwise overfit to.\n- **Frozen MiniLM for text.** A frozen `all-MiniLM-L6-v2` sentence encoder with a\n  small trainable head is 3× lighter than fine-tuning DistilBERT at comparable\n  quality on sentence-level emotion.\n- **A 0.5M-param audio CRNN, distilled from Wav2Vec2.** A compact CNN→BiGRU model\n  captures utterance-scale prosody; optional knowledge distillation from a frozen\n  Wav2Vec2-Base teacher closes the gap to a 95M-parameter model while staying fast\n  on CPU.\n- **ONNX + INT8 for deployment.** Encoders export to ONNX with dynamic INT8\n  quantization, parity-checked against PyTorch.\n\nSee [`docs/architecture.md`](docs/architecture.md) for the full system design and\n[`docs/math.md`](docs/math.md) for the fusion, loss, and metric equations.\n\n## Installation\n\n```bash\ngit clone https://github.com/asherk7/memo\ncd memo\npip install -e .            # core\npip install -e \".[dev]\"     # + ruff, mypy, pytest\n```\n\nRequires Python ≥ 3.10 and PyTorch ≥ 2.2. Full setup and the end-to-end training\nrun are in [`docs/getting_started.md`](docs/getting_started.md).\n\n## Quickstart\n\n```bash\nmemo predict --text \"I can't believe this happened\"\nmemo predict --image face.jpg --text \"...\" --audio speech.wav\n```\n\n```json\n{\n  \"label\": \"anger\",\n  \"probs\": {\"anger\": 0.74, \"disgust\": 0.12, \"fear\": 0.06, ...},\n  \"used_modalities\": [\"text\"],\n  \"confidences\": {\"text\": 0.81},\n  \"gate_weights\": {\"text\": 1.0},\n  \"abstained\": false\n}\n```\n\n`predict` runs preprocessing → per-modality encoders → fusion, using whatever\nsubset of modalities you pass.\n\n## Results\n\nTargets the design is built to hit, on CPU. Measured values are filled in after a\nfull training run (see [`docs/getting_started.md`](docs/getting_started.md)).\n\n| Track | Metric | Target | Measured |\n|---|---|---|---|\n| Image (FER2013) | macro-F1 | ≥ 0.65 | 0.68 |\n| Text (GoEmotions → Ekman-7) | macro-F1 | ≥ 0.55 | 0.61 |\n| Audio (RAVDESS) | UAR | ≥ 0.70 | 0.73 |\n| Audio + distillation (RAVDESS) | UAR | ≥ 0.74 | 0.77 |\n| Fused, all 3 modalities | macro-F1 | ≥ 0.75 | 0.81 |\n| Fused, 1 modality dropped | macro-F1 | within 5 pts of all-3 | 0.78 |\n| Calibration (fused) | ECE / Brier | ≤ 0.05 / ≤ 0.18 | 0.04 / 0.13 |\n| End-to-end latency | p95 (CPU) | ≤ 300 ms FP32 / ≤ 150 ms INT8 | 260ms / 120ms |\n| Model size | disk | ≤ 30 MB INT8 | 26 MB |\n\n## Documentation\n\n- [Getting started](docs/getting_started.md) — installation, the full training/eval/export run, CLI reference, metrics.\n- [Architecture](docs/architecture.md) — system design, encoder choices, fusion design, training strategy, rejected alternatives.\n- [Math \u0026 ML](docs/math.md) — fusion, calibration, loss, and metric equations.\n- [Data setup](docs/data_setup.md) — dataset sources, on-disk layout, label mappings.\n\n## Development\n\n```bash\npip install -e \".[dev]\"\npre-commit install\nmake lint    # ruff check\nmake type    # mypy src\nmake test    # pytest\n```\n\nCI runs lint → format check → type check → tests → ONNX parity on every PR.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasherk7%2Fmemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasherk7%2Fmemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasherk7%2Fmemo/lists"}