fix: stop discarding finished signs while the classifier is busy - #35
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is why nothing was ever recognised. Not the vocabulary — a dropped-frame bug.
A window closes on exactly one frame. If that frame arrived while a previous classification was still in flight, the entire sign was discarded — silently, with no error and no log.
And frames almost always arrive during a classification. Frames are delivered synchronously from
requestAnimationFrame; the first one starts an async classify and yields, so every subsequent frame hitsbusyand returns early. On a phone running hand, pose and face inference per frame, the window-closing frame is essentially never the one holding the lock.The finished sign is now queued in
pendingWindowand picked up when the classifier frees, so a slow device recognises late rather than not at all.The test earns its place
Reverting the fix fails two tests, not one — including the plain case with no artificial blocking. That is the measure of how broad this was: it was not an edge case on slow hardware, it was the normal path.
What I got wrong before this
I attributed the silence to vocabulary mismatch twice. It held for the first video — Presentación y Cortesía, greetings the model genuinely does not know — but the second was "En el Médico", squarely in the trained domain, and it should have worked. That is what stopped me repeating the explanation and made me read the frame loop.
Also measured on the way, since it was the other suspect and worth ruling out: at
MIN_CONFIDENCE0.45 the model speaks on 60.7% of held-out signs with 89.3% precision. The threshold was never what was keeping it quiet.