A staleness limit counted in frames: how pose scoring lies when the detector slows down

A pose pipeline that scores rehabilitation movement can keep giving confident results after its detector has, in practice, stopped. The setting that allows this looks perfectly sane in a diff: a staleness limit written in frames instead of milliseconds. On the reviewer's laptop, which runs inference on its GPU, the two mean the same thing. On a patient's phone that has fallen back to running inference on its CPU, they do not.

Why the diff looks fine

DanceSaga runs camera capture, landmark inference and scoring as separate loops, so the scorer always reads the latest set of landmarks instead of waiting for a new one. Keeping the loops separate is what keeps a session alive when inference stutters, but it also means the scorer needs a rule for when the latest set is too old to trust. Writing that rule as a frame count feels natural because the detector reports in frames, and at the frame rate everyone tests on it works out to a sensible time window. When the GPU delegate fails to start and inference falls back to the CPU, the detector may run at roughly a third of its usual rate (an estimate that varies by device), so the same frame count now covers three times as much real time. The scorer keeps counting repetitions against a pose the patient has already left, and nothing in the logs looks like an error.

The rule that holds when inference degrades

Express every staleness limit in real time, convert any frame-based value when the config loads, and reject a config that still contains one. Our budget is 150 ms of landmark age, measured from the moment the camera frame was captured to the moment the scorer uses its landmarks. Past that budget the scorer must not interpolate or reuse old data: it goes into a hold state, freezes the repetition count, and the interface tells the patient that tracking has paused while camera and audio keep running. This is what keeps the session usable when one part fails, because inference can slow down and the GPU delegate can fall back while the output stays honest: the scorer goes quiet instead of making numbers up. Teams working under medical device software lifecycle standards such as IEC 62304 will recognise this as a hazard control, and it should be traced like one.

A check you can run today

Replay a recorded session in Chrome with the strongest CPU throttling preset in the DevTools Performance panel, log the gap between each score's timestamp and the capture timestamp of the landmarks it used, and if any score came out with an age above 150 ms, your limit is counting frames somewhere.

What it costs

A time-based limit produces more hold states on weak hardware, and patients on older phones will see the pause message often enough to complain. That is the right trade: a paused session becomes a support ticket, while an inflated repetition count is wrong clinical data that looks right. The open decision is whether to switch to a lighter pose model automatically when the hold rate crosses a threshold, which keeps sessions running at the cost of less accurate hand and foot landmarks. Make that switch visible in telemetry before you make it automatic.

Why not just raise the frame count for slow devices?

Because frame rate is not a fixed property of the device: it changes during a session when the phone throttles for heat or inference falls back from the GPU, so a frame-based window is only correct by coincidence.

Back to DanceSaga - Pose Detection · Domains

← Back to DanceSaga - Pose Detection
Engineering & Architecture Brief

A staleness limit counted in frames: how pose scoring lies when the detector slows down

A pose pipeline that scores rehabilitation movement can keep giving confident results after its detector has, in practice, stopped. The setting that allows this looks perfectly sane in a diff: a staleness limit written in frames instead of milliseconds. On the reviewer's laptop, which runs inference on its GPU, the two mean the same thing. On a patient's phone that has fallen back to running inference on its CPU, they do not.

Why the diff looks fine

DanceSaga runs camera capture, landmark inference and scoring as separate loops, so the scorer always reads the latest set of landmarks instead of waiting for a new one. Keeping the loops separate is what keeps a session alive when inference stutters, but it also means the scorer needs a rule for when the latest set is too old to trust. Writing that rule as a frame count feels natural because the detector reports in frames, and at the frame rate everyone tests on it works out to a sensible time window. When the GPU delegate fails to start and inference falls back to the CPU, the detector may run at roughly a third of its usual rate (an estimate that varies by device), so the same frame count now covers three times as much real time. The scorer keeps counting repetitions against a pose the patient has already left, and nothing in the logs looks like an error.

The rule that holds when inference degrades

Express every staleness limit in real time, convert any frame-based value when the config loads, and reject a config that still contains one. Our budget is 150 ms of landmark age, measured from the moment the camera frame was captured to the moment the scorer uses its landmarks. Past that budget the scorer must not interpolate or reuse old data: it goes into a hold state, freezes the repetition count, and the interface tells the patient that tracking has paused while camera and audio keep running. This is what keeps the session usable when one part fails, because inference can slow down and the GPU delegate can fall back while the output stays honest: the scorer goes quiet instead of making numbers up. Teams working under medical device software lifecycle standards such as IEC 62304 will recognise this as a hazard control, and it should be traced like one.

A check you can run today

Replay a recorded session in Chrome with the strongest CPU throttling preset in the DevTools Performance panel, log the gap between each score's timestamp and the capture timestamp of the landmarks it used, and if any score came out with an age above 150 ms, your limit is counting frames somewhere.

What it costs

A time-based limit produces more hold states on weak hardware, and patients on older phones will see the pause message often enough to complain. That is the right trade: a paused session becomes a support ticket, while an inflated repetition count is wrong clinical data that looks right. The open decision is whether to switch to a lighter pose model automatically when the hold rate crosses a threshold, which keeps sessions running at the cost of less accurate hand and foot landmarks. Make that switch visible in telemetry before you make it automatic.

Technical FAQ: Why not just raise the frame count for slow devices?

Because frame rate is not a fixed property of the device: it changes during a session when the phone throttles for heat or inference falls back from the GPU, so a frame-based window is only correct by coincidence.

Related Architecture Specifications (DANCEGOAL): danceheal.com · learnmerengue.com · rehabsaga.com

More Technical Articles on rehabdance.com

The CPU fallback nobody has ever loaded: a pose-detection config error that sails through review →