TransVLAD: Focusing on Locally Aggregated Descriptors for Few-Shot Learning

Haoquan Li, Laoming Zhang, Daoan Zhang, Lang Fu, Peng Yang, Jianguo Zhang

Abstract

TransVLAD is a novel Transformer-based framework designed to mitigate the chronic overfitting of Vision Transformers (ViTs) in few-shot learning (FSL). By integrating self-supervised pre-training via Masked Autoencoders (MAE), a specialized NeXtVLAD feature aggregation module, and a high-ratio masking strategy during fine-tuning, TransVLAD achieves state-of-the-art performance across five major benchmarks. Notably, the framework provides a 3x acceleration in training speed and a 70% reduction in memory usage compared to standard ViT fine-tuning.

Introduction

Few-shot learning aims to create models capable of recognizing new objects from only a handful of examples. While Vision Transformers have revolutionized computer vision, their "data-hungry" nature often leads to severe overfitting on the small-scale datasets typical of FSL. Consequently, many researchers have continued to rely on traditional Convolutional Neural Networks (CNNs).

The authors of TransVLAD identify two primary biases that hinder FSL performance in Transformers:

  1. Supervision Bias: Models learn only the features necessary to distinguish "base" training classes, discarding information vital for recognizing "novel" classes.
  2. Simple-Characteristic Bias: Models focus on the most obvious features to minimize loss, ignoring subtle but critical "hard" characteristics.

Methodology

TransVLAD introduces a two-stage pipeline designed to make Transformers both robust and efficient for few-shot scenarios.

The TransVLAD framework: MAE-based pre-training (top) and masked fine-tuning with NeXtVLAD aggregation (bottom).

Self-Supervised Pre-training (MAE)

The framework utilizes Masked Autoencoders (MAE) for self-supervised pre-training. By reconstructing missing pixels from images that are 75% masked, the Transformer learns unbiased, spatially aware features. This process ensures the model captures a broad range of visual information that generalizes better than features learned through standard supervised training.

NeXtVLAD Aggregation

Instead of standard "mean pooling," which can average out important local details, TransVLAD employs a NeXtVLAD module. This component clusters local patch features into "locally aggregated descriptors," preserving the abundant local characteristics essential for identifying novel concepts.

Detailed architecture of the NeXtVLAD aggregation module, showing the decomposition of local features into groups for efficient clustering.

Masking in Fine-tuning

A key innovation in TransVLAD is maintaining a high masking ratio (70%) during the fine-tuning stage. This serves as a powerful data augmentation tool, forcing the model to classify images based on "minor" features when dominant ones are obscured. Furthermore, processing fewer patches leads to a 3x training speedup and significant memory savings.

Soft Focal Loss (SFL)

To combat simple-characteristic bias, the authors adapted standard Focal Loss into a "soft" version. This allows the model to utilize soft labels (e.g., from Mixup) while prioritizing "hard" samples that are more difficult to classify, ensuring the model learns more nuanced features.

Experimental Results

TransVLAD was evaluated on five popular few-shot classification benchmarks: miniImageNet, tieredImageNet, CIFAR-FS, FC100, and CUB-200-2011.

  • State-of-the-Art Performance: TransVLAD topped 10 different benchmarks, outperforming previous methods by an average of over 2%. On the tieredImageNet 1-shot task, it improved accuracy by 3.5%.
  • Efficiency: Fine-tuning for 100 epochs on miniImageNet takes less than 4 hours on a single consumer-grade GPU (e.g., RTX 3090).
  • Generalization: The model demonstrated robust cross-domain transfer, performing well even when tested on datasets entirely different from its training set.

Conclusion

TransVLAD demonstrates that self-supervised pre-training is the "cure" for Transformer overfitting in few-shot learning. By focusing on locally aggregated descriptors and leveraging aggressive masking, the framework achieves a superior balance of accuracy and computational efficiency. While challenges remain in transferring knowledge from highly specialized domains (like fine-grained bird species) to general datasets, TransVLAD sets a new standard for Transformer-based FSL.

Summary updated

BibTeX
@inproceedings{li2022transvlad,
  author = {Haoquan Li and Laoming Zhang and Daoan Zhang and Lang Fu and Peng Yang and Jianguo Zhang},
  title = {{TransVLAD: Focusing on Locally Aggregated Descriptors for Few-Shot Learning}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20044-1\_30},
}
Figure