WaterSAM: Adapting SAM for Underwater Object Segmentation

Yang Hong, Xiaowei Zhou, Ruzhuang Hua, Qingxuan Lv, Junyu DongJournal of Marine Science and Engineering 2024

TL;DR

This paper introduces WaterSAM, a novel adaptation of Meta's Segment Anything Model (SAM) for the challenging domain of underwater object segmentation. By employing Low-Rank Adaptation (LoRA), WaterSAM significantly reduces the number of trainable parameters and computational cost while achieving superior segmentation performance compared to the original SAM on underwater datasets.

What Problem Does This Paper Address?

Object segmentation is crucial for many computer vision applications, but the underwater environment presents unique and significant challenges. These include poor visibility due to light absorption and scattering, turbulence, noise, low contrast, and uneven illumination. Furthermore, the scarcity of labeled underwater datasets exacerbates these issues, making it difficult to train robust segmentation models. While general-purpose foundation models like SAM show promise, their direct application to underwater imagery often falls short. Existing adaptation methods, like AquaSAM, require extensive fine-tuning of all SAM parameters, leading to high computational demands and a need for substantial labeled data, which is often unavailable in underwater scenarios.

Methods

The core innovation of WaterSAM lies in its adaptation of the Segment Anything Model (SAM) using Low-Rank Adaptation (LoRA). Instead of fine-tuning all of SAM's parameters, WaterSAM injects small, trainable rank decomposition matrices into the Transformer layers of SAM's image encoder. This approach, inspired by LoRA, allows for efficient fine-tuning by approximating the weight updates with low-rank matrices. Specifically, WaterSAM applies LoRA to the query (Q) and value (V) layers within the self-attention mechanisms of the image encoder. This modification enhances the encoder's ability to extract robust underwater features without altering the original SAM weights for the prompt encoder and mask decoder. This strategy dramatically reduces the number of trainable parameters to just 6.7% of the original SAM model, leading to lower computational costs and enabling effective adaptation with less labeled data.

Datasets

The authors evaluated WaterSAM on three underwater image datasets:

  • COD10K: A dataset containing 10,000 images, with a focus on camouflaged objects. For this study, they extracted images from the aquatic category, using 759 training and 474 testing figures.
  • SUIM: This dataset includes 1525 paired samples for training/validation and 110 for benchmarking, covering seven categories. The authors specifically selected "Human divers," "Robots (AUVs/ROVs/instruments)," and "Fish and vertebrates" for their experiments, processing images to create binary object-mask pairs.
  • UIIS: The first general Underwater Image Instance Segmentation dataset, featuring 4628 images with pixel-level annotations across seven categories. The authors converted this dataset to a format compatible with SUIM and conducted experiments on the entire dataset and a subset focusing on fish, human divers, and robots.

Key Insights and Ideas

  • LoRA is a game-changer for domain adaptation: The paper demonstrates that LoRA, a parameter-efficient fine-tuning technique, is highly effective for adapting large foundation models like SAM to specialized domains with unique challenges, like underwater imagery.
  • Targeted adaptation is key: By focusing LoRA on the image encoder, WaterSAM specifically enhances the model's ability to process and understand the complex visual characteristics of underwater scenes, rather than broadly retraining the entire model.
  • Efficiency without sacrificing performance: The significant reduction in trainable parameters (to 6.7%) is achieved without a substantial drop in segmentation accuracy, making WaterSAM a more practical solution for resource-constrained environments.
  • SAM's limitations in underwater scenarios are highlighted: The qualitative results show that the original SAM struggles with indistinct boundaries, complex shapes, and color similarities to the background in underwater images, underscoring the need for specialized adaptations.

Key Results

WaterSAM demonstrated significant improvements across all tested datasets:

  • COD10K: Mean IoU increased from 16.98% (SAM) to 84.96% (WaterSAM), a 400% improvement. Overall Accuracy (OA) rose from 29.47% to 96.09%, a 226% improvement.
  • SUIM: Mean IoU improved from 38.41% to 90.47% (136% increase), and OA from 61.98% to 98.08% (58% increase).
  • UIIS: Mean IoU increased from 46.64% to 84.24% (81% increase), and OA from 64.58% to 93.16% (44% increase).
  • Qualitative analysis showed WaterSAM's superior ability to delineate object boundaries, especially in challenging conditions where the original SAM failed.
  • Comparison with AquaSAM on the SUIM dataset showed WaterSAM achieving a mean IoU of 98.08% compared to AquaSAM's 76.64%, highlighting WaterSAM's advantage in adapting SAM with less data.

Limitations and Future Work

  • Limitations: While WaterSAM shows significant improvements, the paper acknowledges that the original SAM can still struggle with objects that have very indistinct boundaries or are highly camouflaged. The computational cost, though reduced, is still a factor, especially when using higher ranks for LoRA.
  • Future Work: The authors propose adapting the newer SAM2 model for underwater video segmentation tasks. They also suggest exploring further optimizations for even greater efficiency and accuracy in challenging underwater environments.

Summary updated

Abstract

Object segmentation, a key type of image segmentation, focuses on detecting and delineating individual objects within an image, essential for applications like robotic vision and augmented reality. Despite advancements in deep learning improving object segmentation, underwater object segmentation remains challenging due to unique underwater complexities such as turbulence diffusion, light absorption, noise, low contrast, uneven illumination, and intricate backgrounds. The scarcity of underwater datasets further complicates these challenges. The Segment Anything Model (SAM) has shown potential in addressing these issues, but its adaptation for underwater environments, AquaSAM, requires fine-tuning all parameters, demanding more labeled data and high computational costs. In this paper, we propose WaterSAM, an adapted model for underwater object segmentation. Inspired by Low-Rank Adaptation (LoRA), WaterSAM incorporates trainable rank decomposition matrices into the Transformer’s layers, specifically enhancing the image encoder. This approach significantly reduces the number of trainable parameters to 6.7% of SAM’s parameters, lowering computational costs. We validated WaterSAM on three underwater image datasets: COD10K, SUIM, and UIIS. Results demonstrate that WaterSAM significantly outperforms pre-trained SAM in underwater segmentation tasks, contributing to advancements in marine biology, underwater archaeology, and environmental monitoring.
BibTeX
@article{hong2024watersam,
  author = {Yang Hong and Xiaowei Zhou and Ruzhuang Hua and Qingxuan Lv and Junyu Dong},
  title = {{WaterSAM: Adapting SAM for Underwater Object Segmentation}},
  journal = {Journal of Marine Science and Engineering},
  year = {2024},
  doi = {10.3390/jmse12091616},
}
Figure