Fashion Matching Recommendation — Portfolio Project by Muhammad Daffa Ashdaqfillah
An outfit discovery prototype that combines an item photo and a style prompt, using fine-tuned CLIP, a ChromaDB catalog index, and a SwiftUI client.

Published on June 15, 2026
Project Details



A shopper can start with an item from the catalog or a photo of something they own, add a prompt such as “outfit for a gym workout,” and browse suggestions from other product groups. I built the catalog preparation and model evaluation, fine-tuned the CLIP checkpoint, and connected the retrieval API to a SwiftUI client.
Choosing an encoder for retrieval
The catalog had 44,441 source records. After cleaning the display name, category, and description, I built a single caption per product and mapped fine-grained categories to groups such as tops, bottoms, footwear, and bags. The fine-tuning notebook retained 44,158 image–caption pairs and split them by product group into 39,742 training and 4,416 validation examples. I inspected example images alongside their generated captions and counted records per group before splitting. There were 14,824 tops and just 304 outerwear items in the cleaned catalog. Stratifying by group preserved some examples of the smaller classes for validation.
The model bake-off used a fixed sample of 60 items from 10 categories. I compared Recall@1 in both retrieval directions, category macro F1, and evaluation time. The selection score averaged Recall@5 in both directions, category macro F1, and category top-three accuracy.
| Pretrained model | Text → image R@1 | Image → text R@1 | Selection score | Run time |
|---|---|---|---|---|
| LAION ViT-B/32 | 86.67% | 88.33% | 0.9789 | 8.89 s |
| ALIGN Base | 90.00% | 90.00% | 0.9619 | 10.57 s |
| FashionCLIP | 91.67% | 90.00% | 0.9494 | 8.16 s |
| BLIP ITM | 86.67% | 86.67% | 0.9462 | 272.25 s |
| OpenAI ViT-B/32 | 73.33% | 80.00% | 0.9177 | 9.55 s |
FashionCLIP returned the correct image first more often. LAION had the highest combined selection score and fit the indexing design because its image and text vectors can be precomputed independently. BLIP scored image–text pairs directly, accounting for its much longer run on this sample. These timings cover the notebook evaluation rather than API request latency.
Fine-tuning on product pairs

I fine-tuned the last six blocks of both encoders, the two projection heads, and the learned logit scale. That updated 62.1 million of 151.3 million weights. The run used AdamW for 15 epochs, batch size 32, a learning rate of 0.000001, and weight decay of 0.01.
Every batch produced a square matrix of image–caption logits. The diagonal contained matching products. Cross entropy over the rows and columns trained retrieval in both directions, with the other examples in the batch supplying negatives. The training loop clamped the learned logit scale after each update. The final training and validation losses were 0.0155 and 0.0329.
The baseline and fine-tuned checkpoint were evaluated on the same seeded sample of 1,000 validation products. A hit counted when the corresponding image or caption appeared within the first K results. Mean reciprocal rank (MRR) gives greater weight to correct matches at the top.
| Retrieval metric | Pretrained LAION | Fine-tuned LAION |
|---|---|---|
| Image → text Hits@1 | 61.1% | 78.2% |
| Text → image Hits@1 | 61.0% | 77.0% |
| Image → text Hits@5 | 89.1% | 98.1% |
| Text → image Hits@5 | 91.2% | 97.1% |
| Image → text MRR | 0.7332 | 0.8684 |
| Text → image MRR | 0.7382 | 0.8597 |
The gain came from better ranking of the same product's caption or photo. The fine-tuned model scored 62.7% on zero-shot product grouping, with outerwear among the harder groups. The dataset's labels describe individual products. Matching items as an outfit is a separate judgment that the retrieval benchmark did not measure.
Turning similarity into outfit suggestions
The FastAPI service loads the checkpoint and catalog embeddings once. ChromaDB stores image and caption vectors in separate collections, along with the metadata needed to filter by product group. At request time, the service encodes the style prompt and any new image, retrieves candidates from complementary groups, and excludes the input item. The backend L2-normalizes the vectors, so their dot product gives cosine similarity during reranking.
The reranker combines prompt-to-caption similarity, image-to-image similarity, and caption-to-caption similarity with weights of 0.50, 0.35, and 0.15. An uploaded photo without a caption uses the first two signals at 0.55 and 0.45. The ranker picks one leading candidate per eligible group so a request can return a top, shoes, and a bag instead of several variations of the original item.