Dense algae detection method based on double attention mechanisms and feature fusion

Through the dense algae detection network model based on YOLOV8, combined with the dual attention mechanism and feature fusion, the problem of poor quality of mid-span scale and cross-temporal and spatial recognition of algae target recognition is solved, and efficient and accurate identification of algae is achieved.

CN120279550APending Publication Date: 2025-07-08SOUTHWEAT UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510317758.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The prior art has the problem of poor identification quality in algae target recognition with dense distribution across scales, across time and space, and targets, especially when identifying multi-objective and similar morphological samples, the feature processing and decoding capabilities are insufficient.

Method used

The dense algae detection network model based on YOLOV8 is adopted, combined with the dual attention mechanism backbone network and the enhanced weighted feature fusion neck network, and the WIOU generalized cross-comparison loss function is used for training to improve feature extraction, fusion and decoding capabilities.

Benefits of technology

It improves the accuracy of algae recognition for different species and backgrounds, has strong generalization and efficient algae image recognition performance, and can better handle complex backgrounds and close targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279550A_ABST
    Figure CN120279550A_ABST
Patent Text Reader

Abstract

The invention relates to a dense algae detection method based on double attention mechanisms and feature fusion. The method comprises the steps that firstly, a microalgae data set is obtained and preprocessed, and a training set, a verification set and a test set are obtained; then, a dense algae detection network model is constructed based on YOLOV8, and the network model comprises a double attention mechanism backbone network, an enhanced weighted feature fusion neck network and a small target detection head; then, training the dense algae detection network model by adopting the training set and the verification set, and measuring the coincidence degree of a prediction frame and a real frame by adopting a WIOU generalized intersection-to-union ratio loss function during training; and finally, inputting the test set into the trained dense algae detection network model, and outputting a dense algae type detection result. According to the method, algae of different types and different backgrounds can be relatively completely and accurately identified, and the method has relatively strong generalization and relatively high algae image identification comprehensive performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of target detection, and particularly to a dense algae detection method based on a dual attention mechanism and feature fusion. Background Art

[0002] Algae are one of the more important organisms in nature. It can be used as a water quality indicator organism to warn of the eutrophication degree of water bodies and predict the types of water pollution. However, some algae (such as cyanobacteria) will release algal toxins, which will then threaten the safety of drinking water. Both algal toxins and organic pollution are caused by the excessive reproduction and outbreak of algae. These pollution sources will damage the fresh water bodies on which humans depend for survival, leading to a serious decline in water quality. Since it is inevitable for human drinking water to use water bodies polluted by algae, the pollution source will enter the human body through the digestive tract, causing discomfort symptoms such as diarrhea, liver poisoning, and nerve paralysis. It has now become a global or worldwide freshwater pollution problem. Therefore, screening algae targets in a timely and effective manner and prescribing the right remedies to contain or treat water pollution has great social significance for maximizing the protection of freshwater water resources.

[0003] With the rapid development of computer vision technology, deep learning has shown excellent results in most fields, and there has also been some progress in the recognition of algae targets. Currently, the publicly available datasets for algae are relatively scarce, and they generally have poor quality, high background blur, and poor ability to capture and process small targets. To a certain extent, this restricts the feature extraction and processing capabilities for algae targets, manifested as misrecognition of similar algae and misrecognition of small and closely arranged targets. The cascaded structure based on convolutional neural networks has shown relatively good results in the field of target detection. Compared with YOLOV1, YOLO V2-V8 have all optimized the convolutional structure, continuously introduced the C2f convolution and SWIN-TRANSFORMER architecture, and also inserted a spatial attention mechanism and an adjusted feature splicing module. Given the characteristics of the YOLO series of target detection algorithms, such as easy modification of the model, clear structure, strong skeleton structure feature extraction ability, cross-scale feature fusion, and high expression accuracy, some domestic scholars have now adjusted the network architecture of the YOLO series to improve the performance of detecting planktonic algae and animal and plant targets, inserted the SPP, LSKA, and Adown modules into the YOLOV3, YOLOV5, and YOLOV8 architectures, and continuously proposed new enhanced network architectures to improve the model's parameter quantity, inference speed, and inference quality. However, the recognition quality for samples with cross-scale, cross-time and space range, closely arranged targets, and similar species is still very poor, and there are limitations in feature processing and decoding for multi-target and morphologically similar samples.

[0004] Therefore, in the related art, there is an urgent need for a method to improve the recognition quality of algal samples with cross-scale, cross-time and space, and dense target distribution. Summary of the Invention

[0005] Based on this, in view of the above technical problems, it is necessary to provide a dense algal detection method based on a dual attention mechanism and feature fusion, which can improve the recognition quality of algal samples with cross-scale, cross-time and space, and dense target distribution.

[0006] In a first aspect, the present application provides a dense algal detection method based on a dual attention mechanism and feature fusion. The method includes:

[0007] Obtain a microalgae dataset and perform preprocessing to obtain a training set, a validation set and a test set;

[0008] Build a dense algal detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network and a small target detection head;

[0009] Use the training set and the validation set to train the dense algal detection network model. When training, use the WIOU generalized intersection over union loss function to measure the coincidence degree between the predicted box and the ground truth box;

[0010] Input the test set into the trained dense algal detection network model and output the detection result of the dense algal type.

[0011] Optionally, in an embodiment of the present application, the dual attention mechanism backbone network includes a convolution module, a three-dimensional attention mechanism cascaded with a cross-time and space attention mechanism module, and a serpentine convolution cascaded with a dual attention mechanism module.

[0012] Optionally, in an embodiment of the present application, the expression of the three-dimensional attention mechanism cascaded with the cross-time and space attention mechanism module is:

[0013] Attn(x) = σ(1 / (σ(MLP(AvgPool(x))) + MLP(MaxPool(x)))) ⊙ (x)

[0014] Where x represents the input feature encoding vector, AvgPool represents the average pooling operation, MaxPool represents the maximum pooling operation, MLP represents the fully connected layer, σ represents the sigmoid function, and ⊙ represents the element-wise multiplication operation of two vectors with the same dimension at the corresponding positions.

[0015] Optionally, in an embodiment of the present application, the enhanced weighted feature fusion neck network includes a feature fusion module that cascades serpentine convolution and Wn-Concat and a spatio-temporal attention mechanism, and a feature fusion module that cascades dilated convolution, spatio-temporal attention mechanism, and serpentine convolution.

[0016] Optionally, in an embodiment of the present application, the formula of the WIOU generalized intersection over union loss function is:

[0017]

[0018] where W represents the width of the anchor box, H represents the height of the anchor box, S represents the area of the anchor box, x and y respectively represent the x and y coordinates of the anchor box, the subscript gt represents the ground truth box, the subscript pt represents the predicted box, exp represents the exponential operation with base e, * represents simple scalar multiplication, and l WIoU represents the value of the WIOU loss function.

[0019] In a second aspect, the present application also provides a dense algae detection device based on a dual attention mechanism and feature fusion. The device includes:

[0020] An image acquisition module, configured to obtain a microalgae dataset and perform preprocessing to obtain a training set, a validation set, and a test set;

[0021] A model building module, configured to build a dense algae detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small object detection head;

[0022] A model training module, configured to train the dense algae detection network model using the training set and the validation set. When training, the WIOU generalized intersection over union loss function is used to measure the overlap degree between the predicted box and the ground truth box;

[0023] A dense algae detection module, configured to input the test set into the trained dense algae detection network model and output the detection result of the dense algae type.

[0024] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the steps of the methods in the above respective embodiments.

[0025] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the methods in the above respective embodiments are implemented.

[0026] The above-mentioned dense algae detection method based on dual attention mechanism and feature fusion, first, obtains the microalgae data set and preprocesses it to obtain the training set, the validation set and the test set; then, builds a dense algae detection network model based on YOLOV8, and the network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network and a small target detection head; then, the dense algae detection network model is trained using the training set and the validation set, and the WIOU generalized intersection-over-union loss function is used during training to measure the overlap degree of the predicted box and the true box; finally, the test set is input into the dense algae detection network model after training, and the dense algae type detection result is output. That is to say, for two algae with similar intermediate morphologies, such as Cyclotella and Stratophyta, the structure of the enhanced weighted feature fusion neck network can supervise the network training process and provide real-time feedback on features or target parts with poor training or learning effects, and enhance their learning weights, making the classification boundaries of similar samples clearer. For a small number of samples, the enhanced feature fusion (including splicing function) module can prompt the model to fully learn the comprehensive feature information of the sample data, thereby improving its detection accuracy; for algae with dense target distribution and severe occlusion, such as Anabaena and Navicula, the structure of the dual attention mechanism backbone network is conducive to clarifying and strengthening the focus of feature learning and extraction, and is conducive to strengthening the extraction and omission capture of features in densely distributed areas, while minimizing the increase in the number of parameters. Comprehensively grasp the characteristics of target information across scales, time and space, and ranges, laying a solid foundation for enhancing the performance of feature fusion and efficient feature expression. At the same time, the overall structure of the constructed model greatly improves the ability to process, extract, encode, decode and express feature information. It can identify algae of different types and backgrounds more completely and accurately, and has strong generalization and high comprehensive performance in algae image recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A diagram of an application environment of a dense algae detection method based on a dual attention mechanism and feature fusion in one embodiment;

[0028] Figure 2 is a flowchart of a dense algae detection method based on a dual attention mechanism and feature fusion in one embodiment;

[0029] Figure 3 A schematic diagram of the structure of a dense algae detection network model in one embodiment;

[0030] Figure 4 is a structural block diagram of a dense algae detection device based on a dual attention mechanism and feature fusion in one embodiment;

[0031] Figure 5Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0032] To make the objectives, technical solutions and advantages of this application clearer, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.

[0033] A dense algae detection method based on dual attention mechanism and feature fusion provided by an embodiment of this application can be applied to, for example Figure 1 the application environment shown. Among them, the terminal communicates with the server through the network. The data storage system can store the data that the server needs to process. The data storage system can be integrated on the server, or placed in the cloud or other network servers. Among them, the terminal can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented with an independent server or a server cluster composed of multiple servers.

[0034] In one embodiment, as Figure 2 shown, a dense algae detection method based on dual attention mechanism and feature fusion is provided. Taking the method applied to Figure 1 the server in as an example for illustration, it includes the following steps:

[0035] S201: Obtain a microalgae dataset and perform preprocessing to obtain a training set, a validation set, and a test set.

[0036] In the embodiment of this application, first, collect multiple independent species of microalgae samples, place them under a microscope for observation, and take original images. The microalgae species include common freshwater algae such as Anabaena and Straight algae. And expand the microalgae original images to 250 images each by means of flipping, scaling, background color transformation, etc. Standardize the resolution of all the expanded images to 640×640 pixels. At the same time, randomly divide all the algae images according to the ratio of training set: validation set: test set = 8:1:1 and manually annotate all the images, and store the target annotation labels in XML files.

[0037] S203: Build a dense algae detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head.

[0038] In the embodiments of the present application, under the conditions of complex backgrounds, serious adhesion, similar samples, close arrangement, and significant differences in various sample data for algae images, in order to improve the performance of feature extraction, feature fusion, and feature expression of the network, a dense algae detection network model as shown in Figure 3 is constructed based on YOLOV8, including a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head Detect. Among them, the dual attention mechanism backbone network is a skeleton feature extraction network constructed with a combined attention mechanism of three-dimensional attention (Similarity-Aware Activation Module, SimAM) and spatio-temporal attention (ConvolutionalBlock Attention Module, CBAM) as the main line, which is used to enhance the ability of feature information extraction and recognition, and to exclude noise and ripple interference to the greatest extent. The enhanced weighted feature fusion neck network is a skip connection feature fusion and feature expression network that improves the feature layers of different scales in the neck with the enhanced weighted feature fusion module Wn-CONCAT with the number of feature maps specified by the user as the main line. The small target detection head Detect is used to avoid the serious problem of missing the detection of tiny algae targets.

[0039] Specifically, in an embodiment of the present application, the dual attention mechanism backbone network includes a convolutional module, a three-dimensional attention mechanism cascaded with a spatio-temporal attention mechanism module, and a serpentine convolution cascaded with a dual attention mechanism module.

[0040] In an embodiment of the present application, as shown in Figure 3 , after inputting the image information, features are directly extracted by the convolutional module at the P1 layer, and the P2-P4 layers are improved with the Improved-backbone1 structure, which is a three-dimensional attention mechanism cascaded with a spatio-temporal attention mechanism module, and the P5 layer is improved with the Improved-backbone2 structure, which is a serpentine convolution cascaded with a dual attention mechanism module. Specifically, the design idea of the Improved-backbone1 structure is to use the dynamic convolution ODConv-3 rdThe module linearly weights multiple convolutional kernels according to the input characteristics, retains the main features, and then uses the step modulation type SPD layer convSPD module to perform convolution merging according to the step size to extract features. Then, the SimAM three-dimensional attention mechanism is used to extract the target space information of the image, and at the same time, it is cascaded into the module of inserting the CBAM cross-space-time attention mechanism module into C2f. After the features are processed by branch conversion, the feature information of the current scale is combined. Among them, Split is a module with the function of dividing feature data. The design idea of the Improved-backbone2 structure is to cascade the Conv, convSPD, C2f feature conversion module C2f-Dysnakeconv adjusted by dynamic snake convolution, Fast Spatial Pyramid Pooling (SPPF), CBAM, and SimAM modules. Due to the characteristics of cross-region connection of the YOLO series models, when extracting large targets, considering the problem that the sizes of algae targets are different, resulting in different degrees of complexity of feature information, a snake convolution module is introduced to adaptively adjust the training parameters according to the input features to ensure that the large-scale feature information is not lost or discarded.

[0041] In an embodiment of the present application, the expression of the three-dimensional attention mechanism cascading the cross-space-time attention mechanism module is:

[0042] Attn(x) = σ(1 / (σ(MLP(AvgPool(x))) + MLP(MaxPool(x)))) ⊙ (x)

[0043] Where, x represents the input feature encoding vector, AvgPool represents the average pooling operation, MaxPool represents the maximum pooling operation, MLP represents the fully connected layer, σ represents the sigmoid function, and ⊙ represents the operation of multiplying two vectors of the same dimension at the corresponding positions by the vectors of the same dimension.

[0044] It should be noted that σ(MLP(AvgPool(x))) + MLP(MaxPool(x))) represents the effect of the CBAM attention mechanism, and σ(1 / (σ(MLP(AvgPool(x))) + MLP(MaxPool(x)))) represents the effect of the SimAM attention mechanism.

[0045] In an embodiment of the present application, the enhanced weighted feature fusion neck network includes a feature fusion module with snake convolution cascading Wn-Concat and cross-space-time attention mechanism, and a feature fusion module with dilated convolution cascading cross-space-time attention mechanism and snake convolution.

[0046] In one embodiment of the present application, since the morphologies of Cyclotella and Melosira are relatively similar, misclassification and incorrect classification are likely to occur during binary classification, and some algae are densely distributed, resulting in a large amount of information being missed by general neural network models during reinforcement learning and feature expression. To enhance the ability of feature fusion and feature expression, as Figure 3 shown, the three-time upsampling structure repeat unit is improved with the Improved-neck1 structure, which is a feature fusion module that cascades serpentine convolution, Wn-Concat, and spatio-temporal attention mechanism. The three-level repeat unit before the detection results of P3-P5 are output is improved with the Improved-neck2 structure, which is a feature fusion module that cascades dilated convolution, spatio-temporal attention mechanism, and serpentine convolution. Specifically, the design idea of the Improved-neck1 structure is that after the Upsample upsampling is completed, the C2f feature conversion module C2f-Dysnakeconv adjusted by dynamic serpentine convolution fuses and integrates feature information at different levels to enrich the feature expression ability. At the same time, considering the difficulty of detection when the number of decomposed sub-feature maps is different, the Wn-Concat enhanced feature fusion module is connected. Finally, the spatio-temporal attention mechanism CBAM is used to strengthen the learning process of feature expression. The Wn-Concat module is set by the user to the number of sub-feature map parameters according to the complexity of the image information, and then dynamically adjusts the learning weight ratio of each feature according to its performance during training. The number of its sub-feature maps is not limited to 2 or 3, and ReLU is used as the activation function before feature splicing, which can eliminate the dependence on background information during feature information restoration and expression. In this application, the number of sub-feature maps n is set to 4, 6, and 8 respectively. The mechanism of the Wn-Concat module is shown in the following formula.

[0047]

[0048]

[0049] Among them, Conv represents the convolution operation, δ represents the impulse function, i and j represent the i-th and j-th feature maps, n represents the number of feature maps, x i 、x j represent the vectors of the input i-th and j-th features, W i 、W j represent the original weighted coefficients of the input i-th and j-th features before regularization, w i represents the weight coefficient of the i-th feature map after regularization (a positive number between 0 and 1), and ε represents an infinitesimal constant close to 0. The enhancement of this module can effectively avoid the problems of low recognition accuracy among samples with different degrees of target feature density, occlusion, and similarity.

[0050] The design idea of the Improved-neck2 structure is as follows: First, use the InceptionDWConv2d module of dilated convolution to improve the fusion characteristics of multi-scale feature parameters. Then, use CBAM to enhance the comprehensive convolution feature ability of the Conv convolution block and the convSPD stride-by-step, as well as the large-range feature splicing ability of Concat. Finally, use the C2f feature conversion module C2f-Dysnakeconv module adjusted by dynamic snake convolution to process and synthesize the comprehensive expression results of features with different complexities due to images, avoiding the loss of feature omission caused by the boundary stitching of sub-feature maps that are misprocessed due to "local reasoning" when restoring features, ensuring the accuracy of feature decoding, facilitating the transfer of more accurate rules for target feature recognition and prediction to the head structure of this network, and better improving the reasoning ability for the inspected targets with complex image information.

[0051] S205: Use the training set and the validation set to train the dense algae detection network model. When training, use the WIOU generalized intersection over union loss function to measure the overlap degree between the predicted bounding box and the ground truth bounding box.

[0052] In the embodiment of the present application, the number of training iterations is set to 100, the batch normalization size is 4, the initial learning rate is 1e-5, the SGD optimizer is used to optimize the model, the prepared training set and the YOLOV8 pre-trained weights are used to train the model. During the training process, after each round of iterative training, the prepared validation set is loaded for validation. Record the validation metric results obtained by the current weight model and compare them with the previous training results. When the accuracy is higher, save the current model weights until the training result metrics tend to a stable value and then stop training, finally obtaining the model weights with the best comprehensive performance. Among them, the validation metric results refer to the values calculated using the WIOU generalized intersection over union loss function. The WIOU generalized intersection over union loss function is applicable to various object detection tasks with different scales and shapes, avoiding the drawback that loss functions such as IoU, CIoU, and DIoU cannot optimize the losses of objects with different scales.

[0053] Specifically, in an embodiment of the present application, the formula of the WIOU generalized intersection over union loss function is:

[0054]

[0055] Among them, W represents the width of the anchor box, H represents the height of the anchor box, S represents the area of the anchor box, x and y respectively represent the x and y coordinates of the anchor box, the subscript gt represents the ground truth bounding box, the subscript pt represents the predicted bounding box, exp represents the exponential operation with e as the base, * represents simple scalar multiplication operation, and l WIoU represents the value of the WIOU loss function.

[0056] S207: Input the test set into the trained dense algae detection network model to output the detection results of dense algae types.

[0057] In the embodiment of this application, load the model weights with the best comprehensive performance, use the prepared test set to test the model effect, and output the detection results of dense algae types.

[0058] In the above-mentioned dense algae detection method based on dual attention mechanism and feature fusion, first, obtain the microalgae data set and perform preprocessing to obtain the training set, validation set, and test set; then, build a dense algae detection network model based on YOLOV8, and the network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head; then, use the training set and validation set to train the dense algae detection network model, and use the WIOU generalized intersection over union loss function to measure the coincidence degree between the prediction box and the ground truth box during training; finally, input the test set into the trained dense algae detection network model to output the detection results of dense algae types. That is to say, for two types of algae with similar intermediate forms, such as Cyclotella and Melosira, etc., the structure of the enhanced weighted feature fusion neck network can supervise the training process of the network and timely feedback the features or target parts with poor training or learning effects, and enhance their learning weights, so as to make the classification boundary of similar samples clearer. For a small number of samples, the module of enhanced feature fusion (including splicing function) can prompt the model to fully learn the comprehensive feature information with less sample data, thereby improving its detection accuracy; for algae with a dense target distribution and serious occlusion, such as Anabaena and Navicula, etc., the structure of the dual attention mechanism backbone network is beneficial to clarify and strengthen the key points of feature learning and extraction, is beneficial to enhancing the extraction and omission capture of features in the densely distributed area, and comprehensively grasps the features of target information across scales, time and space, and scope as much as possible while minimizing the increase in the number of parameters, laying a solid foundation for enhancing the performance of feature fusion and efficient feature expression. At the same time, the overall structure of the constructed model greatly improves the ability to process, extract, encode, decode, and express feature information, can identify different types and backgrounds of algae more completely and accurately, and has strong generalization and high comprehensive performance of algae image recognition.

[0059] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0060] Based on the same inventive concept, an embodiment of the present application further provides a dense algae detection device based on a dual attention mechanism and feature fusion for implementing the dense algae detection method based on a dual attention mechanism and feature fusion described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the dense algae detection device based on a dual attention mechanism and feature fusion provided below can refer to the limitations on the dense algae detection method based on a dual attention mechanism and feature fusion in the above text, and will not be repeated here.

[0061] In one embodiment, as Figure 4 shown, a dense algae detection device 400 based on a dual attention mechanism and feature fusion is provided, including: an image acquisition module 401, a model construction module 403, a model training module 405, and a dense algae detection module 407, where:

[0062] The image acquisition module 401 is used to obtain a microalgae data set and perform preprocessing to obtain a training set, a validation set, and a test set.

[0063] The model construction module 403 is used to construct a dense algae detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head.

[0064] The model training module 405 is used to train the dense algae detection network model using the training set and the validation set. When training, the WIOU generalized intersection over union loss function is used to measure the coincidence degree between the predicted box and the ground truth box.

[0065] The dense algae detection module 407 is used to input the test set into the trained dense algae detection network model and output the dense algae type detection result.

[0066] In one embodiment of the present application, the dual attention mechanism backbone network includes a convolutional module, a three-dimensional attention mechanism cascaded with a spatio-temporal attention mechanism module, and a serpentine convolution cascaded with a dual attention mechanism module.

[0067] In one embodiment of the present application, the expression of the three-dimensional attention mechanism cascaded with the spatio-temporal attention mechanism module is:

[0068] Attn(x) = σ(1 / (σ(MLP(AvgPool(x))) + MLP(MaxPool(x)))) ⊙ (x)

[0069] Where x represents the input feature encoding vector, AvgPool represents the average pooling operation, MaxPool represents the max pooling operation, MLP represents the fully connected layer, σ represents the sigmoid function, and ⊙ represents the element-wise multiplication operation of two vectors of the same dimension at the corresponding positions.

[0070] In one embodiment of the present application, the enhanced weighted feature fusion neck network includes a feature fusion module of serpentine convolution cascaded with Wn-Concat and spatio-temporal attention mechanism, and a feature fusion module of dilated convolution cascaded with spatio-temporal attention mechanism and serpentine convolution.

[0071] In one embodiment of the present application, the formula of the WIOU generalized intersection over union loss function is:

[0072]

[0073] Where W represents the width of the anchor box, H represents the height of the anchor box, S represents the area of the anchor box, x and y represent the x and y coordinates of the anchor box respectively, the subscript gt represents the ground truth box, the subscript pt represents the predicted box, exp represents the exponential operation with base e, * represents the simple multiplication operation, and l WIoU represents the value of the WIOU loss function.

[0074] Each module in the above-mentioned dense algae detection device based on dual attention mechanism and feature fusion can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.

[0075] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 5As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a dense algae detection method based on a dual attention mechanism and feature fusion. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0076] Those skilled in the art can understand that Figure 5 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0077] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0078] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0079] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0080] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties.

[0081] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0082] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0083] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A dense algae detection method based on dual attention mechanism and feature fusion, characterized in that The method includes: Obtain a microalgae dataset and perform preprocessing to obtain a training set, a validation set, and a test set; Build a dense algae detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head; Use the training set and the validation set to train the dense algae detection network model. When training, use the WIOU generalized intersection over union loss function to measure the overlap degree between the predicted bounding box and the ground truth bounding box; Input the test set into the trained dense algae detection network model and output the dense algae type detection result.

2. The dense algae detection method based on the dual attention mechanism and feature fusion according to claim 1, characterized in that, The dual attention mechanism backbone network includes a convolutional module, a three-dimensional attention mechanism cascaded with a spatio-temporal attention mechanism module, and a serpentine convolution cascaded with a dual attention mechanism module.

3. The dense algae detection method based on dual attention mechanism and feature fusion according to claim 2, characterized in that The expression of the three-dimensional attention mechanism cascaded with the spatio-temporal attention mechanism module is: Attn(x) = σ(1 / (σ(MLP(AvgPool(x))) + MLP(MaxPool(x)))) ⊙ (x), where x represents the input feature encoding vector, AvgPool represents the average pooling operation, MaxPool represents the maximum pooling operation, MLP represents the fully connected layer, σ represents the sigmoid function, and ⊙ represents the element-wise multiplication operation of two vectors of the same dimension at the corresponding positions.

4. A dense algae detection method based on dual attention mechanism and feature fusion according to claim 1, characterized in that The enhanced weighted feature fusion neck network includes a serpentine convolution cascaded with a Wn-Concat and a spatio-temporal attention mechanism feature fusion module, and a dilated convolution cascaded with a spatio-temporal attention mechanism and a serpentine convolution feature fusion module.

5. A dense algae detection method based on a dual attention mechanism and feature fusion according to claim 1, characterized in that The formula of the WIOU generalized intersection over union loss function is: Among them, W represents the width of the anchor box, H represents the height of the anchor box, S represents the area of the anchor box, x and y respectively represent the x and y coordinates of the anchor box, the subscript gt represents the ground truth box, the subscript pt represents the predicted box, exp represents the exponential operation with base e, * represents simple scalar multiplication, and l WIoU represents the value of the WIOU loss function.

6. A dense algae detection device based on a dual attention mechanism and feature fusion, characterized in that, The device includes: An image acquisition module, which is used to obtain a microalgae dataset and perform preprocessing to obtain a training set, a validation set, and a test set; A model building module, which is used to build a dense algae detection network model based on YOLOV8. The network model includes a dual attention mechanism backbone network, an enhanced weighted feature fusion neck network, and a small target detection head; A model training module, which is used to use the training set and the validation set to train the dense algae detection network model. When training, use the WIOU generalized intersection over union loss function to measure the overlap degree between the predicted bounding box and the ground truth bounding box; A dense algae detection module, which is used to input the test set into the trained dense algae detection network model and output the dense algae type detection result.

7. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

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 the steps of the method according to any one of claims 1 to 5.

Citation Information

Cited By

  • Method for detecting bird target by using YOLOv5s improved model

    CN120932028A