Drown diatom detection method based on multi-dimensional attention fusion and storage medium

By constructing a multi-dimensional attention fusion module and a lightweight feature regeneration module, the problems of feature information loss and fusion imbalance in complex backgrounds of diatom images are solved, improving the detection effect and optimizing the model's computational efficiency.

CN121582669APending Publication Date: 2026-02-27GUANGDONG UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511797763.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-01
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing target detection models face challenges in diatom images, including complex backgrounds and weak feature interactions, lack of attention mechanism dimensions, imbalance in multi-scale fusion, and large number of model parameters, resulting in unsatisfactory detection performance.

Method used

A prototype routing channel attention module (PRCA) and an adaptive focusing spatial attention module (AFSA) are constructed. Combined with a residual learnable scale fusion module (RLSF) and a lightweight feature regeneration module (LFR), the collaborative focusing capability of feature channels and spatial regions is enhanced, multi-scale feature fusion is optimized, and the computational burden is reduced through feature transformation and channel dimensionality reduction.

Benefits of technology

It effectively overcomes the problems of feature information loss and fusion imbalance in complex backgrounds, improves the detection effect of weak diatom targets, and reduces the number of model parameters and computational burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582669A_ABST
    Figure CN121582669A_ABST
Patent Text Reader

Abstract

The invention relates to a drowning diatom detection method based on multi-dimensional attention fusion and a storage medium. The method comprises the following steps: S1, acquiring a diatom image and extracting a multi-scale feature map by using a feature extraction network; s2, constructing a prototype routing channel attention module PRCA to perform representation enhancement on a feature channel of the multi-scale feature map; s3, constructing an adaptive focusing space attention module AFSA to perform response enhancement on a space region of the multi-scale feature map; s4, constructing a learnable scale fusion module RLSF with a residual error to carry out learnable cross-scale fusion on the enhanced feature map; s5, constructing a lightweight feature regeneration module LFR to perform feature transformation and channel dimension reduction on the fused feature map; and S6, outputting a target bounding box and a category prediction result. The method aims at solving the problems of feature information loss, feature fusion imbalance and large model parameter quantity in diatom detection, and can be applied to the microscopic image analysis fields of forensic drowning diagnosis, water quality monitoring and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and target detection, specifically to a method and storage medium for detecting drowned diatoms based on multidimensional attention fusion. Background Technology

[0002] In forensic practice, diatom examination is one of the "gold standards" for diagnosing drowning deaths. By performing morphological analysis and classification of diatoms in samples from the internal organs, especially the lungs, liver, and kidneys, crucial biological evidence is provided for the diagnosis of drowning. Traditional manual microscopic examination methods are not only extremely time-consuming and labor-intensive, but their results also heavily rely on the examiner's subjective experience.

[0003] Deep learning technology, especially Convolutional Neural Networks (CNNs), has provided a new approach for automated, high-throughput detection of diatoms. However, directly applying existing object detection models to diatom images under a microscope does not yield ideal results, mainly due to the following technical challenges: 1. Combating Complex Backgrounds and Weak Features: Diatom images are often accompanied by high-density background noise and artifacts. Diatom targets themselves are characterized by low resolution, indistinct features, and susceptibility to occlusion. During feature extraction, these weak target feature information are easily "submerged" and "interfered" by complex background information.

[0004] 2. Lack of "Dimensionality" in Attention Mechanisms: To address the aforementioned issues, existing methods have attempted to introduce attention mechanisms, but most of these mechanisms are not refined enough. They either focus on channels or space, lacking a multi-dimensional collaborative focusing capability. This prevents the model from adaptively addressing the two key questions of "which feature channels should be focused on" and "which spatial regions should be focused on" simultaneously, resulting in crucial information still being easily overlooked.

[0005] 3. The "dilution" effect of multi-scale fusion: Although existing detection models attempt to fuse multi-scale features, during the fusion process, the high-resolution shallow detail features used to detect small targets are often "covered" or "diluted" by the deep strong semantic features used to detect large targets. This reduces the model's sensitivity to small targets.

[0006] 4. The conflict between model accuracy and efficiency: In order to improve accuracy, many advanced models are constantly stacking deeper and more complex network modules. While this may improve performance, it also brings a huge number of parameters and computational burden, which is not conducive to achieving lightweight and rapid deployment on forensic examination equipment with limited computing power.

[0007] In summary, when improving existing detection architectures to solve the above problems, the key technical problems that still need to be solved are: (1) solving the problem of feature information loss caused by weak targets under the interference of high-density background noise; (2) overcoming the problem of feature fusion imbalance caused by semantic differences in the fusion of multi-scale feature maps; and (3) solving the problem of large model parameters and heavy computational burden while ensuring detection accuracy. Summary of the Invention

[0008] To address the aforementioned technical problems, this invention provides a method and storage medium for detecting drowned diatoms based on multidimensional attention fusion. The method addresses the feature information loss problem by constructing a prototype routing channel attention module (PRCA) and an adaptive focusing spatial attention module (AFSA) for cascaded enhancement, collaboratively focusing on weak features from both channel and spatial dimensions. To address the feature fusion imbalance problem, this invention constructs a residual learnable scale fusion module (RLSF) to perform weighted fusion of the enhanced multi-scale features, preserving high-resolution detailed feature information. To address the large number of model parameters, this invention constructs a lightweight feature regeneration module (LFR) to perform feature transformation and channel dimensionality reduction on the fused features, optimizing computational efficiency.

[0009] Specifically, the method includes the following steps: S1: Acquire diatom images and extract multi-scale feature maps using a feature extraction network; S2: Construct the Prototype Routed Channel Attention (PRCA) module to enhance the representation of feature channels in multi-scale feature maps; S3: Construct an Adaptive Focus Spatial Attention (AFSA) module to enhance the response of spatial regions in multi-scale feature maps; S4: Construct a Residual Learnable Scale Fusion (RLSF) module to perform learnable cross-scale fusion on the enhanced feature maps; S5: Construct a lightweight feature regeneration module (LFR) to perform feature transformation and channel dimensionality reduction on the fused feature map; S6: Output the target bounding box and category prediction results.

[0010] Preferably, S1 includes the following steps: S1.1: Acquire diatom images, use annotation tools to complete target bounding box annotations, and convert the annotation files to .txt format. The annotation file content includes the target category code (Class ), and the normalized coordinates of the four vertices of its rotated bounding box ( x 1, y 1, x 2, y 2, x 3, y 3, x 4, y 4); S1.2: Perform preprocessing operations such as uniform size adjustment and pixel value normalization on all images, and divide the images into training set, validation set and test set; S1.3: Input the preprocessed image into the feature extraction network, extract its features through depthwise convolution operations, and generate a multi-scale feature map set. f 3, f 4, f 5}; Preferably, S1.3 includes the following steps: S1.3.1: The preprocessed diatom image f input The input feature extraction network extracts its initial feature maps through two CBS (Convolution-BatchNormalization-SiLU) modules. f 2. The expression is as follows:

[0011]

[0012] In the above formula, This represents the SiLU activation function. This indicates a batch normalization operation. Represents a two-dimensional convolution operation; S1.3.2: Initial feature map f 2. Input the multi-scale feature extraction module C3K2F (CrossStage Partial with Kernel size 2-False) of the input feature extraction network to extract its shallow feature map. f 3. The expression is as follows:

[0013]

[0014]

[0015] In the above formula, This indicates an operation that segments the input feature map along the channel dimension. f 21 andf 22 yes f The sum of the number of channels in the two segmented feature maps is equal to... f 2 channels; This indicates an operation that splices along the channel dimension; Indicates stacking n The Bottleneck module consists of a main branch that connects to a sub-branch after passing through two CBS modules. S1.3.3: Shallow feature map f The C3K2T (CrossStage Partial with Kernel size 2-True) multi-scale feature extraction module of the input feature extraction network extracts its mid-layer feature maps. f 4. The expression is as follows:

[0016]

[0017]

[0018] In the above formula, f 31 and f 32 yes f The sum of the number of channels in the 3-segmented feature map is equal to f 3 channels; Indicates stacking n There is a C3K module, and internally, the C3K module has a main branch that passes through a CBS module and... n There are one Bottleneck module. One sub-branch goes through one CBS module. Two branches are concatted and then go through another CBS module. S1.3.4: Transfer the middle layer feature map f 4. The long-range modeling module C2PSA (CrossStage Partial with Spatial Attention) of the input feature extraction network uses a global attention mechanism to extract its deep feature maps. f 5. The expression is as follows:

[0019]

[0020]

[0021] In the above formula, f 41 andf 42 yes f The sum of the number of channels in the 4 segmented feature maps is equal to f 4 channels; Indicates stacking n Each PSABlock contains a position-sensitive attention block (PSABlock), and each PSABlock includes a self-attention mechanism and two CBS modules. S1.3.5: Output a set of multi-scale feature maps { f 3 ,f 4 ,f 5}.

[0022] Preferably, S2 includes the following steps: S2.1: Construct the Prototype Routed Channel Attention (PRCA) module. S2.2: Extract the multi-scale feature map output from step S1 using Fast Fourier Transform (FFT). Frequency domain feature map and initialize the group prototype matrix. ; Preferably, S2.2 includes the following steps: S2.2.1: Extracting multi-scale feature maps using Fast Fourier Transform (FFT) f i The frequency domain information is used, and only the amplitude portion is taken to generate a frequency domain amplitude feature map. The expression is as follows:

[0023]

[0024] In the above formula, f i This represents the multi-scale feature map extracted from the feature extraction network. This represents the two-dimensional Fast Fourier Transform operation. This represents a complex frequency domain feature map containing amplitude and phase information. This indicates the amplitude operation. Represents the frequency domain amplitude characteristic map; S2.2.2: Processing frequency domain amplitude feature maps using depthwise separable convolution (DSConv) and the sigmoid activation function. Generate frequency mask The frequency mask is applied to the frequency domain amplitude feature map using element-wise multiplication to generate the frequency domain feature map. The expression is as follows:

[0025]

[0026] In the above formula, This indicates a depthwise separable convolution operation with a kernel size of 3×3. This represents the Sigmoid activation function. This represents an element-wise multiplication operation; S2.2.3: Initialize the grouping prototype matrix The parameters of this matrix are updated through backpropagation during model training, as shown in the following expression:

[0027] In the above formula, This indicates a parameter initialization operation, which creates a grouped prototype matrix of a specified size. That is, the specified size, indicating that the space size of the matrix is... n ×9, n Indicates creation n The prototype matrices are grouped, with 9 representing the number of parameters in each group. This number must match the number in step S2.2.2. The dimensions remain consistent after the convolution kernel is flattened. S2.3: Calculate the grouping prototype matrix Affinity matrix And use one-dimensional convolution operations to generate frequency domain feature maps. Rating matrix ; Preferably, S2.3 includes the following steps: S2.3.1: Calculate the weight matrix of the depthwise separable convolution kernel in step S2.2.2. With group prototype matrix Affinity matrix The expression is as follows:

[0028] In the above formula, The weight matrix represents the depthwise separable convolution kernel. This indicates a resizing operation. This indicates the operation of calculating cosine similarity. This represents the Softmax activation function; S2.3.2: Utilizing nThe frequency domain feature map output from step S2.2.2 is processed by a parallel one-dimensional convolution kernel Conv1D (1D Convolution). Multi-view feature evaluation is performed to generate a scoring matrix. The expression is as follows:

[0029] In the above formula, Indicates the first j A one-dimensional convolution kernel is applied to the frequency domain feature map. n Indicates the number of grouped prototype matrices; S2.4: Calculate channel attention weights and with multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. ; Preferably, S2.4 includes the following steps: S2.4.1: Using the affinity matrix output in step S2.3 and rating matrix Calculate channel attention weights The expression is as follows:

[0030] In the above formula, This indicates an operation that sums along the grouping dimension; S2.4.2: Adjust channel attention weights With multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. The expression is as follows: .

[0031] Preferably, S3 includes the following steps: S3.1: Construct the Adaptive Focus Spatial Attention (AFSA) module. S3.2: Receive the feature map output from step S2 after representation enhancement by the PRCA module, denoted here as... And extract using pooling and convolution operations. Spatial feature map ; Preferably, S3.2 includes the following steps: S3.2.1: Utilize average pooling and max pooling operations along the channel to... Channel-level information compression is performed, and the two pooling results are merged using the Concat operation to generate a pooled feature map. The expression is as follows:

[0032] In the above formula, This indicates average pooling along the channel. This indicates max pooling along the channel; S3.2.2: Use depthwise separable convolution DSConv to process the pooled feature map output from step S3.2.1. Spatial context extraction is performed to generate spatial feature maps. The expression is as follows:

[0033] S3.3: Sharpening the spatial feature map Generate a spatial attention mask and combine it with... Channel-by-channel weighting is performed to generate an enhanced feature map at this scale. ; Preferably, S3.3 includes the following steps: S3.3.1: Utilize an adaptive sharpening mechanism to transform the spatial feature map output in step S3.2.2. Perform spatial feature enhancement to generate a sharpened spatial feature map. The expression is as follows:

[0034]

[0035]

[0036] In the above formula, Representing the computational spatial feature map Operating on the standard deviation in the spatial dimension s That is, spatial feature map Standard deviation in spatial dimension k This represents a learnable sharpening factor parameter. e This represents a tiny constant that prevents division by zero. l That is, based on the standard deviation s Dynamically calculated adaptive sharpening factor, when s When smaller, l A larger value will achieve a greater sharpening effect; S3.3.2: Calculate the sharpened spatial feature map output from step S3.3.1 using the Sigmoid activation function. Spatial attention mask Spatial attention masks are applied through element-wise multiplication operations. The final enhanced feature map is generated. The expression is as follows: .

[0037] Preferably, S4 includes the following steps: S4.1: Construct a residual learnable scale fusion module RLSF (Residual Learnable ScaleFusion); S4.2: Receive the feature map output from step S3 after response enhancement by the AFSA module, denoted here as... And by using learnable weights, a top-down dynamic weighted fusion is performed to generate a preliminary multi-scale fusion feature map set. P 3, P 4, P 5}; Preferably, S4.2 includes the following steps: S4.2.1: Enhance the deep feature map Set as the initial deep fusion feature map P 5. P 5. After performing scale alignment operation, compare with the mid-layer enhanced feature map Perform learnable-scale fusion operations with residuals to generate preliminary mid-level fusion feature maps. P 4. P 4. After performing scale alignment operation, compare with shallow enhancement feature map Perform learnable-scale fusion operation with residuals to generate preliminary shallow fused feature maps. P 3. The expression is as follows:

[0038]

[0039]

[0040] In the above formula, This indicates a scale alignment operation. This represents the element-wise addition operation, { α 4, α 5, β 3, β 4} represents the learnable weights of the corresponding scale-enhanced feature map; S4.2.2: Output a preliminary set of multi-scale fused feature maps { P 3, P 4, P 5}; S4.3: The initial multi-scale fused feature map set output from step S4.2.2 { P 3, P 4, P 5) Perform bottom-up feature fusion to generate the final multi-scale fused feature map. The expression is as follows:

[0041]

[0042]

[0043] In the above formula, This represents the final shallow fusion feature map. This represents the final mid-layer fused feature map. This represents the final deep fusion feature map.

[0044] Preferably, S5 includes the following steps: S5.1: Construct the Lightweight Feature Regeneration (LFR) module; S5.2: Receive the learnable cross-scale fusion feature map output from step S4, which has been processed by the RLSF module. Hereinafter, it is denoted as... Then, through channel splitting operations, regenerated branches and retained branches are formed, as shown in the following expressions:

[0045] In the above formula, and yes The segmented feature map, Indicates a regenerative branch. Indicates that the branch is retained; S5.3: For regeneration branches Perform feature transformation and channel dimensionality reduction, preserving branches. No action taken; Preferably, S5.3 includes the following steps: S5.3.1: Using a set of convolution operations to regenerate the branch Feature transformation and channel dimensionality reduction are performed to extract features and reduce computational burden, generating a regenerative branch. The expression is as follows:

[0046] In the above formula, This indicates that the regeneration branch passes through the first CBS module, which is used for feature decoupling and performs channel dimensionality reduction; This indicates a depthwise separable convolution operation used to extract spatial context information from the feature map after channel dimensionality reduction by the first CBS module. This indicates that the regeneration branch passes through the second CBS module, which is used to transform and reassemble the spatial context information extracted by depthwise separable convolution; S5.3.2: For retained branches No processing is performed to preserve the original feature information; S5.4: Preservation using residual join And splice regeneration branches With preserved branches Generate the final feature map The expression is as follows: .

[0047] Preferably, S6 includes the following steps: S6.1: Receive the feature map output from step S5 after feature transformation and channel dimensionality reduction by the LFR module, denoted here as... and will Input the network detection head to perform bounding box and classification prediction, and generate the original prediction tensor; Preferably, S6.1 includes the following steps: S6.1.1: Using the C3K2F module to... Feature extraction is performed to generate a feature map for input to the detection head, as shown in the following expression:

[0048] In the above formula, This represents the feature map used as input to the detection head; S6.1.2: Will Input the bounding box prediction branch and the classification prediction branch respectively to generate the original bounding box prediction tensor and the original classification prediction tensor. Then, concatenate the two along the channel dimension to generate the original prediction tensor at this scale, as shown in the following expression:

[0049]

[0050]

[0051] In the above formula, (Convolution layers for box regression) represents the bounding box prediction branch path, which internally passes through two CBS modules and a standard 3×3 Conv2D (2D Convolution) convolutional layer, and this convolutional layer does not contain batch normalization operations and activation functions. This represents the original bounding box prediction tensor; (Convolution layers for box classification) represents the classification prediction branch path, which internally passes through two DSConv layers and a standard Conv2D convolutional layer with a kernel size of 3×3. This convolutional layer also does not contain batch normalization operations and activation functions. Represents the original classification prediction tensor; This represents the original prediction tensor.

[0052] S6.2: Decode, integrate, and post-process the original prediction tensors to generate the final prediction result; Preferably, S6.2 includes the following steps: S6.2.1: The original prediction tensor output from step S6.1.2 Decode the result to generate the integrated prediction tensor, as shown in the following expression:

[0053] In the above formula, The decoding operation involves concatenating the original prediction tensors at all scales and splitting them into original bounding box prediction tensors. and the original classification prediction tensor ;for The coordinates are converted into the final bounding box coordinates through decoding. ,for Applying the Sigmoid activation function to obtain class confidence ;Will and Performing the Concat concatenation operation yields the integrated prediction result tensor. ; S6.2.2: Post-processing is performed using the NMS (Non-Maximum Suppression) algorithm to integrate the prediction result tensor output from step S6.2.1. Redundant bounding boxes are removed, and the bounding box with the highest confidence score is retained. The final bounding box coordinates, confidence score, and corresponding class index are generated. The expression is as follows:

[0054] In the above formula, This represents a nonmaximum suppression algorithm, which is based on... The system filters candidate bounding boxes based on category confidence and a preset confidence threshold, calculates the Intersection over Union (IOU) ratio between candidate boxes, and removes redundant bounding boxes with an IOU greater than the preset threshold. This step ultimately outputs... , It includes the target bounding box coordinates, confidence scores, and corresponding category indices after filtering and suppression, and serves as the final detection result.

[0055] The second technical solution adopted in this invention is: a computer-readable storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, it implements the drowning diatom detection method based on multidimensional attention fusion described above. The beneficial effects of this invention are: 1. This invention constructs a collaborative mechanism of "selecting channels first and then determining space" by using the Prototype Routing Channel Attention Module (PRCA) and the Adaptive Focusing Spatial Attention Module (AFSA). This effectively overcomes the shortcomings of traditional attention mechanisms, such as their single dimension and inability to simultaneously suppress channel redundancy and spatial background interference, and solves the problem of feature information loss in complex backgrounds.

[0056] 2. This invention uses the Residual Learnable Scale Fusion Module (RLSF) for dynamic weighted fusion, overcoming the feature fusion imbalance defect in traditional multi-scale fusion where shallow small target features are "diluted" by deep semantics.

[0057] 3. This invention uses the “segmentation-regeneration-preservation” structure of the Lightweight Feature Regeneration Module (LFR) to perform feature transformation and channel dimensionality reduction, which significantly reduces the computational burden caused by complex module stacking and solves the problem of large model parameter count.

[0058] In summary, by organically combining the above modules, this invention not only solves the core problems of feature information loss, feature fusion imbalance, and large model parameter quantity, but also improves the detection effect of weak diatom targets in complex backgrounds. Attached Figure Description

[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings used in the prior art and embodiments. The following drawings are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0060] Figure 1This is a flowchart illustrating a method for detecting drowned diatoms based on multidimensional attention fusion according to the present invention. Figure 2 This is a schematic diagram of a specific embodiment of the drowning diatom detection method based on multidimensional attention fusion of the present invention; Figure 3 This is a schematic diagram of the prototype routing channel attention module PRCA in an embodiment of the present invention; Figure 4 This is a schematic diagram of the adaptive focusing spatial attention module AFSA in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the residual learnable scale fusion module RLSF in an embodiment of the present invention; Figure 6 This is a schematic diagram of the lightweight feature regeneration module LFR in an embodiment of the present invention; Detailed Implementation Plan To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0061] This invention provides a method and storage medium for detecting drowned diatoms based on multidimensional attention fusion, which enhances the model's ability to focus on feature channels and spatial regions at the algorithm level, improves the effectiveness of multi-scale feature fusion, and improves the detection effect of tiny diatoms in complex backgrounds while taking into account the lightweight nature of the model.

[0062] A typical embodiment of the present invention uses a dataset of diatom images acquired at 1500x magnification under a scanning electron microscope as an example, referring to... Figure 1 , Figure 2 The method includes the following steps: S1: Acquire diatom images and extract multi-scale feature maps using a feature extraction network; S2: Construct the Prototype Routed Channel Attention (PRCA) module to enhance the representation of feature channels in multi-scale feature maps; S3: Construct an Adaptive Focus Spatial Attention (AFSA) module to enhance the response of spatial regions in multi-scale feature maps; S4: Construct a Residual Learnable Scale Fusion (RLSF) module to perform learnable cross-scale fusion on the enhanced feature maps; S5: Construct a lightweight feature regeneration module (LFR) to perform feature transformation and channel dimensionality reduction on the fused feature map; S6: Output the target bounding box and category prediction results.

[0063] Furthermore, S1 includes the following steps: S1.1: Acquire diatom images, use annotation tools to complete target bounding box annotations, and convert the annotation files to .txt format. The annotation file content includes the target category code ( Class ), and the normalized coordinates of the four vertices of its rotated bounding box ( x 1, y 1, x 2, y 2, x 3, y 3, x 4, y 4); S1.2: Perform preprocessing operations such as uniform size adjustment and pixel value normalization on all images, and divide the images into training set, validation set and test set; S1.3: Input the preprocessed image into the feature extraction network, extract its features through depthwise convolution operations, and generate a multi-scale feature map set. f 3, f 4, f 5}; Furthermore, S1.3 includes the following steps: S1.3.1: The preprocessed diatom image f input The input feature extraction network extracts its initial feature maps through two CBS (Convolution-BatchNormalization-SiLU) modules. f 2. The expression is as follows:

[0064]

[0065] In the above formula, This represents the SiLU activation function. This indicates a batch normalization operation. Represents a two-dimensional convolution operation; S1.3.2: Initial feature map f2. Input the multi-scale feature extraction module C3K2F (CrossStage Partial with Kernel size 2-False) of the input feature extraction network to extract its shallow feature map. f 3. The expression is as follows:

[0066]

[0067]

[0068] In the above formula, This indicates an operation that segments the input feature map along the channel dimension. f 21 and f 22 yes f The sum of the number of channels in the two segmented feature maps is equal to... f 2 channels; This indicates an operation that splices along the channel dimension; Indicates stacking n The Bottleneck module consists of a main branch that connects to a sub-branch after passing through two CBS modules. S1.3.3: Shallow feature map f The C3K2T (CrossStage Partial with Kernel size 2-True) multi-scale feature extraction module of the input feature extraction network extracts its mid-layer feature maps. f 4. The expression is as follows:

[0069]

[0070]

[0071] In the above formula, f 31 and f 32 yes f The sum of the number of channels in the 3-segmented feature map is equal to f 3 channels; Indicates stacking n There is a C3K module, and internally, the C3K module has a main branch that passes through a CBS module and... n There are one Bottleneck module. One sub-branch goes through one CBS module. Two branches are concatted and then go through another CBS module. S1.3.4: Transfer the middle layer feature map f 4. The long-range modeling module C2PSA (CrossStage Partial with Spatial Attention) of the input feature extraction network uses a global attention mechanism to extract its deep feature maps. f 5. The expression is as follows:

[0072]

[0073]

[0074] In the above formula, f 41 and f 42 yes f The sum of the number of channels in the 4 segmented feature maps is equal to f 4 channels; Indicates stacking n Each PSABlock contains a position-sensitive attention block (PSABlock), and each PSABlock includes a self-attention mechanism and two CBS modules. S1.3.5: Output a set of multi-scale feature maps { f 3 ,f 4 ,f 5}.

[0075] Furthermore, S2 includes the following steps: S2.1: Construct the Prototype Routed Channel Attention (PRCA) module. S2.2: Extract the multi-scale feature map output from step S1 using Fast Fourier Transform (FFT). Frequency domain feature map and initialize the group prototype matrix. ; Furthermore, S2.2 includes the following steps: S2.2.1: Extracting multi-scale feature maps using Fast Fourier Transform (FFT) f i The frequency domain information is used, and only the amplitude portion is taken to generate a frequency domain amplitude feature map. The expression is as follows:

[0076]

[0077] In the above formula, f i This represents the multi-scale feature map extracted from the feature extraction network. This represents the two-dimensional Fast Fourier Transform operation. This represents a complex frequency domain feature map containing amplitude and phase information. This indicates the amplitude operation. Represents the frequency domain amplitude characteristic map; S2.2.2: Processing frequency domain amplitude feature maps using depthwise separable convolution (DSConv) and the sigmoid activation function. Generate frequency mask The frequency mask is applied to the frequency domain amplitude feature map using element-wise multiplication to generate the frequency domain feature map. The expression is as follows:

[0078]

[0079] In the above formula, This indicates a depthwise separable convolution operation with a kernel size of 3×3. This represents the Sigmoid activation function. This represents an element-wise multiplication operation; S2.2.3: Initialize the grouping prototype matrix The parameters of this matrix are updated through backpropagation during model training, as shown in the following expression:

[0080] In the above formula, This indicates a parameter initialization operation, which creates a grouped prototype matrix of a specified size. That is, the specified size, indicating that the space size of the matrix is... n ×9, n Indicates creation n The prototype matrices are grouped, with 9 representing the number of parameters in each group. This number must match the number in step S2.2.2. The dimensions remain consistent after the convolution kernel is flattened. S2.3: Calculate the grouping prototype matrix Affinity matrix And use one-dimensional convolution operations to generate frequency domain feature maps. Rating matrix ; Furthermore, S2.3 includes the following steps: S2.3.1: Calculate the weight matrix of the depthwise separable convolution kernel in step S2.2.2. With group prototype matrix Affinity matrix The expression is as follows:

[0081] In the above formula, The weight matrix represents the depthwise separable convolution kernel. This indicates a resizing operation. This indicates the operation of calculating cosine similarity. This represents the Softmax activation function; S2.3.2: Utilizing n The frequency domain feature map output from step S2.2.2 is processed by a parallel one-dimensional convolution kernel Conv1D (1D Convolution). Multi-view feature evaluation is performed to generate a scoring matrix. The expression is as follows:

[0082] In the above formula, Indicates the first j A one-dimensional convolution kernel is applied to the frequency domain feature map. n Indicates the number of grouped prototype matrices; S2.4: Calculate channel attention weights and with multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. ; Furthermore, S2.4 includes the following steps: S2.4.1: Using the affinity matrix output in step S2.3 and rating matrix Calculate channel attention weights The expression is as follows:

[0083] In the above formula, This indicates an operation that sums along the grouping dimension; S2.4.2: Adjust channel attention weights With multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. The expression is as follows: .

[0084] Furthermore, S3 includes the following steps: S3.1: Construct the Adaptive Focus Spatial Attention (AFSA) module. S3.2: Receive the feature map output from step S2 after representation enhancement by the PRCA module, denoted here as... And extract using pooling and convolution operations. Spatial feature map ; Furthermore, S3.2 includes the following steps: S3.2.1: Utilize average pooling and max pooling operations along the channel to... Channel-level information compression is performed, and the two pooling results are merged using the Concat operation to generate a pooled feature map. The expression is as follows:

[0085] In the above formula, This indicates average pooling along the channel. This indicates max pooling along the channel; S3.2.2: Use depthwise separable convolution DSConv to process the pooled feature map output from step S3.2.1. Spatial context extraction is performed to generate spatial feature maps. The expression is as follows:

[0086] S3.3: Sharpening the spatial feature map Generate a spatial attention mask and combine it with... Channel-by-channel weighting is performed to generate an enhanced feature map at this scale. ; Furthermore, S3.3 includes the following steps: S3.3.1: Utilize an adaptive sharpening mechanism to transform the spatial feature map output in step S3.2.2. Perform spatial feature enhancement to generate a sharpened spatial feature map. The expression is as follows:

[0087]

[0088]

[0089] In the above formula, Representing the computational spatial feature map Operating on the standard deviation in the spatial dimension s That is, spatial feature map Standard deviation in spatial dimension k This represents a learnable sharpening factor parameter. e This represents a tiny constant that prevents division by zero. l That is, based on the standard deviation s Dynamically calculated adaptive sharpening factor, when s When smaller, l A larger value will achieve a greater sharpening effect; S3.3.2: Calculate the sharpened spatial feature map output from step S3.3.1 using the Sigmoid activation function. Spatial attention mask Spatial attention masks are applied through element-wise multiplication operations. The final enhanced feature map is generated. The expression is as follows: .

[0090] Furthermore, S4 includes the following steps: S4.1: Construct a residual learnable scale fusion module RLSF (Residual Learnable ScaleFusion); S4.2: Receive the feature map output from step S3 after response enhancement by the AFSA module, denoted here as... And by using learnable weights, a top-down dynamic weighted fusion is performed to generate a preliminary multi-scale fusion feature map set. P 3, P 4, P 5}; Furthermore, S4.2 includes the following steps: S4.2.1: Enhance the deep feature map Set as the initial deep fusion feature map P 5. P 5. After performing scale alignment operation, compare with the mid-layer enhanced feature map Perform learnable-scale fusion operations with residuals to generate preliminary mid-level fusion feature maps. P 4. P 4. After performing scale alignment operation, compare with shallow enhancement feature map Perform learnable-scale fusion operation with residuals to generate preliminary shallow fused feature maps. P 3. The expression is as follows:

[0091]

[0092]

[0093] In the above formula, This indicates a scale alignment operation. This represents the element-wise addition operation, { α 4, α 5, β 3, β 4} represents the learnable weights of the corresponding scale-enhanced feature map; S4.2.2: Output a preliminary set of multi-scale fused feature maps { P 3, P 4, P 5}; S4.3: The initial multi-scale fused feature map set output from step S4.2.2 { P 3, P 4, P 5) Perform bottom-up feature fusion to generate the final multi-scale fused feature map. The expression is as follows:

[0094]

[0095]

[0096] In the above formula, This represents the final shallow fusion feature map. This represents the final mid-layer fused feature map. This represents the final deep fusion feature map.

[0097] Furthermore, S5 includes the following steps: S5.1: Construct the Lightweight Feature Regeneration (LFR) module; S5.2: Receive the learnable cross-scale fusion feature map output from step S4, which has been processed by the RLSF module. Hereinafter, it is denoted as... Then, through channel splitting operations, regenerated branches and retained branches are formed, as shown in the following expressions:

[0098] In the above formula, and yes The segmented feature map, Indicates a regenerative branch. Indicates that the branch is retained; S5.3: For regeneration branches Perform feature transformation and channel dimensionality reduction, preserving branches. No action taken; Furthermore, S5.3 includes the following steps: S5.3.1: Using a set of convolution operations to regenerate the branch Feature transformation and channel dimensionality reduction are performed to extract features and reduce computational burden, generating a regenerative branch. The expression is as follows:

[0099] In the above formula, This indicates that the regeneration branch passes through the first CBS module, which is used for feature decoupling and performs channel dimensionality reduction; This indicates a depthwise separable convolution operation used to extract spatial context information from the feature map after channel dimensionality reduction by the first CBS module. This indicates that the regeneration branch passes through the second CBS module, which is used to transform and reassemble the spatial context information extracted by depthwise separable convolution; S5.3.2: For retained branches No processing is performed to preserve the original feature information; S5.4: Preservation using residual join And splice regeneration branches With preserved branches Generate the final feature map The expression is as follows: .

[0100] Furthermore, S6 includes the following steps: S6.1: Receive the feature map output from step S5 after feature transformation and channel dimensionality reduction by the LFR module, denoted here as... and will Input the network detection head to perform bounding box and classification prediction, and generate the original prediction tensor; Furthermore, S6.1 includes the following steps: S6.1.1: Using the C3K2F module to... Feature extraction is performed to generate a feature map for input to the detection head, as shown in the following expression:

[0101] In the above formula, This represents the feature map used as input to the detection head; S6.1.2: Will Input the bounding box prediction branch and the classification prediction branch respectively to generate the original bounding box prediction tensor and the original classification prediction tensor. Then, concatenate the two along the channel dimension to generate the original prediction tensor at this scale, as shown in the following expression:

[0102]

[0103]

[0104] In the above formula, (Convolution layers for box regression) represents the bounding box prediction branch path, which internally passes through two CBS modules and a standard 3×3 Conv2D (2D Convolution) convolutional layer, and this convolutional layer does not contain batch normalization operations and activation functions. This represents the original bounding box prediction tensor; (Convolution layers for box classification) represents the classification prediction branch path, which internally passes through two DSConv layers and a standard Conv2D convolutional layer with a kernel size of 3×3. This convolutional layer also does not contain batch normalization operations and activation functions. Represents the original classification prediction tensor; This represents the original prediction tensor.

[0105] S6.2: Decode, integrate, and post-process the original prediction tensors to generate the final prediction result; Furthermore, S6.2 includes the following steps: S6.2.1: The original prediction tensor output from step S6.1.2 Decode the result to generate the integrated prediction tensor, as shown in the following expression:

[0106] In the above formula, The decoding operation involves concatenating the original prediction tensors at all scales and splitting them into original bounding box prediction tensors. and the original classification prediction tensor ;for The coordinates are converted into the final bounding box coordinates through decoding. ,for Applying the Sigmoid activation function to obtain class confidence ;Will and Performing the Concat concatenation operation yields the integrated prediction result tensor. ; S6.2.2: Post-processing is performed using the NMS (Non-Maximum Suppression) algorithm to integrate the prediction result tensor output from step S6.2.1. Redundant bounding boxes are removed, and the bounding box with the highest confidence score is retained. The final bounding box coordinates, confidence score, and corresponding class index are generated. The expression is as follows:

[0107] In the above formula, This represents a nonmaximum suppression algorithm, which is based on... The system filters candidate bounding boxes based on category confidence and a preset confidence threshold, calculates the Intersection over Union (IOU) ratio between candidate boxes, and removes redundant bounding boxes with an IOU greater than the preset threshold. This step ultimately outputs... , It includes the target bounding box coordinates, confidence scores, and corresponding category indices after filtering and suppression, and serves as the final detection result.

[0108] Furthermore, thanks to the lightweight feature regeneration module (LFR) and the overall architecture optimization constructed in this invention, the method described in this invention significantly reduces computational complexity and the number of parameters while ensuring detection accuracy. Therefore, the method of this invention is not only suitable for high-performance servers, but also for deployment on edge computing devices or mobile terminals with limited computing power. In specific implementation, the trained model can be converted into a new format and deployed on embedded neural processing unit (NPU) chips, the built-in processor of handheld microscopic detectors, or mobile devices such as tablets used in forensic examinations, thereby enabling real-time, rapid, and offline detection of weak diatom targets in forensic autopsy scenes or field water quality monitoring scenarios with no network connection or limited computing power.

[0109] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make other equivalent modifications or substitutions without departing from the spirit of the invention. These equivalent modifications or substitutions are included within the scope defined by the claims.

Claims

1. A method for detecting drowned diatoms based on multidimensional attention fusion, characterized in that, The method includes the following steps: S1: Acquire diatom images and extract multi-scale feature maps using a feature extraction network; S2: Construct the Prototype Routed Channel Attention (PRCA) module to enhance the representation of feature channels in multi-scale feature maps; S3: Construct an Adaptive Focus Spatial Attention (AFSA) module to enhance the response of spatial regions in multi-scale feature maps; S4: Construct a Residual Learnable Scale Fusion (RLSF) module to perform learnable cross-scale fusion on the enhanced feature maps; S5: Construct a lightweight feature regeneration module (LFR) to perform feature transformation and channel dimensionality reduction on the fused feature map; S6: Output the target bounding box and category prediction results.

2. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S1 includes the following steps: S1.1: Acquire diatom images, use annotation tools to complete target bounding box annotations, and convert the annotation files to .txt format. The annotation file content includes the target category code ( Class ), and the normalized coordinates of the four vertices of its rotated bounding box ( x 1, y 1, x 2, y 2, x 3, y 3, x 4, y 4); S1.2: Perform preprocessing operations such as uniform size adjustment and pixel value normalization on all images, and divide the images into training set, validation set and test set; S1.3: Input the preprocessed image into the feature extraction network, extract its features through depthwise convolution operations, and generate a multi-scale feature map set. f 3, f 4, f 5}; S1.3 includes the following steps: S1.3.1: The preprocessed diatom image f input The input feature extraction network extracts its initial feature maps through two CBS (Convolution-BatchNormalization-SiLU) modules. f 2. The expression is as follows: In the above formula, This represents the SiLU activation function. This indicates a batch normalization operation. Represents a two-dimensional convolution operation; S1.3.2: Initial feature map f 2. Input the multi-scale feature extraction module C3K2F (Cross Stage Partial with Kernel size 2-False) of the input feature extraction network to extract its shallow feature map. f 3. The expression is as follows: In the above formula, This indicates an operation that segments the input feature map along the channel dimension. f 21 and f 22 yes f The sum of the number of channels in the two segmented feature maps is equal to... f 2 channels; This indicates an operation that splices along the channel dimension; Indicates stacking n The Bottleneck module consists of a main branch that connects to a sub-branch after passing through two CBS modules. S1.3.3: Shallow feature map f The C3K2T (Cross Stage Partial with Kernel size 2-True) multi-scale feature extraction module of the 3-input feature extraction network extracts its mid-layer feature maps. f 4. The expression is as follows: In the above formula, f 31 and f 32 yes f The sum of the number of channels in the 3-segmented feature map is equal to f 3 channels; Indicates stacking n There is a C3K module, and internally, the C3K module has a main branch that passes through a CBS module and... n There are one Bottleneck module. One sub-branch goes through one CBS module. Two branches are concatted and then go through another CBS module. S1.3.4: Transfer the middle layer feature map f 4. The long-range modeling module C2PSA (Cross Stage Partial with Spatial Attention) of the input feature extraction network is used to extract its deep feature maps using a global attention mechanism. f 5. The expression is as follows: In the above formula, f 41 and f 42 yes f The sum of the number of channels in the 4 segmented feature maps is equal to f 4 channels; Indicates stacking n Each PSABlock contains a position-sensitive attention block, and each PSABlock includes a self-attention mechanism and two CBS modules. S1.3.5: Output a set of multi-scale feature maps { f 3 ,f 4 ,f 5}.

3. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S2 includes the following steps: S2.1: Construct the Prototype Routed Channel Attention (PRCA) module. S2.2: Extract the multi-scale feature map output from step S1 using Fast Fourier Transform (FFT). Frequency domain feature map and initialize the group prototype matrix. ; S2.2 includes the following steps: S2.2.1: Extracting multi-scale feature maps using Fast Fourier Transform (FFT) f i The frequency domain information is used, and only the amplitude portion is taken to generate a frequency domain amplitude feature map. The expression is as follows: In the above formula, f i This represents the multi-scale feature map extracted from the feature extraction network. This represents the two-dimensional Fast Fourier Transform operation. This represents a complex frequency domain feature map containing amplitude and phase information. This indicates the amplitude operation. Represents the frequency domain amplitude characteristic map; S2.2.2: Processing frequency domain amplitude feature maps using depthwise separable convolution (DSConv) and the sigmoid activation function. Generate frequency mask The frequency mask is applied to the frequency domain amplitude feature map using element-wise multiplication to generate the frequency domain feature map. The expression is as follows: In the above formula, This indicates a depthwise separable convolution operation with a kernel size of 3×3. This represents the Sigmoid activation function. This represents an element-wise multiplication operation; S2.2.3: Initialize the grouping prototype matrix The parameters of this matrix are updated through backpropagation during model training, as shown in the following expression: In the above formula, This indicates a parameter initialization operation that creates a grouped prototype matrix of a specified size. That is, the specified size, indicating that the space size of the matrix is... n ×9, n Indicates creation n The prototype matrices are grouped, with 9 representing the number of parameters in each group. This number must match the number in step S2.2.

2. The dimensions remain consistent after the convolution kernel is flattened. S2.3: Calculate the grouping prototype matrix Affinity matrix And use one-dimensional convolution operations to generate frequency domain feature maps. Rating matrix ; S2.3 includes the following steps: S2.3.1: Calculate the weight matrix of the depthwise separable convolution kernel in step S2.2.

2. With group prototype matrix Affinity matrix The expression is as follows: In the above formula, The weight matrix represents the depthwise separable convolution kernel. This indicates a resizing operation. This indicates the operation of calculating cosine similarity. This represents the Softmax activation function; S2.3.2: Utilizing n The frequency domain feature map output from step S2.2.2 is processed by a parallel one-dimensional convolution kernel Conv1D (1D Convolution). Multi-view feature evaluation is performed to generate a scoring matrix. The expression is as follows: In the above formula, Indicates the first j A one-dimensional convolutional kernel is applied to the frequency domain feature map. n Indicates the number of grouped prototype matrices; S2.4: Calculate channel attention weights and with multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. ; S2.4 includes the following steps: S2.4.1: Using the affinity matrix output in step S2.3 and rating matrix Calculate channel attention weights The expression is as follows: In the above formula, This indicates an operation that sums along the grouping dimension; S2.4.2: Adjust channel attention weights With multi-scale feature maps f i Perform element-wise multiplication to generate the final channel attention feature map. The expression is as follows: 。 4. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S3 includes the following steps: S3.1: Construct the Adaptive Focus Spatial Attention (AFSA) module. S3.2: Receive the feature map output from step S2 after representation enhancement by the PRCA module, denoted here as... And extract using pooling and convolution operations. Spatial feature map ; S3.2 includes the following steps: S3.2.1: Using average pooling and max pooling operations along the channel to... Channel-level information compression is performed, and the two pooling results are merged using the Concat operation to generate a pooled feature map. The expression is as follows: In the above formula, This indicates average pooling along the channel. This indicates max pooling along the channel; S3.2.2: Use depthwise separable convolution DSConv to process the pooled feature map output from step S3.2.

1. Spatial context extraction is performed to generate spatial feature maps. The expression is as follows: S3.3: Sharpening the spatial feature map Generate a spatial attention mask and combine it with... Channel-by-channel weighting is performed to generate an enhanced feature map at this scale. ; S3.3 includes the following steps: S3.3.1: Utilize an adaptive sharpening mechanism to transform the spatial feature map output in step S3.2.

2. Perform spatial feature enhancement to generate a sharpened spatial feature map. The expression is as follows: In the above formula, Representing the computational spatial feature map Standard deviation operation in spatial dimension σ That is, spatial feature map Standard deviation in spatial dimension k This represents a learnable sharpening factor parameter. ε This represents a tiny constant that prevents division by zero. λ That is, based on the standard deviation σ Dynamically calculated adaptive sharpening factor, when σ When smaller, λ A larger value will achieve a greater sharpening effect; S3.3.2: Calculate the sharpened spatial feature map output from step S3.3.1 using the Sigmoid activation function. Spatial attention mask Spatial attention masks are applied through element-wise multiplication operations. The final enhanced feature map is generated. The expression is as follows: 。 5. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S4 includes the following steps: S4.1: Construct a residual learnable scale fusion module RLSF (Residual Learnable Scale Fusion); S4.2: Receive the feature map output from step S3 after response enhancement by the AFSA module, denoted here as... And by using learnable weights, a top-down dynamic weighted fusion is performed to generate a preliminary multi-scale fusion feature map set. P 3, P 4, P 5}; S4.2 includes the following steps: S4.2.1: Enhance the deep feature map Set as the initial deep fusion feature map P 5. P 5. After performing scale alignment operation, compare with the mid-layer enhanced feature map Perform learnable-scale fusion operations with residuals to generate preliminary mid-level fusion feature maps. P 4. P 4. After performing scale alignment operation, compare with shallow enhancement feature map Perform learnable-scale fusion operation with residuals to generate preliminary shallow fused feature maps. P 3. The expression is as follows: In the above formula, This indicates a scale alignment operation. This represents the element-wise addition operation, { α 4, α 5, β 3, β 4} represents the learnable weights of the corresponding scale-enhanced feature map; S4.2.2: Output a preliminary set of multi-scale fused feature maps { P 3, P 4, P 5}; S4.3: The preliminary multi-scale fused feature map set output from step S4.2.2 { P 3, P 4, P 5) Perform bottom-up feature fusion to generate the final multi-scale fused feature map. The expression is as follows: In the above formula, This represents the final shallow fusion feature map. This represents the final mid-layer fused feature map. This represents the final deep fusion feature map.

6. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S5 includes the following steps: S5.1: Construct the Lightweight Feature Regeneration (LFR) module; S5.2: Receive the learnable cross-scale fusion feature map output from step S4, which has been processed by the RLSF module. Hereinafter, it is denoted as... And through channel splitting operations, regenerated branches and retained branches are formed, as shown in the following expressions: In the above formula, and yes The segmented feature map, Indicates a regenerative branch. Indicates that the branch is retained; S5.3: For regeneration branches Perform feature transformation and channel dimensionality reduction, preserving branches. No action taken; S5.3 includes the following steps: S5.3.1: Using a set of convolution operations to regenerate the branch Feature transformation and channel dimensionality reduction are performed to extract features and reduce computational burden, generating a regenerative branch. The expression is as follows: In the above formula, This indicates that the regeneration branch passes through the first CBS module, which is used for feature decoupling and performs channel dimensionality reduction; This indicates a depthwise separable convolution operation used to extract spatial context information from the feature map after channel dimensionality reduction by the first CBS module. This indicates that the regeneration branch passes through the second CBS module, which is used to transform and reassemble the spatial context information extracted by depthwise separable convolution; S5.3.2: For retained branches No processing is performed to preserve the original feature information; S5.4: Preservation using residual join And splice regeneration branches With preserved branches Generate the final feature map The expression is as follows: 。 7. The method for detecting drowned diatoms based on multidimensional attention fusion according to claim 1, characterized in that, S6 includes the following steps: S6.1: Receive the feature map output from step S5 after feature transformation and channel dimensionality reduction by the LFR module, denoted here as... and will Input the network detection head to perform bounding box and classification prediction, and generate the original prediction tensor; S6.1 includes the following steps: S6.1.1: Using the C3K2F module to... Feature extraction is performed to generate a feature map for input to the detection head, as shown in the following expression: In the above formula, This represents the feature map used as input to the detection head; S6.1.2: Will Input the bounding box prediction branch and the classification prediction branch respectively to generate the original bounding box prediction tensor and the original classification prediction tensor. Then, concatenate the two along the channel dimension to generate the original prediction tensor at this scale, as shown in the following expression: In the above formula, (Convolution layers for box regression) represents the bounding box prediction branch path, which internally passes through two CBS modules and a standard 3×3 Conv2D (2D Convolution) convolutional layer, and this convolutional layer does not contain batch normalization operations and activation functions. This represents the original bounding box prediction tensor; (Convolution layers for box classification) represents the classification prediction branch path, which internally passes through two DSConv layers and a standard Conv2D convolutional layer with a kernel size of 3×3. This convolutional layer also does not contain batch normalization operations and activation functions. Represents the original classification prediction tensor; Represents the original prediction tensor; S6.2: Decode, integrate, and post-process the original prediction tensors to generate the final prediction result; S6.2 includes the following steps: S6.2.1: The original prediction tensor output from step S6.1.2 Decode the result to generate the integrated prediction tensor, as shown in the following expression: In the above formula, The decoding operation involves concatenating the original prediction tensors at all scales and splitting them into original bounding box prediction tensors. and the original classification prediction tensor ;for The coordinates are converted into the final bounding box coordinates through decoding. ,for Applying the Sigmoid activation function to obtain class confidence ;Will and Performing the Concat concatenation operation yields the integrated prediction result tensor. ; S6.2.2: Post-processing is performed using the NMS (Non-Maximum Suppression) algorithm to integrate the prediction result tensor output from step S6.2.

1. Remove redundant bounding boxes and retain the target bounding box with the highest confidence score. Generate the final target bounding box coordinates, confidence score, and corresponding category index, as shown in the following expression: In the above formula, This represents a nonmaximum suppression algorithm, which is based on... The system filters candidate bounding boxes based on category confidence and a preset confidence threshold, calculates the Intersection over Union (IOU) ratio between candidate boxes, and removes redundant bounding boxes with an IOU greater than the preset threshold. This step ultimately outputs... , It includes the target bounding box coordinates, confidence scores, and corresponding category indices after filtering and suppression, and serves as the final detection result.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a drowning diatom detection method based on multidimensional attention fusion as described in any one of claims 1 to 7.