COMPrompter: reconceptualized segment anything model with multiprompt network for camouflaged object detection

Xiaoqin Zhang, Zhenni Yu, Li Zhao, Deng-Ping Fan, Guobao Xiao

TL;DR

COMPrompter adapts the Segment Anything Model (SAM) for camouflaged object detection by replacing its single-prompt approach with a multiprompt strategy. By combining traditional box prompts with a novel gradient-enhanced boundary prompt and high-frequency wavelet features, it achieves state-of-the-art performance on camouflage and medical segmentation benchmarks while running four times faster than vanilla SAM.

What Problem Does This Paper Address?

Camouflaged Object Detection (COD) is a challenging computer vision task because targets seamlessly blend into their surroundings—think of a flatfish on a sandy seabed or a tumorous polyp in an endoscopy video.

While foundation models like Meta's Segment Anything Model (SAM) boast incredible zero-shot generalization, they often struggle with the subtle, ambiguous boundaries characteristic of camouflaged objects. When given a standard single prompt (like a bounding box), SAM frequently misses fine structures or splits a single semantic object into multiple disjointed masks. Existing adaptation methods fail to explore alternative prompt types that can explicitly guide the model through highly concealed environments.

Methods

COMPrompter re-conceptualizes SAM's prompt architecture by introducing a multiprompt network that fuses macro-localization with micro-boundary details.

The COMPrompter pipeline architecture (left) alongside the Box-Boundary Mutual Guidance module (right).

The architecture consists of three core components:

  1. Edge Gradient Extraction Module (EGEM): Instead of trying to model the messy, noisy internal gradients of an entire camouflaged object, EGEM focuses strictly on the object-background junction. It applies dilation and Canny edge detection to generate a thick boundary mask embedded with sharp gradient information.
  2. Box-Boundary Mutual Guidance Module (BBMG): This module takes the sparse box embedding and the dense boundary embedding from EGEM and fuses them via depthwise separable convolutions and residual connections, forcing the two prompt types to complement each other.
  3. Discrete Wavelet Transform (DWT) Integration: To prevent the loss of fine details within the vision transformer, the authors apply DWT to the image embeddings to extract diagonal high-frequency signals (representing rapid texture changes and sharp edges) and inject them directly into the BBMG fusion layer.

To keep computational overhead low, the heavy image encoder and the EGEM calculations are precomputed and frozen; only the lightweight mask decoder is fine-tuned during training.

Datasets

The authors evaluated COMPrompter across two distinct domains:

  • Camouflaged Object Detection: Evaluated on four standard benchmarks: CAMO, CHAMELEON, COD10K, and NC4K (used to test generalization).
  • Polyp Segmentation (Medical COD): Evaluated on five public datasets: Kvasir-SEG, CVC-ClinicDB, CVC-ColonDB, CVC-300, and ETIS-LaribPolypDB.

Key Insights and Ideas

  • Boundaries Over Entire Targets: Prior gradient-based COD methods attempted to learn texture gradients across the entire object, which introduces significant noise due to varying internal patterns. COMPrompter shows that isolating the boundary gradient yields a much cleaner, more deterministic signal for the network to learn.
  • Wavelets Fix Transformer Blurriness: Vision Transformers (ViTs) can sometimes smooth over high-frequency edge details. Introducing DWT-derived diagonal high-frequency features directly into the prompt embedding space effectively recovers these lost details.
  • Prompt Synergy: Bounding boxes provide excellent spatial constraints but lack edge precision. Boundary masks provide edge precision but lack global context. Fusing them mutually creates a stronger prior than using either prompt type in isolation.

Key Results

  • State-of-the-Art Performance: COMPrompter outperforms both SAM-based variants and specialized non-SAM COD models. On the benchmark COD10K dataset, it surpasses the previous leading model by an average positive metric of 2.2%, achieving a 2% rise in weighted F-measure ($F_\beta^\omega$) and a 3.1% boost in enhanced-alignment measure ($E_\phi$).
Performance comparison of COMPrompter against other SOTA methods on the COD10K-Test dataset.
  • Clinical Superiority: When applied to medical polyp segmentation, COMPrompter beats MedSAM by an average of 3.2% in mean Dice (mDice) and 4.5% in mean Intersection over Union (mIoU).
  • Efficiency Gains: Thanks to the frozen encoder strategy, COMPrompter drastically reduces active parameters and increases inference speed by 4x compared to vanilla SAM, running at 8 frames per second (fps) on a single NVIDIA RTX 3080TI.

Limitations and Future Work

The primary limitation of COMPrompter occurs when multiple camouflaged objects reside within a single bounding box prompt. In these scenarios, the single box prompt emphasizes the non-target background areas between the distinct objects, which can confuse the boundary guidance module and lead to segmentation errors.

The authors note that a promising direction for future work is extending the framework to support a multiprompt strategy using multiple sub-boxes to cleanly isolate individual targets within complex, multi-object scenes.

Summary updated

BibTeX
@article{zhang2025comprompter,
  author = {Xiaoqin Zhang and Zhenni Yu and Li Zhao and Deng-Ping Fan and Guobao Xiao},
  title = {{COMPrompter: reconceptualized segment anything model with multiprompt network for camouflaged object detection}},
  journal = {Science China Information Sciences},
  year = {2025},
  doi = {10.1007/s11432-024-4233-9},
}
Figure