The Wikimedia collector truncated the whole basename at 60 characters, so 13 files lost their extension and cv2 could not read them by name - the distractor sets were quietly scoring 13 images fewer than they held. It now truncates the stem and keeps the extension, and the files on disk are renamed to match. The search terms also pull in .djvu volumes whose page 1 Commons serves as a JPEG thumbnail. Twelve book scans were in the sets; they contributed 0 false accepts, and they are not shelves, so the collector filters them and the manifests no longer list them. With all 2650 crops readable the sweep is re-measured end to end: 3.09% at the old lines, 0.30% at the shipped 4.0/4, image6 44 shown / 42 correct / 95.5%. The accept sweep table and the verdict's far-unknown sentence now carry those numbers instead of the pre-calibration ones. Also: the fetched images are gitignored (manifests and results are not), the l10/l11 shelf-tag crops that back the catalog corrections are committed, and a stale pre-gate eval.json and a duplicate of eval/labels/image6.json are gone.
27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
"""Which facings are falsely accepted, and as what."""
|
|
import sys, cv2
|
|
sys.path.insert(0, "code")
|
|
from eval_identity import LocalLaneAdapter, load_labels, at_live_resolution, leaked, UNKNOWN, crop_of
|
|
from identity_lanes import DecisionPolicy
|
|
|
|
payload = load_labels("eval/labels/image6.json")
|
|
image = cv2.imread("add/image6.jpg")
|
|
facings = [f for f in payload["facings"] if f["label"] != "exclude"]
|
|
facings = [f for f in facings if leaked(image, f["box"], "stock-lopia-clean") is None]
|
|
enrolled = {"sku_l01","sku_l02","sku_l03","sku_l05","sku_l06","sku_l09","sku_l10","sku_l11"}
|
|
|
|
for live in (False, True):
|
|
picture = at_live_resolution(image) if live else image
|
|
scaled = facings if not live else [
|
|
{**f, "box": [int(round(v * picture.shape[1] / image.shape[1])) for v in f["box"]]}
|
|
for f in facings]
|
|
lane = LocalLaneAdapter("stock-lopia-clean")
|
|
print(f"=== {'live' if live else 'full'} ===")
|
|
for f in scaled:
|
|
crop = crop_of(picture, f["box"])
|
|
if crop.size == 0: continue
|
|
ranked = lane.rank(crop)
|
|
d = lane.decide(crop, ranked, accept=2.0, margin=0.0, scale="local")
|
|
ans = d.get("best_sku") if d.get("identity_level") == "accepted" else None
|
|
if ans and ans != f["label"]:
|
|
print(f" #{f['index']:>3} truth={f['label']:<9} answered={ans:<9} enrolled={f['label'] in enrolled}")
|