fix: increase edge inference confidence threshold to reject non-fish images#114
Merged
jpdevhub merged 1 commit intoJun 22, 2026
Merged
Conversation
|
@sks-007 is attempting to deploy a commit to the karan3431's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Resolves #99
Problem Statement
When running the application in offline mode, taking a picture of a non-fish object (like a human face or generic object) often resulted in the app blindly accepting the image and returning a bogus "Fresh" score, rather than explicitly rejecting it.
Root Cause
The
NOT_A_FISH_THRESHOLDinsrc/fusionInference.jswas configured to0.36. Because the Stream A MobileNet model has 3 classes, pure random chance yields a baseline probability of0.33. This meant the threshold was so low that almost any out-of-distribution image's maximum class probability would pass the check, successfully bypassing the guardrail.Solution Implemented
NOT_A_FISH_THRESHOLDfrom0.36to0.55.This requires the model to be significantly more confident than random chance before accepting an image as a valid fish, effectively filtering out generic objects and faces without the payload overhead of downloading a secondary object-detection model.
Testing Performed
NOT_A_FISHerror state.Potential Impacts
Very blurry or poorly lit legitimate fish images might occasionally fall below the 55% confidence threshold, requiring the user to rescan (which is the intended safe fallback behavior).