Compress Any Segment Anything Model (SAM)

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Fan, Juntong, Hao, Zhiwei, Shen, Jianqiang, Jui, Shang-Ling, Zhang, Yi, Liao, Jing-Xiao, Fan, Feng-Lei
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918089303523328
author Fan, Juntong
Hao, Zhiwei
Shen, Jianqiang
Jui, Shang-Ling
Zhang, Yi
Liao, Jing-Xiao
Fan, Feng-Lei
author_facet Fan, Juntong
Hao, Zhiwei
Shen, Jianqiang
Jui, Shang-Ling
Zhang, Yi
Liao, Jing-Xiao
Fan, Feng-Lei
contents Due to the excellent performance in yielding high-quality, zero-shot segmentation, Segment Anything Model (SAM) and its variants have been widely applied in diverse scenarios such as healthcare and intelligent manufacturing. Therefore, effectively compressing SAMs has become an increasingly pressing practical need. In this study, we propose Birkhoff, a novel data-free compression algorithm for SAM and its variants. Unlike quantization, pruning, distillation, and other compression methods, Birkhoff embodies versatility across model types, agility in deployment, faithfulness to the original model, and compactness in model size. Specifically, Birkhoff introduces a novel compression algorithm: Hyper-Compression, whose core principle is to find a dense trajectory to turn a high-dimensional parameter vector into a low-dimensional scalar. Furthermore, Birkhoff designs a dedicated linear layer operator, HyperLinear, to fuse decompression and matrix multiplication to significantly accelerate inference of the compressed SAMs. Extensive experiments on 18 SAMs in the COCO, LVIS, and SA-1B datasets show that Birkhoff performs consistently and competitively in compression time, compression ratio, post-compression performance, and inference speed. For example, Birkhoff can achieve a compression ratio of 5.17x on SAM2-B, with less than 1% performance drop without using any fine-tuning data. Moreover, the compression is finished within 60 seconds for all models.
format Preprint
id arxiv_https___arxiv_org_abs_2507_08765
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Compress Any Segment Anything Model (SAM)
Fan, Juntong
Hao, Zhiwei
Shen, Jianqiang
Jui, Shang-Ling
Zhang, Yi
Liao, Jing-Xiao
Fan, Feng-Lei
Computer Vision and Pattern Recognition
Artificial Intelligence
Due to the excellent performance in yielding high-quality, zero-shot segmentation, Segment Anything Model (SAM) and its variants have been widely applied in diverse scenarios such as healthcare and intelligent manufacturing. Therefore, effectively compressing SAMs has become an increasingly pressing practical need. In this study, we propose Birkhoff, a novel data-free compression algorithm for SAM and its variants. Unlike quantization, pruning, distillation, and other compression methods, Birkhoff embodies versatility across model types, agility in deployment, faithfulness to the original model, and compactness in model size. Specifically, Birkhoff introduces a novel compression algorithm: Hyper-Compression, whose core principle is to find a dense trajectory to turn a high-dimensional parameter vector into a low-dimensional scalar. Furthermore, Birkhoff designs a dedicated linear layer operator, HyperLinear, to fuse decompression and matrix multiplication to significantly accelerate inference of the compressed SAMs. Extensive experiments on 18 SAMs in the COCO, LVIS, and SA-1B datasets show that Birkhoff performs consistently and competitively in compression time, compression ratio, post-compression performance, and inference speed. For example, Birkhoff can achieve a compression ratio of 5.17x on SAM2-B, with less than 1% performance drop without using any fine-tuning data. Moreover, the compression is finished within 60 seconds for all models.
title Compress Any Segment Anything Model (SAM)
topic Computer Vision and Pattern Recognition
Artificial Intelligence
url https://arxiv.org/abs/2507.08765