HFP-SAM Beats Vanilla SAM at Spotting Camouflaged Sea Creatures Underwater
A frequency-aware SAM variant beats prior marine segmentation models by extracting wavelet edges as prompts and swapping the decoder for a Mamba block.
ProTakeaways
- HFP-SAM adapts SAM for marine segmentation using wavelet-derived frequency priors instead of spatial features alone.
- Three modules: Frequency Guided Adapter, Frequency-aware Point Selection, and Full View Mamba decoder.
- Achieves 0.807 mIoU on MAS3K with Hiera-L backbone, beating Dual-SAM and MAS-SAM baselines.
- Under Gaussian noise at sigma=0.20, keeps 0.598 mIoU while vanilla SAM drops to 0.518.
- FPS generates prompt points 30x faster than global sampling while improving accuracy over random sampling.
- Code released at github.com/Drchip61/TIP-HFP-SAM; trains on a single RTX 3090.
Segmenting fish, corals, and other marine life from underwater imagery sounds like a solved problem in the age of foundation models, but it isn't. Murky water, drifting particulates, and animals that mimic their surroundings routinely fool general-purpose segmenters. A new framework called HFP-SAM tackles this by feeding wavelet-derived frequency cues into a frozen Segment Anything Model, then finishing the job with a Mamba-based decoder.
The result is a system that demonstrates superior performance on four public marine datasets and, notably, holds up under synthetic noise where vanilla SAM collapses.
Why underwater vision breaks SAM
Marine Animal Segmentation is the task of drawing pixel-perfect masks around sea creatures in raw underwater footage. It is a crucial vision task for advancing marine biology research, ecological monitoring and autonomous underwater robotics, but the marine environment poses unique challenges including poor visibility, variable lighting conditions, and the presence of particulates that often obscure marine animal features.
SAM was trained on a billion natural-image masks and struggles when transplanted here. The authors point out two specific failure modes: it lacks perceiving fine-grained details and frequency information, and its simple point or box prompts either miss the twisting shape of an octopus or scoop up background that looks identical to the target. Earlier SAM adaptations for marine work mostly retrained the encoder or decoder while leaving the prompt mechanism untouched, which caps how much performance you can squeeze out.
Frequency priors instead of raw pixels
The core idea is to stop trusting the spatial domain alone. Underwater images are saturated with high-frequency noise from particulates, so the team decomposes the input with a Discrete Haar Wavelet Transform into low-frequency and three high-frequency sub-bands (horizontal, vertical, diagonal). Averaging the high-frequency bands produces a map where frequency analysis generates highlighted regions corresponding to real object edges rather than texture noise.

Three modules plug into the frozen SAM backbone:
- Frequency Guided Adapter (FGA): injects marine-domain knowledge by modulating transformer features with a downsampled frequency prior mask, rather than encoding frequency features directly. This closes the alignment gap between SAM's pretrained spatial representations and the new frequency cues.
- Frequency-aware Point Selection (FPS): slides a window across the frequency map, picks the top-k highest-response windows, and samples both positive and negative points inside them using SAM's own coarse mask as the label. No extra prompt-generation network needed.
- Full View Mamba (FVM): replaces the lightweight SAM decoder with a state-space model that scans features in four spatial directions and bidirectionally across channels, giving linear computational complexity for long-range context.
The numbers
On the MAS3K benchmark the ViT-B version of HFP-SAM hits 0.797 mIoU, edging out prior SAM adaptations Dual-SAM (0.789) and MAS-SAM (0.788). The Hiera-L variant, HFP-SAM2, pushes to 0.807 mIoU and leads on all five metrics across MAS3K, RMAS, UFO120, and RUWI. For context, plain SAM out of the box scores only 0.566 on MAS3K.
The ablation table is where the story sharpens. Starting from a fine-tuned SAM decoder baseline of 0.566 mIoU, stacking a vanilla adapter jumps performance to 0.739, adding FGA reaches 0.754, FPS pushes to 0.771, and FVM lands the final 0.797. A noise stress test with Gaussian and speckle corruption at sigma=0.20 shows SAM alone drops to 0.518 mIoU while SAM+FGA still holds 0.598, evidence that the frequency prior is more than a training artifact.

Real breakthrough and the catch
The interesting contribution is treating the wavelet spectrum as a prompt generator, not just an extra feature channel. Random point sampling scores 0.760 mIoU and takes 1.3 ms, while a brute-force global sampling gets 0.764 mIoU but costs 315 ms. FPS hits 0.771 mIoU in 9 ms, giving both accuracy and a 30x speedup over the exhaustive alternative.
Zero-shot transfer holds up too. Without any fine-tuning, HFP-SAM beats vanilla SAM on camouflaged object detection (COD10K), polyp segmentation (Kvasir), and salient object detection (DUTS). The failure mode is honest and predictable: the frequency-aware point selection generates highlighted regions combined with SAM's coarse predictions, so if the initial coarse mask misses a small fish entirely, the refined pass amplifies the error rather than recovering it. A confidence-gating trick reduces point-level prompt errors from 5.05% to 2.79%, but doesn't eliminate the underlying dependency.
When it fits your stack
This is worth trying if you're building:
- Underwater robotics pipelines where SAM's box or point prompts are unreliable and manual annotation is impractical.
- Ecological monitoring tools that need to segment camouflaged species against textured reef or seafloor backgrounds.
- Any SAM-adaptation project where high-frequency sensor noise (medical ultrasound, sonar, low-light imagery) breaks the pretrained backbone.
Code and weights are on GitHub, and the accepted version is available through IEEE Transactions on Image Processing. The training recipe is modest: the source code is publicly available, images are resized to 512x512, and everything trains on a single RTX 3090 in 50 epochs with the SAM encoder frozen throughout.