A multi-scale feature fusion and multi-head detection method for densely stacked and interspecies similar algae
By improving the skeleton, neck structure, and detection head of the YOLOV8 model, and combining it with the WIOUV3-FocalLoss loss function, the detection challenges of densely stacked and interspecies similar algae were solved, achieving higher detection accuracy and recognition precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHWEAT UNIV OF SCI & TECH
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing algae detection algorithms suffer from issues of missed detection, false detection, and misclassification when identifying densely stacked and interspecifically similar algae, especially when the background is complex, heavily occluded, or the image texture features are unclear, resulting in poor recognition performance.
The skeleton structure of YOLOV8 is replaced with RFA-SWINTRANSFORMER, the neck structure of YOLOV8 is improved and the detection head is replaced with ASFF-Detect. At the same time, WIOUV3-FocalLoss loss function is used to enhance feature extraction, fusion and expression capabilities, and improve the convergence performance of the network model.
It improves the detection accuracy of densely stacked and interspecies similar algae, with Map improving by 1.05% and Precision by 1.90%, significantly improving the problems of missed detection and false detection, and enhancing the accuracy of identifying images with complex backgrounds and mixed algae.
Smart Images

Figure CN122156878A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of algae identification technology, and in particular to a multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae. Background Technology
[0002] Algae, as an important group of organisms, are tiny in size and simple in structure, yet diverse in species, playing a vital role in maintaining the balance of aquatic ecosystems. Traditional methods for algae detection and identification mainly rely on microscopic examination, which is slow, costly, and requires a high level of expertise from operators and analysts. To improve detection speed and identification accuracy, most studies both domestically and internationally have employed computer vision methods for analysis and identification, demonstrating significant effectiveness.
[0003] Traditional target detection algorithms mainly include the YOLO series, SSD, and RCNN algorithms. In recent years, these target detection algorithms have achieved good results in underwater small target recognition, pest detection, and defect detection. Fu et al. proposed an improved convolutional neural network underwater small target detection method that combines region extraction and Hu moment features, incorporating Hu moment features into the CNN network to enhance feature representation capabilities; Shi et al. incorporated a self-attention mechanism into the YOLOv5 network to solve the recognition defects of long-distance target features; Li et al. proposed the YOLOv8-TLC algorithm based on the YOLOv8n model, introducing a new detection head, LSK-Attention mechanism, TSP module, and C2f-DS module, which improved the detection accuracy and efficiency of the model and improved the recognition effect for sparse defect features.
[0004] Soon after, the YOLO series algorithms were gradually accepted and recognized in the field of object detection due to their advantages such as high efficiency, convenience, small parameter size, and high learning efficiency. They also demonstrated their superior performance in the field of biology. Chu Zhen et al. proposed an algorithm based on the YOLOV3 algorithm with an improved SPP structure, which increased the Map value by 4.24 percentage points compared to the YOLOV8 baseline algorithm. However, there is still room for improvement in detecting blurry, clumped, and incomplete algae. Wang Lucai et al., based on the YOLOV5 algorithm and combined with improvements in delayed resampling, improved the detection performance of algae with long-tailed distributions in real-world situations. However, the fit of the predicted bounding boxes and the convergence performance of the loss function were not improved. Lin et al., based on the YOLOV8 algorithm, combined the "aggregation and distribution" mechanism with the "attention scale sequence fusion" module, which improved mAP@50 by 4.3% compared to the YOLOV8 baseline algorithm, solving the constraint on detection accuracy caused by scale changes. However, for algae with relatively large morphology, there is still a significant difference between the ground truth bounding box and the predicted bounding box.
[0005] Subsequently, the YOLO series of algorithms have been gradually used in algae research, but certain shortcomings still exist in identification and detection. Liu et al., in the field of water pollution, improved and replaced the YOLOV5 network model skeleton structure with ShuffleNetV2, inserted an ECA attention mechanism, and used an edge filtering algorithm to preprocess algae images. They applied random-scale masking to the algae images and adjusted the brightness and contrast. Both the pre- and post-processed images were used in the training of the neural network, and the GhostConv module was used for lightweight processing. The map resolution reached 98.10%, an improvement of 12.50% compared to the original algorithm. However, the processed model performed poorly in detecting algae with low brightness and densely packed algae. To improve underwater target detection, especially for densely packed microalgae, Chen et al. replaced the YOLOv8 backbone network with a Swin-Transformer network structure. This resulted in a more accurate algae target detection algorithm, better eliminating the interference of water ripples in the underwater background. However, significant missed detections still occurred for some sparse algae, and the detection quality of selected algae species was extremely poor in mixed algae images, sometimes misidentifying them as background. This is because... The receptive field of a convolutional module is a fixed-scale receptive field. Targets that are too small will be filtered out during the convolution operation, leading to significant omissions in feature extraction. John et al. proposed a target detection neural network applicable to various scenarios based on a combination of Bifpn and YOLO algorithms. They used the Bifpn structure to improve the Concat feature fusion module. However, this approach resulted in significant omissions for some larger algae, and ghosting and feature fabrication occurred when recognizing overlapping algae, causing the predicted and ground truth bounding boxes to not perfectly overlap. Furthermore, it led to severe misjudgments or misidentification of algae as background in images with too many or too few targets. When algae themselves resembled the background, recognition errors were even more difficult to avoid. Yan et al. studied the YOLO algorithm, replacing the original loss function with the Focal-Loss loss function and adding an ASFF attention module before the detection head, thus improving the performance of the detection head and solving errors in feature representation and feature reconstruction. Compared with the original algorithm, the map performance was improved by 3.33%, and the feature fusion capability was quantitatively improved in the field of multi-target processing and reconstruction. However, due to the lack of attention, the detection effect of low-visibility anaerobic algae was poor, and the recognition quality of algae similar to the background or interspecies was greatly reduced. Research on algae recognition using the YOLO algorithm has improved the detection quality, but the recognition quality of algae targets with complex backgrounds, severe occlusion, and unclear image texture features is generally poor, which urgently needs improvement. Moreover, even EfficientNet cannot guarantee complete correct recognition of actual algae images with interspecies similarity and random mixing, which is the current difficulty and pain point in algae target detection algorithm research. Summary of the Invention
[0006] The purpose of this invention is to propose a multi-scale feature fusion and multi-head detection method for densely stacked and interspecies similar algae to address the problems existing in the prior art. First, the backbone structure of YOLOV8 is replaced with an RFA-SWINTRANSFORMER structure to enhance the network's feature extraction capability for densely packed algal targets. Second, an improved YOLOV8 neck structure based on attention mechanisms such as Bifpn-Concat and CAFM is used to improve the feature fusion and feature expression modules, enhancing the ability to process and express algal feature information with dense arrangement and complex boundary features, as well as the feature fusion performance. Addressing the issues of insufficient small target detection capability and confusion in multi-category algal detection in the YOLOV8 algorithm's detection head, this invention replaces the original YOLOV8 detection head with an ASFF-Detect module, reducing the probability of misidentifying targets as background and the probability of misclassification. Finally, based on the network model improvement, a WIOUV3-FocalLoss loss function is proposed to improve the network model's convergence performance.
[0007] To achieve the above objectives, the present invention provides the following solution: A multi-scale feature fusion and multi-head detection method for densely stacked and interspecies-similar algae includes: Construct a dataset of algal samples and perform data preprocessing; The algae detection model was trained using the preprocessed dataset; wherein the algae detection model adopted the improved YOLOV8 model, and the model improvement points included: replacing the skeleton structure of YOLOV8, improving the neck structure of YOLOV8, and replacing the original detection head of YOLOV8. Dense algae detection was performed using a trained algae detection model.
[0008] Optionally, the data preprocessing includes: The sample data was processed using random mosaic and rotation scaling image enhancement techniques and adaptive image filling techniques.
[0009] Optionally, improvements to the YOLOv8 model include: The skeleton structure of YOLOV8 was replaced with the RFA-SWINTRANSFORMER structure; YOLOV8 neck structure based on attention mechanisms such as Bifpn-Concat and CAFM; The original detection head of YOLOV8 was replaced with the ASFF-Detect detection head module.
[0010] Optionally, the algae detection model includes: a skeletal structure, a neck structure, and a head structure; The skeleton structure is used to receive preprocessed algae image data, perform multi-scale feature extraction operations, and obtain multi-scale feature map information, namely feature map information at scales P1-P5. The neck structure is used to perform feature fusion and improvement on multi-scale feature map information to obtain optimized feature map information. The head structure is used to perform target detection using multiple detection heads on optimized feature map information.
[0011] Optionally, the skeleton structure includes five feature layers, P1-P5. The P1 feature layer uses an RFAConv module alone, and the four feature layers of different scales, P2-P5, all use RSBC repeating units formed by cascading RFAConv, SWIN-BLOCK, and CoordGate modules in sequence. The RFAConv module and the SWIN-BLOCK module are used alternately; The RFAConv module is a convolutional module that targets the receptive field and has an attention mechanism; The SWIN-BLOCK module uses a global self-attention mechanism to connect the extraction results of each level of feature extraction across regions. It includes an MSA window shifting self-attention mechanism, a 2-layer MLP, and a BN layer, and connects the various sub-modules in a residual connection manner. The CoordGate module is an attention mechanism based on coordinate position. First, it arranges the positions of global image regions according to the size of the receptive field, and then uses a preset convolution to transform them according to the spatial dimension. During the transformation, the horizontal and vertical position information are arranged with different tensors. The encoding includes the position encoding of the feature regions.
[0012] Optionally, the neck structure adopts a Bifpn structure based on a bidirectional feature propagation mechanism, and the neck structure includes: a feature fusion repeating unit BCCC and a feature expression repeating unit ABCGC; The Feature Fusion Repeating Unit (BCCC) is used to integrate feature map information at multiple scales from P3 to P5 based on three consecutive upsampling feature fusions. The BCCC is composed of a single upsampling module (Upsample), a feature stitching module (Concat), a spatiotemporal attention mechanism (CBAM), and a region connectivity feature integration structure (C2f-CAFM-GSConv) module cascaded in sequence. The C2f-CAFM-GSConv module is used to perform local cross-module interactive learning by eliminating parameter redundancy and suppressing information loss due to feature map size parameter transformation, thereby further improving the ability to fuse and represent features that are similar to the target and background and that are stacked between targets. The spatiotemporal attention mechanism CBAM uses both average pooling and max pooling to aggregate the spatial information of the feature map. The feature representation repetition unit ABCGC is composed of AKConv module, Concat module, GAM attention module and C2f-CAFM-GSConv module cascaded in sequence, and is used to restore the feature map information of P3-P5 to the target anchor box information. The AKConv module obtains the corresponding offset by performing convolution operations, and uses a method of varying stride according to the convolution kernel size to perform size transformation to one-dimensional feature reshaping and column stacking, flexibly adjusting the sample shape; The GAM attention module, while incorporating the advantages of CBAM attention, also incorporates the concept of 3D reconstruction. It directly preserves feature map regions in a pool-free manner and maximizes the preservation of feature fusion results from convolutions at the same level.
[0013] Optionally, the head structure includes four detection heads, which are used to receive the results of feature recovery and restoration at the P2-P5 scale, respectively; The head structure adopts the ASFF attention mechanism to improve the original detection head, filters the learned spatial conflict information, strengthens the weight of such feature outputs during feature restoration, and suppresses inconsistency by adjusting it step by step according to the training situation during the training iteration.
[0014] Optionally, in the C2f-CAFM-GSConv module: The C2f submodule consists of one or more convolutional modules and a fully connected layer. The C2f submodule aggregates multi-scale information by concatenating the outputs of different BottleNeck modules with the original feature maps. CAFM attention mechanism is a two-branch attention mechanism that, through Adjusting the number of channels promotes information fusion, and grouping by dimension and randomly sorting within the group, the output tensors within each group are spliced by dimension to form a preset size output; The GSCONV submodule is a channel-dense convolution designed to preserve the hidden connections between each channel to the maximum extent possible.
[0015] Optionally, the Wiou-v3-FocalLoss loss function is used to train the algae detection model, as shown in the following table: ; ,in ; ,in ; ; in, , W represents the width of the anchor frame, H represents the height of the anchor frame, S represents the area of the anchor frame, x and y represent the x and y coordinates of the anchor frame, respectively, all subscripts in the formula gt represent the ground truth bounding box, pt represent the predicted bounding box, and exp represent the exponential operation with base e. This represents a simple scalar multiplication operation. This represents the WIOU loss function value. This indicates the probability or confidence level that the box is predicted correctly, and log represents the logarithm to base e. This represents the IOU loss function value. , , , This represents the corresponding loss function value. Indicates the attenuation factor, Indicates outlier degree, Indicates gradient gain. This represents the monotonic focusing coefficient.
[0016] The beneficial effects of this invention are as follows: This invention employs the RSBC backbone structure to broaden the receptive field and improve the feature extraction performance of the network model through an attention mechanism incorporating gating and sliding windows. The Neck structure uses a Bifpn topology to accommodate parameter information learned at the same level across time intervals, enabling more advanced feature fusion. Simultaneously, using the C2f_CAFM_GSConv module as the main thread, it intentionally enhances the ability to capture feature information of various targets in local branches and enhances the ability to capture spatial location relative to the target in global branches. Furthermore, in feature reconstruction and representation, it uses a method of varying stride based on the convolutional kernel size for size transformation and... This invention adjusts the sample shape to fit the output of the detection head and uses a global attention mechanism to capture and retain target feature information across modules, scales, and time and space, enhancing the feature fusion and representation capabilities for algal feature information with complex feature maps. Furthermore, the addition of the ASFF-Detect 4-head detection head improves the problem of misidentification of certain algal targets due to their small size. A WIOUV3-FocalLoss loss function is proposed to strengthen the focus on the boundary of the target location, improving the convergence performance of the network model and increasing the prediction accuracy of the network for some difficult-to-detect algal targets. Compared with baseline algorithms, this invention improves map accuracy by 1.05% and precision by 1.90%, and its overall performance is significantly better than most mainstream target detection algorithms. In actual detection, it can accurately identify algal target information in densely packed, inter-species similar, and randomly mixed algal samples, significantly improving the problems of missed detections, false detections, misclassifications, and background misidentification in baseline algorithms. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a structural diagram of the ALGAE-YOLO network model according to an embodiment of the present invention; Figure 2 This is a structural diagram of the C2F-CAFM-GSConv module according to an embodiment of the present invention; Figure 3 This is a comparative diagram of the Bifpn structure and the PANet structure according to an embodiment of the present invention; wherein, (a) is a schematic diagram of the PANet feature network, and (b) is a schematic diagram of the Bifpn feature network; Figure 4This is a comparison chart of loss curves from an embodiment of the present invention. Figure 5 This is a schematic diagram illustrating the performance analysis of the loss function under different α parameters in an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the performance analysis of the loss function under different β parameters in an embodiment of the present invention; Figure 7 This is a schematic diagram illustrating the performance analysis of the loss function under different δ parameters in an embodiment of the present invention; Figure 8 This is a schematic diagram illustrating the performance analysis of the loss function under different γ parameters in an embodiment of the present invention; Figure 9 This is a comparison chart of the detection results of different target detection algorithms in this embodiment of the invention; Figure 10 The above is a comparison of the PR curves of various algae before and after the improvement of the YOLOV8 algorithm in this embodiment of the invention; where (a) is the PR curve of Anabaena, (b) is the PR curve of Cyclocarya, (c) is the PR curve of Dinoflagellate, (d) is the PR curve of Navicula, (e) is the PR curve of Stray Algae, and (f) is the PR curve of Tetracyclis. Figure 11 This is a record of the confusion matrix detection results according to an embodiment of the present invention; Figure 12 This is a bar chart comparing Map values under different IoU thresholds in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] This embodiment proposes a multi-scale feature fusion and multi-head detection method for densely stacked and interspecies similar algae, including: Construct a dataset of algal samples and perform data preprocessing; The algae detection model was trained using the preprocessed dataset; wherein the algae detection model adopted the improved YOLOV8 model, and the model improvement points included: replacing the skeleton structure of YOLOV8, improving the neck structure of YOLOV8, and replacing the original detection head of YOLOV8. Dense algae detection was performed using a trained algae detection model.
[0022] Specifically, in this embodiment, the dataset is constructed as follows: Due to the scarcity of publicly available datasets for freshwater algae, this embodiment uses a Hikvision hyperspectral camera to capture algae samples on slides observed under a Hikvision S300 optical biological microscope with a 20X objective and a 40X eyepiece. Relatively clear original algae images were collected and selected as initial images, which were then uniformly cropped after screening. Two-dimensional original images of algae were generated. After converting these original algae images from .bmp file format to .jpg format, this embodiment selected six algae species—Anabaena, Chronalla, Dinaflattate, Navicula, Straight Algae, and Tellathaphy Algae—as experimental research objects. The labelimg tool was used to label the images containing these six algae targets according to the principle of minimum bounding rectangle, creating a freshwater algae dataset. This dataset contains 1774 algae images. To meet the training requirements of deep learning algorithms, it was randomly divided into training, testing, and validation sets in an 8:1:1 ratio. The label distribution of this algae dataset is shown in Table 1.
[0023]
[0024] According to the distribution patterns of various algae annotations in Table 1, Anabaena has the most target labels, accounting for 45.05%, while Cyclocarya has the fewest, accounting for 6.86%. This indicates that the sample distribution in this data is extremely unbalanced, exhibiting a severe long-tail distribution. This leads to the problem that a small number of samples, such as Cyclocarya and Straight-chain Algae, have insufficient target features to learn, resulting in a decrease in the performance of deep learning training due to its dependence on the distribution of data volume. On the other hand, the real-world images suffer from uneven lighting and large differences in depth of field. Learning occluded target information and lighter-colored target information is more costly and difficult. In addition, the large size differences among different algae individuals make it difficult for the model to identify relatively small algae target information.
[0025] Based on the above analysis, in order to reduce the negative impact of the dataset's inherent features and the quality of the algae images on algae target feature extraction and learning, this embodiment uses random scaling, flipping, and mosaic techniques to enhance the dataset. This mitigates the drawbacks of insufficient feature learning for a small number of samples due to uneven data distribution and the inherent quality of the algae images. The expanded dataset exhibits a relatively balanced distribution of algae target labels, with a percentage range of only 3.25% between categories. The final number of algae target objects is 11,970, essentially resolving the problem of imbalanced original sample numbers and eliminating the impact of poor learning performance for some algae types caused by excessive deviation in the number of samples to be learned.
[0026] The experimental setup in this embodiment used an Intel Core i7-10750H CPU, an 8GB Nvidia GeForce RTX4060 GPU, and Windows 10, CUDA 11.3, PyTorch framework, and VSCode software. The hyperparameters used during training were batch_size=4, num_workers=8, train_epoch=100, val_period=10, momentum=0.937, warmup_epoch=3, weight_decay=0.0005, and the image size was [missing information]. The optimizer is SGD, employing data augmentation with a 50% probability of random scaling, a 10° rotation angle, and a 50% probability of mosaic transformation. The pre-trained weight model file passed during training is the officially released open-source yolov8n.pt. Unless otherwise specified, the neural network algorithms compared—YOLOv3, YOLOv5, YOLOv8, YOLOX, and RT-DETR—all use the same dataset and the same training, test, and validation set partitioning methods during training, prediction, and model evaluation, and their hardware and software environment configurations and initial hyperparameters are also identical. The algae detection model (Algae-YOLO network) used in this implementation is described below: In this embodiment, the dataset used for network model training, prediction, and evaluation is an expanded and balanced freshwater algae dataset. Existing target detection methods for microalgae detection suffer from problems such as large parameter count, slow training speed, and long training time. Furthermore, the similarity between algae species and background colors, small algae targets, and similar or densely stacked algae species also increase the difficulty for network models in identifying algae targets. To address these issues, this embodiment proposes a deep learning method based on multi-attention fusion, comprehensively adjusting the modules and performance of feature extraction, feature fusion, and feature representation, named ALAGE-YOLO. Figure 1As shown. This network has 39 layers, including a skeleton structure, a neck structure, and a head structure. In the preprocessing stage, random mosaic and rotation-scaling image enhancement techniques and adaptive image padding techniques were used to ensure that all images were resized uniformly during training. This ensures that feature information is fully incorporated into the network for learning. Furthermore, to improve the convergence capability of the network model, this embodiment employs the WIOU-FOCAL loss function to accelerate the convergence speed and ensure that the network model does not experience gradient bounce during training. On the other hand, to ensure that some smaller algae targets (such as Anabaena) are not missed during feature representation due to their small scale, this embodiment uses a four-head detection mechanism to simultaneously and effectively control the detection efficiency when reconstructing small-scale algae targets.
[0027] Further improvements to the YOLOv8 model include: The skeleton structure of YOLOV8 was replaced with the RFA-SWINTRANSFORMER structure; YOLOV8 neck structure based on attention mechanisms such as Bifpn-Concat and CAFM; The original detection head of YOLOV8 was replaced with the ASFF-Detect detection head module.
[0028] Specifically, in this embodiment, the YOLOV8 model is improved. First, the backbone structure of YOLOV8 is replaced with the RFA-SWINTRANSFORMER structure to enhance the network's ability to extract features from dense algal targets. The SWINTRANSFORMER structure refers to the repeating units in the backbone structure corresponding to the feature map size hierarchy (such as P2, P3, P4, P5), which are formed by cascading RFACONV-SWINBLOCK-Coordgate modules. Second, the YOLOV8 neck is improved based on attention mechanisms such as Bifpn-Concat and CAFM. The network structure is improved, and the feature fusion and feature expression modules are enhanced to improve the ability to process and express algal features with dense distribution and complex boundary features, as well as the feature fusion performance. Addressing the issues of insufficient small target detection capability and confusion in multi-category algal detection in the YOLOV8 algorithm's detection head, this embodiment replaces the original YOLOV8 detection head with the ASFF-Detect detection head module, reducing the probability of misidentifying targets as background and the probability of misclassification. Finally, based on the network model improvement, a WIOUV3-FocalLoss loss function is proposed to give the network model better convergence performance.
[0029] The backbone structure, except for the P1 feature layer which uses the RFAConv module alone, employs RSBC repeating units composed of cascaded RFAConv, SWIN-BLOCK, and CoordGate in the four feature layers of different scales (P2-P5). The RFAConv and SWIN-BLOCK modules are used alternately (the RFAConv module replaces the Conv module to expand the receptive field's recognition range and capability, while the SWIN-BLOCK module, a feature processing block dominated by a sliding window attention mechanism, replaces the C2f module). This achieves a halving of the feature map size and a doubling of the number of channels, avoiding the problem of significant omissions in the extraction of some stacked target features. Furthermore, the addition of a CoordGate gated attention mechanism improves the control over the relative position of the target region by creating a gated mask based on the static coordinates of the target location. RFAConv is a convolutional module with an attention mechanism targeting the receptive field; it uses feature transformation based on the original feature map size... The regular window shifting method extracts the spatial features of the original receptive field without additional parameters, and simultaneously performs corresponding convolution transformations according to the number of channels, expanding the scale range of the receptive field of the original feature extraction structure. Furthermore, the feature domains covered by each window do not contain duplicate target feature information. Subsequently, the SWIN-TRANSFORMER block connects the extracted results of each level of feature extraction across regions using a global self-attention mechanism. It includes an MSA window shifting self-attention mechanism, a 2-layer MLP, and a BN layer, and connects the various sub-modules with residual connections, achieving channel cascading and expansion. This is an efficient and low-latency batch processing attention mechanism. CoordGate is a coordinate-based attention mechanism. It first arranges the receptive fields according to the order of their global image region positions based on their size, and then uses... The convolution transforms the spatial dimension, arranging horizontal and vertical positional information with different tensors during the transformation. This encoding includes positional encoding of the feature regions, complementing the feature enhancement features of input signal-based attention mechanisms such as window attention and local receptive field widening. Therefore, the continuous operation of this RSBC repeating unit effectively captures the feature information and relative positional information of the target region, enhancing the feature extraction capture performance and laying a solid foundation for subsequent feature fusion and feature representation quality assurance. Finally, the SPPF feature pyramid, a fully connected structure spanning multiple stages, encompasses the feature information extracted from feature layers at scales P1-P5, achieving cross-scale feature fusion.
[0030] The neck structure employs a Bifpn structure based on a bidirectional feature propagation mechanism, including a feature fusion repeating unit (BCCC) and a feature expression repeating unit (ABCGC). While upsampling mechanisms allow neural networks to filter out effective information regions after feature extraction, and simultaneously halve the feature map size and channel number, they cannot efficiently extract accurate feature information. Unlike PANet, which has only one top-down and one bottom-up path, Bifpn, with its halved feature size, treats each bidirectional (top-down and bottom-up) path as a feature network layer and repeats the same layer multiple times. This takes into account parameter information learned across time and at the same level, achieving a higher level of feature fusion and providing feedback and self-correction during feature information restoration and reconstruction. The mechanism of Bifpn is shown in Equations 5-6. A comparison of the Bifpn and PANet structures is provided below. Figure 3 As shown in (a)-(b).
[0031] (Equation 1); (Equation 2); In Equations 1-2, Conv represents convolution operation, and Resize represents feature recovery. Indicates the initial weights. This represents the new weights after being biased by the intermediate layer. This represents the input parameters of the nth feature layer. This represents the parameters learned by the nth feature layer after biasing. This represents the output parameters of the nth feature layer. If n is not specified, it refers to which feature layer it is (e.g., P1, P2, etc.) and so on.
[0032] The BCCC module integrates target feature information extracted at small, medium, and large scales (P3-P5) based on three consecutive upsampling feature fusions. It consists of a single upsampling step, a feature concatenation module (Concat), a spatiotemporal attention mechanism (CBAM), and a region connectivity feature integration structure (C2f-CAFM-GSConv) cascaded sequentially. Building upon the Bifpn topology, the CBAM spatiotemporal attention mechanism utilizes both average pooling and max pooling to aggregate spatial information from the feature maps, effectively managing the fused target morphology and spatial location information. After inputting feature information parameters extracted from the previous stage, and passing through a convolutional-based attention fusion module and the C2f-CAFM-GSConv module (which uniformly exchanges local information), it improves the problem of poor fusion of target features deviating from the image center, resulting in anchor boxes not corresponding to the true target location. Ultimately, through three consecutive operations of the BCCC module, the problem of information distortion at the feature splicing point in the original C2f-Concat simple cascade structure was improved. It also balanced the problem of differences in recognition performance caused by dense target distribution, avoided the problem of background misidentification caused by the similarity between the target area and the background, and enhanced the model's ability to fuse features across stages, modules, and time and space, as well as its ability to control global target information.
[0033] On the other hand, the ABCGC module differs from the BCCC module because its feature representation structure needs to adapt to the approximate size range of the recovered target information. To avoid the serious loss of small-sized target information, the ABCGC structure proposed in this embodiment is composed of AKConv, Concat, GAM attention, and C2f-CAFM-GSConv modules cascaded sequentially, used for the restoration of target anchor box information from feature map information of P3-P5. Considering that some large-scale target feature maps are used in... In convolutional kernel feature reconstruction, the original boundary cannot be accurately grasped due to the large target size. This embodiment uses the AKConv module to obtain the corresponding offset by performing convolution operations, and uses a method of varying stride according to the convolution kernel size to transform the size to one-dimensional feature reshaping and column stacking, flexibly adjusting the sample shape. This overcomes the problem that ordinary convolutional modules cannot adjust sampling and reconstruction as needed for complex boundaries or stacked targets. In this embodiment, the convolution kernel is selected at scales P3-P5 as follows: , , On the other hand, there is a potential for misclassification when a single algae image contains multiple algae species. This problem is particularly pronounced when target categories with similar appearances and surface morphologies exist in the network's learning data (e.g., *Cyclotella* and *Alternaria* are morphologically similar). The GAM (Global Attention) mechanism, combining the advantages of CBAM (Concurrent Beam Acid Attention) with the idea of 3D reconstruction, directly preserves feature map regions in a pool-free manner, maximizing the preservation of feature fusion results from convolutions at the same level. This helps correct errors in feature fusion, such as misfusion at sub-feature map boundaries and incorrect recovery of stacked targets, thus resolving the issues of misidentification or missed identification caused by interspecies similarity or target stacking. Overall, the ABCGC (Analog-Based Classification-Generated Complexity) structure effectively corrects errors in the feature fusion module and also improves the ability to recover features with complex boundary information and varying degrees of target learning difficulty.
[0034] Overall, the entire Neck structure enhances the ability to fuse features across stages, modules, and time and space, as well as the ability to control global target information and correct errors in target information extraction and feature fusion. It ensures the ability to control and restore features of algae images with stacking and varying degrees of target distribution complexity, and enhances the performance of feature recognition and representation for algae targets with complex features and arbitrary shapes and sizes.
[0035] The head structure includes four detection heads, each responsible for receiving the results of feature recovery and reconstruction at scales P2-P5. An ASFF attention mechanism is used to improve the original detection heads, allowing for appropriate filtering of learned spatial conflict information. This strengthens the weight of such features during reconstruction and, through iterative adjustments based on training data, suppresses inconsistencies. This effectively addresses the severe omission of closely overlapping targets caused by overlapping, dense distribution, and random size distribution. Adding a small target detection head at P2 size alleviates the problem of missing detection for some algae (such as Anabaena, where a single target size is [missing information]). This addresses the issue of missing small targets (such as pixels) during detection and recognition. In summary, the ASFF-Detect quad-head detector proposed in this embodiment improves the detection performance for small and overlapping targets. Furthermore, the WIOU loss function weakens the penalty for geometric factors when the predicted bounding box and the ground truth bounding box have good overlap. Adding FocalLoss to the WIOU loss to constrain geometric dimensions avoids gradient divergence and oscillations caused by some points on the target boundary being far from the ground truth boundary, thereby accelerating convergence and improving the smoothness of the loss curve convergence, avoiding gradient bounce problems, and making the convergence value of the loss curve closer to 0, thus improving training efficiency and the overall stability of the model.
[0036] C2f-CAFM-GSCONV structural unit: The network model structure diagram of the C2f-CAFM-GSCONV structural unit is as follows: Figure 2 As shown. C2f itself consists of one or more convolutional modules and a fully connected layer. It concatenates the outputs of different BottleNeck modules with the original feature maps, and can better aggregate multi-scale information. This is beneficial for the perfect fusion of training and learning results at different scales, and enhances the feature representation ability of the model to a certain extent. Among them, the BottleNeck module is the original module inside the C2f structure, a three-layer stacked convolutional structure. Its working principle is: input 256 dimensions → 1×1 convolution reduces to 64 dimensions → 3×3 convolution processing → 1×1 convolution increases back to 256 dimensions. It reduces the computational complexity and number of parameters of the model, which is beneficial for maintaining and improving the feature representation ability. It can be used with residual connection structures to avoid the gradient explosion problem (gradient non-convergence), reduce memory usage, and improve network training efficiency. CAFM attention mechanism is a two-branch attention mechanism, which... Adjusting the number of channels promotes information fusion, and grouping by dimension with random sorting within each group, then concatenating the output tensors of each group by dimension to form... The output size facilitates cross-temporal fusion of extracted features by convolutional blocks. Based on this consideration, this embodiment enhances the ability to capture feature information of each target in local branches and enhances the ability to capture spatial location relative to the target in global branches. Its attention mechanism formula is shown in Equations 1-4. GSCONV is a channel-dense convolution that can preserve the hidden connections between each channel to the maximum extent, alleviating the information loss caused by feature map size changes and channel scaling during network model learning. It removes redundant and repetitive information in a linear transformation manner and is only used in the Neck structure, which can highlight the performance advantages of the attention mechanism. It also complements the fully connected structure of feature fusion and feature representation. In summary, the overall C2f-CAFM-GSConv module can perform local cross-module interactive learning by eliminating parameter redundancy and suppressing information loss due to feature map size parameter transformation, further improving the ability to fuse and represent features that are similar to the target and background and that are stacked between targets.
[0037] (Equation 3); (Equation 4); (Equation 5); (Formula 6); The symbols and parameters in Equations 3-6 have the following meanings: Q, K, and V are the query, value, and key matrices, respectively; Y represents the input features; Softmax is the activation function; and Attention represents the CAFM attention mechanism. It is a learnable scaling parameter, CS represents the in-channel rearrangement operation, W represents the convolution operation, and the subscript is... and The parameters representing convolution, This indicates the output of a local branch. This indicates the output of the global branch. This indicates the output of the CAFM module.
[0038] Wiou-v3-FocalLoss loss function: In the YOLOv8 object detection algorithm, DIoU is used as the boundary loss function to determine and classify positive and negative samples. DIoU is an IoU calculation method defined by the overlap area between the predicted and actual boundaries, and it introduces a center point distance penalty term, offering the advantage of stable gradient descent in dense object scenes. However, for some image samples with poor quality but good prediction results, while the DioU loss value converges, the convergence value is too high, far exceeding 0.1. Furthermore, DioU lacks a prediction term for the regression error between the ground truth and predicted boxes, which can lead to gradient bounce in some cases when the ground truth box deviates from the predicted box but exceeds the IoU threshold. It also lacks sensitivity to L1-Norm loss for targets of different scales, resulting in a rapid drop in loss value to a near-zero normal number when only the center point of the predicted box is close to the center point of the ground truth box, but the bounding box does not perfectly adhere to the most accurate edge of the target. In contrast, the WIOU loss function estimates the outlier of the Anchor Box (…). And it assigns small gradient gains to AnchorBoxes with low outliers, reducing the interference of low-quality samples on the lower bound of the loss function's convergence. Subsequent versions of WIOUV3 employ dynamically non-monotonic generalized intersection-union ratio gradient gains based on outlier. The allocation strategy, which takes into account the loss penalty term based on distance metric, improves the convergence speed of the network and adaptively adjusts the network's learning strategy in the comparison of outliers. On the other hand, the FocalLoss loss introduces a balancing factor ( Adjusting the weights of positive and negative samples ensures the model is not dominated by an excessive number of simple samples, thereby improving the detection accuracy of minority classes; and introducing a weighting factor ( The model is strengthened to focus more on samples that are difficult to distinguish (such as partially occluded or blurred targets), which improves the model's adaptability to complex scenes. To address these two issues, this embodiment uses the WIOUV3-FocalLoss loss function, which accelerates the network's convergence speed and ensures that the network model's loss function value converges below 0.001, eliminating gradient bounce and reducing the oscillation amplitude of the loss curve. It also accurately predicts the impact of the difference between the predicted and ground truth boxes on the loss of target information, improving the robustness of the network model during training. The formulas for the loss functions of various versions of WIOU are shown in Equations 7-10, and the formula for the Wiou-v3-FocalLoss loss function proposed in this embodiment is shown in Equation 10.
[0039] (Equation 7); ,in (Equation 8); ,in (Equation 9); (Equation 10); The symbols in Equations 7-10 have the following meanings: W represents the width of the anchor frame, H represents the height of the anchor frame, S represents the area of the anchor frame, x and y represent the x and y coordinates of the anchor frame, respectively, and all subscripts in these five formulas represent the true bounding box, pt represents the predicted bounding box, and exp represents the exponential operation with base e. This represents a simple scalar multiplication operation. This represents the WIOU loss function value. This indicates the probability or confidence level that the box is predicted correctly, and log represents the logarithm to base e. This represents the IOU loss function value. , , , This represents the corresponding loss function value, where v1, v2, etc., indicate versions with similar meanings. Indicates the attenuation factor, Indicates outlier degree, Indicates gradient gain. This represents the monotonic focusing coefficient.
[0040] Experimental analysis and discussion of results: Model evaluation metrics: To evaluate model performance and quantify its superiority, this experiment uses five parameters—Map50, F1s, P, R, and Map50-95—as evaluation metrics. Map50 represents the average accuracy of target recognition for each type of target, with a 50% IoU threshold for determining positive samples. F1s represents the correlation between Precision and Recall, used to assess the overall model performance. Precision represents the proportion of correctly detected algae samples out of the total number of detected targets. Recall represents the proportion of detected algae targets out of the total number of algae targets. Map50-95 represents the average of all Map values incremented by 5% between 50% and 95% IoU, used to measure the overall model performance under different IoU thresholds. All five parameters are expressed as percentages, and their corresponding formulas are shown in Equations 11-15.
[0041] ; ; ; ; ; In the formula, Represent the equation of the PR curve, where Represents the recall rate for each class; N represents the total number of target classes in the dataset to be tested; This indicates the number of correctly identified algal target samples. This indicates the number of incorrectly identified algae target samples; This indicates the number of missed detections of algae targets; The mean of the average precision at each IoU threshold (e.g., 0.5, 0.55, ..., 0.95).
[0042] Loss function performance study: Loss function analysis: To verify the effectiveness of the loss function in this embodiment, CIoULoss, DIoULoss, WIOUv1Loss, WIOUv2Loss, and WIOUv3Loss were used as control groups. Compared with the WIOUv3-FocalLoss loss function, under the same conditions of 100 training rounds and an initial loss value of 5, the convergence capabilities of CIoULoss, DIoULoss, WIOUv1Loss, and WIOUv2Loss were almost at the same level. WIOUv3Loss exhibited better smoothness than the aforementioned three loss functions. WIOUv3-FocalLoss, while maintaining a smooth loss function curve, had a convergence loss value around 0.4, significantly lower than the other loss functions, and its convergence speed was much faster. The actual loss function during training is shown in the figure below. Figure 4 As shown. This is because the WIOUv3-FocalLoss loss function accelerates the convergence efficiency for complex and high-quality samples by using a generalized convergence function. This makes the convergence ability of the network model stronger with the increase of training rounds, which enhances the focus on the boundary of the target location. It also avoids the fundamental problem of poor network model training caused by gradient bounce, which is not present in loss functions such as CIOU and DIOU.
[0043] Analysis of optimal parameter selection for WIOUV3-FocalLoss loss curve: The WIOUv3-FocalLoss loss function selected in this embodiment outperforms the loss functions used in the comparison. This is because the loss function contains... , , , Since the four parameters are somewhat independent, this embodiment uses the method of controlling variables to study the optimal combination of the four parameters separately. This embodiment uses the default parameters. , , , The initial conditions were studied separately, and the optimal value of map50 was recorded under the same conditions of training the algorithm for 100 epochs with the original YOLOv8 network as the baseline. The quantitative analysis of the parameters of the WIOUv3-FocalLoss loss function is shown in the bar chart below. Figures 5-8 As shown; where, Figure 5 For performance analysis of the loss function under different α parameters, Figure 6 For performance analysis of the loss function under different β parameters, Figure 7 For performance analysis of the loss function under different δ parameters, Figure 8 Performance analysis of the loss function under different γ parameters.
[0044] like Figures 5-8 As shown, in the fixed section When the parameters are set to default values, select respectively With parameters of 1.70, 1.75, and 1.80, under the same conditions of training the algorithm for 100 epochs using the original YOLOv8 network as the baseline, The optimal map value of 93.30% was achieved at that time; under fixed conditions, except for... When the parameters are set to default values, select respectively With parameters of 0.20, 0.25, and 0.30, under the same conditions of training the algorithm for 100 epochs using the original YOLOv8 network as the baseline, The optimal map value of 93.40% was achieved; under fixed conditions, except... When the parameters are set to default values, select respectively With parameters of 0.30, 0.40, and 0.50, under the same conditions of training the algorithm for 100 epochs using the original YOLOv8 network as the baseline, The optimal map value of 93.50% was achieved at that time; under fixed conditions, except for... When the parameters are set to default values, select respectively With parameters of 1.50, 1.60, and 1.70, under the same conditions of training the algorithm for 100 epochs using the original YOLOv8 network as the baseline, The optimal map value of 93.70% was achieved. In summary, this embodiment selects... , , , This is the optimal set of hyperparameters for the loss function used in training the Algae-YOLO algorithm.
[0045] Ablation experiment: To verify the effectiveness of the algorithm's performance, this embodiment selects the YOLOV8 baseline algorithm as the control group algorithm and designs a total of 4 ablation experiments. Ablation1 represents replacing the skeleton structure with the improved skeleton structure proposed in this embodiment. Ablation2 represents replacing the neck structure with the improved neck structure proposed in this embodiment based on Ablation1. Ablation3 represents replacing the detection head with the ASFF-Detect detection head (2 necks, 3 heads) based on Ablation2 (2 necks, 3 heads). Ablation4 (3 necks, 4 heads) represents adding a small target detection head P2 based on Ablation3. The final Algae-YOLO (3 necks, 4 heads) is the algorithm of this embodiment obtained by replacing the original loss function DIOU with the loss function WIOUV3-FocalLoss proposed in this embodiment and training it with its optimal parameter set based on Ablation4 (3 necks, 4 heads). In all ablation experiments, five model performance evaluation indicators, namely Map50, F1s, P, R, and map50-95, were selected for comparison. The parameter records and comparison results of the ablation experiments are shown in Tables 2-1 and 2-2.
[0046]
[0047]
[0048] According to the data in Tables 2-1 and 2-2, when the neck structure was replaced with the Backbone structure proposed in this embodiment, its Precision value increased from 92.65% to 93.21% (+0.46%). This indicates that the Backbone structure proposed in this embodiment enhances the feature extraction capture performance and improves the problem of feature extraction omissions caused by dense target distribution. Based on the improved Backbone structure, applying the Neck structure proposed in this embodiment, it was found that its Map value increased from 93.83% to 94.31% (+0.48%) compared to Ablation1. This indicates that... The improvements to the feature fusion module enhance the ability to fuse features across stages, modules, and time and space, as well as the control over global target information. It also serves to compare prior information with learned feature information and improves the ability to correct misidentification of targets as background. Compared to the standard detection head Ablation2 using the baseline algorithm, the ASFF-Detect head shows a precision improvement from 91.88% to 93.51% (+1.63%), indicating that the ASFF-Detect head can adjust its precision based on the training progress during training iterations. The round-by-round adjustment function ensures that correctly identified algal features can be accurately reproduced in the detection results, effectively avoiding misidentification of similar algae (Ch / St). Adding a small target detection head P2 improved precision by 0.05% compared to Ablation3 and by 0.64% compared to the baseline algorithm. Its map50-95 accuracy improved from 68.34% to 71.28% (+2.96%) compared to Ablation3, and also improved by 2.08% compared to the baseline algorithm. This indicates that the addition of the small target detection head is beneficial for detecting smaller microalgal cells. (e.g., identification of some Anabaena cells); the final Algae-YOLO algorithm, supported by the WIOUV3-FocalLoss loss function, achieves fast and stable convergence during training. Its measured precision value is 1.90% higher than the baseline algorithm, and its Map50-95 score is 2.37% higher. Furthermore, all actual values for the proposed metrics are superior to the baseline algorithm. This demonstrates that the loss function proposed in this embodiment accurately predicts the impact of the difference between the predicted and ground truth bounding boxes on the loss of target information, improving the identification and detection capabilities for stacked and dense algae. In summary, the overall performance of the algorithm proposed in this embodiment is superior to the baseline algorithm.
[0049] Comparative experiment: To verify the overall performance of the improved model, this embodiment selects representative network models YOLOV3, YOLOV5, YOLOX, YOLOV8 and RT-DETR object detection network. The five model performance evaluation metrics, Map50, F1s, P, R and map50-95, are used for comparison. The parameter recording and comparison results of the comparative experiment are shown in Table 3.
[0050]
[0051] As shown in Table 3, the algorithm in this embodiment outperforms other classic YOLO algorithms in all metrics. Its Map value is 11.83% higher than YOLOv3, its Recall value is 16.91% higher than YOLOv5, and its Precision value is 11.94% higher than YOLOX. Compared to RT-DETR, the Algae-YOLO algorithm in this embodiment is superior in all metrics except for Map50-95, which is only slightly lower by 0.73%. It is also superior to other algorithms compared to RT-DETR. Therefore, it can be concluded that the algorithm in this embodiment outperforms other algorithms in terms of model evaluation metrics, showing a significant improvement trend.
[0052] To better analyze the detection performance of the improved network model, one representative image each of a small number of similar algae images, densely distributed algae images, and single images containing multiple types of algae were randomly selected. The detection results of the Algae-YOLO algorithm in this embodiment were compared with those of classic object detection algorithms such as YOLOV3, YOLOV5, YOLOX, YOLOV8, and RT-DETR. Errors or omissions in detection are marked with purple dashed circles. The comparison is shown in the figure below. Figure 9 As shown.
[0053] like Figure 9As shown, in the case of multiple types of algae in an image, the Algae-YOLO algorithm in this embodiment correctly detected one *Cyclotium lappa*, one *Tetracyclis obliqueis*, and one *Navicula*, while YOLOV3 and YOLOV5 missed *Cyclotium lappa*, and YOLOV8 and YOLOX not only missed *Tetracyclis obliqueis* but also misdetected one *Navicula* as *Cyclotium lappa*. The RT-DETR algorithm did not correctly identify any algae targets, while the algorithm in this embodiment detected all of them correctly. Regarding the case of densely packed *Anabaena* with some occlusion and stacking, the algorithm in this embodiment and the RT-DETR algorithm correctly detected all 27 *Anabaena* species. All other YOLO series algorithms showed false negatives, detecting only 10 *Anabaena* targets (missing 17). Regarding the presence of *Cyclocarya paliurus*, which resembles *Alternaria linearis*, in the same image, YOLOV3 and YOLOV5 misdetected *Cyclocarya paliurus* as *Alternaria natans*, while YOLOV8 misdetected it as *Alternaria linearis*, which has a similar morphology. All YOLO series algorithms showed varying degrees of false positives for *Alternaria linearis*. Although RT-DETR did not misclassify *Cyclocarya paliurus* as *Alternaria linearis*, it missed a *Alternaria linearis* target in the lower right corner as background. In contrast, the algorithm in this embodiment correctly detected all 2 *Cyclocarya paliurus* and 11 *Alternaria linearis* targets. The recorded detection results show that, compared to the YOLO series, the Algae-YOLO algorithm has a significant advantage in actual target detection performance, and is comparable to or even surpasses other target detection algorithms (excluding the YOLO series). Therefore, it can be concluded that the algorithm in this embodiment outperforms current mainstream target detection algorithms in terms of actual target detection performance.
[0054] Experimental Results Analysis and Discussion: Confusion Matrix: The confusion matrix reflects the model's performance in detecting and classifying six types of freshwater algae. Row labels represent the true categories, column labels represent the predicted categories, and the data on the diagonal indicates the accuracy of classification and detection, all expressed as percentages. Figure 11 As shown, the values in the confusion matrix are mostly zero except for the rightmost and bottommost columns and the main diagonal. There is only a 0.01 probability of misidentifying *Tetracystis obliqueis* as *Anabaena* and *Navicula*, while other algae are not misidentified. Furthermore, the morphologically similar *Tetracystis linearis* and *Cyclocarya spicata* are not misclassified, and *Cyclocarya spicata* and *Dinophyta* are detected correctly. Although the algorithm in this embodiment has a certain probability of misidentifying *Anabaena* and *Tetracystis linearis* as background, it does not produce false positives or incorrect detections. Therefore, in terms of the confusion matrix, the algorithm in this embodiment has better detection performance.
[0055] PR curve: The precision (PR) curve reflects the relationship between precision and recall. A PR curve close to the upper right corner of the image indicates that the model has a high deduplication rate and recall rate. To accurately analyze the performance advantages of the algorithm before and after improvement for specific algae detection categories, this embodiment uses a comparative analysis of the PR curves of various algae before and after the network model improvement. A PR curve comparison chart is plotted for each algae category, as shown below. Figure 10 As shown in (a)-(f); where, Figure 10 (a) is the PR curve of Anabaena. Figure 10 (b) is the PR curve of Cyclocarya paliurus. Figure 10 (c) is the PR curve of dinoflagellates. Figure 10 (d) is the PR curve of Navicula. Figure 10 (e) is the PR curve of the linear algae. Figure 10 (f) is the PR curve of *Tetracystis obliqueis*.
[0056] Figure 10 This indicates that the Algae-YOLO algorithm has stronger detection performance for dinoflagellates (DI) under any circumstances; for two other algae, *Cyclocarya paliurus* (CH) and *Tetracyclis obliqueis* (TE), its detection performance is almost at the same level as the YOLOV8 baseline algorithm; for algae like *Anabaena* (AN), its accuracy is better than the original network when the recall value is in the range of [0.67, 0.83], and the PR curve of the Algae-YOLOV8 algorithm for algae like AN is closer to the original algorithm. The area under the PR curves is near the top right corner. Except for *Novoidea* (NA) in the Recall range [0.70, 0.90] and *Stelephalia* (ST) in the Recall range [0, 0.33], where the Precision value is slightly lower than the original algorithm, the improved YOLOV8 algorithm's PR curve area for NA and ST detection results is almost equal to the YOLOV8 baseline algorithm. This indicates that the improved Algae-YOLO algorithm outperforms the original algorithm in overall detection performance for closely packed, randomly mixed freshwater algae. The Algae-YOLO algorithm proposed in this embodiment has better robustness and overall performance compared to the original YOLOV8 algorithm, with higher detection accuracy and stronger feature extraction-fusion-expression capabilities.
[0057] Comparative analysis of Map50 values under different IoU thresholds: To verify the performance advantage of the Algae-YOLO algorithm in this embodiment compared to the baseline algorithm at the same significance level, this embodiment, with the hyperparameter conf=0.5 as the initial condition, collected the Map50 values after 100 training rounds with the IoU threshold increasing from 0.5 to 0.95 in increments of 0.05, while keeping other parameters constant. The comparison bar chart is shown below. Figure 12 As shown. By Figure 12 It can be seen that when the IoU threshold is 0.5, the Map value is only improved by 0.01 compared to the original algorithm. Within the IoU threshold range of [0.55, 0.65], the Map values of both algorithms are the same. However, when the IoU threshold is increased to 0.7, the Map value of the algorithm in this embodiment is still 0.8, while the baseline algorithm's recorded value is 0.74, an improvement of 0.06. Within the IoU threshold range of [0.70, 0.95], the Map values of the algorithm in this embodiment are consistently higher than the baseline algorithm. Furthermore, at IoU thresholds of 0.9 and 0.95, the Map value is improved by 0.31 compared to the original algorithm, representing the largest improvement. This indicates that the algorithm in this embodiment is more accurate than the original algorithm in accurately determining the true location of the target.
[0058] This embodiment created a dataset containing labels for six common algae species found in freshwater environments, and performed data augmentation on algae species with fewer labels, resulting in approximately 12,000 algae targets labeled. Addressing the shortcomings of the original YOLOv8 network, which suffers from numerous false negatives and missed detections in cases of interspecies similarity, target stacking or density, and multiple algae species present in a single image, this embodiment proposes the Algae-YOLO algorithm. It employs the RSBC backbone structure to broaden the receptive field and utilizes attention mechanisms with gating and sliding windows to improve the network model's feature extraction performance. The Neck structure uses a Bifpn topology to accommodate parameter information learned at the same level across time intervals, enabling more advanced feature fusion. Furthermore, using the C2f_CAFM_GSConv module as the main thread, it intentionally enhances the capture of feature information for each target in local branches and strengthens the spatial location relative to the target in global branches. The system enhances the capture capability; in feature restoration and representation, it employs a size transformation method based on varying stride according to the convolution kernel size to adjust the sample shape and adapt it to the output of the detection head. A global attention mechanism is also used to capture and retain target feature information across modules, scales, and time and space, improving the feature fusion and representation capabilities for algal features with complex feature maps. Furthermore, the addition of the ASFF-Detect 4-head detection head improves the problem of misidentification of certain algal targets due to their small size. A WIOUV3-FocalLoss loss function is proposed to strengthen the focus on the boundary of the target location, improving the convergence performance of the network model and enhancing the prediction accuracy of some difficult-to-detect algal targets. Compared with the baseline algorithm, the algorithm in this embodiment improves Map by 1.05% and Precision by 1.90%, and its overall performance is significantly better than most mainstream target detection algorithms. In actual detection, it can accurately identify algal target information of densely packed algal samples, algal species similar, and randomly mixed algal samples, significantly improving the problems of missed detections, false detections, misclassifications, and background misidentification of the baseline algorithm.
[0059] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A multi-scale feature fusion and multi-head detection method for densely stacked and interspecies-similar algae, characterized in that, include: Construct a dataset of algal samples and perform data preprocessing; The algae detection model was trained using the preprocessed dataset; wherein the algae detection model adopted the improved YOLOV8 model, and the model improvement points included: replacing the skeleton structure of YOLOV8, improving the neck structure of YOLOV8, and replacing the original detection head of YOLOV8. Dense algae detection was performed using a trained algae detection model.
2. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 1, characterized in that, The data preprocessing includes: The sample data was processed using random mosaic and rotation scaling image enhancement techniques and adaptive image filling techniques.
3. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 1, characterized in that, Improvements to the YOLOv8 model include: The skeleton structure of YOLOV8 was replaced with the RFA-SWINTRANSFORMER structure; YOLOV8 neck structure improved based on Bifpn-Concat and CAFM attention mechanism; The original detection head of YOLOV8 was replaced with the ASFF-Detect detection head module.
4. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 1, characterized in that, The algae detection model includes: skeletal structure, neck structure, and head structure; The skeleton structure is used to receive preprocessed algae image data, perform multi-scale feature extraction operations, and obtain multi-scale feature map information, namely feature map information at scales P1-P5. The neck structure is used to perform feature fusion and improvement on multi-scale feature map information to obtain optimized feature map information. The head structure is used to perform target detection using multiple detection heads on optimized feature map information.
5. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 4, characterized in that, The skeleton structure includes five feature layers, P1-P5. The P1 feature layer uses an RFAConv module alone. The four feature layers of different scales, P2-P5, all use RSBC repeating units formed by cascading RFAConv, SWIN-BLOCK, and CoordGate modules in sequence. The RFAConv module and the SWIN-BLOCK module are used alternately; The RFAConv module is a convolutional module that targets the receptive field and has an attention mechanism; The SWIN-BLOCK module uses a global self-attention mechanism to connect the extraction results of each level of feature extraction across regions. It includes an MSA window shifting self-attention mechanism, a 2-layer MLP, and a BN layer, and connects the various sub-modules in a residual connection manner. The CoordGate module is an attention mechanism based on coordinate position. First, it arranges the positions of global image regions according to the size of the receptive field, and then uses a preset convolution to transform them according to the spatial dimension. During the transformation, the horizontal and vertical position information are arranged with different tensors. The encoding includes the position encoding of the feature regions.
6. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 4, characterized in that, The neck structure adopts a Bifpn structure based on a bidirectional feature propagation mechanism. The neck structure includes: a feature fusion repeating unit BCCC and a feature expression repeating unit ABCGC. The Feature Fusion Repeating Unit (BCCC) is used to integrate feature map information at multiple scales from P3 to P5 based on three consecutive upsampling feature fusions. The BCCC is composed of a single upsampling module (Upsample), a feature stitching module (Concat), a spatiotemporal attention mechanism (CBAM), and a region connectivity feature integration structure (C2f-CAFM-GSConv) module cascaded in sequence. The C2f-CAFM-GSConv module is used to perform local cross-module interactive learning by eliminating parameter redundancy and suppressing information loss due to feature map size parameter transformation, thereby further improving the ability to fuse and represent features that are similar to the target and background and that are stacked between targets. The spatiotemporal attention mechanism CBAM uses both average pooling and max pooling to aggregate the spatial information of the feature map. The feature representation repetition unit ABCGC is composed of AKConv module, Concat module, GAM attention module and C2f-CAFM-GSConv module cascaded in sequence, and is used to restore the feature map information of P3-P5 to the target anchor box information. The AKConv module obtains the corresponding offset by performing convolution operations, and uses a method of varying stride according to the convolution kernel size to perform size transformation to one-dimensional feature reshaping and column stacking, flexibly adjusting the sample shape; The GAM attention module, while incorporating the advantages of CBAM attention, also incorporates the concept of 3D reconstruction. It directly preserves feature map regions in a pool-free manner and maximizes the preservation of feature fusion results from convolutions at the same level.
7. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 4, characterized in that, The head structure includes four ASFF-Detect heads, which are used to receive the results of feature recovery and restoration at the P2-P5 scale, respectively. The head structure adopts the ASFF attention mechanism to improve the original detection head, filters the learned spatial conflict information, strengthens the weight of such feature outputs during feature restoration, and suppresses inconsistency by adjusting it step by step according to the training situation during the training iteration.
8. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 6, characterized in that, In the C2f-CAFM-GSConv module: The C2f submodule consists of one or more convolutional modules and a fully connected layer. The C2f submodule aggregates multi-scale information by concatenating the outputs of different BottleNeck modules with the original feature maps. CAFM attention mechanism is a two-branch attention mechanism that, through Adjusting the number of channels promotes information fusion, and grouping by dimension and randomly sorting within the group, the output tensors within each group are spliced by dimension to form a preset size output; The GSCONV submodule is a channel-dense convolution designed to preserve the hidden connections between each channel to the maximum extent possible.
9. The multi-scale feature fusion and multi-head detection method for densely stacked and interspecifically similar algae according to claim 1, characterized in that, The Wiou-v3-FocalLoss loss function was used to train the algae detection model, and its formula is shown below: ; ,in ; ,in ; ; in, , W represents the width of the anchor frame, H represents the height of the anchor frame, S represents the area of the anchor frame, x and y represent the x and y coordinates of the anchor frame, respectively, all subscripts in the formula gt represent the ground truth bounding box, pt represent the predicted bounding box, and exp represent the exponential operation with base e. This represents a simple scalar multiplication operation. This represents the WIOU loss function value. This indicates the probability or confidence level that the box is predicted correctly, and log represents the logarithm to base e. This represents the IOU loss function value. , , , This represents the corresponding loss function value. Indicates attenuation factor, Indicates outlier degree, Indicates gradient gain. This represents the monotonic focusing coefficient.