Updates on Image search using vectors

This commit is contained in:
sriram
2026-09-28 15:44:01 +05:30
parent 6628207810
commit c0489d89d6
16 changed files with 1184 additions and 37 deletions

View File

@@ -432,6 +432,21 @@ IMAGE_SEARCH_DEFAULT_MIN_SCORE = float(os.getenv("IMAGE_SEARCH_DEFAULT_MIN_SCORE
# product share an image and tie, so more than top_k must come back), and
# the floor for hnsw.ef_search on that query so the index does not drop them.
IMAGE_SEARCH_MAX_FETCH_K = int(os.getenv("IMAGE_SEARCH_MAX_FETCH_K", "100"))
# How far the best image match must lead the best DIFFERENT photo for the
# answer to count as confirmed (`match_confidence`). A phone photo of a card on
# a screen measured 0.507 against its own product and 0.419 against a
# stranger; with glare that gap closes, and a flipped order is a wrong
# product shown with confidence. Pack sizes sharing one photo tie exactly and
# are never each other's competitor. Unmeasured start: tune with
# scripts/eval_identify.py.
IMAGE_SEARCH_MIN_MARGIN = float(os.getenv("IMAGE_SEARCH_MIN_MARGIN", "0.05"))
# Diagnosis: when set, every image-search request (vector, text, brand and the
# top matches) is written here as one JSON file, for
# scripts/replay_image_query.py. Blank = off. At most IMAGE_SEARCH_CAPTURE_MAX
# files are kept; the oldest go first. The routes are public, so leave it off
# except while chasing a report.
IMAGE_SEARCH_CAPTURE_DIR = os.getenv("IMAGE_SEARCH_CAPTURE_DIR", "").strip()
IMAGE_SEARCH_CAPTURE_MAX = int(os.getenv("IMAGE_SEARCH_CAPTURE_MAX", "200"))
# ---------------------------------------------------------------------------
# Identify a product from a phone photo - POST /api/search/identify