Skip to main content
QUICK REVIEW

[Paper Review] How to Train Vision Transformer on Small-scale Datasets?

Hanan Gani, Muzammal Naseer|arXiv (Cornell University)|Oct 13, 2022
CCD and CMOS Imaging SensorsEngineering11 citations
TL;DR

This paper proposes a self-supervised pre-training method that learns inductive biases directly from small-scale datasets to effectively initialize Vision Transformers (ViTs) for fine-tuning, enabling state-of-the-art performance without large-scale pre-training. By training a ViT on small datasets using contrastive self-supervision with local and global crop views, the learned features serve as a powerful weight initialization, outperforming existing methods on CIFAR10/100, Tiny-ImageNet, and fine-grained datasets like Aircraft and Cars.

ABSTRACT

Vision Transformer (ViT), a radically different architecture than convolutional neural networks offers multiple advantages including design simplicity, robustness and state-of-the-art performance on many vision tasks. However, in contrast to convolutional neural networks, Vision Transformer lacks inherent inductive biases. Therefore, successful training of such models is mainly attributed to pre-training on large-scale datasets such as ImageNet with 1.2M or JFT with 300M images. This hinders the direct adaption of Vision Transformer for small-scale datasets. In this work, we show that self-supervised inductive biases can be learned directly from small-scale datasets and serve as an effective weight initialization scheme for fine-tuning. This allows to train these models without large-scale pre-training, changes to model architecture or loss functions. We present thorough experiments to successfully train monolithic and non-monolithic Vision Transformers on five small datasets including CIFAR10/100, CINIC10, SVHN, Tiny-ImageNet and two fine-grained datasets: Aircraft and Cars. Our approach consistently improves the performance of Vision Transformers while retaining their properties such as attention to salient regions and higher robustness. Our codes and pre-trained models are available at: https://github.com/hananshafi/vits-for-small-scale-datasets.

Motivation & Objective

  • To address the challenge of training Vision Transformers (ViTs) from scratch on small-scale datasets, where ViTs typically underperform due to lack of inductive biases.
  • To develop a self-supervised pre-training strategy that learns useful inductive biases directly from small datasets, eliminating reliance on large-scale pre-training.
  • To provide a plug-and-play initialization method that improves ViT performance across diverse small-scale datasets without architectural or loss function modifications.
  • To demonstrate that self-supervised feature learning on small data can yield better generalization and attention to salient regions than standard ImageNet pre-training.

Proposed method

  • Train a Vision Transformer on a small dataset using a contrastive self-supervised learning objective with dual crop views: local (high-resolution) and global (low-resolution) patches.
  • Use a multi-layer perceptron (MLP) projector head to map ViT features from both views into a shared latent space for contrastive learning.
  • Optimize the model using a contrastive loss (e.g., InfoNCE) to maximize agreement between positive (augmented) views and minimize similarity with negative pairs.
  • Use the self-supervised model weights as an initialization for supervised fine-tuning on the same small dataset, without architectural or loss function changes.
  • Employ data augmentation strategies including random cropping, color jittering, and resizing to generate diverse local and global views.
  • Evaluate the effectiveness of different MLP head sizes, crop ratio combinations, and training schedules to identify optimal configurations.

Experimental results

Research questions

  • RQ1Can self-supervised pre-training on small-scale datasets learn inductive biases that improve ViT performance on downstream tasks?
  • RQ2How does self-supervised pre-training compare to ImageNet pre-training or random initialization when training ViTs from scratch on small datasets?
  • RQ3What hyperparameters (e.g., crop ratio, MLP head size) most significantly affect performance in self-supervised ViT training on small data?
  • RQ4Can the proposed method be applied universally across different ViT architectures and small-scale datasets without architectural modifications?

Key findings

  • The proposed self-supervised pre-training method achieves 79.15% top-1 accuracy on CIFAR100, outperforming the previous SOTA of 68.29% trained over 600 epochs.
  • On Tiny-ImageNet, the method reaches 63.36% top-1 accuracy, surpassing the previous SOTA of 58.87% using SimCLR and 52.39% using MOCO-V3.
  • The method achieves state-of-the-art performance with only 300 training epochs (200 self-supervised + 100 supervised), outperforming a prior method that required 600 epochs.
  • A 3-layer MLP head with 1024 dimensions yields the best performance, while larger heads (e.g., 65536) lead to overfitting and reduced accuracy.
  • Optimal local-to-global crop ratio combinations (e.g., (0.2, 0.4) and (0.5, 1.0)) significantly improve performance on CIFAR100 and Tiny-ImageNet.
  • The self-supervised initialization improves attention maps, enhancing the model’s ability to focus on salient image regions and increasing robustness.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.