A service can respond successfully while ranking the wrong products first. In my Visual Search project for finding products from photos, checks therefore covered retrieved products and their order, particularly after database changes.
Article context
Returning nearby items in a notebook is one step. Checking the ranking after a migration is another.
CONTEXT
The Visual Search project described here computes similarity between e-commerce product photos and serves retrieval through FastAPI and ClickHouse. This article explains the move from image experiments to service checks.
SUMMARY
The first service uses CLIP, FastAPI and ClickHouse. An unexecuted migration and swapped columns showed why successful requests could not verify ranking. Latency below 200 ms remains a target.
Experiments inform model selection. The service computes and stores vectors, then checks examine retrieved neighbors, migrations, response time and load.
The diagram summarizes project stages. The sub-200 ms target is not a measured latency result.
Checking a visual-search migration17
The service responds after a migration: does it still return the right products in the right order?
Defects encountered in the project show the value of retaining query images and reference results. A before-and-after comparison can check retrieved identifiers, distances and ranking. Latency and load measurements answer a further question: does the service remain usable at the expected volume?
Results to check after migration
Retrieved product identifiers and order
Calculated distances and associated metadata
Response time and errors under load
Takeaways
A successful service response does not guarantee a correct product ranking.
The first service uses CLIP for basic visual similarity; segmentation and other explored approaches were not all integrated.
An incomplete migration and swapped columns caused errors that successful requests alone did not reveal.
Neighbor ranking, latency and load require separate checks; the sub-200 ms threshold is a documented target.
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.
Primary source
Visual Search project — research and productionization
An account of the Visual Search project: CLIP selection, vector computation and storage, the FastAPI service, migration fixes and product-ranking checks.