Skip to main content
QUICK REVIEW

[Paper Review] Mask-guided Vision Transformer (MG-ViT) for Few-Shot Learning

Yuzhong Chen, Zhenxiang Xiao|arXiv (Cornell University)|May 20, 2022
Machine Learning and ELMComputer Science10 citations
TL;DR

This paper proposes Mask-guided Vision Transformer (MG-ViT), a novel few-shot learning framework that enhances pre-trained Vision Transformers by applying a gradient-weighted class activation mapping (Grad-CAM)-guided patch mask to focus on task-relevant, discriminative image patches while preserving global context via a residual connection. MG-ViT achieves state-of-the-art performance on both image classification and object detection benchmarks, outperforming standard fine-tuning by up to 9.1% in 10-shot detection and 1.9% in 10-shot classification through efficient knowledge generalization without additional pre-training costs.

ABSTRACT

Learning with little data is challenging but often inevitable in various application scenarios where the labeled data is limited and costly. Recently, few-shot learning (FSL) gained increasing attention because of its generalizability of prior knowledge to new tasks that contain only a few samples. However, for data-intensive models such as vision transformer (ViT), current fine-tuning based FSL approaches are inefficient in knowledge generalization and thus degenerate the downstream task performances. In this paper, we propose a novel mask-guided vision transformer (MG-ViT) to achieve an effective and efficient FSL on ViT model. The key idea is to apply a mask on image patches to screen out the task-irrelevant ones and to guide the ViT to focus on task-relevant and discriminative patches during FSL. Particularly, MG-ViT only introduces an additional mask operation and a residual connection, enabling the inheritance of parameters from pre-trained ViT without any other cost. To optimally select representative few-shot samples, we also include an active learning based sample selection method to further improve the generalizability of MG-ViT based FSL. We evaluate the proposed MG-ViT on both Agri-ImageNet classification task and ACFR apple detection task with gradient-weighted class activation mapping (Grad-CAM) as the mask. The experimental results show that the MG-ViT model significantly improves the performance when compared with general fine-tuning based ViT models, providing novel insights and a concrete approach towards generalizing data-intensive and large-scale deep learning models for FSL.

Motivation & Objective

  • To address the inefficiency of standard fine-tuning in generalizing knowledge from data-intensive Vision Transformers (ViT) for few-shot learning (FSL).
  • To guide ViT to focus on task-relevant and discriminative image patches during FSL by introducing a mask operation that suppresses irrelevant background content.
  • To preserve global spatial and positional information lost after masking by adding a residual connection between the first and last encoder layers.
  • To improve model generalization by integrating an active learning-based sample selection method that identifies representative few-shot samples.
  • To demonstrate the effectiveness of MG-ViT across diverse downstream tasks, including image classification and object detection, under low-data regimes.

Proposed method

  • Apply a Grad-CAM-based saliency map to identify the most discriminative and task-relevant image patches from the source dataset.
  • Apply a learnable mask to suppress non-relevant patches before the first ViT encoder layer, allowing the model to focus on high-salience regions during FSL.
  • Introduce a residual connection between the first and last ViT encoder layers to retain global spatial and positional context lost due to masking.
  • Adopt a two-stage training scheme: pre-train on a base dataset using vanilla ViT, then fine-tune on both base and novel classes using MG-ViT.
  • Incorporate a cluster-based active learning method to select representative few-shot samples, improving model generalization and performance on unlabeled data.
  • Use discrete and continuous mask shapes to explore trade-offs between global semantics (discrete) and object contour accuracy (continuous) in different tasks.

Experimental results

Research questions

  • RQ1Can a patch-level mask operation improve few-shot learning performance in Vision Transformers by focusing on task-relevant, discriminative image patches?
  • RQ2How does the residual connection between encoder layers affect performance when global spatial information is partially lost due to masking?
  • RQ3Does active learning-based sample selection lead to better generalization in few-shot learning compared to random sampling?
  • RQ4How do different mask types—discrete versus continuous—affect performance in image classification versus object detection tasks?
  • RQ5Can MG-ViT generalize effectively to diverse downstream tasks such as image classification and object detection without additional pre-training or architectural overhaul?

Key findings

  • MG-ViT improves few-shot object detection performance by 2.7% (50.6% vs. 47.9%) in 5-shot, 9.1% (65.3% vs. 56.2%) in 10-shot, and 1.1% (76.0% vs. 74.9%) in 30-shot over standard fine-tuning.
  • In image classification, MG-ViT achieves 85.6% accuracy in 1-shot, 98.1% in 5-shot, and 98.5% in 10-shot, outperforming standard fine-tuning by up to 1.9%.
  • Active learning-based sample selection improves 10-shot image classification accuracy by 1.9% (from 96.6% to 98.5%) and 10-shot detection mAP by 9.0% (from 56.3% to 65.3%).
  • Neighborhood sample identification improves 5-shot image classification accuracy by 7.4% (from 90.4% to 97.8%) and 30-shot detection mAP by 2.4% (from 72.9% to 75.3%).
  • Discrete masks perform better for image classification (98.7% in 5-shot), while continuous masks yield superior results in object detection (65.3% in 10-shot), indicating task-dependent mask design benefits.
  • The combination of mask guidance, residual connection, and active learning enables MG-ViT to inherit pre-trained ViT weights without additional pre-training, achieving state-of-the-art performance with minimal architectural modification.

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.