Product recognition demo for supermarket shelf images
The head is now part of a store rather than a script: `finetune_identity.py --stock stock-lopia` trains on that store's enrolled views (27 views over 7 products, 12 augmented copies each) and writes `<stock>/identity_head.pt`, which ProductGallery loads automatically. The first attempt exposed a trap worth recording. A discriminative head has no "none of the above": trained with an angular margin to separate seven products, it maps everything confidently onto those seven, including cartons it has never seen. raw features, threshold 0.55 home shelf 78% accepted foreign shelves 5% accepted trained head, threshold 0.40 home shelf 58% accepted foreign shelves 44% accepted Rejection - the gallery's whole point - disappears. The fix needs no retraining: the two mechanisms fail in opposite directions, so raw features decide *whether* to answer (they generalise) and the head decides *what* to answer (it discriminates). Measured: 47% accepted on the home shelf, 5% on foreign ones. Lower coverage than raw-only, which is the honest trade. The head also needs its own threshold (0.40 against the raw 0.55): a trained head's similarity scale is its own, and reusing the raw line rejected almost everything it said. 175 tests pass. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|---|---|---|
| recognization | ||
| .gitignore | ||