BA-SAM: Scalable Bias-Mode Attention Mask for Segment Anything Model
Not on the map. Why?
Abstract (arXiv)
In this paper, we address the challenge of image resolution variation for the Segment Anything Model (SAM). SAM, known for its zero-shot generalizability, exhibits a performance degradation when faced with datasets with varying image sizes. Previous approaches tend to resize the image to a fixed size or adopt structure modifications, hindering the preservation of SAM's rich prior knowledge. Besides, such task-specific tuning necessitates a complete retraining of the model, which is cost-expensive and unacceptable for deployment in the downstream tasks. In this paper, we reformulate this issue as a length extrapolation problem, where token sequence length varies while maintaining a consistent patch size for images of different sizes. To this end, we propose Scalable Bias-Mode Attention Mask (BA-SAM) to enhance SAM's adaptability to varying image resolutions while eliminating the need for structure modifications. Firstly, we introduce a new scaling factor to ensure consistent magnitude in the attention layer's dot product values when the token sequence length changes. Secondly, we present a bias-mode attention mask that allows each token to prioritize neighboring information, mitigating the impact of untrained distant information. Our BA-SAM demonstrates efficacy in two scenarios: zero-shot and fine-tuning. Extensive evaluation on diverse datasets, including DIS5K, DUTS, ISIC, COD10K, and COCO, reveals its ability to significantly mitigate performance degradation in the zero-shot setting and achieve state-of-the-art performance with minimal fine-tuning. Furthermore, we propose a generalized model and benchmark, showcasing BA-SAM's generalizability across all four datasets simultaneously. Code is available at https://github.com/zongzi13545329/BA-SAM
Key facts. Cited by 15 papers in the map (data through 7 Oct 2026). Builds on 89 of its 103 references that are in the map. First posted on arXiv 4 Jan 2024.
Builds on
89 of 103 references.
References · 89
- 2017Attention Is All You Needcited by 59,932
- 2015Deep Residual Learning for Image Recognitioncited by 51,809
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2014Microsoft COCO: Common Objects in Contextcited by 17,498
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,082
- 2023Segment Anythingcited by 8,158
- 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,339
- 2022Hierarchical Text-Conditional Image Generation with CLIP Latentscited by 6,539
- 2017Squeeze-and-Excitation Networkscited by 4,763
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2014Going Deeper with Convolutionscited by 4,231
38 more
- 2021On the Opportunities and Risks of Foundation Modelscited by 3,961
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2021Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervisioncited by 3,848
- 2020Deformable DETR: Deformable Transformers for End-to-End Object Detectioncited by 3,410
- 2020Exploring Simple Siamese Representation Learningcited by 2,853
- 2018CBAM: Convolutional Block Attention Modulecited by 2,463
- 2017Non-local Neural Networkscited by 2,290
- 2021Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutionscited by 1,960
- 2022Visual Prompt Tuningcited by 1,674
- 2019Generating Long Sequences with Sparse Transformerscited by 1,523
- 2022DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detectioncited by 1,306
- 2019LVIS: A Dataset for Large Vocabulary Instance Segmentationcited by 1,215
- 2021Swin Transformer V2: Scaling Up Capacity and Resolutioncited by 1,215
- 2021SimMIM: A Simple Framework for Masked Image Modelingcited by 1,147
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2016Semantic Understanding of Scenes through the ADE20K Datasetcited by 1,063
- 2021Towards a Unified View of Parameter-Efficient Transfer Learningcited by 863
- 2019Once-for-All: Train One Network and Specialize it for Efficient Deploymentcited by 778
- 2018Image Transformercited by 770
- 2022AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognitioncited by 714
- 2022EVA: Exploring the Limits of Masked Visual Representation Learning at Scalecited by 685
- 2017Convolutional Sequence to Sequence Learningcited by 550
- 2017Skin Lesion Analysis Toward Melanoma Detection: A Challenge at the 2017 International Symposium on Biomedical Imaging (ISBI), Hosted by the International Skin Imaging Collaboration (ISIC)cited by 549
- 2023Medical SAM Adapter: Adapting Segment Anything Model for Medical Image Segmentationcited by 485
- 2021LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inferencecited by 475
- 2020ResNeSt: Split-Attention Networkscited by 445
- 2019Selective Kernel Networkscited by 401
- 2017Residual Attention Network for Image Classificationcited by 385
- 2021Bottleneck Transformers for Visual Recognitioncited by 364
- 2019Attention Augmented Convolutional Networkscited by 363
- 2022Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understandingcited by 360
- 2019Dynamic Convolution: Attention over Convolution Kernelscited by 355
- 2023Faster Segment Anything: Towards Lightweight SAM for Mobile Applicationscited by 345
- 2020Visual Transformers: Token-based Image Representation and Processing for Computer Visioncited by 333
- 2020Exploring Self-attention for Image Recognitioncited by 313
- 2023Customized Segment Anything Model for Medical Image Segmentationcited by 277
- 2022TinyViT: Fast Pretraining Distillation for Small Vision Transformerscited by 232
50 most cited of 89 All 89 (JSON)
Built on by
Citing papers per year: 2024: 11; 2025: 2; 2026: 2.
15 papers.
Sort:
By area:
- 2024DGMamba: Domain Generalization via Generalized State Space Modelcited by 21
- 2024Test-Time Domain Generalization for Face Anti-Spoofingcited by 20
- 2024SemFlow: Binding Semantic Segmentation and Image Synthesis via Rectified Flowcited by 20
- 2024Mamba or RWKV: Exploring High-Quality and High-Efficiency Segment Anything Modelcited by 18
- 2024PYRA: Parallel Yielding Re-Activation for Training-Inference Efficient Task Adaptationcited by 17
- 2024DG-PIC: Domain Generalized Point-In-Context Learning for Point Cloud Understandingcited by 13
- 2024Segment Anything with Multiple Modalitiescited by 12
- 2024Adversarial Attacks on Both Face Recognition and Face Anti-spoofing Modelscited by 4
- 2024ALPS: An Auto-Labeling and Pre-training Scheme for Remote Sensing Segmentation With Segment Anything Modelcited by 4
- 2025A Comprehensive Survey on Video Scene Parsing:Advances, Challenges, and Prospectscited by 2
- 2024HRSAM: Efficient Interactive Segmentation in High-Resolution Imagescited by 1
- 2026HyperVision: A Channel-Adaptive Ground-Based Hyperspectral Vision Pre-trained Backbonecited by 1
3 more
- 2026Can Frozen Hyperspherical Features Guide the Selection of Pseudo Masks?24 Sep 2026
- 2026HyperVision: A Channel-Adaptive Ground-Based Hyperspectral Vision Pre-trained Backbone17 May 2026
- 2025A Comprehensive Survey on Video Scene Parsing:Advances, Challenges, and Prospects16 Jun 2025
- 2025BiSeg-SAM: Weakly-Supervised Post-Processing Framework for Boosting Binary Segmentation in Segment Anything Models2 Apr 2025
- 2024Source-Free Test-Time Adaptation For Online Surface-Defect Detection18 Aug 2024
- 2024Segment Anything with Multiple Modalities17 Aug 2024
- 2024DG-PIC: Domain Generalized Point-In-Context Learning for Point Cloud Understanding11 Jul 2024
- 2024HRSAM: Efficient Interactive Segmentation in High-Resolution Images2 Jul 2024
- 2024Mamba or RWKV: Exploring High-Quality and High-Efficiency Segment Anything Model27 Jun 2024
- 2024ALPS: An Auto-Labeling and Pre-training Scheme for Remote Sensing Segmentation With Segment Anything Model16 Jun 2024
- 2024SemFlow: Binding Semantic Segmentation and Image Synthesis via Rectified Flow30 May 2024
- 2024Adversarial Attacks on Both Face Recognition and Face Anti-spoofing Models27 May 2024
3 more
- 2024Test-Time Domain Generalization for Face Anti-Spoofingcited by 20
- 2024PYRA: Parallel Yielding Re-Activation for Training-Inference Efficient Task Adaptationcited by 17
- 2024DG-PIC: Domain Generalized Point-In-Context Learning for Point Cloud Understandingcited by 13
- 2024Segment Anything with Multiple Modalitiescited by 12
- 2024Adversarial Attacks on Both Face Recognition and Face Anti-spoofing Modelscited by 4
- 2024ALPS: An Auto-Labeling and Pre-training Scheme for Remote Sensing Segmentation With Segment Anything Modelcited by 4
- 2025A Comprehensive Survey on Video Scene Parsing:Advances, Challenges, and Prospectscited by 2
- 2024HRSAM: Efficient Interactive Segmentation in High-Resolution Imagescited by 1
- 2026HyperVision: A Channel-Adaptive Ground-Based Hyperspectral Vision Pre-trained Backbonecited by 1
- 2024Source-Free Test-Time Adaptation For Online Surface-Defect Detectioncited by 0
- 2025BiSeg-SAM: Weakly-Supervised Post-Processing Framework for Boosting Binary Segmentation in Segment Anything Modelscited by 0
- 2026Can Frozen Hyperspherical Features Guide the Selection of Pseudo Masks?cited by 0
- 2026Can Frozen Hyperspherical Features Guide the Selection of Pseudo Masks?24 Sep 2026
- 2026HyperVision: A Channel-Adaptive Ground-Based Hyperspectral Vision Pre-trained Backbone17 May 2026
- 2025A Comprehensive Survey on Video Scene Parsing:Advances, Challenges, and Prospects16 Jun 2025
- 2025BiSeg-SAM: Weakly-Supervised Post-Processing Framework for Boosting Binary Segmentation in Segment Anything Models2 Apr 2025
- 2024Source-Free Test-Time Adaptation For Online Surface-Defect Detection18 Aug 2024
- 2024Segment Anything with Multiple Modalities17 Aug 2024
- 2024DG-PIC: Domain Generalized Point-In-Context Learning for Point Cloud Understanding11 Jul 2024
- 2024HRSAM: Efficient Interactive Segmentation in High-Resolution Images2 Jul 2024
- 2024ALPS: An Auto-Labeling and Pre-training Scheme for Remote Sensing Segmentation With Segment Anything Model16 Jun 2024
- 2024Adversarial Attacks on Both Face Recognition and Face Anti-spoofing Models27 May 2024
- 2024Test-Time Domain Generalization for Face Anti-Spoofing28 Mar 2024
- 2024PYRA: Parallel Yielding Re-Activation for Training-Inference Efficient Task Adaptation14 Mar 2024