FashionBERT: Text and Image Matching with Adaptive Loss for Cross-modal Retrieval

Dehong Gao, Linbo Jin, Ben Chen, Minghui Qiu, Peng Li, Yi Wei, Yi Hu, Hao Wang

TL;DR

FashionBERT is a specialized vision-and-language model designed to match fashion images with text by treating images as a grid of patches rather than a collection of detected objects. By combining this "patch-based" approach with a novel adaptive loss function that balances multiple training tasks, it achieves state-of-the-art performance in retrieving fashion items across different modalities.

What Problem Does This Paper Address?

In cross-modal retrieval (e.g., searching for an image using a text query), most state-of-the-art models rely on Regions of Interest (RoIs). These models use a pre-trained detector to find "objects" (like a person or a car) and treat those regions as image tokens.

However, the authors argue that this "object-level" approach fails in the fashion industry for three reasons:

  1. Coarseness: Fashion descriptions are highly detailed (e.g., "crew neck," "off-shoulder," "bohemian style"). RoIs often capture the whole garment but miss these fine-grained attributes.
  2. Redundancy: Fashion images usually contain only one or two items. Forcing a detector to find many RoIs leads to many overlapping, nearly identical tokens that add no new information.
  3. Irrelevance: Detectors often pick up "noise" like the model’s face, hair, or hands, which are irrelevant to the product being sold.

Methods

The authors propose FashionBERT, which adapts the famous BERT architecture for multimodal fashion data.

1. The Patch Method

Instead of using a complex object detector, FashionBERT simply divides an image into a fixed grid of patches (e.g., 8x8). Each patch is passed through a CNN (like ResNeXt-101) to create an "image token." This ensures the model sees the entire image—including small details—without the bias of a pre-trained object detector.

2. Multitask Learning

The model is trained on three simultaneous tasks:

  • Masked Language Modeling (MLM): Predicting missing words in a description.
  • Masked Patch Modeling (MPM): Predicting the visual content of missing image patches.
  • Text & Image Alignment (TIA): A binary classifier determining if a specific text and image actually match.

3. Adaptive Loss

Standard multitask models usually sum up the losses of different tasks using fixed weights. FashionBERT introduces an adaptive loss algorithm. It treats the loss weights as variables to be optimized in every batch. If one task is "lagging" (has a higher gradient/loss), the model automatically increases its weight, ensuring the model doesn't ignore harder tasks in favor of easier ones.

Datasets

The primary benchmark used is Fashion-Gen, a large-scale public dataset containing:

  • 67,666 unique fashion products.
  • 293,008 image-text pairs (descriptions written by professional stylists).
  • Images are 256x256 pixels, with products photographed from multiple angles.

The authors also mention using a private dataset of 10 million pairs from Alibaba.com for industrial fine-tuning.

Key Insights and Ideas

  • Patches > RoIs for Fashion: The "aha moment" is that for specialized domains like fashion, raw pixel patches provide more "raw" and "detailed" information than high-level object detections. This allows the model to learn the relationship between words like "sequins" and the specific texture in a small patch of the image.
  • Dynamic Task Balancing: The adaptive loss prevents the model from over-fitting on the easiest task (usually TIA) while neglecting the harder generative tasks (MLM/MPM).
  • Architecture Matters: Using a deeper BERT backbone (12 layers vs 4 or 6) and a more modern CNN (ResNeXt vs Inception) consistently improved results, suggesting that fashion retrieval benefits significantly from increased model capacity.

Key Results

FashionBERT significantly outperformed existing state-of-the-art models like ViLBERT and VL-BERT on the Fashion-Gen dataset:

  • Matching Accuracy: Achieved 91.01%, compared to ViLBERT's 88.11%.
  • Retrieval (Rank@1): In Image-to-Text retrieval, it hit 23.96%, a notable jump over the previous best of 20.97%.
  • Industrial Impact: When deployed at Alibaba, the model showed that a 2-layer "tiny" version of FashionBERT could maintain high performance while meeting the strict latency requirements (under 20ms) for online search.

Limitations and Future Work

  • Alignment Granularity: While patches are better than RoIs, the model still treats the alignment at a somewhat global level. The authors suggest exploring even finer "token-to-patch" alignment in the future.
  • Interpretability: The paper notes a desire to better "visualize" what the model is looking at to understand how it identifies abstract styles like "artsy" or "minimalist."
  • Efficiency: While they tested smaller models, further work in model distillation is needed to make these heavy Transformer architectures even faster for massive-scale e-commerce platforms.

Summary updated

BibTeX
@inproceedings{gao2020fashionbert,
  author = {Dehong Gao and Linbo Jin and Ben Chen and Minghui Qiu and Peng Li and Yi Wei and Yi Hu and Hao Wang},
  title = {{FashionBERT: Text and Image Matching with Adaptive Loss for Cross-modal Retrieval}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2020},
  doi = {10.1145/3397271.3401430},
}

Loading related content...

Figure