Moving rehab pose tracking from the server to the browser without losing the angle you can trust

The old pipeline uploaded patient video to a GPU server, ran pose estimation there and sent joint angles back, so every session depended on one point of failure. Moving inference into the browser removes that point. In its place come hundreds of weaker ones: every phone, every GPU driver, every tab the operating system slows down. The budget question is not whether the new stack is cheaper. It is how much measured reliability each line of cost buys.

What the parallel run actually pays for

The most expensive part of the migration is running both stacks side by side on the same exercises, because the server keeps billing GPU time after the browser build has shipped. That money buys the number the clinical team needs: angle agreement between the old and new outputs, per joint and per exercise, measured on real patients rather than on a lab volunteer. Knee flexion and shoulder abduction rarely drift in the same way, so a single global accuracy figure hides the joint that will fail first. If you work under medical device software lifecycle standards such as IEC 62304, this comparison is also your verification evidence. Skipping it saves nothing, it pushes the cost into a later revalidation, so end the parallel run when every tracked joint stays inside the agreement band the clinicians signed off, not when the calendar says so.

The failure that looks like success

On mobile, the WebGL or WebGPU context can be lost when the tab goes to the background or the device throttles under heat, and a naive render loop keeps drawing the last landmarks it received, so the knee angle freezes at a plausible value, the rep counter keeps running, no error fires, and the patient believes they are being scored by a system that stopped seeing them seconds ago.

Degrade in layers, and say so on screen

When the old server died it threw an obvious error, and the new stack has to rebuild that honesty on purpose. The design that holds up treats every component as replaceable by a weaker one: the GPU delegate falls back to the WASM CPU path at a lower frame rate, the model loads from the service worker cache when the CDN is unreachable, and session records wait in IndexedDB with sequence numbers until the clinic backend accepts them. Each landmark frame carries a timestamp, and the angle readout is valid only while the newest frame is less than 150 ms old. The decision rule is simple: if a joint's frames exceed that budget or its visibility score falls below threshold, mark the segment unscored and pause the rep count, and never interpolate across the gap. Interpolation gives you a smoother chart and a wrong clinical record. Our estimate is that roughly a quarter of home sessions on older Android devices run on the CPU path, which means that path has to be tested as a product in its own right, not as an emergency exit.

The part that hurts

Once video stops leaving the device, you can no longer rescore old sessions when the model improves, and that trade is permanent: you give up reprocessing in exchange for privacy and zero video storage. The device matrix is the second bill. Our estimate puts QA effort at about three times what it takes to validate a single server image, and you pay it again every time a browser vendor changes its graphics stack. The next decision is whether to keep a consented, opt-in upload path for a small calibration cohort, which gives that group rescoring back but brings back the storage and consent management the migration just removed.

Can we keep the server pipeline as a silent fallback?

No. A silent fallback to server inference would send video off the device and break the privacy promise that justified the migration. Keep the server only as an explicit, visible mode for the consented calibration cohort, and shut it down for everyone else once joint agreement is signed off.

Back to RehabAnalysis · Domains

← Back to RehabAnalysis
Engineering & Architecture Brief

Moving rehab pose tracking from the server to the browser without losing the angle you can trust

The old pipeline uploaded patient video to a GPU server, ran pose estimation there and sent joint angles back, so every session depended on one point of failure. Moving inference into the browser removes that point. In its place come hundreds of weaker ones: every phone, every GPU driver, every tab the operating system slows down. The budget question is not whether the new stack is cheaper. It is how much measured reliability each line of cost buys.

What the parallel run actually pays for

The most expensive part of the migration is running both stacks side by side on the same exercises, because the server keeps billing GPU time after the browser build has shipped. That money buys the number the clinical team needs: angle agreement between the old and new outputs, per joint and per exercise, measured on real patients rather than on a lab volunteer. Knee flexion and shoulder abduction rarely drift in the same way, so a single global accuracy figure hides the joint that will fail first. If you work under medical device software lifecycle standards such as IEC 62304, this comparison is also your verification evidence. Skipping it saves nothing, it pushes the cost into a later revalidation, so end the parallel run when every tracked joint stays inside the agreement band the clinicians signed off, not when the calendar says so.

The failure that looks like success

On mobile, the WebGL or WebGPU context can be lost when the tab goes to the background or the device throttles under heat, and a naive render loop keeps drawing the last landmarks it received, so the knee angle freezes at a plausible value, the rep counter keeps running, no error fires, and the patient believes they are being scored by a system that stopped seeing them seconds ago.

Degrade in layers, and say so on screen

When the old server died it threw an obvious error, and the new stack has to rebuild that honesty on purpose. The design that holds up treats every component as replaceable by a weaker one: the GPU delegate falls back to the WASM CPU path at a lower frame rate, the model loads from the service worker cache when the CDN is unreachable, and session records wait in IndexedDB with sequence numbers until the clinic backend accepts them. Each landmark frame carries a timestamp, and the angle readout is valid only while the newest frame is less than 150 ms old. The decision rule is simple: if a joint's frames exceed that budget or its visibility score falls below threshold, mark the segment unscored and pause the rep count, and never interpolate across the gap. Interpolation gives you a smoother chart and a wrong clinical record. Our estimate is that roughly a quarter of home sessions on older Android devices run on the CPU path, which means that path has to be tested as a product in its own right, not as an emergency exit.

The part that hurts

Once video stops leaving the device, you can no longer rescore old sessions when the model improves, and that trade is permanent: you give up reprocessing in exchange for privacy and zero video storage. The device matrix is the second bill. Our estimate puts QA effort at about three times what it takes to validate a single server image, and you pay it again every time a browser vendor changes its graphics stack. The next decision is whether to keep a consented, opt-in upload path for a small calibration cohort, which gives that group rescoring back but brings back the storage and consent management the migration just removed.

Technical FAQ: Can we keep the server pipeline as a silent fallback?

No. A silent fallback to server inference would send video off the device and break the privacy promise that justified the migration. Keep the server only as an explicit, visible mode for the consented calibration cohort, and shut it down for everyone else once joint agreement is signed off.

Related Architecture Specifications (DANCEGOAL): merenguesteps.com · salsamethod.com · danceheal.com

More Technical Articles on rehabanalysis.com

Moving joint angle tracking into the browser without losing the measurement →