This is a submission for the Presage SmartSpectra SDK Challenge
What I Built
FlyPPG is a stress-test harness and a fly-inspired mitigation layer for remote photoplethysmography.
I started by trying to beat SmartSpectra at its own game: clean-signal heart-rate accuracy. I lost — on front-facing, well-lit footage with a chest in frame, SmartSpectra is excellent and my head-to-head attempts couldn't get close. So instead of pretending otherwise, I pivoted to what Presage documents as their known limits: uneven lighting, rhythmic flicker, and framing requirements (footage without a chest visible is rejected outright).
FlyPPG does two things:
- A reproducible benchmark harness that builds flicker-injected clips (arbitrary strength, arbitrary flicker BPM) from a public dataset, runs them through the SmartSpectra SDK multiple times, and scores every arm against a pseudo-reference with a verdict line — all in CI, no local setup. (full scoreboard, raw run)
- A fly visual-system denoising layer ("fly lamina") — inspired by how flies reject uniform flicker at the lamina/medulla level of their early visual system — that suppresses globally-correlated illumination flicker before rPPG extraction.
The headline results, from the same frontal recording:
| Scenario | SmartSpectra | With FlyPPG pre-filter |
|---|---|---|
| 12% TV-style flicker | 7.04 bpm MAE, 55% usable windows, conf 0.39 | 2.70 bpm MAE, 82% windows, conf 0.94 |
| 88 bpm rhythmic flicker | reports 88.0 ± 0.9 bpm at 99.4% confidence (that's the lamp's frequency, not the heart — true HR is 77.1) | sags to 83.9 bpm at 64% confidence — degraded, never entrained |
| No chest in frame | REJECTED, no output | keeps tracking at ~77 bpm |
I also labeled the harness honestly: at mild 6% flicker the fly layer is actually slightly worse than raw (7.88 → 8.64 MAE), and the reference is SmartSpectra's own clean-footage reading plus known dataset caveats. Both are in the SCORES.md with the logs — you can audit every number.
Demo
Live demo viewer — click through the three scenarios (12% flicker → no chest → 88 bpm trap) and the fly-brain tab. In the 88 bpm trap, look for the red READING THE LAMP – Entrained by 88 bpm flicker badge on SmartSpectra's pane, with true 77.1: +10.9 bpm (red) vs +6.9 bpm (amber) under the heart-rate readouts.
Demo video: [https://youtu.be/csEDsW-L1hM]
Every clip shown is reproducible: fl12.mp4 (12% flicker), ent088.mp4 (flicker at exactly 88 bpm), and their denoised _dn twins are committed to the repo, and the injection code that made them is ~200 lines of numpy.
Code
Repository: github.com/dominionochai/FlyPPG
Setup:
git clone https://github.com/dominionochai/FlyPPG
cd FlyPPG
# interactive demo — no install needed
open viewer.html # or just double-click it
# run the flicker experiment tooling (Python 3.11+)
python -m pip install numpy scipy opencv-python-headless imageio-ffmpeg
python experiments/flicker_experiment.py inject <src.mp4> <dst.mp4> --strength 0.12 --freq-bpm 88
python experiments/flicker_experiment.py denotch <src.mp4> <dst.mp4>
# run SmartSpectra on a clip (Node 22)
cd experiments && npm install
npx smartspectra_file_run.mjs <clip.mp4> <outdir> --metrics=cardio # requires SMARTSPECTRA_API_KEY env var
One-click cloud version: the SmartSpectra flicker experiment GitHub Actions workflow (.github/workflows/smartspectra-flicker.ycmc — see note in repo: smartspectra-flicker.yml) builds every clip from scratch, runs the SDK twice per arm, and publishes SCORES.md.
How It Responds to Human Signals
The app consumes live Presage signals from the SmartSpectra Node SDK (--metrics=cardio): the pulseRate series with per-window confidence values, the same signals you get streaming. For every clip I parse those per-timestamp readings, compute error against the reference, and surface three human-legible signals: heart rate, signal quality (confidence 0–1), and motion — the same trio shown live in the demo viewer's gutters and quality lane, with a scrub cursor you can drag across time.
The integration itself is thin and intentional: each MP4 clip goes through smartspectra_file_run.mjs → raw SDK output (pulseRate.value/stable/confidence/timestamp) → JSON. All the judgment (MAE, window coverage, entrainment detection) sits outside the SDK so it can't be gamed, and all the fly-lamina work happens on the video before the SDK sees it.
Prize Categories
Best Thoughtful Real-World Use. rPPG pulse sensing has one hard systematic weakness: it only works in good lighting — and real life isn't good lighting. Telehealth calls happen at night under warm desk lamps and ceiling fans; elderly home monitoring happens in rooms with a window on one side; smart-mirrors and kiosks live with overhead fixtures cycling at 100–120 Hz. FlyPPG addresses the need where it actually fails: uneven and rhythmic illumination, so integrators of SmartSpectra can keep usable pulse readings in rooms they don't control.
Who it's for: developers and product teams building on pulse-rate sensing — telehealth platforms, wellness dashboards, adjacent-technology pilots — who today quietly gate their feature behind "needs decent lighting" and lose users (and readings) to it.
How we designed for them:
- Drop-in, upstream-of-SDK posture — the fly-lamina denoising layer is a pre-filter on the video, so it composes with the existing SmartSpectra integration (no SDK changes, no different data contract).
- A published benchmark, not a claim — every result comes from a reproducible CI harness (SCORES.md) that anyone can re-run with their own clips and API key, including the arms where our layer loses (mild 6% flicker). If you're deciding whether to ship this, you need to know both.
- Zero-install evaluation path — the demo viewer is a single HTML file; the repository is public with per-step setup commands and all clips committed.
- No live camera use. The demo viewer plays pre-rendered clips from the public MPSC-RR dataset (CC-BY-4.0, research-permitted). No user faces, video, audio, or biometrics are collected, stored, transmitted, or retained by this project. There is no account, no server, no analytics.
- SmartSpectra SDK usage runs exclusively inside GitHub Actions CI on committed dataset clips. Raw SDK responses (pulseRate series) are stored as public CI artifacts for auditability; they contain only synthetic-numbered windows from the public dataset.
- API key handling: the SmartSpectra key lives in a GitHub Actions encrypted secret and is never echoed; the publishing step scrubs it from all logs before committing anything public.
- No AI service processes personal data. The LLM coding agent worked on code, benchmark numbers, and public dataset clips only.
- No medical claims. This is a research demo / benchmark. Nothing here diagnoses, treats, or informs any medical decision, and the entrainment trap result exists precisely to show how wrong a confident pulse reading can be in bad lighting.
Agent Session
I used Vibe Code (Mistral) to drive the code and benchmark.
Top comments (0)