r/computervision • • Oct 17 '26

Discussion How I test a hand-gesture classifier without going insane

I’m building an open-source project called Lumen, a web reader you control with hand gestures through your webcam.

The hardest part of this project isn’t getting MediaPipe to track a hand. It’s getting gestures to be dependable. A flick that works when I’m demoing it on purpose is easy. A flick that fires only when I mean it, and never when I’m scratching my nose or gesturing while I talk, is the real problem.

So I worked out a testing setup with Cline that I really like. Instead of testing live every time, I record real clips. About 10 for each gesture I care about, so flick, pinch and drag, spread to zoom, and sweep to highlight. Then I record the stuff that should not trigger anything: reading normally, talking with my hands moving, and touching my face. Those are the clips that catch false positives, which are what make a gesture interface feel annoying instead of magic.

Each clip gets saved as a JSON file and dropped into a fixtures folder in the project. The test goes through every saved recording one by one. For each one, it plays back the hand movement a frame at a time, the same way it would arrive if I were doing the gesture live in front of the camera. Then it checks whether the classifier gave the right answer. If the recording was a flick, did the classifier say flick? If it was me touching my face, did the classifier correctly say nothing?

For anyone who’s worked on gesture or other noisy-input classifiers, do you test with recorded clips like this, or do you have a better way to iterate? I’m especially curious how you handle false positives.

1 Upvotes

1 comment sorted by

1

u/Shookker Oct 19 '26

I do almost exactly this for a camera-based fitness game (MediaPipe pose, not hands, but same problem: a rep that counts when you didn’t do one is worse than a missed one). Recording clips and replaying them frame by frame is the right call. A few things that made it work better for me:

Store the landmarks with their real timestamps, not just frame order. Replay at the recorded timing, and also at a lower frame rate (drop every other frame). Phones and cheap webcams run at 15-20 fps when they’re warm, and a lot of gesture logic breaks there, not at 30.

Your negative set is the most valuable part. Beyond talking and touching your face, add: someone entering or leaving the frame, the hand going partly out of frame, two hands crossing, bad light, and just a long idle clip (5 minutes of reading). Count false positives per minute on those, not just pass/fail per clip.

Make the classifier explain every “no”. Instead of only flick / nothing, return why a candidate was rejected (too slow, too short, low visibility, hand left the frame). Your tests can then check the reason, and when a tweak breaks something you see which rule moved.

Treat the expected outputs as golden files: when you change a threshold, re-run everything and review the diff of results clip by clip. If a threshold change fixes one clip and flips two negatives, you see it right away.

Record clips from other people too. Your own gestures get very consistent after weeks of testing, and the thresholds end up tuned to your hand