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

Abstract

Cross-modal retrieval in the fashion industry requires a high degree of sensitivity to fine-grained details in both images and text. Traditional approaches rely on Region of Interest (RoI) embeddings, which often capture "object-level" information but miss the subtle stylistic attributes (e.g., textures, necklines) described in fashion text. We present FashionBERT, a vision-and-language model that replaces RoIs with image patches. By leveraging a BERT-based architecture and a novel adaptive loss function for multitask learning, FashionBERT achieves state-of-the-art performance on fashion-specific retrieval tasks.

The Challenge: Why RoIs Fail in Fashion

Most cross-modal models use pre-trained detectors to identify objects within an image. While effective for general scenes, this approach faces three major hurdles in fashion:

  1. Coarseness: Fashion descriptions are highly specific (e.g., "crew neck," "bohemian"). RoIs typically encompass the entire garment, losing these fine-grained details.
  2. Redundancy: Fashion images often feature a single product. Forcing a detector to find multiple RoIs results in overlapping tokens that provide little unique information.
  3. Irrelevance: Detectors frequently highlight non-product elements like a model's face or hair, which are irrelevant to the product metadata.
Traditional RoI detection often results in overlapping boxes that fail to capture fine-grained stylistic details.

Methodology: FashionBERT

FashionBERT addresses these issues by treating the image as a sequence of patches rather than a collection of objects.

Patch-Based Image Representation

Instead of relying on an external object detector, FashionBERT divides the input image into a fixed grid (e.g., 8x8). Each patch is processed through a CNN (ResNeXt-101) to generate a visual token. This ensures the model considers the entire image—including textures and small details—without the bias of a pre-trained detector.

Multitask Learning and Adaptive Loss

The model is pre-trained using three objectives:

  • Masked Language Modeling (MLM): Predicting hidden words in the text description.
  • Masked Patch Modeling (MPM): Reconstructing the visual content of masked image patches.
  • Text & Image Alignment (TIA): Classifying whether a text-image pair is a match.

To balance these tasks, the authors introduce an adaptive loss algorithm. Unlike static weighting, this method treats loss weights as learnable parameters. By dynamically adjusting weights based on the gradient of each task, the model avoids over-optimizing for "easier" tasks (like TIA) at the expense of more complex generative tasks (MLM/MPM).

Detectors often identify irrelevant regions, such as the model's face, which do not contribute to product-specific retrieval.

Experimental Results

The model was evaluated on the Fashion-Gen dataset, which contains nearly 300,000 professionally curated image-text pairs, and a private dataset of 10 million pairs from Alibaba.com.

  • Performance: FashionBERT achieved a matching accuracy of 91.01%, significantly outperforming ViLBERT (88.11%) and VL-BERT.
  • Retrieval: In Image-to-Text retrieval, it reached a Rank@1 of 23.96%, a substantial improvement over previous benchmarks.
  • Industrial Application: Deployed at Alibaba.com, a compressed "tiny" version of the model maintained high accuracy while meeting sub-20ms latency requirements for real-time search.

Conclusion and Future Work

FashionBERT demonstrates that for specialized domains like e-commerce, raw pixel patches provide a richer, more detailed signal than high-level object detections. Future work will explore finer "token-to-patch" alignment and improved visualization techniques to interpret how the model identifies abstract styles like "minimalist" or "artsy."

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},
}
Figure