Saved in:
Bibliographic Details
Main Authors: Song, Yiran, Zhou, Qianyu, Li, Xiangtai, Fan, Deng-Ping, Lu, Xuequan, Ma, Lizhuang
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2401.02317
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913272840585216
author Song, Yiran
Zhou, Qianyu
Li, Xiangtai
Fan, Deng-Ping
Lu, Xuequan
Ma, Lizhuang
author_facet Song, Yiran
Zhou, Qianyu
Li, Xiangtai
Fan, Deng-Ping
Lu, Xuequan
Ma, Lizhuang
contents 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
format Preprint
id arxiv_https___arxiv_org_abs_2401_02317
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle BA-SAM: Scalable Bias-Mode Attention Mask for Segment Anything Model
Song, Yiran
Zhou, Qianyu
Li, Xiangtai
Fan, Deng-Ping
Lu, Xuequan
Ma, Lizhuang
Computer Vision and Pattern Recognition
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
title BA-SAM: Scalable Bias-Mode Attention Mask for Segment Anything Model
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2401.02317