MnemoDOCS
Documentation

Running and building on Mnemo

Mnemo turns first-person video into a short, time-stamped text diary of what the wearer did, then answers questions from that diary alone. This page covers installation, every command and setting, the architecture, and how to reproduce the reported numbers. The source is on GitHub.

Overview

There are two ways to use Mnemo:

  • Diary mode (GPU). Any action, any object. HOI-TCN decides which 4-second windows are worth describing. Qwen3-VL-4B describes them in fixed lines, an object-state memory adds opens and closes, and questions are answered from the diary with times. This is the mode behind the results on the home page.
  • Tracker mode (CPU). The original pick-up / put-down tracker for a few personal objects (keys, wallet, phone, pill bottle). It remembers the place where each object was put down and learns daily habits.

In the ENGRAM paper (in preparation), the method is called Egocentric Neural Grounded Retrieval of Actions and Moments, and the diary is the reference diary.

Installation

git clone https://github.com/imlikhiths/MNemo.git
cd MNemo
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
python -m pytest
  • Tested on Linux with Python 3.14. The test suite has 87 tests on synthetic data, so no dataset is needed.
  • The trained trigger ships in the repository (models/hoi_tcn.pt, 1 MB).
  • The MediaPipe hand model and YOLOv8n download automatically the first time they are used.
  • For diary mode, also install pip install "transformers>=4.57" accelerate.

Linux audio note. On some systems, MediaPipe's import of sounddevice crashes through PortAudio. Mnemo uses no audio, so modules/hand_detector.py replaces that module with an empty stub.

Quick start

Diary mode

python mnemo.py log kitchen.mp4 --start "2026-10-17 08:30" --trigger
python mnemo.py activities
python mnemo.py qa "did I close the fridge?" --llm
  • --trigger lets HOI-TCN choose the windows the VLM describes. Without it, every window is described.
  • Without --llm, qa lists the matching diary rows and needs no GPU.
  • Qwen3-VL-4B needs a 16 GB GPU such as a T4. Qwen/Qwen3-VL-2B-Instruct is smaller and faster.

Tracker mode

python mnemo.py run recording.mp4 --mode model --show
python mnemo.py ask "where is my wallet?"
python mnemo.py simulate --days 14
python mnemo.py habits --simulated

run 0 --show uses a live camera. The habit demo runs on simulated history. Say so whenever you present it.

Running on Kaggle

The free Kaggle T4 is enough for everything. Package the code with python -m tools.make_colab_zip, upload mnemo_code.zip as a Kaggle dataset, and open a notebook with GPU T4 and internet turned on:

NotebookWhat it does
colab/mnemo_live_demo.ipynbAny first-person video → diary → type your own questions. The video should be 2–3 minutes; processing takes about 1.5× its length.
colab/mnemo_kaggle.ipynbThe full benchmark: trigger vs. fixed rate, state memory, question answering, and the whole-morning test.
colab/mnemo_ego4d.ipynbThe Ego4D Natural Language Queries test. Needs an approved Ego4D licence; the AWS keys go in Kaggle Secrets.
colab/mnemo_vlm.ipynbDiary mode on Google Colab.
colab/mnemo_train.ipynbTrains HOI-TCN on public datasets.

Commands

Every command is a subcommand of python mnemo.py. The global option --db PATH selects the database (default outputs/mnemo.db).

CommandMain optionsWhat it does
log SOURCE--start --trigger --threshold --model --max-seconds --checkpointStage 1: video → diary, using the vision-language model
qa QUESTION--llm --model --nowStage 2: answer from the diary, or list matching rows
activities--limitPrint the diary
run SOURCE--mode rules|model --show --start --objects --no-landmarksTracker mode on a video file or a camera index
ask QUESTION--now --simulated"Where is X?" from tracker events
events--limit --simulatedList tracker events
enroll--dir --check --check-onlyBuild the landmark index from short clips of each place
habits--now --simulatedLearned routines and missed-routine alerts
simulate--days --end --no-missWrite simulated history to a separate database

Configuration

Every setting lives in config.py. Values marked TUNE there are starting points to measure on your own footage. The main ones:

SettingDefaultMeaning
VLM_MODELQwen/Qwen3-VL-4B-InstructThe model that describes windows and answers questions
VLM_WINDOW_S4.0Seconds of video per description
VLM_FRAMES / VLM_FRAME_W8 / 448Frames per window, and their width in pixels
VLM_TRACK_STATESTrueObject-state memory: open/closed, on/off, re-checks
VLM_MAX_ACTIONS8Maximum actions per window (stops repetition loops)
STATE_CHECK_MAX_AGE_S600How long an open object keeps being re-checked
QA_MAX_LOG_LINES60Diary rows given to the model when it answers
GATE_THRESHOLD0.6Trigger threshold τ on the window score
GATE_HEARTBEAT_S20.0Describe at least one window this often
PROCESS_FPS / PROCESS_WIDTH10 / 640Frame rate and width for perception
OBJECT_BACKENDautoFine-tuned YOLO if present, else YOLO-World, else COCO
LANDMARK_MIN_SIM0.80Below this similarity, a place is "unknown" (tracker mode)

Architecture

The always-on lane (perception and HOI-TCN) runs on every frame on the CPU. The on-demand lane (the VLM) runs only for windows the trigger selects, plus a heartbeat every 20 s. Frames are held in RAM only while their window is processed. See the methodology for the full picture.

PartCode
Command line, settingsmnemo.py, config.py
Video source, RAM-only buffermodules/video_source.py
Perception: hands, objects, camera motionmodules/hand_detector.py, object_detector.py, ego_motion.py, perception.py
105-number feature per framemodules/features.py
HOI-TCN model and trainingmodel/architecture.py, train.py, evaluate.py, metrics.py
Interaction triggermodules/hoi_gate.py
Stage 1: VLM describer and state memorymodules/vlm_logger.py
Diary and event store (SQLite)modules/storage.py
Stage 2: grounded answers, moment searchquery/llm_qa.py, query/locate.py
Tracker mode: rules, places, habitsmodules/interaction.py, landmarks.py, habits.py, query/query_engine.py
Experimentsevaluation/
Dataset fetchers, labelling, demo videotools/

Diary format

The diary is one SQLite table, activities, with one row per action. A 2.4-hour morning produced 636 rows in a 240 kB file.

ColumnMeaning
ts_start, ts_endStart and end of the window, in local time
verbThe action, from a fixed list of everyday verbs. Empty when nothing was done with the hands (place only).
objectThe object acted on
placeWhere the wearer was
where_Where the object is or ended up
rawThe model's full answer, kept for checking
sourceWhich video produced the row; rows derived from a state change are marked as such

For each window, the VLM fills in fixed lines, which are then parsed into rows:

PLACE: kitchen counter
STATE: fridge = open
DID: put | milk | fridge

The small model: HOI-TCN

  • What it is. A causal temporal convolutional network. It gives each frame a probability of pick-up, put-down or none.
  • Input. 105 numbers per frame: 45 per hand (presence, wrist position, landmarks relative to the wrist, velocity relative to the background), 13 for the tracked object nearest a hand, and 2 for camera motion.
  • Layers. One encoder per modality (64, 32 and 8 units), a projection to 96 channels, and four residual blocks of causal convolutions (kernel 3, dilation 1, 2, 4, 8). The receptive field is 61 frames, about 6 s.
  • Size. 240,252 parameters.
  • Window score. The score is the maximum of 1 − P(none) over the window. A window is sent on when its score is at least τ, or when 20 s have passed since the last call.

The convolutions only look at past frames, so the same network runs live, frame by frame. A test checks that streaming output equals full-sequence output.

Training

  • Data. EPIC-KITCHENS-100 pieces rich in take and put actions, split by person: 68 pieces from 22 people for training, 16 from 5 others for validation and 16 from another 5 for testing.
  • Setup. AdamW (lr 10⁻³, weight decay 10⁻³, cosine schedule), batches of 64. The loss is class-weighted cross-entropy plus a holding head with weight 0.5. Whole modalities are dropped at random (p = 0.1). Early stopping uses validation event F1.
  • Charades-Ego was tried, but it lowered put-down accuracy, so the final model uses EPIC-KITCHENS-100 only.
python -m model.train --features data/features/epic --batch-size 64 --out models/hoi_tcn.pt
python -m model.evaluate --checkpoint models/hoi_tcn.pt --features data/features/epic --split test

Test results on held-out people: F1 0.529, precision 0.446, recall 0.652. The ablation table is on the results section of the home page.

Reproducing the results

  1. Run colab/mnemo_kaggle.ipynb on a Kaggle T4. The VLM runs once over every window, and each system (every window, trigger at each threshold, every N-th window, with and without states) is replayed from that single pass. All systems are therefore scored on the same model outputs.
  2. Download mnemo_results.zip and unzip it.
  3. Draw the figures:
    python -m evaluation.make_figures --results <unzipped folder> --out docs/figures
  • Test set. 20 random one-minute clips from EPIC-KITCHENS-100 participants P02, P06, P08, P14 and P26. None of them were used in training.
  • Validation people. P04, P21, P22, P27 and P31.
  • The threshold. τ = 0.6 was read off the test curve, which is why every threshold is reported.
ExperimentCode
Benchmark: one VLM pass, replayed for every systemevaluation/benchmark.py
Diary accuracy against EPIC ground truthevaluation/log_accuracy.py
Yes/no questions, incl. the direct-VLM baselineevaluation/qa_benchmark.py
Whole-morning questionsevaluation/long_qa.py
Trigger settings on validation peopleevaluation/tune_gate.py
Ego4D Natural Language Queriesevaluation/ego4d_nlq.py, tools/fetch_ego4d.py

Using your own footage

Tracker mode can be tuned for one home. You can mount the camera, fine-tune YOLO on your own objects, enroll places from short clips, then label and evaluate your own videos. The step-by-step guide is docs/own_footage.md.

Privacy

  • Frames are kept only in a RAM buffer, and only while their window is processed. Nothing visual is written to disk. tests/test_privacy_and_pipeline.py runs the real pipeline with every image-writing function blocked, and fails if any image or video file appears.
  • The diary is plain text in a local SQLite file, and the whole system can run on one machine.
  • The text can still be sensitive. A real deployment needs encryption and user-controlled deletion. The guarantee covers stored data, not someone inspecting the running machine's memory.

Limitations

  • Kitchens and head-mounted cameras. All quantitative results come from EPIC-KITCHENS-100, which was filmed with head-mounted cameras. Mnemo is meant to be worn on the chest.
  • Strict scoring. Recall of 26–31% reflects strict scoring, which requires the exact verb and noun class. Read the numbers as comparisons between systems that share the same VLM outputs.
  • Small morning test. It joins separate clips and has 38 questions.
  • Narrow trigger. HOI-TCN knows only pick-up and put-down. Actions like stirring or wiping are caught mainly by the heartbeat.
  • Not a medical device. There has been no user study. Mnemo is a research prototype.

Data and licences

The repository contains no videos and no dataset files.

ComponentLicenceUsed for
Mnemo codeMIT—
EPIC-KITCHENS-100CC BY-NC 4.0Training HOI-TCN, all results, the clips on this site
Ego4DEgo4D licenceNLQ test; clips must not be redistributed
MediaPipe Hand LandmarkerApache-2.0Hand landmarks
Ultralytics YOLOv8 / YOLO-WorldAGPL-3.0Object detection
Qwen3-VL-4B-InstructApache-2.0Describing windows, answering questions
OpenCLIPMITPlace matching in tracker mode
  • The HOI-TCN weights were trained on EPIC-KITCHENS-100 only. Treat them as non-commercial too.
  • Ultralytics is AGPL-3.0. If you distribute a product that includes it, its terms apply to that product.