Skip to content
All posts

March 9, 2026 · 8 min

Human Activity Recognition From Sensors, Not Cameras

HAR-Activity-Recognition classifies what someone is doing — walking, sitting, going upstairs or downstairs — straight from accelerometer and gyroscope streams. No camera, no hardware beyond a phone. It's a problem that looks simple and is quietly full of traps, which is exactly why it's good practice.

The architecture

A CNN reads each sensor window for local patterns; an LSTM reads the sequence of windows for temporal structure. In PyTorch that is a small model — a few convolutional layers into a recurrent head. The architecture is the shortest part of this writeup because it's the shortest part of the work.

The real work is in the windows

Window size and overlap are the knobs that actually move accuracy. Too short and you can't distinguish walking from climbing stairs — the raw dynamics look alike; too long and you blur transitions between activities, which are often the events that matter. Overlap trades compute for coverage of transitions.

The other big one is leakage. If the same person's windows land on both sides of the train/test split, the model memorizes their gait and your metrics lie. Splitting by subject — some people entirely unseen during training — is the only honest evaluation, and it costs a couple of accuracy points that were never real to begin with.

Tracking beats tuning

The honest win came from MLflow. Once every run logged its window size, overlap, subject split, seed and metrics, I could see which knob actually moved accuracy instead of guessing. Most "tuning" is just not losing track of what you changed.

Before the tracker, my tuning loop was: change two things, retrain, see a better number, have no idea which change did it. After: change one thing, log it, attribute the delta. The accuracy improvements came from the same experiments either way — but only in the second world could I tell you which ones to keep.

The annoying part is the job

Sensor data is never clean: dropped samples, mismatched sampling rates between devices, subjects who simply walk differently. Budget most of your time there — the model is the short end of the pipeline. This is a pattern I've stopped fighting: in every sensor or signal project, data hygiene is the long end and architecture is the short one.

thanks for reading — more soon ✦

M

drawing ideas into systems...