feat: price-tag UI, still-image tag passes, and honest tag evidence

Web client: price-tag boxes in a distinct style (teal, chip with the parsed
price), an OCR section in the product card showing the tag's price, name,
discount and the reconciliation verdict with both values, and a compliance strip
under the stage. The photo stage now draws the image into the canvas and uses the
same containment as the media, so boxes cannot drift from the product (they did:
the canvas stretched to the stage while the photo was contained).

Server fixes the browser runs forced out:
- Photo mode reconciled before identities existed, so every tag read "tag only".
  The tag bundle is cached with the still and classify re-reconciles against the
  identities it just produced, returning them per detection.
- The still path only ever read the first four bands (plan hands out two per
  call); it now drains every band, twice at different upscales so the vote has
  independent reads.
- Voting is confidence-weighted and a dead heat stays unread; the plausible
  shelf-price range is 10-9999, which stops a misread from becoming a ¥26,300
  price. The compliance coverage bar moved to 0.7 after 0.5 produced a false
  "group without price tag" on a shelf where every facing has one.

Measured on add/image6.jpg: 8 readable tags with names and prices, 942 ms for
the whole still, 7 real price mismatches, no false violations, and hints that
say plainly when a row could not be read.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
kiyo9w 2026-09-24 14:11:23 +09:00
parent a27841afa4
commit 8f750c15c5
8 changed files with 330 additions and 60 deletions

View file

@ -98,6 +98,9 @@ class StoredImage:
detections: List[Dict[str, Any]] = field(default_factory=list)
created_at: float = 0.0
nbytes: int = 0
# The tag pass for this still (tags, bands, box->tag), kept so a later
# classify can re-reconcile against the identities it just produced.
tag_bundle: Optional[Dict[str, Any]] = None
def identity_state_from_level(level: Optional[str]) -> str:
@ -192,6 +195,17 @@ class ImageStore:
if stored is not None:
stored.detections = list(detections)
def set_tag_bundle(self, image_id: str, bundle: Dict[str, Any]) -> None:
with self._lock:
stored = self._items.get(image_id)
if stored is not None:
stored.tag_bundle = bundle
def get_tag_bundle(self, image_id: str) -> Optional[Dict[str, Any]]:
with self._lock:
stored = self._items.get(image_id)
return stored.tag_bundle if stored is not None else None
def _evict_locked(self) -> None:
now = time.time()
for image_id in [k for k, v in self._items.items() if now - v.created_at > self.ttl_s]: