Prepare embeddings
Obtain or compute per-modality vector embeddings (for example CLIP for image/text) and normalise them before combining.
Rank cross-modal items. Assess retrieval quality.
Cross-modal retrieval finds items in one modality (images, audio, documents) that match a query in another (text, video, transcript). Typical errors include poor alignment between modalities, embedding-space drift, and false high-similarity matches from superficial features.
Learning concept · Not a validated service
Cross-modal retrieval finds items in one modality (images, audio, documents) that match a query in another (text, video, transcript). Typical errors include poor alignment between modalities, embedding-space drift, and false high-similarity matches from superficial features.
A proposed use: a developer dashboard that ranks likely matches of product descriptions to images to help human taggers prioritise review. This starter does not implement a production pipeline or human-in-the-loop review interface.
Obtain or compute per-modality vector embeddings (for example CLIP for image/text) and normalise them before combining.
Concatenate or fuse the modality vectors for queries and candidate items so the retrieval space is consistent.
Compute cosine similarity between the query embedding and candidate embeddings and sort to produce a ranked list.
Use metrics such as Recall@K and mean reciprocal rank on a held-out labelled set and inspect failure cases manually.
The supplied starter creates small random NumPy arrays to represent text and image embeddings, concatenates them into combined item vectors, constructs a noisy query from the first item, computes cosine similarity between the query and items, and prints the top-3 ranked indices and their scores.
combined_embeddings = np.hstack([text_embeddings, image_embeddings])
query_text_embedding = text_embeddings[0] + rng.normal(0, 0.05, 8)
query_image_embedding = image_embeddings[0] + rng.normal(0, 0.05, 8)
query = np.hstack([query_text_embedding, query_image_embedding]).reshape(1, -1)
scores = cosine_similarity(query, combined_embeddings).ravel()
ranked = np.argsort(scores)[::-1]The starter uses synthetic random embeddings for five items and a single noisy query; it does not load real multimodal models (CLIP or similar), does not use any labelled retrieval dataset, and does not compute evaluation metrics like Recall@K or MRR. The tiny random set cannot validate retrieval performance or calibration.
A proposed extension is to replace the random arrays with precomputed CLIP (or modality-specific) embeddings for a small image-text dataset, hold out query-item relevance labels, and compute Recall@K and mean reciprocal rank to quantify retrieval quality.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.