What can I say... I'm a Steinbeck fan.
Ad astra per alia porci...
A Universal Calorie Burn Counter October 14th, 2023

AI in the Browser

Modern browsers—yes, even those running on mobile phones—are capable of far more than displaying pages and submitting forms.

I built CadenceCam as a small demonstration of that idea. An old phone runs a web app that uses the camera to detect repetitive movement, counts repetitions, and sends the reps signal over WebRTC (wifi only) to a dashboard. The dashboard, running on a separate device, displays the reps and calculates calories. The substantial computation (a model trained through probabilistic learning) happens inside the browser, on the device that captures the movement.

This approach has benefits beyond reducing latency. Camera data can stay on the phone, communication between devices can happen directly over the local network, and the backend can be limited to the jobs that genuinely require it, such as initial pairing and storing workout history. Less data travels to a server, privacy improves, and infrastructure costs remain low.

Not every workload belongs in the frontend. But modern JavaScript engines, and increasingly powerful mobile hardware have moved the boundary considerably. Before adding another backend service, it may be worth asking: could the user’s browser do this work instead?

CadenceCam is my answer to that question—along with a practical way to stop losing count halfway through a workout.