Abstract
The Foundation model for image segmentation, Segment Anything (SAM), has been actively researched in various fields since its proposal. Various researches have been proposed to adapt SAM to specific domains, with one notable approach involving the addition and training of lightweight adapter modules. While adapter-based fine-tuning approaches have reported parameter efficiency and significant performance improvements, they face an often overlooked issue: the excessive consumption of GPU memory relative to the number of trainable parameters. Addressing this issue, this paper proposes a memory-efficient parallel convolutional adapter (CAD) architecture. This architecture connects in parallel with SAM's image encoder, eliminating the need to store activations and gradients of the image encoder during model training. Our proposed architecture demonstrated competitive experimental results while using less than half the GPU memory compared to SAM Adapter, indicating its value as an alternative to simple decoder fine-tuning when hardware limitations preclude adapter-based learning.
Introduction
The Segment Anything Model (SAM) has revolutionized zero-shot image segmentation. However, its performance often degrades when applied to specialized domains such as medical imaging, shadow detection, or camouflaged object detection. To bridge this gap, Parameter-Efficient Fine-Tuning (PEFT) techniques, particularly adapters, have become the standard. Adapters are small, trainable modules inserted into a frozen backbone, allowing the model to learn task-specific features without retraining millions of parameters.
While adapters are parameter-efficient, they are frequently not memory-efficient. This paper identifies a critical "activation bottleneck" in existing adapter-based methods for SAM, which prevents their use on consumer-grade hardware. We propose CAD (Convolutional ADapter), a parallel architecture designed to slash memory usage while maintaining high segmentation accuracy.
The Activation Bottleneck in PEFT
A common misconception in the PEFT community is that freezing a model's weights automatically makes it easy to train. While freezing weights reduces the memory needed for the optimizer state, it does not necessarily reduce the memory needed for activations.
In traditional "SAM Adapter" architectures, adapter modules are nested inside the Transformer blocks of the image encoder. Because the trainable adapter is "wrapped" by frozen heavy layers, the training process must still perform backpropagation through the entire backbone. This requires storing the intermediate activations and gradients of the massive ViT-H encoder, pushing VRAM requirements beyond 40GB.
Methods: Parallel Convolutional Adapter (CAD)
The core innovation of CAD is its parallel topology. Instead of injecting modules into the internal layers of the Transformer, CAD sits alongside the entire image encoder as a separate branch.
1. High-Frequency Component (HFC) Extraction
To provide the model with strong structural priors, CAD first extracts high-frequency details (edges and textures) from the input image using a Fast Fourier Transform (FFT). This HFC is concatenated with the original RGB image, resulting in a 6-channel input that emphasizes boundaries—a crucial feature for segmenting difficult objects.
2. Parallel Convolutional Branch
This 6-channel input is processed by a lightweight convolutional network consisting of three "Conv blocks." Each block includes a 3x3 convolution, Leaky ReLU activation, Batch Normalization, and pooling. This branch operates independently of the SAM image encoder.
3. Residual Integration
The output of the convolutional branch is scaled using a tanh function and a 0.1 multiplier to ensure training stability. This refined feature map is then added directly to the final image embedding produced by the frozen SAM encoder. By treating the backbone as a "black box" and only interacting with its final output, CAD eliminates the need to store intermediate activations of the Transformer blocks, drastically reducing the memory footprint.
Experimental Evaluation
We evaluated CAD on three challenging benchmarks: the ISTD dataset for shadow detection, and the CAMO and COD10K datasets for camouflaged object detection.
Memory Efficiency
The most striking result is the reduction in VRAM usage. For the ViT-H version of SAM:
- SAM Adapter: 42.6 GB VRAM
- CAD (Ours): 15.5 GB VRAM
This 63% reduction allows researchers to fine-tune the largest SAM models on a single consumer-grade GPU like the RTX 3090 or 4090.
Performance
CAD delivers competitive accuracy, significantly outperforming simple "Decoder-only" fine-tuning. On the ISTD shadow detection task, CAD achieved a Dice score of 0.8616, a massive leap from the zero-shot SAM score of 0.2153 and superior to the Decoder-only baseline of 0.7544. While the more complex SAM Adapter maintains a slight edge in raw accuracy, CAD offers a far superior performance-to-memory ratio.
Conclusion
CAD addresses the often-overlooked memory overhead of adapter-based fine-tuning. By adopting a parallel convolutional architecture and leveraging high-frequency image priors, CAD makes high-quality adaptation of the Segment Anything Model accessible to a wider range of researchers and practitioners. Future work will explore more sophisticated parallel branches to further close the performance gap with internal adapters while maintaining the memory-efficient profile.
Summary updated