feat: report views below the enrollment pyramid floor
Some checks failed
tests / model-free (pull_request) Has been cancelled

The protocol asks for a source at least 800px tall so a view can be stored as a
200/400/800px pyramid. Nothing enforced it, and the clean catalog's l09 view is
305px - the documented defect where its inlier scores dwarf every other
reference (85-129 against 10-40) and it wins facings it should not.

Reported, not refused: the view is usable and dropping it would remove the SKU
from the catalog entirely, which is worse than an incomparable score. The fix is
re-sourcing the packshot, which is a data task. The check names the view and its
height so the re-sourcing has a target. Suite 272 -> 274.
This commit is contained in:
tngo 2026-09-28 22:45:25 +09:00
parent b38c66aa7b
commit 200328527e
2 changed files with 60 additions and 2 deletions

View file

@ -23,7 +23,9 @@ import cv2 # noqa: E402
import numpy as np # noqa: E402
from rebuild_catalog import ( # noqa: E402
PYRAMID_FLOOR,
RebuildError,
below_pyramid_floor,
live_ready_verdict,
load_shelf_skus,
text_discriminated_siblings,
@ -43,6 +45,7 @@ def artwork(mark=None):
class SiblingFlagTests(unittest.TestCase):
"""The near-unknown case: same artwork, different product."""
def make_source(self, images):
root = tempfile.mkdtemp(prefix="siblings-")
for name, image in images.items():
@ -72,6 +75,27 @@ class SiblingFlagTests(unittest.TestCase):
text_discriminated_siblings({"sku_x1": ["sku_x1.jpg", "sku_x1_2.jpg"]}, root), []
)
class PyramidFloorTests(unittest.TestCase):
"""The l09 defect: a view too small to store as the protocol's pyramid."""
def make_source(self, height):
root = tempfile.mkdtemp(prefix="floor-")
image = cv2.resize(artwork(), (300, height), interpolation=cv2.INTER_NEAREST)
cv2.imwrite(os.path.join(root, "sku_x1.jpg"), image)
return root
def test_a_small_view_is_reported(self):
root = self.make_source(305)
small = below_pyramid_floor({"sku_x1": ["sku_x1.jpg"]}, root)
self.assertEqual(len(small), 1, small)
self.assertEqual(small[0]["sku"], "sku_x1")
self.assertEqual(small[0]["height"], 305)
self.assertEqual(small[0]["floor"], PYRAMID_FLOOR)
def test_a_full_size_view_is_not_reported(self):
root = self.make_source(1000)
self.assertEqual(below_pyramid_floor({"sku_x1": ["sku_x1.jpg"]}, root), [])
class CompletenessVerdictTests(unittest.TestCase):
"""The enrollment protocol's completeness rule, as a verdict."""