[Paper Review] BatchFormerV2: Exploring Sample Relationships for Dense Representation Learning
BatchFormerV2 introduces a plug-and-play batch Transformer module that models relationships between samples in a mini-batch for dense representation learning in vision Transformers. Using a two-stream training strategy, it enables information flow across patches and images during training without inference cost, consistently improving performance on image classification, object detection, and panoptic segmentation by up to 1.3% on DETR-based models.
Attention mechanisms have been very popular in deep neural networks, where the Transformer architecture has achieved great success in not only natural language processing but also visual recognition applications. Recently, a new Transformer module, applying on batch dimension rather than spatial/channel dimension, i.e., BatchFormer [18], has been introduced to explore sample relationships for overcoming data scarcity challenges. However, it only works with image-level representations for classification. In this paper, we devise a more general batch Transformer module, BatchFormerV2, which further enables exploring sample relationships for dense representation learning. Specifically, when applying the proposed module, it employs a two-stream pipeline during training, i.e., either with or without a BatchFormerV2 module, where the batchformer stream can be removed for testing. Therefore, the proposed method is a plug-and-play module and can be easily integrated into different vision Transformers without any extra inference cost. Without bells and whistles, we show the effectiveness of the proposed method for a variety of popular visual recognition tasks, including image classification and two important dense prediction tasks: object detection and panoptic segmentation. Particularly, BatchFormerV2 consistently improves current DETR-based detection methods (e.g., DETR, Deformable-DETR, Conditional DETR, and SMCA) by over 1.3%. Code will be made publicly available.
Motivation & Objective
- To address the limitation of current vision Transformers in leveraging inter-sample relationships during training, especially for dense prediction tasks.
- To enable robust dense representation learning by extending batch attention beyond image-level to pixel/patch-level representations.
- To resolve the training-and-testing inconsistency problem when applying parametric batch attention modules.
- To develop a plug-and-play module that improves performance without adding inference cost.
- To demonstrate effectiveness across diverse vision tasks, including image classification, object detection, and panoptic segmentation.
Proposed method
- Proposes BatchFormerV2, a general batch Transformer module that applies self-attention across the batch dimension to model relationships between samples in a mini-batch.
- Employs a two-stream training pipeline: one stream includes the BatchFormerV2 module, the other does not, with shared layers/blocks across both streams.
- Uses shared classifier heads before and after the BatchFormerV2 module to ensure batch-invariant representation learning.
- Enables information propagation not only between images but also across patches and pixels in different samples during training.
- Allows removal of the BatchFormerV2 module at inference time, ensuring no additional computational cost.
- Applies the module at various blocks in vision Transformer architectures to support multi-level representation learning.
Experimental results
Research questions
- RQ1Can modeling inter-sample relationships in a mini-batch improve dense representation learning in vision Transformers?
- RQ2How can batch attention be effectively applied at the pixel/patch level rather than just the image level?
- RQ3Can a plug-and-play batch Transformer module be trained without introducing inference overhead?
- RQ4Does the proposed method improve performance across diverse vision tasks, including classification, detection, and segmentation?
- RQ5How does the method perform under data-scarce or small-dataset settings?
Key findings
- BatchFormerV2 improves DeiT-Ti by 9.5% on CIFAR-100 (from 49.2% to 58.7%) and DeiT-B by 14.4% (from 52.2% to 66.6%) when training from scratch.
- On ImageNet, BatchFormerV2 improves DeiT-Ti by 0.5% (72.2% to 72.7%), DeiT-S by 0.6% (79.8% to 80.4%), and DeiT-B by 0.5% (81.7% to 82.2%).
- For object detection, BatchFormerV2 improves all tested DETR-based models by over 1.3% in AP.
- On panoptic segmentation, BatchFormerV2 achieves consistent gains across multiple backbone architectures.
- The method shows particular benefit on small datasets like CIFAR-100, where strong data augmentation may limit gains on ImageNet.
- The two-stream training strategy successfully avoids training-and-testing inconsistency, enabling plug-and-play deployment with zero inference cost.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.