diff --git a/recognization/code/collect_shelf_images.py b/recognization/code/collect_shelf_images.py index 56e20a2..f7b3e45 100644 --- a/recognization/code/collect_shelf_images.py +++ b/recognization/code/collect_shelf_images.py @@ -129,7 +129,9 @@ def image_info(titles: list) -> dict: def main() -> None: - root = sys.argv[1] if len(sys.argv) > 1 else os.path.expanduser("~/dorayaki-data/shelf-images") + default = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), + "data", "external-shelves", "wikimedia-commons") + root = sys.argv[1] if len(sys.argv) > 1 else default os.makedirs(root, exist_ok=True) print("searching Commons...") diff --git a/recognization/code/eval_external_images.py b/recognization/code/eval_external_images.py index a555a85..2014b6a 100644 --- a/recognization/code/eval_external_images.py +++ b/recognization/code/eval_external_images.py @@ -1,10 +1,14 @@ """ Run the pipeline over store photos it has never seen. - python code/eval_external_images.py [~/dorayaki-data/shelf-images] + python code/eval_external_images.py [data/external-shelves/wikimedia-commons] Reports detection and identity per image, and writes a JSON summary. See docs/EXTERNAL-EVAL.md for what the numbers mean. + +The images live in the repository (`data/external-shelves/`), not in a home +directory: they are evaluation evidence, and evidence that only exists on one +machine cannot be re-checked. """ import json, os, sys, time sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) @@ -13,8 +17,9 @@ from engine import build_default_engine, EngineSettings from tags import TagService, TagSettings from reconcile import attach_tags_to_boxes -ROOT = os.path.expanduser(sys.argv[1] if len(sys.argv) > 1 else "~/dorayaki-data/shelf-images") -manifest = json.load(open(os.path.join(ROOT, "manifest.json"))) +DEFAULT_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), + "data", "external-shelves", "wikimedia-commons") +ROOT = os.path.expanduser(sys.argv[1] if len(sys.argv) > 1 else DEFAULT_ROOT) engine = build_default_engine(EngineSettings(stock_dir="stock-lopia")) catalog_by_sku = {p["sku_id"]: p for p in engine.catalog()} diff --git a/recognization/code/finetune_identity.py b/recognization/code/finetune_identity.py index d31741a..376789a 100644 --- a/recognization/code/finetune_identity.py +++ b/recognization/code/finetune_identity.py @@ -292,7 +292,9 @@ def main() -> None: parser.add_argument("--epochs", type=int, default=60) parser.add_argument("--views", type=int, default=2, help="enrolment views per class") parser.add_argument("--augment", type=int, default=12, help="augmented copies per enrolment view") - parser.add_argument("--image", default=os.path.expanduser("~/dorayaki-data/shelf-images")) + parser.add_argument("--image", default=os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), + "data", "external-shelves", "wikimedia-commons")) parser.add_argument("--stock", default=None, help="train on a store's enrolled views instead of the milk shelf, " "and write /identity_head.pt for the gallery to load") diff --git a/recognization/data/packshots/research/sku_l10/manifest.json b/recognization/data/packshots/research/sku_l10/manifest.json new file mode 100644 index 0000000..2d79924 --- /dev/null +++ b/recognization/data/packshots/research/sku_l10/manifest.json @@ -0,0 +1,22 @@ +{ + "sku": "sku_l10", + "canonical_product": "味の素 ピュアセレクト マヨネーズ 400g", + "packshot_path": "data/packshots/source/sku_l10.jpg", + "source_url": "https://thumbnail.image.rakuten.co.jp/@0_mall/matsukiyo/cabinet/d0042/4901001114030_1.jpg?_ex=1000x1000", + "source_page": "https://item.rakuten.co.jp/matsukiyo/4901001114030/", + "source_retailer": "楽天市場 / マツモトキヨシ楽天市場店", + "jan": "4901001114030", + "width": 1000, + "height": 1000, + "format": "JPEG", + "verification": { + "visual": "Front packshot visibly reads AJINOMOTO, ピュアセレクト, マヨネーズ, and 400g.", + "exact_product": true + }, + "size_correction": { + "rejected_size": "450g", + "canonical_size": "400g", + "reason": "Ajinomoto's official current product page lists 250g, 400g, 600g, and 1kg, not 450g. Archived official Ajinomoto pages from 2008-2014 show the same lineup. The repository shelf photo add/image6.jpg and its shelf tag show ピュアセレクト マヨネーズ 400g; docs/research/2026-09-28-recognition-architecture/DECISION.md records the same mismatch. Retail searches for 450g returned Kewpie products or mixed listings, while JAN 4901001114030 consistently identifies Ajinomoto ピュアセレクト マヨネーズ 400g.", + "official_product_page": "https://www.ajinomoto.co.jp/products/detail/?ProductName=pureselect_1" + } +} diff --git a/recognization/data/packshots/source/sku_l10.jpg b/recognization/data/packshots/source/sku_l10.jpg new file mode 100644 index 0000000..ed1b455 Binary files /dev/null and b/recognization/data/packshots/source/sku_l10.jpg differ diff --git a/recognization/stock-lopia-clean/stock.csv b/recognization/stock-lopia-clean/stock.csv index 4e021a0..7a6affd 100644 --- a/recognization/stock-lopia-clean/stock.csv +++ b/recognization/stock-lopia-clean/stock.csv @@ -8,6 +8,6 @@ sku_l06,キューピー フィッテ 210g,2026-09-20,2026-12-25,18,7,11,'',379 sku_l07,丸和油脂 ラッキーマヨネーズ 200g,2026-09-20,2026-12-25,24,10,14,'',199 sku_l08,スパイシーストーム ペリペリミックス 30g,2026-09-15,2027-03-15,12,4,8,'',699 sku_l09,ピュアセレクト コクうま カロリーカット65% 360g,2026-09-22,2026-12-28,30,13,17,'',209 -sku_l10,ピュアセレクト マヨネーズ 450g,2026-09-22,2026-12-28,36,15,21,'',222 +sku_l10,ピュアセレクト マヨネーズ 400g,2026-09-22,2026-12-28,36,15,21,'',222 sku_l11,キューピー ハーフマヨネーズ 450g,2026-09-19,2026-12-22,48,22,26,'',269 sku_l12,焼肉のたれ 中辛,2026-09-10,2027-02-10,24,8,16,'',299 diff --git a/recognization/stock-lopia/stock.csv b/recognization/stock-lopia/stock.csv index 4e021a0..7a6affd 100644 --- a/recognization/stock-lopia/stock.csv +++ b/recognization/stock-lopia/stock.csv @@ -8,6 +8,6 @@ sku_l06,キューピー フィッテ 210g,2026-09-20,2026-12-25,18,7,11,'',379 sku_l07,丸和油脂 ラッキーマヨネーズ 200g,2026-09-20,2026-12-25,24,10,14,'',199 sku_l08,スパイシーストーム ペリペリミックス 30g,2026-09-15,2027-03-15,12,4,8,'',699 sku_l09,ピュアセレクト コクうま カロリーカット65% 360g,2026-09-22,2026-12-28,30,13,17,'',209 -sku_l10,ピュアセレクト マヨネーズ 450g,2026-09-22,2026-12-28,36,15,21,'',222 +sku_l10,ピュアセレクト マヨネーズ 400g,2026-09-22,2026-12-28,36,15,21,'',222 sku_l11,キューピー ハーフマヨネーズ 450g,2026-09-19,2026-12-22,48,22,26,'',269 sku_l12,焼肉のたれ 中辛,2026-09-10,2027-02-10,24,8,16,'',299