cupido/scripts/barrier_picker_app
Giorgio Gilestro d0f0e2d443 Picker: render existing annotation as a clickable mark below the video
When a video that already has a barrier_opening row is loaded, a thin
bar now appears below the player with a red vertical line at the
marked opening_s. A tooltip shows the timestamp, the analyst's
initials, and the bad_rois flag. Clicking the line snaps the player
to the exact opening; clicking elsewhere on the bar seeks
proportionally. Bar is hidden for un-annotated videos.

API change: each queue item now carries an `existing` field with the
opening_s, bad_rois, analyst, etc. from barrier_opening.csv when
available, so the frontend can paint the mark without extra requests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 14:27:33 +01:00
..
static Picker: render existing annotation as a clickable mark below the video 2026-05-01 14:27:33 +01:00
app.py Picker: render existing annotation as a clickable mark below the video 2026-05-01 14:27:33 +01:00
docker-compose.yml Welcome modal + port 8085 2026-05-01 14:15:42 +01:00
Dockerfile Add barrier_picker_app — Dockerised web picker for barrier opening 2026-05-01 12:33:28 +01:00
README.md Welcome modal + port 8085 2026-05-01 14:15:42 +01:00
requirements.txt Add barrier_picker_app — Dockerised web picker for barrier opening 2026-05-01 12:33:28 +01:00

Cupido — web-based barrier-opening picker

A small FastAPI + HTML5-video app for annotating the barrier-opening moment in each tracked recording. Lives in its own Docker container so it can run on the lab server without polluting any existing environment.

What it does

For every video referenced by all_video_info_merged.tsv that has a tracking DB on disk and isn't yet in barrier_opening.csv, it serves a <video> element pre-loaded with that mp4. The analyst plays / scrubs / pauses at the moment the barrier opens, then clicks one of:

button meaning written to bad_rois
All barriers open every ROI (1..6) is usable post-opening empty
Upper barriers open only the top row opens (ROIs 1, 3, 5) 2,4,6
Lower barriers open only the bottom row opens (ROIs 2, 4, 6) 1,3,5

Plus a Skip (advance without saving) and Unusable (write opening_s = NaN).

Keyboard shortcuts

  • Space — play / pause
  • / — ±5 s
  • Shift+arrows — ±1 s
  • Ctrl+arrows — ±0.1 s
  • , / . — ±1 frame
  • 1 / 2 / 3 — All / Upper / Lower
  • s — skip ; u — unusable

Run locally (docker compose)

cd scripts/barrier_picker_app
docker compose up --build

Then browse to http://localhost:8085/.

The container mounts:

  • /mnt/data/projects/cupido (data volume, read-only)
  • /mnt/ethoscope_data/videos (source mp4s, read-only)
  • data/metadata/ from the repo (read-write — for persisting barrier_opening.csv)

Adjust paths in docker-compose.yml if your layout differs.

Run without Docker (development)

cd scripts/barrier_picker_app
pip install -r requirements.txt
python app.py     # serves on http://localhost:8000

By default it expects:

  • merged TSV at /mnt/data/projects/cupido/all_video_info_merged.tsv
  • inventory at /cupido/data/metadata/video_inventory.csv
  • writes to /cupido/data/metadata/barrier_opening.csv

Override via environment variables:

CUPIDO_DATA_VOLUME=/path/to/data \
CUPIDO_INVENTORY_CSV=$(pwd)/../../data/metadata/video_inventory.csv \
CUPIDO_OUTPUT_CSV=$(pwd)/../../data/metadata/barrier_opening.csv \
python app.py