A lightweight model for echo trace detection in echograms based on improved YOLOv8 Authors: Jungang Ma, Jianfeng Tong, Minghua Xue, Junfan Yao Published: 2024 ABSTRACT With the rise of underwater unmanned platforms like unmanned boats, ROVs, and AUVs, there’s an increasing need for underwater detection technologies. Researchers have merged scientific echosounders with these platforms for biometric applications. However, current detection models are too parameter-heavy to embed in echosounders and struggle with noisy, irregular, and dense echograms. This paper introduces YOLOv8-SBE, a lightweight fish detection model based on YOLOv8, addressing these issues by enhancing feature extraction, information fusion, and small object recognition. YOLOv8-SBE adds the C2f_ScConv module to improve efficiency and reduce parameters, incorporates the BiFPN structure to enhance information transfer, and uses the EMA attention module for better small target recognition. It reduces computational complexity by 18.5%, decreases model parameters by 40%, and improves mAP0.5 to 79.5% and mAP0.5:0.95 to 58.2%, making it suitable for echosounders with limited resources. Introduction In recent years, more and more equipment that can be applied to marine information acquisition, such as sail buoy, glider, unmanned surface vehicle (USV), autonomous underwater vehicle (AUV) and some other unmanned survey platforms are integrated with echosounders for fishery resources survey and monitoring of marine biological resources. Among them, Pedersen et al.1 integrates low-power scientific echosounders into two autonomous surface vehicles (one a wave glider and the other a sail buoy) and discusses the main features of these systems as well as the challenges in ensuring the collection of high-quality echosounder data. Goulon et al.2 used an USV equipped with a state-of-the-art fisheries science echosounder, the EK80, for broadband applications to study its potential for monitoring fish populations in lakes. Brierley et al.3 equipped an AUV with a scientific echosounder to assess the avoidance of research vessels by the Antarctic krill (Euphausia superba). However, in practical fisheries applications, because echosounders lack functions such as fish and fish school identification, researchers often acquire information in echograms through empirical judgment, but this method is often limited by subjective factors and local experience, making echogram identification difficult, so automatic identification functions are highly needed. In order to solve this problem, Slonimer et al.4 hybridized deep learning and heuristic methods in echograms, semantic segmentation by U-Net to detect fish. Vohra et al.5 utilized deep learning networks and semantic segmentation to automatically detect marine organisms in the water column from underwater acoustic data. However, the disadvantages of the above two methods are also obvious. Firstly, the algorithm is not applicable to irregular targets and dense targets. Secondly, the semantic segmentation method is easy to lead to the loss of information in fixed resolution, thus losing some detail information and affecting target detection. Therefore, it is necessary to propose an algorithm for automated recognition of underwater fish echo trajectories from echosounders to improve the efficiency of echosounder in fishery applications. The traditional methods for monitoring fish schools are inefficient and often rely on manual labor. Therefore, people use computer vision for fish detection, obtain target photos or videos through underwater cameras, create datasets for model training, and achieve good detection results. However, occlusion has always been a challenge in fish detection6. In underwater photos and videos, other fish or environments, such as underwater plants, obscure many fish objects, making their detection difficult. Meanwhile, optical cameras exhibit local limitations within the range of underwater photography and are influenced by environmental factors such as light and water temperature. In contrast, echo-detection technology utilizes sound waves to detect underwater objects, providing valuable insights into underwater targets’ position, shape, size, and motion. Compared with traditional underwater imaging techniques such as optical imaging, echo-detection has the characteristics of strong penetration, offering clearer and larger detection ranges underwater and wider detection angles. Therefore, we use echogram detection to make up for the limitations of optical image detection in complex, deep, and remote underwater environments, including deep water, murky water, and low-light conditions. In target echogram detection, traditional methods utilize pixel differences, mathematical-statistical features, and echo features between images to achieve fish school detection. However, due to the inability to fully reflect the complex background and texture features of echograms7, the comprehensiveness and accuracy of the feature extraction process cannot be guaranteed, resulting in poor detection performance and high false detection and missed detection rates. Therefore, the development of deep learning has also broken through the technical bottleneck of traditional object detection algorithms in feature extraction and has performed excellently in accuracy and speed, becoming the mainstream algorithm for current object detection. In target recognition, two main categories of deep learning algorithms are two-stage and one-stage networks. In two-stage networks, a region with a high probability of containing objects is proposed first, and then these proposal regions are input into a CNN for object detection. The two-stage object detection algorithms include R-CNN8, Fast R-CNN9, Faster R-CNN10, SPP-Net11, Mask R-CNN12. Although the detection accuracy of the algorithm in this phase is high, its detection speed is slow and unsuitable for the application scenario of multi-targets, small targets, and occluded targets, which is the subject of this study. In one-stage networks, methods such as YOLO (you only look once)13–16, SSD17, RetinaNet18, combine the region proposal process with objects detection to simplify the algorithm, and achieve a balance between accuracy and speed. YOLO, the most famous single-stage object detection algorithm, directly performs object detection and bounding box regression on the image and achieves higher object detection speed. Sun et al.19reported that YOLO not only improves accuracy but also reduces the missed detection and false detection rates of the model for small-scale and overlapping fish targets by increasing the depth of the network, reducing information loss, optimizing the loss function, and introducing the Soft-NMS (Soft-Non-Maximum Suppression) algorithm. However, they did not take into account the practical issue of applying it specifically to fish detectors when improving the YOLOv5 model. Due to the limited storage capacity of echosounders and the large size of YOLO models, there is difficulty in deploying networks to low-power devices. Therefore, research should focus on the lightweight of perception algorithms. The recognition network improved using lightweight modules can save computational resources20. Therefore, we evaluate the recently popular deep learning network YOLOv8, the latest detection algorithm in the YOLO family. It is characterized by high detection efficiency, high accuracy, and small model memory occupation. We propose a lightweight fish detection model named YOLOv8-SBE using YOLOv8n as the baseline model, where “S” stands for C2f_ScConv and Soft-NMS, “B” stands for BiFPN structure, and “E” stands for EMA attention mechanism module. This model aims to solve problems such as difficulties in deploying YOLO models due to the limited storage capacity of the echosounders, and it specifically improves detection accuracy for small targets in dense and occluded environments. To address these issues, our contributions are summarized as follows:Introducing the ScConv module in the backbone network part, integrating the ScConv module with the C2f module in YOLOv8, and proposing the C2f_ScConv module, which improves the performance of the convolutional network model and reduces the computational requirements.We introduce the BiFPN structure in neck to solve the problems faced by the PAN-FPN structure, which cannot fully handle large-scale feature maps, leading to the fact that the feature maps will lose some original information, resulting in a relatively low reuse rate, etc. The BiFPN structure enhances the information transfer and fusion ability of the feature maps in the same layer, improves the perception and recognition of the target, and is key to lightweighting the model.We introduce the multi-scale attention module EMA, which further improves the model’s ability to identify targets at different scales and makes the model more focused on smaller targets.Finally, in detection scenarios where there are occluded targets, dense targets, and small targets, we use soft-NMS to replace the original NMS to solve the problem that NMS may hinder the detection of targets occluded by other elements or the background.We conduct a large number of experiments on the dataset collected by the echosounder, and the results show that, compared with other detection algorithms, our proposed YOLOv8-SBE model not only reduces the required parameters and computation amount of the model significantly but also further improves the detection accuracy of the model, which provides theoretical support for the embedded work of realizing the YOLOv8 detection model in the echosounder. Introducing the ScConv module in the backbone network part, integrating the ScConv module with the C2f module in YOLOv8, and proposing the C2f_ScConv module, which improves the performance of the convolutional network model and reduces the computational requirements. Introducing the ScConv module in the backbone network part, integrating the ScConv module with the C2f module in YOLOv8, and proposing the C2f_ScConv module, which improves the performance of the convolutional network model and reduces the computational requirements. We introduce the BiFPN structure in neck to solve the problems faced by the PAN-FPN structure, which cannot fully handle large-scale feature maps, leading to the fact that the feature maps will lose some original information, resulting in a relatively low reuse rate, etc. The BiFPN structure enhances the information transfer and fusion ability of the feature maps in the same layer, improves the perception and recognition of the target, and is key to lightweighting the model. We introduce the BiFPN structure in neck to solve the problems faced by the PAN-FPN structure, which cannot fully handle large-scale feature maps, leading to the fact that the feature maps will lose some original information, resulting in a relatively low reuse rate, etc. The BiFPN structure enhances the information transfer and fusion ability of the feature maps in the same layer, improves the perception and recognition of the target, and is key to lightweighting the model. We introduce the multi-scale attention module EMA, which further improves the model’s ability to identify targets at different scales and makes the model more focused on smaller targets. We introduce the multi-scale attention module EMA, which further improves the model’s ability to identify targets at different scales and makes the model more focused on smaller targets. Finally, in detection scenarios where there are occluded targets, dense targets, and small targets, we use soft-NMS to replace the original NMS to solve the problem that NMS may hinder the detection of targets occluded by other elements or the background. Finally, in detection scenarios where there are occluded targets, dense targets, and small targets, we use soft-NMS to replace the original NMS to solve the problem that NMS may hinder the detection of targets occluded by other elements or the background. We conduct a large number of experiments on the dataset collected by the echosounder, and the results show that, compared with other detection algorithms, our proposed YOLOv8-SBE model not only reduces the required parameters and computation amount of the model significantly but also further improves the detection accuracy of the model, which provides theoretical support for the embedded work of realizing the YOLOv8 detection model in the echosounder. We conduct a large number of experiments on the dataset collected by the echosounder, and the results show that, compared with other detection algorithms, our proposed YOLOv8-SBE model not only reduces the required parameters and computation amount of the model significantly but also further improves the detection accuracy of the model, which provides theoretical support for the embedded work of realizing the YOLOv8 detection model in the echosounder. Related work YOLOv8 algorithm YOLOv8 is a cutting-edge object detection model that excels in accuracy and speed, making it suitable for a wide range of applications21.YOLOv8 builds on previous versions of YOLO and introduces new features and optimizations. The backbone network and the “neck” part may refer to the design concept of YOLOv7 ELAN22 adopting a gradient-rich C2f structure. A new network structure using Decoupled-Head design for better classification and detection.YOLOv8 also transitions anchor-based detection to anchor-free detection. It uses a task-aligned distributor for sample matching and introduces Distribution Focus Loss (DFL). Non-maximum suppression is used to remove redundant bounding boxes, which improves performance on a wide range of hardware platforms, from CPUs to GPUs. The structure of YOLOv8 is shown in Fig. 1. YOLOv8 employs C2f blocks for enhanced feature extraction. It processes the input through a convolution module and a split module, followed by concatenation after n Bottleneck modules. This approach reduces convolutions and accelerates the network. The neck utilizes a feature pyramid network23 (FPN) to handle multi-scale feature maps from the Backbone, achieving detection at various scales. FPN and PANet24integrate low-level and high-level features through upsampling and downsampling. The SPPF block, at the backbone’s end, uses three max-pooling layers to process features at multiple scales, enhancing feature abstraction. A more detailed view of the YOLOv8 modules is shown in Fig. 2. Fig. 1YOLOv8 model structure. YOLOv8 model structure. Fig. 2Detailed view of the YOLOv8 modules. Detailed view of the YOLOv8 modules. C2f module with integrated ScConv Conventional CNN structures are characterized by substantial computational and storage requirements. The ScConv25 module introduces a groundbreaking CNN compression technique that can simultaneously address spatial and channel redundancy issues within convolutional layers because it utilizes the redundancy of intermediate feature maps, improves feature extraction efficiency, and reduces parameters and calculations without any performance loss. As shown in Fig. 3, this module proposes two core components: the spatial redundancy reduction unit (SRU) and the channel reconstruction unit (CRU). SRU addresses spatial challenges within feature maps by breaking down the entire map into multiple spatial blocks and employing distinct convolutional kernels for each. This enhances precision in feature information within each block and significantly diminishes overall spatial redundancy. As a result, feature extraction becomes more efficient and accurate, decreasing computational complexity. CRU focuses on optimizing the channel dimension of feature maps. In order to process channel information more flexibly and efficiently, CRU has introduced a lightweight fully connected layer. This allows the model to merge information from different channels more effectively, reducing channel redundancy. This method improves the discriminative ability of features and further reduces computational requirements. ScConv can serve as a plug-and-play module, providing versatility and compatibility without the need for any changes to existing model structures, and it can easily replace standard convolutions. In the design of C2f-ScConv in this article, as shown in Fig. 4, replacing one Conv in the original bottleneck with ScConv reduces the number of parameters and computation while ensuring accuracy does not decrease C2f is converted into a C2f_ScConv structure, reducing common spatial and channel redundancy in standard convolutions, thereby improving the performance of convolutional network models and reducing computational requirements. Fig. 3The structure of ScConv integrated with a SRU and a CRU. The structure of ScConv integrated with a SRU and a CRU. Fig. 4The bottleneck of C2f_ScConv. The bottleneck of C2f_ScConv. BiFPN The neck network of YOLOv8 utilizes a collaborative combination of path aggregation network (PAN) and feature pyramid network (FPN) structure, as shown in Fig. 5a. Due to the use of summation for feature fusion in FPN, some details may be lost during the fusion process. Therefore, its performance may not be as good as PAN for high-precision detection scenarios. PAN uses cascading methods for feature fusion, which can preserve more details but increase computational complexity. Meanwhile, the PAN-FPN structure can’t fully handle large-scale feature maps, which may overlook valuable information and decrease detection quality. In addition, after upsampling and downsampling, the feature map will lose some original information, resulting in a relatively low reuse rate. Therefore, in order to more effectively address the aforementioned issues and correct this, we innovatively integrated the Bidirectional Feature Pyramid Network (BiFPN)26 into our model, as shown in Fig. 5b. Remove unidirectional input nodes from BIFPN (which do not participate in cross-level feature fusion and have a relatively small impact on overall network performance, thus simplifying the network structure) and connect the original input nodes and output nodes of the same layer to better preserve and utilize the feature map of that layer during the feature fusion process. This can enhance feature maps’ information transmission and fusion ability. BiFPN does not use simple feature map stacking or addition like traditional fusion methods; instead, it uses weighted feature fusion due to the problems of dense schools of fish, occlusion, and small object detection in echogram target detection. By integrating BiFPN, multi-scale feature fusion has been achieved, enhancing the representation of small target information in deep features, thereby improving the accuracy of fish detection and achieving lightweight processing for the neck part. It is an optimized alternative to PAN-FPN. Fig. 5Network structure (a) PAN-FPN. (b) BiFPN. Network structure (a) PAN-FPN. (b) BiFPN. EMA attention mechanism EMA27 is a novel and efficient multi-scale attention module that does not require dimensionality reduction. It achieves a uniform distribution of spatial semantic features in each feature group by reshaping a portion of channels into batch dimensions and grouping channel dimensions into multiple sub-features. The EMA module mainly consists of three stages. Firstly, feature grouping is where EMA divides the input feature map into multiple sub-features in the channel dimension direction to learn different meanings. Secondly, it conducts cross-spatial learning. Since the large receptive field of neurons can collect multi-scale spatial information, EMA uses three parallel routes to extract attention-weight descriptors from grouped feature maps. Finally, EMA utilizes 2D global pooling operations to encode and output each branch’s global spatial information output. EMA adopts a method of aggregating spatial information in different directions in the spatial dimension, which effectively enhances the aggregation of features. Implementing this process involves introducing two tensors: one for the output of the 1 × 1 dimensional branch and the other for the output of the 3 × 3 dimensional branch. In order to capture overall spatial knowledge in the export of 1 × 1 branches, a 2D global average pooling operation was adopted. Before combining the collaborative activation mechanism with channel features, the output of the minimum branch undergoes a direct reshaping process to conform to the appropriate dimensional structure. The formula for 2D global average pooling operation is as shown in Eq. (1).1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${z}_{c}=\frac{1}{H\times\;W}\sum_{j}^{H}\sum_{i}^{W}{x}_{c}\left(i,j\right).$$\end{document} where C, H and W represent the number of channels, height, and width of the feature map, respectively. The improved model adds the EMA attention module to the neck of YOLOv8 because the EMA attention module has relatively small computational and parameter requirements, low model complexity, high computational efficiency, and good task adaptability. The EMA attention module is suitable for a wide range of visual tasks, making the model more focused on smaller objects. soft-NMS Traditional NMS28 is a fundamental algorithm to identify local maximum values while suppressing non-maximum ones. Initially, it arranges all candidate bounding boxes based on category scores and selects the box with the highest score. Subsequently, it iterates through the remaining candidate boxes. The former is removed whenever the Intersection over Union (IoU) value between a remaining candidate box and the one with the highest score exceeds the predetermined IoU threshold. This process repeats until all boxes are processed, yielding the retained candidate boxes as the final detection outcome. However, NMS exhibits a drawback: for overlapping candidate boxes, if the IoU value between the box with the highest confidence score and others surpasses the threshold, they are deleted, while those below the threshold are retained. Consequently, in scenarios involving dense or occluded scenes, NMS may hinder the detection of objects obscured by other elements or backgrounds. In response to this limitation, Bodla et al.29 proposed a Soft NMS algorithm, eliminating the necessity for additional parameters and ensuring ease of implementation. Despite its enhanced functionality, Soft NMS maintains the same algorithmic complexity as traditional NMS, thus averting an increase in computational load. Furthermore, its seamless integration with existing object detection pipelines facilitates its adoption in various applications without necessitating additional training. By preventing object omission detection resulting from overlapping proposals, Soft NMS enhances the robustness and accuracy of object detection systems. Soft Non-Maximum Suppression does not entail the abrupt deletion of detection boxes with excessive IoU; instead, it assigns weighted values to all boxes except the one with the highest score. These weights reduce the confidence score of the box, attenuating the scores of neighboring detection boxes that intersect with it. The extent of score attenuation increases with the number of overlapping boxes. Subsequently, the predictor applies a confidence threshold to filter the boxes. The following delineates the processing steps for NMS and Soft NMS expressed in Eqs. (2) and (3).2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$s_{i} \left\{ {\begin{array}{*{20}l} {s_{i} ,} \hfill & {IoU\left( {M,b_{i} } \right) < N_{t} } \hfill \\ {0,} \hfill & {IoU\left( {M,b_{i} } \right) \ge N_{t} } \hfill \\ \end{array} } \right.$$\end{document}3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$s_{i} \left\{ {\begin{array}{*{20}l} {s_{i} ,} \hfill & {IoU\left( {M,b_{i} } \right) < N_{t} } \hfill \\ {s_{i} \left( {1 - IoU\left( {M,b_{i} } \right)} \right),} \hfill & {IoU\left( {M,b_{i} } \right) \ge N_{t} } \hfill \\ \end{array} } \right.$$\end{document} where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{i}$$\end{document} denotes the current score of the detection box being processed, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${N}_{t}$$\end{document} is the IoU threshold, and M is the highest-scoring detection box. Proposed model YOLOv8-SBE In this paper, YOLOv8n, the lightest model in the YOLOv8 family, is chosen as the original network to be improved to make it suitable for underwater devices with limited storage. Figure 6 shows the structure of the improved network. the C2f_ScConv module consists of a combination of the ScConv convolution module and the C2f module, and all the C2f modules in the backbone network part of the original YOLOv8 are replaced with this module, which improves the feature extraction efficiency and reduces the number of parameters and computations. This backbone layer extracts the features of the input image at three different scales, which are then transferred to the neck layer for further feature extraction. to the neck layer for further feature extraction. In the neck layer, we use a high-performance EMA attention module and replace the original PAN-FPN structure with the BiFPN structure in the neck network, which reduces the computational complexity, improves the detection accuracy of small targets, and performs multi-scale feature fusion after up-sampling to obtain the new fused features at three different scales. Finally, the fused features are passed to the head layer of the network for prediction. The YOLOv8-SBE model accomplishes a lightweight improvement with guaranteed accuracy, providing a theoretical model for target detection for embedded work with echosounders. Fig. 6Overall network structure of the improved YOLOv8. Overall network structure of the improved YOLOv8. Model testing Datasets The study dataset was provided by Tong et al.30, which consists of 91 images captured by a single-beam commercial echosounder in the high sea of the Northwest Pacific Ocean. As shown in Fig. 7a, this is the original data image, where the horizontal-axis represents time in seconds, and the length of each image is 1250s, and the vertical-axis represents depth in meters, and the length of each image is 95 m, according to the depth of draught of the fishing vessel to remove the acoustic data within 5 m of the sea surface, to avoid the bubbles produced by the fishing vessel and the movement of the waves interfering with the data, so the dataset are all the picture of the 5 to 100 m of the submerged water. Firstly, the echo level values from the acoustic data were converted to acoustic backscattering strength values. Secondly, the part outside the integration threshold was removed by setting the threshold to avoid the interference of zooplankton and large predators in the echo data. Then, the slight discrete noise generated by bubbles and the high-frequency impulse noise generated by the instrument was removed by open and close operations and 3 × 3 median filtering, respectively. After the above image processing process, we get Fig. 7b from Fig. 7a, and the dataset consists of images after image preprocessing. The dataset of this paper is composed of 411 images. Then, we used an edge detection algorithm on the dataset to annotate the dataset. Figure 7c shows the three types of echo traces were labeled as “0” for single fish, “1” for multiple fish, and “2” for fish school. In the dataset, a total of 80,541 echo traces were extracted by the edge detection algorithm, of which 49,231 were single-fish echo traces, 25,145 multi-fish echo traces, 25,145 single-fish echo traces, and 6165 fish school echo traces. The dataset was randomly divided into a training set of 329 images (80%) and a validation set of 82 images (20%). Fig. 7Example of acoustic echograms. (a) Original acoustic echogram. (b) Acoustic echogram after preprocessing. (c) echo trace labeling. Example of acoustic echograms. (a) Original acoustic echogram. (b) Acoustic echogram after preprocessing. (c) echo trace labeling. Model running environment The experiments in this study were all conducted in the same computing platform, as presented in Table 1. The used deep learning framework was Pytorch 1.13.1 + cu117 + cudnn8.0, with an NVIDIA GeForce RTX 3060 GPU and Windows 11, and the CPU model is 12th Gen Intel(R) Core (TM) i7-12700 H 2.30 GHz. The IDE was PyCharm, with a programming environment of Python 3.9. Table 1Experimental configuration.ItemsTypeOSWindows 11GPUNVIDIA GeForce RTX 3060CPU12th Gen Intel(R) Core(TM) i7-12700 H 2.30 GHzIDEPyCharmProgramming languagePython 3.9Deep learning frameworkPytorch 1.13.1 + cu117 + cudnn8.0 Table 1Experimental configuration.ItemsTypeOSWindows 11GPUNVIDIA GeForce RTX 3060CPU12th Gen Intel(R) Core(TM) i7-12700 H 2.30 GHzIDEPyCharmProgramming languagePython 3.9Deep learning frameworkPytorch 1.13.1 + cu117 + cudnn8.0 Experimental configuration. Training was performed using theYOLOv8n model from the YOLOv8 family, the images were resized to 640 × 640, the batch size of the training process was set to 4, and the epoch was set to 1500 iterations, and training was stopped early when there was no significant improvement in average accuracy after 300 epochs. The learning rate used during model training was 0.01, with an SGD momentum of 0.937 and an optimizer weight decay of 0.0005; all other training parameters were set to the default values of the YOLOv8 network. Table 2 shows the main training hyperparameters. Table 2Experimental parameter setting.ParameterConfigurationEpochs1500Patience300Batch size4OptimizerSGDMomentum0.937Weight decay0.0005Learning rate0.01Image size640 × 640 Table 2Experimental parameter setting.ParameterConfigurationEpochs1500Patience300Batch size4OptimizerSGDMomentum0.937Weight decay0.0005Learning rate0.01Image size640 × 640 Experimental parameter setting. Model running environment In order to comprehensively and objectively assess the performance of the proposed model, we utilized the mean average precision (mAP) to measure the model’s accuracy and evaluate the object detection results. TP represents the true positives (the number of target frames that are correctly predicted to be in the positive category), FP represents the false positives (the number of target frames that are incorrectly predicted to be in the positive category), and FN represents the false negatives (the number of target frames that are actually in the positive category but are incorrectly predicted to be in the negative category). Precision is the proportion of cases classified as positive and positive in the entire sample. Accuracy is calculated using Eq. (4):4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Precision=\frac{TP}{TP+FP}$$\end{document} Recall represents the proportion of actual positive cases to the predicted positive cases. Recall is calculated using Eq. (5):5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Recall=\frac{TP}{TP+FN}$$\end{document} AP is the area under the precision-recall curve and represents the average precision of the model at different recall rates. It is defined as Eq. (6):6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$AP={\int}_{0}^{1}PRdx$$\end{document} mAP (mean average precision) is a comprehensive metric used to assess the performance of object detection models across multiple categories. It calculates the average precision (AP) for each category and then takes the average of these AP values to gauge the model’s performance. where C represents the number of categories in the dataset. The higher the mAP value, the better the model’s performance; in this study, C = 3. It is defined as Eq. (7):7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$mAP=\frac{1}{C}\sum_{i=1}^{C}A{P}_{i}$$\end{document} mAP0.5 is the value of AP when the IoU threshold is 0.5. The AP for each IoU threshold value from 0.5 to 0.95 with an increment step of 0.05 is calculated and averaged to obtain mAP0.5:0.95. In addition, the number of parameters and FLOPs are also metrics for lightweight models. The network structure mainly determines the number of parameters. The number of floating-point operations (FLOPs) is the number of calculations the model needs to perform, which is used to evaluate the computational power of the model; the smaller the FLOPS is, the lower the computational power required by the model, and the simpler the model is. Process of model test In order to quantitatively evaluate the performance of the proposed YOLOv8-SBE, we performed tests on the dataset. We conducted ablation experiments to evaluate the importance of BiFPN, ScConv, EMA, and soft-NMS modules in the model and gain insight into their impact on the model performance. In addition, we compare our proposed model with other state-of-the-art target detection frameworks, providing evidence that the target detection framework proposed in this paper outperforms other popular target detection frameworks in terms of accuracy. Results Result of model test Table 3 summarizes the training results and statistics of mAP. As can be seen from the table, the mAP0.5:0.95 rises significantly, from 55.3–58.2%, an increase of 2.9%, and the mAP of the fish population rises the most, which indicates that the model’s detection accuracy is improved in the occluded target scene. The method presented in this paper enhances the mAP for each target category compared to the benchmark YOLOv8 model. Table 3Comparison of map before and after improvement.ClassmAP0.5 Ours/Baseline%mAP0.5:0.95 Ours/Baseline%All0.795/0.790.582/0.553Single fish0.716/0.7140.477/0.444Multiple fish0.808/0.8070.583/0.566Fish school0.861/0.8480.686/0.65 Table 3Comparison of map before and after improvement.ClassmAP0.5 Ours/Baseline%mAP0.5:0.95 Ours/Baseline%All0.795/0.790.582/0.553Single fish0.716/0.7140.477/0.444Multiple fish0.808/0.8070.583/0.566Fish school0.861/0.8480.686/0.65 Comparison of map before and after improvement. We compared the precision, recall, mAP0.5 and mAP0.5:0.95 of YOLOv8-SBE and YOLOv8n over 200 runs and plotted the curves as shown in Fig. 8. From Fig. 8, it can be seen that the proposed YOLOv8-SBE, a lightweight model, slightly outperforms the baseline model YOLOv8n in terms of precision, and slightly underperforms the baseline model in terms of recall. In the mAP0.5 curve comparison, the precision of the two is the same, while in the mAP0.5:0.95 comparison curve, the precision of YOLOv8-SBE is significantly higher than that of the baseline model, which is consistent with the results in Table 3. Fig. 8Performance curves of YOLOv8-SBE and YOLOv8 models. Performance curves of YOLOv8-SBE and YOLOv8 models. From Fig. 9, we can see that the loss curves of both YOLOv8-SBE and YOLOv8n decrease over 1500 calendar hours until they stabilize. The various types of loss curves of YOLOv8-SBE and YOLOv8n have comparable convergence speeds on the validation set, but in the training set, the dfl_loss curve of YOLOv8-SBE converges slightly slower than that of the baseline model YOLOv8n, and the loss values are slightly larger than those of YOLOv8n. This indicates that the feature extraction ability of the YOLOv8-SBE model slightly decreases in the lightweighting process. Fig. 9Comparison of loss function. Comparison of loss function. A comparison of YOLOv8-SBE and YOLOv8 detection results is shown in Table 4, from that our proposed YOLOv8-SBE improves the detection accuracy, speed, and model size. Among them, the accuracy, mAP0.5 and mAP0.5:0.95 of the YOLOv8- SBE model is 78.3%, 79.5% and 58.2%, which are 2.3%, 0.5% and 2.9% higher than that of YOLOv8n, respectively, but decrease 1% in recall. In addition, the memory size of the YOLOv8-SBE model is 3.8 MB, which is about 3/5 of that of the YOLOv8n. The GFLOPs of YOLOv8-SBE are reduced by 18.5%, and most importantly, in terms of the parameters, compared to the current most lightweight YOLOv8n model (3006223 parameters), YOLOv8-SBE uses only 1,801,397 parameters, a decrease of about 40%. These results show that our lightweight improvements to YOLOv8 significantly reduce parameter usage and computation, making the model lightweight and easy to embed in the echosounder. We complete the theoretical modeling of fish detection for the echosounder, and at the same time, we improve the target detection accuracy as much as possible to guarantee the recognition accuracy of occluded and small targets. Table 4Comparison of hull number recognition by original and improved algorithms.MethodP/%R/%mAP0.5/%mAP0.5:0.95/%Params/MFLOPS/GModel size/MBYOLOv8n76 72.1 7955.338.16.1YOLOv8-SBE(Ours) 78.3 71.1 79.5 58.2 1.8 6.6 3.8 Table 4Comparison of hull number recognition by original and improved algorithms.MethodP/%R/%mAP0.5/%mAP0.5:0.95/%Params/MFLOPS/GModel size/MBYOLOv8n76 72.1 7955.338.16.1YOLOv8-SBE(Ours) 78.3 71.1 79.5 58.2 1.8 6.6 3.8 Comparison of hull number recognition by original and improved algorithms. Fish detection result Since our dataset is characterized by small, dense and occluded targets, we hide the detected target labels during detection to ensure clear images. As shown in Fig. 10a,c show the results detected by the baseline model YOLOv8n, and Fig. 10b,d show the results detected by YOLOv8-SBE, with a single fish in the red prediction box, multiple fish in the pink prediction box, and fish school in the orange prediction box. We can clearly see that YOLOv8-SBE has an obvious advantage in the detection of single fish, which meets our expected experimental goal of reducing the number of missed detections significantly. In multi-fish detection, YOLOv8-SBE has a slight advantage. In the detection of fish, the results of the two models remain consistent. Fig. 10The fish detecting results of the baseline model and proposed model, (a, c) the original model, (b, d) the proposed model. The fish detecting results of the baseline model and proposed model, (a, c) the original model, (b, d) the proposed model. Ablation experiments We conducted ablation experiments to validate the improved validity and reliability of the YOLOv8-SBE detection model and to explore the specific contribution of each improvement strategy to optimize the detection model. The models used in these experiments were trained on a private dataset and experimental conditions such as equipment, experimental environment, and number of iterations were kept constant for all experiments. We chose parameters and FLOPs to measure the size and complexity of the models and mAP0.5, mAP0.5:0.95 to measure the accuracy of the detection models. The experimental results are shown in Table 5, where “√” indicates the corresponding improvement strategy of the model. Table 5Ablation experiment results of YOLOv8-SBE.YOLOv8nC2f_ScConvBiFPNEMASoft-NMSmAP0.5/%mAP0.5:0.95/%Params/MFLOPS/G1√7955.33.018.12√√79.453.52.817.53√√76.154.41.997.14√√77.954.23.028.35√√78583.018.16√√√79.154.91.86.77√√√ 80.4 55.12.837.78√√√76.3531.997.29√√√√79.955.51.86.610√√√√√79.5 58.2 1.8 6.6 Table 5Ablation experiment results of YOLOv8-SBE.YOLOv8nC2f_ScConvBiFPNEMASoft-NMSmAP0.5/%mAP0.5:0.95/%Params/MFLOPS/G1√7955.33.018.12√√79.453.52.817.53√√76.154.41.997.14√√77.954.23.028.35√√78583.018.16√√√79.154.91.86.77√√√ 80.4 55.12.837.78√√√76.3531.997.29√√√√79.955.51.86.610√√√√√79.5 58.2 1.8 6.6 Ablation experiment results of YOLOv8-SBE. In Table 5, the first row shows the detection results of the baseline model YOLOv8n network, the benchmark for this experiment. The second row shows the results after adding the C2f_ScConv module to the backbone section. This module utilizes the redundancy of the intermediate feature maps to improve the feature extraction efficiency and reduce the number of parameters and computations. We find a 0.4% improvement in mAP0.5, a 6.7% decrease in the number of parameters, and a 7.4% decrease in FLOPs compared to the baseline model. The third line describes the results after introducing the BiFPN structure in the neck section. BiFPN simplifies the network structure by connecting the original input and output nodes in the same layer, which is a key part of the lightweighting of this model and decreases the number of parameters by 33.3% and FLOPs by 12.3% compared to the baseline model. The fourth row shows the results after adding the EMA attention module, EMA is suitable for a wide range of visual tasks and allows the model to focus more on smaller objects; this module is used alongside C2f_ScConv, and as shown in row 7, mAP0.5 reaches a maximum value of 80.4%. The fifth row shows the experimental results when replacing NMS with soft-NMS, and combining rows 9 and 10, and it is clear that soft-NMS is the key to improving mAP0.5:0.95 by 2.7% compared to the baseline model. Rows 6, 7, and 8, on the other hand, show a two-by-two combination of modules to achieve an improvement in accuracy or lightness, but not both. In row 9, simultaneous application of the modules C2f_ScConv, BiFPN, and EMA improves accuracy and lightness compared to the baseline model. Line 10, on the other hand, shows the final results of our proposed YOLOv8-SBE model, which shows that the optimal results are achieved in the mAP0.5:0.95, number of parameters, and FLOPs metrics, and the mAP0.5:0.95 reaches the highest value of 58.2%, with an increase of 2.9%, while the lightness metrics of the number of parameters, and the FLOPs, reach the lowest value of 1.8 m, respectively, 6.6GFLOPs, down 40% and 18.5%, respectively, and mAP0.5 rises 0.5% relative to the baseline model. These experimental results demonstrate that our proposed YOLOv8-SBE model achieves lightweight improvement by substantially reducing model parameters based on improved detection accuracy. Comparative experiments This section compares the experimental results of the proposed method with other state-of-the-art lightweight target detection models. The experimental results are compared with other state-of-the-art lightweight target detection models on the dataset. Table 6 shows that YOLOv8-SBE outperforms the other detection models regarding mAP, computation, and model size. Compared with the SSD algorithm, mAP0.5 and mAP0.5:0.95 improve by 37.9% and 26.1%, respectively, and reduce the number of parameters by 24.49 × 106, which reduces the computation by 56.15 GFLOPs; compared with the EfficientNet algorithm, mAP0.5 and mAP0.5:0.95 improve by 57.1% and 42.9%, respectively, and reduce the number of parameters by 12.07 × 106 and a reduction of 18.46 GFLOPs in computation; mAP0.5 and mAP0.5:0.95 are improved by 3.2% and 13.8%, respectively, with a decrease in the number of parameters by 5.22 × 106, and the computation volume by 9.2 GFLOPs for YOLOv8-SBE compared to YOLOv5s algorithm; Compared to the YOLOX algorithm, mAP0.5 and mAP0.5:0.95 are improved by 42.2% and 35.2%, respectively, with a decrease in the number of parameters by 7.14 × 106, and the computation volume by 20.16 GFLOPs for YOLOv8-SBE; Compared with YOLOv6n, mAP0.5 and mAP0.5:0.95 are improved by 2.4% and 9.8%, respectively, with a decrease in the number of parameters by 2.83 × 106, and the computation volume by 4.74 GFLOPs for YOLOv8-SBE; Compared to the baseline model YOLOv8n, mAP0.5 and mAP0.5:0.95 are improved by 0.5% and 2.9%, respectively, with a decrease in the number of parameters by 1.2 × 106, and the computation volume by 1.5 GFLOPs for YOLOv8-SBE; Compared with the YOLOv10 algorithm, mAP0.5 and mAP0.5:0.95 are improved by 7.1% and 7.3%, respectively, with a decrease in the number of parameters by 0.8 × 106 and a decrease in the amount of computation by 2.6 GFLOPs; compared with the YOLOv11 algorithm, mAP0.5 and mAP0.5:0.95 are improved by 4.6% and 5.5%, respectively, with a decrease in the number of parameters by 0.7 × 106 and 2.1 GFLOPs less computation; The experimental results show that for dense, occluded and small targets, the YOLOv8-SBE model outperforms the current mainstream lightweight detection models, ensuring the highest mAP and the best overall performance while taking accuracy into account. It meets the lightweight target detection model requirement for echosounders and has higher practical application value. Table 6Comparative experiments—different models.ModelmAP0.5/%mAP0.5:0.95/%Params/MFLOPs/GSSD41.632.126.2962.75EfficientNet22.415.313.8725.09YOLOv5s76.344.47.0215.8YOLOX37.323.08.9426.76YOLOv6n77.148.44.6311.34YOLOv8n7955.33.018.1YOLOv10n72.450.92.69.2YOLOv11n74.952.72.58.7YOLOv8-SBE(Ours) 79.5 58.2 1.8 6.6 Table 6Comparative experiments—different models.ModelmAP0.5/%mAP0.5:0.95/%Params/MFLOPs/GSSD41.632.126.2962.75EfficientNet22.415.313.8725.09YOLOv5s76.344.47.0215.8YOLOX37.323.08.9426.76YOLOv6n77.148.44.6311.34YOLOv8n7955.33.018.1YOLOv10n72.450.92.69.2YOLOv11n74.952.72.58.7YOLOv8-SBE(Ours) 79.5 58.2 1.8 6.6 Comparative experiments—different models. Conclusion This study provides a feasible lightweight method, YOLOv8-SBE, based on YOLOv8, for fish detection and identification in echosounders. In previous studies, researchers have proposed methods for marine life recognition that focus on improving accuracy, ignoring the requirements of the model size on the hardware itself, making it difficult to carry out embedded work and possibly affecting the energy consumption of the echosounder. This study pays special attention to model size in the method design to address this issue. We adopted a series of improvements to reduce the model parameters. First, all the C2f are replaced with C2f_ScConv modules in the backbone network, and one Conv in the original bottleneck is replaced with ScConv, which reduces the parameters and computation while ensuring that the accuracy is not degraded. Second, a lightweight structure named BiFPN is introduced in the feature enhancement and fusion stage to replace the PAN-FPN structure in the neck network, improving the target’s perception and recognition and significantly reducing the number of parameters. In addition, we introduce the EMA attention module in the neck network, which has relatively small computational and parameter requirements and low model complexity, effectively improving the model recognition accuracy. Finally, we select soft-NMS, which is more adapted to dense and occluded target recognition scenarios, to improve the model detection accuracy. The experimental results show that compared with the traditional lightweight YOLOv8n detection network, YOLOv8-SBE requires only 1.8 × 106 parameters and 6.6 GFLOPs of operation, which reduces the number of model parameters by 40% and the model operation by 18.5%. Regarding accuracy, the mAP0.5 detection accuracy of YOLOv8-SBE reaches 79.5%, an improvement of 0.5%, and the mAP0.5:0.95 is improved by 2.9%. Based on the guaranteed detection accuracy, the model drastically reduces the number of parameters and the amount of computation, which makes it easier to deploy on echosounders with limited memory and computational resources, making it more suitable for underwater fish detection tasks. In our subsequent research, we will focus on embedding the YOLOv8-SBE model into an echosounder, which requires a comprehensive consideration of model lightweighting, device performance, development environment, and real-time capability. In terms of lightweighting, our model will undergo improvements, resulting in reduced parameters, GFLOPs, and model size. However, further optimizations are necessary to better adapt it to the device. Common optimization methods include pruning and quantization, which will help further reduce the model size and improve inference speed. Regarding device performance and the development environment, we will select model formats such as ONNX, TFLite, or TensorRT based on the hardware specifications of the echosounder. We will also take into account the sounder’s operating system and computational resources to ensure smooth integration. For real-time performance, to maintain the stability and efficiency of YOLOv8-SBE in practical applications, we will load image preprocessing tasks directly into the echosounder, which reduces latency caused by data transmission, improving detection efficiency and enabling the system to handle complex underwater environments. The above considerations will facilitate the deployment of YOLOv8-SBE in echosounders and ensure the system operates efficiently in real-world marine exploration tasks.