Offline CLIP image search for manufacturing defect photos: full pipeline walkthrough

OkShirt9372 · reddit · 2026-10-21

The author built a fully offline image search system for manufacturing inspection photos using CLIP ViT-B/32 + VectorAI DB, supporting queries by text description (e.g. "scratch on a metal component") or example photo, with MVTec AD as test data.

Pipeline: local setup (Docker DB, downloaded weights, runs offline) → CLIP image encoder produces normalized 512-dim vectors → stored with image path, part category and defect label → query via image or text encoder with metadata filtering → evaluation starts with whether top-5 results contain another image with the same defect label.

Key caveat: within a label like "scratch", size, location, orientation and severity vary widely, so relevance depends on multiple characteristics. A promising extension is localizing defect regions and embedding crops with varying context. The walkthrough also includes a FAISS comparison.

Original post →

More from coding & agent

coding & agent channel →