Underwater target detection based on improved YOLOv7

Kaiyue Liu, Qi Sun, Sun Daming, Mengduo Yang, Nizhuan Wang

Abstract

Underwater target detection is a crucial aspect of ocean exploration. However, conventional underwater target detection methods face several challenges such as inaccurate feature extraction, slow detection speed and lack of robustness in complex underwater environments. To address these limitations, this study proposes an improved YOLOv7 network (YOLOv7-AC) for underwater target detection. The proposed network utilizes an ACmixBlock module to replace the 3x3 convolution block in the E-ELAN structure, and incorporates jump connections and 1x1 convolution architecture between ACmixBlock modules to improve feature extraction and network reasoning speed. Additionally, a ResNet-ACmix module is designed to avoid feature information loss and reduce computation, while a Global Attention Mechanism (GAM) is inserted in the backbone and head parts of the model to improve feature extraction. Furthermore, the K-means++ algorithm is used instead of K-means to obtain anchor boxes and enhance model accuracy. Experimental results show that the improved YOLOv7 network outperforms the original YOLOv7 model and other popular underwater target detection methods. The proposed network achieved a mean average precision (mAP) value of 89.6% and 97.4% on the URPC dataset and Brackish dataset, respectively, and demonstrated a higher frame per second (FPS) compared to the original YOLOv7 model.

Introduction

Detecting objects underwater is a significant challenge for standard computer vision systems. Unlike clear-air environments, water causes light to scatter and absorb, leading to severe color distortion, low contrast, and murky visibility. Conventional deep learning models often struggle in these conditions because their feature extraction is not robust enough to distinguish targets from noisy, blue-green backgrounds. Furthermore, many high-accuracy models are too computationally heavy for the real-time requirements of autonomous underwater vehicles (AUVs). To bridge this gap, this study introduces YOLOv7-AC, a model that is both more perceptive of subtle features and efficient enough for practical deployment.

Methodology

The researchers introduced several structural innovations to the standard YOLOv7 framework to create YOLOv7-AC, focusing on hybrid feature extraction and attention-driven processing.

The ACmix Module and AC-E-ELAN

The core innovation is the ACmix module, which replaces standard 3x3 convolutions in the E-ELAN (Extended Efficient Layer Aggregation Network) structure. ACmix is a hybrid approach that recognizes that both self-attention and convolution rely heavily on 1x1 convolutions. It performs the 1x1 projection once and then branches into both paths, combining the local learning of convolutions with the global context of self-attention.

The ACmix module integrates self-attention and convolution by sharing a common 1x1 convolutional projection stage.

This is further optimized into the AC-E-ELAN structure, incorporating skip connections and 1x1 convolutional branches inspired by RepVGG, which speeds up inference without sacrificing the richness of the learned features.

Global Attention Mechanism (GAM)

To help the model focus on relevant targets in murky water, Global Attention Mechanism (GAM) modules were inserted into the backbone and head. GAM captures both channel and spatial dependencies, helping the network ignore irrelevant background noise and prioritize important features.

The Global Attention Mechanism (GAM) sequentially applies channel and spatial attention to enhance feature representation.

Additional Optimizations

  • ResNet-ACmix: A new bottleneck module was designed for the backbone to prevent information loss during deep feature extraction while simultaneously reducing the total parameter count.
  • K-means++ for Anchors: Instead of using standard K-means to determine initial bounding box sizes, the researchers used K-means++, which is less sensitive to initial outliers and leads to better-fitting boxes for the specific dimensions of underwater targets.

Results and Discussion

The model was evaluated on two primary benchmarks: the URPC (National Underwater Robot Professional Competition) dataset and the Brackish dataset. YOLOv7-AC outperformed the baseline and several other state-of-the-art models:

  • Accuracy (URPC): Achieved a mean Average Precision (mAP) of 89.6%, a 3.4% improvement over the original YOLOv7.
  • Accuracy (Brackish): Achieved a 97.4% mAP, outperforming the baseline by 1.1%.
  • Speed: On the URPC dataset, the model reached 74 FPS, and on the Brackish dataset, it hit 92 FPS. This is faster than the original YOLOv7 (73 and 90 FPS, respectively), making it highly suitable for real-time robot navigation.

Qualitative results showed that YOLOv7-AC was much better at detecting small or overlapping targets in highly distorted, low-light scenes where the original model often missed them.

Conclusion

YOLOv7-AC represents a promising solution for underwater target detection by effectively balancing global context and local feature extraction. By exploiting the shared reliance of convolutions and self-attention on 1x1 projections, the model achieves superior accuracy with minimal computational overhead. Future research will focus on collecting more varied data and exploring image enhancement techniques to further boost detection reliability in the murkiest conditions.

Summary updated

Abstract

Underwater target detection is a crucial aspect of ocean exploration. However, conventional underwater target detection methods face several challenges such as inaccurate feature extraction, slow detection speed and lack of robustness in complex underwater environments. To address these limitations, this study proposes an improved YOLOv7 network (YOLOv7-AC) for underwater target detection. The proposed network utilizes an ACmixBlock module to replace the 3x3 convolution block in the E-ELAN structure, and incorporates jump connections and 1x1 convolution architecture between ACmixBlock modules to improve feature extraction and network reasoning speed. Additionally, a ResNet-ACmix module is designed to avoid feature information loss and reduce computation, while a Global Attention Mechanism (GAM) is inserted in the backbone and head parts of the model to improve feature extraction. Furthermore, the K-means++ algorithm is used instead of K-means to obtain anchor boxes and enhance model accuracy. Experimental results show that the improved YOLOv7 network outperforms the original YOLOv7 model and other popular underwater target detection methods. The proposed network achieved a mean average precision (mAP) value of 89.6% and 97.4% on the URPC dataset and Brackish dataset, respectively, and demonstrated a higher frame per second (FPS) compared to the original YOLOv7 model. The source code for this study is publicly available at https://github.com/NZWANG/YOLOV7-AC. In conclusion, the improved YOLOv7 network proposed in this study represents a promising solution for underwater target detection and holds great potential for practical applications in various underwater tasks.
BibTeX
@article{liu2023underwater,
  author = {Kaiyue Liu and Qi Sun and Sun Daming and Mengduo Yang and Nizhuan Wang},
  title = {{Underwater target detection based on improved YOLOv7}},
  journal = {Journal of Marine Science and Engineering},
  year = {2023},
  doi = {10.3390/jmse11030677},
}
Figure