product-recognition-demo/recognization/code
kiyo9w 52905e73f6 feat: let the shelf's own price tag name the product
Stage 2 of the plan is "identity as retrieval", so the first thing measured was
whether retrieval can even work here. It cannot, on its own: an off-the-shelf
DINOv2 embedding does group identical products (two orange juices, two apple
juices, two almond drinks) but the fine-grained cases collapse - 32 cartons into
one cluster, and nine different bottled drinks grouped by *container shape*. That
matches the literature (RP2K, RPC all fine-tune; nobody ships off-the-shelf
features for SKU identity).

Meanwhile the shelf has been carrying the answer. Every product has a tag printed
under it, and the tag spells the product's name out in clean text, once per
product - the store's own label. This adds that as an identity channel:

- a tag with a readable name is matched against the catalog by name similarity;
- facings are assigned to the *nearest tag along their row* (the tags mark where
  products sit), not by geometric grouping, which was measured to merge different
  products into a 945 px "product" that then swallowed the wrong tag;
- rows are clustered first, because the same column on six shelves would
  otherwise become one product.

Then the demo catalog itself had to be fixed: it listed another store's products
(senbei, Tropicana) while the shelf holds mayonnaise, so nothing could match. The
catalog for this shelf was read off the tags - 12 products with names and prices -
and the products were enrolled as packaging templates by cropping the facings the
tags had just named.

Measured through the real still path on add/image6.jpg (111 detections):

  tag named the product          28 facings   (all 28 verified correct by eye)
  packaging named the product    74 facings
  both spoke                     23 facings, agreeing 16 (69 %)
  facings with any identity      79

So packaging recognition makes a ~30 % error rate on the facings the tag can
check, and every disagreement carried a low packaging score. The tag therefore
wins a conflict, and the conflict is recorded (`identity_conflict`) instead of
hidden - a product whose tag says one thing and whose packaging says another is a
real finding, not noise to suppress.

144 tests pass; test_tag_identity.py adds 6.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-24 23:28:36 +09:00
..
web feat: price-tag UI, still-image tag passes, and honest tag evidence 2026-09-24 14:11:23 +09:00
__init__.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
app.py feat: let the shelf's own price tag name the product 2026-09-24 23:28:36 +09:00
bench_engine.py feat: recognition engine and session tracker for multi-client serving 2026-09-24 11:52:59 +09:00
benchmark.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
demo.py perf: bound OCR so a walking scan stays real-time, and add walk pacing 2026-09-24 18:14:32 +09:00
detector.py refactor: make the matcher and detector safe for concurrent clients 2026-09-24 11:43:24 +09:00
download_stock.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
empty_shelf_detector.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
engine.py feat: price-tag UI, still-image tag passes, and honest tag evidence 2026-09-24 14:11:23 +09:00
fast_test.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
feature_matcher.py feat: recognition server API, reference stream client, and live label memory 2026-09-24 12:31:17 +09:00
gui_app.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
identity.py feat: identity decision contract and session-local observation model 2026-09-24 11:43:41 +09:00
inventory.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
live.py feat: a synthetic store walk, and the live tuning it forced out 2026-09-24 18:09:23 +09:00
observe.py feat: identity decision contract and session-local observation model 2026-09-24 11:43:41 +09:00
ocr.py feat: OCR engine, price-tag geometry, and the cached tag pass 2026-09-24 13:52:15 +09:00
orb.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
pipeline.py feat: identity decision contract and session-local observation model 2026-09-24 11:43:41 +09:00
reconcile.py feat: let the shelf's own price tag name the product 2026-09-24 23:28:36 +09:00
stream_client.py feat: recognition server API, reference stream client, and live label memory 2026-09-24 12:31:17 +09:00
suft.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
tag_cards.py feat: see the tags we cannot read, so "no tag" means no tag 2026-09-24 22:19:57 +09:00
tags.py feat: see the tags we cannot read, so "no tag" means no tag 2026-09-24 22:19:57 +09:00
test.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
test_api.py test: defend the live session and the server API 2026-09-24 12:44:54 +09:00
test_demo.py feat: a synthetic store walk, and the live tuning it forced out 2026-09-24 18:09:23 +09:00
test_empty.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
test_engine.py test: defend engine and tracking contracts 2026-09-24 12:43:32 +09:00
test_image.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
test_live.py feat: run the tag pass in parallel with recognition, in live and still modes 2026-09-24 13:58:18 +09:00
test_observe.py feat: identity decision contract and session-local observation model 2026-09-24 11:43:41 +09:00
test_ocr_tags.py feat: read a price tag as a card, with the JAN and a tax check 2026-09-24 22:07:41 +09:00
test_real_model.py docs: API contract, README for the server and live mode, real-model test 2026-09-24 12:46:54 +09:00
test_reconcile.py fix: count products, not facings, and demand an anchor before accusing 2026-09-24 22:44:50 +09:00
test_suite.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
test_tag_cards.py feat: read a price tag as a card, with the JAN and a tax check 2026-09-24 22:07:41 +09:00
test_tag_identity.py feat: let the shelf's own price tag name the product 2026-09-24 23:28:36 +09:00
test_tracking.py test: defend engine and tracking contracts 2026-09-24 12:43:32 +09:00
tracking.py fix: use the tracker imports that exist in ultralytics 8.4.153 2026-09-24 13:36:50 +09:00
train.py Initial commit for push folder 2026-09-18 09:13:53 +09:00
yolo_adapter.py feat: identity decision contract and session-local observation model 2026-09-24 11:43:41 +09:00