# Open-source visual quality inspection with entropy-gated kNN refinement

> Source: <https://discuss.huggingface.co/t/open-source-visual-quality-inspection-with-entropy-gated-knn-refinement/191257#post_1>
> Published: 2026-10-31 07:03:41+00:00

Hi everyone! I’m a contributor to hmg-physical-quality-decision-ai, sharing this in a personal capacity.

The project detects objects as oriented bounding boxes and classifies them as GOOD or BAD, with weld inspection as the first use case. It includes a CLI, API, and web UI.

The interesting part is the decision pipeline: it aggregates predictions across test-time augmentations, uses prediction entropy to decide when to consult a reference embedding bank, and applies kNN voting to refine uncertain predictions.

It’s a prototype, and I’d love feedback on the evaluation:

• How would you compare classifier-only, always-on kNN, and entropy-gated kNN on the same detected crops?

• How would you measure rare-defect recall while separating detection misses from classification errors?

Code and examples:

If you work on industrial vision or retrieval-based classification, what would you test first?
