01 — The research

The first service uses CLIP for visual similarity

I compared CLIP ViT-B/32 and FashionCLIP, grouped similar images with K-means and used principal component analysis to explore their representations. I also generated descriptions and tested representations connecting images and text. Product cut-outs and model specialization were among the explored approaches.

The first service retained generic CLIP to retrieve visually similar photos. Product segmentation and the other explored variants were not all integrated into the service.

02 — The computation chain

The service stores normalized 512-dimensional vectors

The pipeline loads image batches and produces 512-dimensional vectors: lists of 512 numbers representing visual features. L2 normalization gives each vector a length of 1 without changing its direction. Vectors are stored in ClickHouse in a separate namespace for each catalog.

FastAPI receives the query image and exposes search results. Distances between vectors can be computed in the database or in memory. The two options can be compared on the same images and volume to measure response time and check product order.

03 — Errors encountered

A request can succeed while returning the wrong ranking

An incomplete migration had introduced new tables without connecting them to the retrieval path being executed. Another defect swapped metadata and distance columns in the results. The service responded, but these errors made the ranking incorrect.

Insertion tests, essential-function checks and a neighbor benchmark detected these problems. Validation also covered migrations, latency and load.

04 — Maintenance

Pinned versions and structured logs help diagnose errors

Credentials and service addresses were moved out of code. Software image versions were pinned, and structured logs replaced debug prints. Unused dependencies and ambiguous configuration were removed.

A latency target below 200 ms guided vector and metadata storage design. It remains a target: response time needs measurement at the expected catalog size and request volume.