Skip to content

feat: improve food scanning UX for low-confidence and non-food images#148

Merged
Indecisive613 merged 1 commit intomainfrom
feature/confidence-limits
Mar 16, 2026
Merged

feat: improve food scanning UX for low-confidence and non-food images#148
Indecisive613 merged 1 commit intomainfrom
feature/confidence-limits

Conversation

@GAchuzia
Copy link
Copy Markdown
Owner

@GAchuzia GAchuzia commented Mar 16, 2026

Description

  • Add a confidence threshold to the ML prediction so low-confidence predictions (e.g. unclear or non‑food images, lower than 80% confidence score) return an unsuccessful notification banner to the user.
  • Align the low-confidence banner styling with the existing buttons so the UI feels consistent.

Note: There will still be edge cases where the current model mistakes non-food items as food with high confidence. The purpose of this PR is to filter out all the low confidence scores.

Fixes #110

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix/feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • Unit tests
  • Manual tests
  • Linted/formatted

Scan an obviously non‑food photo (e.g. object or person) and verify:
- The backend returns success: false, reason: "low_confidence", and a message.
- The scan screen shows the red “No food detected” banner and does NOT show a food details table or warnings.

The idea is anything

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

- Add backend threshold for low confidence scores
- Show a no food detected banner and ask user to try again
Copy link
Copy Markdown
Collaborator

@Indecisive613 Indecisive613 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It doesn't rule out all edge cases - that would require an entirely new model, but at least we can rule out some very low confidence classifications!

@Indecisive613 Indecisive613 merged commit 78055f4 into main Mar 16, 2026
@Indecisive613 Indecisive613 deleted the feature/confidence-limits branch March 16, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confidence thresholds for ML Models

2 participants