Method, device and server for generating a map of cyanobacteria distribution based on diffusion model

The diffusion model with a hybrid attention mechanism enhances the accuracy of cyanobacteria distribution maps by integrating real-time video and geographic data, addressing the limitations of existing models.

CN118968317BActive Publication Date: 2024-12-13POWERCHINA HUADONG ENG CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411442254.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2024-12-13
Estimated Expiration
2044-10-16

AI Technical Summary

Technical Problem

Existing image data processing models for generating cyanobacteria distribution maps fail to account for the impact of geographical location coordinates, resulting in low resolution and poor accuracy.

Method used

A method and device using a diffusion model with an encoder and decoder, incorporating a hybrid attention mechanism to fuse real-time video image data and geographic location coordinates, and iterative denoising to generate accurate cyanobacteria distribution maps.

Benefits of technology

Significantly improves the accuracy and spatiotemporal resolution of cyanobacteria distribution maps by effectively utilizing spatial distribution constraints and balancing local and global information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968317B_ABST
    Figure CN118968317B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device and server for generating a blue algae distribution map based on a diffusion model, which relates to the technical field of water environment monitoring, including: obtaining an original sample data set; sending the original sample data set to a hybrid attention model of an encoder for feature extraction processing, determining the blue algae distribution characteristics under different viewing angles and the hybrid coding of the blue algae distribution characteristics; generating Gaussian noise according to the noise parameter of the current time step, and superimposing the Gaussian noise with the hybrid coding to generate the hybrid coding under the noise state; using a decoder to perform step-by-step denoising on the hybrid coding under the noise state, and iterative training for the denoising process, determining the diffusion model that reaches the maximum iteration round as the target diffusion model, so that the target diffusion model generates a target blue algae distribution map. The present invention can significantly improve the accuracy of a blue algae distribution map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water environment monitoring, and in particular to a method, device and server for generating a blue algae distribution map based on a diffusion model. Background Art

[0002] Cyanobacteria are a common freshwater algae that will proliferate in large numbers under appropriate environmental conditions to form algae blooms, thereby destroying the balance of the aquatic ecosystem. Therefore, timely and accurate monitoring of the distribution range and changing trends of cyanobacteria in lakes is of great significance for analyzing the causes of cyanobacteria outbreaks and formulating control measures. At present, relevant technologies have proposed that an image data processing model can be used to generate a cyanobacteria distribution map based on the collected real-time video image data or the geographical location coordinates of the monitoring points. However, when analyzing the collected data, this scheme fails to take into account the impact of the geographical location coordinates of the monitoring points on the cyanobacteria distribution map, and the existing image data processing model has a poor ability to capture details in video images. Therefore, the cyanobacteria distribution map generated by the existing image data processing model has low resolution and poor accuracy. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a method, device and server for generating a cyanobacteria distribution map based on a diffusion model, which can significantly improve the accuracy of the cyanobacteria distribution map.

[0004] In a first aspect, an embodiment of the present invention provides a method for generating a cyanobacteria distribution map based on a diffusion model, wherein the diffusion model includes: an encoder and a decoder, and the method includes: obtaining an original sample data set, wherein the original sample data set includes: real-time video image data fed back by video monitoring points around a lake, geographic location coordinate information corresponding to each video monitoring point, and a cyanobacteria spatial distribution map determined by inversion of multispectral remote sensing image data covering the lake area; sending the original sample data set to a hybrid attention model of the encoder for feature extraction processing to determine the cyanobacteria distribution characteristics under different viewing angles and the hybrid coding of the cyanobacteria distribution characteristics; generating Gaussian noise according to the noise parameters of the current time step, and superimposing the Gaussian noise with the hybrid coding to generate a hybrid coding in a noisy state; using a decoder to perform stepwise denoising processing on the hybrid coding in the noisy state, and performing iterative training on the denoising processing process, and determining the diffusion model that reaches the maximum iteration round as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving the real-time video image data, geographic location coordinate information and cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a target cyanobacteria distribution map.

[0005] In one embodiment, after the step of obtaining the original sample data set, the method includes: obtaining a video image in real-time video image data that is consistent with the time node of the multispectral remote sensing image data, as well as video features and coordinate features in the video image and the geographical location coordinate information of the monitoring point corresponding to the video image; performing position encoding processing on the video features and coordinate features to determine the fusion features corresponding to each monitoring point, wherein the fusion features are used to represent the video sequence and position encoding corresponding to the monitoring point; determining the fusion features and the cyanobacteria spatial distribution map as target sample data, and inputting the target sample data into the encoder for model training.

[0006] In one embodiment, the step of performing position coding processing on video features and coordinate features to determine the fusion features corresponding to each monitoring point includes: performing linear transformation processing on the video features and coordinate features to unify the dimensions of the video features and coordinate features; performing position coding processing on the video features and coordinate features after the linear transformation processing to determine the fusion features.

[0007] In one embodiment, before the step of sending the original sample data set to the hybrid attention model of the encoder for feature extraction processing, it includes: obtaining a global self-attention model, wherein the global self-attention model is used to capture the long-range dependency between any two positions; constructing a local attention model based on a preset dynamic window function and a learnable two-dimensional kernel function, wherein the dynamic window function is used to control the size of the attention window to gradually increase from the bottom of the image to the top of the image to adapt to the scene changes caused by the pitch angle of the video monitoring point, the two-dimensional kernel function is used to weight the features in the local area, and the local attention model is used to focus on the local neighborhood pattern of the features; based on the global self-attention model and the local attention model, a hybrid attention model is generated, wherein the hybrid attention model is used to adaptively adjust the attention allocation of different monitoring points according to the coverage of each monitoring point.

[0008] In one embodiment, the step of generating a hybrid attention model based on the global self-attention model and the local attention model includes: setting an attenuation function in the global self-attention model and the local attention model through a preset weighted model, and performing model fusion processing on the global self-attention model and the local attention model through a preset layer normalization model to determine the hybrid attention model.

[0009] In one embodiment, a decoder is used to perform step-by-step denoising on a mixed code in a noisy state, and iterative training is performed on the denoising process, and the diffusion model that reaches the maximum iteration round is determined as the target diffusion model. The steps include: using a decoder to perform step-by-step denoising on the mixed code in a noisy state to generate a cyanobacteria distribution map; comparing the cyanobacteria distribution map with the cyanobacteria spatial distribution map to determine the loss function; using the loss function to perform back propagation optimization processing on the decoder, so that the decoder is iteratively trained, and after reaching the maximum iteration round, the diffusion model is determined as the target diffusion model.

[0010] In one embodiment, the decoder includes: multiple decoding blocks, each decoding block is provided with a self-attention layer, and the decoder is used to gradually denoise the mixed code in a noisy state, and the step of generating a cyanobacteria distribution map includes: using the self-attention mechanism of the self-attention layer to capture the global dependency of the mixed code in the noisy state, and through each decoding block, based on the global dependency, gradually denoising the mixed code to reconstruct the cyanobacteria distribution at different scales, and generating a cyanobacteria distribution map.

[0011] In the second aspect, an embodiment of the present invention also provides a device for generating a map of cyanobacteria distribution based on a diffusion model, the diffusion model includes: an encoder and a decoder, the device includes: a data acquisition module, which acquires a set of original sample data, wherein the original sample data set includes: real-time video image data fed back by video surveillance points around the lake, geographical location coordinate information corresponding to each video surveillance point, and a cyanobacteria spatial distribution map determined by inversion of multispectral remote sensing image data covering the lake area; a hybrid coding module, which sends the original sample data set to the encoder's hybrid attention model for feature extraction processing, determines the cyanobacteria distribution characteristics under different viewing angles, and obtains the cyanobacteria distribution characteristics under different viewing angles. and a mixed coding of the distribution characteristics of cyanobacteria; a noise superposition module, which generates Gaussian noise according to the noise parameters of the current time step, and superimposes the Gaussian noise with the mixed coding to generate a mixed coding under the noise state; a model training module, which uses a decoder to gradually denoise the mixed coding under the noise state, and iteratively trains the denoising process, and determines the diffusion model that reaches the maximum iteration round as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving the real-time video image data, geographic location coordinate information and cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a map of the target cyanobacteria distribution.

[0012] In a third aspect, an embodiment of the present invention further provides a server, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement any one of the methods provided in the first aspect.

[0013] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement any one of the methods provided in the first aspect.

[0014] The embodiments of the present invention bring the following beneficial effects:

[0015] The embodiment of the present invention provides a method, device and server for generating a cyanobacteria distribution map based on a diffusion model, obtains an original sample data set, and sends the original sample data set to the mixed attention model of the encoder for feature extraction processing, determines the cyanobacteria distribution characteristics under different viewing angles and the mixed coding of the cyanobacteria distribution characteristics, and then generates Gaussian noise according to the noise parameter of the current time step, and superimposes the Gaussian noise and the mixed coding to generate the mixed coding under the noise state, and finally uses the decoder to perform step-by-step denoising on the mixed coding under the noise state, and iterative training is performed on the denoising process, and the diffusion model that reaches the maximum iteration round is determined as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving the real-time video image data, geographic location coordinate information and cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates the target cyanobacteria distribution map. The embodiment of the present invention can significantly improve the accuracy of the cyanobacteria distribution map.

[0016] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0017] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A schematic flow chart of a method for generating a cyanobacteria distribution map based on a diffusion model provided in an embodiment of the present invention;

[0020] Figure 2A schematic diagram of a specific process of constructing a target diffusion model provided by an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of a diffusion model training deployment provided by an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of a hybrid attention model in an encoder provided by an embodiment of the present invention;

[0023] Figure 5 A schematic diagram of the structure of a decoding block provided by an embodiment of the present invention;

[0024] Figure 6 A schematic diagram of an improved U-Net structure provided by an embodiment of the present invention;

[0025] Figure 7 A schematic diagram of the structure of a device for generating a map of cyanobacteria distribution based on a diffusion model provided by an embodiment of the present invention;

[0026] Figure 8 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] At present, cyanobacteria are a common freshwater algae, which will proliferate in large numbers under appropriate environmental conditions to form algae blooms, thereby destroying the balance of the aquatic ecosystem. Therefore, timely and accurate monitoring of the distribution range and changing trends of cyanobacteria in lakes is of great significance for analyzing the causes of cyanobacteria outbreaks and formulating control measures. Relevant technologies have proposed that an image data processing model can be used to generate a cyanobacteria distribution map based on the collected real-time video image data or the geographical location coordinates of the monitoring points. However, when analyzing the collected data, this scheme fails to take into account the impact of the geographical location coordinates of the monitoring points on the cyanobacteria distribution map, and the existing image data processing model has poor performance on the video images. The ability to capture details is poor. Therefore, the cyanobacteria distribution map generated by the existing image data processing model has low resolution and poor accuracy. Based on this, the method, device and server for generating a cyanobacteria distribution map based on a diffusion model provided by the present invention introduce location constraints. By encoding the geographic location coordinate information of the video monitoring points, the diffusion model can make full use of the spatial distribution constraints of the video site. In addition, the hybrid attention mechanism can balance local details and global information, providing efficient modeling capabilities, so that the diffusion model reduces the computational complexity while ensuring sufficient modeling capabilities. Therefore, the accuracy of the cyanobacteria distribution map can be significantly improved.

[0029] See also Figure 1 The flowchart of a method for generating a blue algae distribution map based on a diffusion model is shown. The diffusion model includes: an encoder and a decoder. The diffusion model is a diffusion model based on Transformer. Transformer is good at processing sequence data. It captures long-range dependencies between different positions through a self-attention mechanism, combines image data extracted from real-time video, geographic location coordinate information of video monitoring points, and spatial distribution of blue algae inverted by remote sensing, and performs fusion modeling. In the training stage, the model uses a hybrid attention strategy to simultaneously model global and local dependencies to fuse real-time video image data and geographic location coordinate features. In the deployment stage, the image data extracted from real-time videos of multiple monitoring stations is used to generate a blue algae distribution map in a geographic spatial coordinate system, so as to achieve accurate generation and dynamic tracking of the distribution of blue algae outbreaks in lakes, and provide support for blue algae disaster warning and water environment management. Specifically, the method mainly includes the following steps S102 to S108:

[0030] Step S102, obtaining a set of original sample data, wherein the set of original sample data includes: real-time video image data fed back by video surveillance points around the lake, geographical location coordinate information corresponding to each video surveillance point, and a spatial distribution map of cyanobacteria determined by inverting multispectral remote sensing image data covering the lake area. In one embodiment, multiple video surveillance points can be deployed around the lake to collect real-time video image data, and after obtaining multispectral remote sensing image data covering the lake area, the spatial distribution map of cyanobacteria can be inverted by extracting spectral classification features.

[0031] In addition, before sending the original sample data set to the encoder, it is necessary to use a position coding module to assign a position code to each video surveillance point, and encode the geographic location coordinates into the feature expression. Specifically, the present invention adopts a unified projection coordinate system, such as the UTM system. The UTM system can provide plane coordinates in meters, which is convenient for calculation and visualization. All input data is converted into a unified coordinate system. For example, if the remote sensing image originally uses a geographic coordinate system (longitude and latitude), it needs to be converted into UTM coordinates. The geographic location coordinates of the video surveillance point also need to be converted from longitude and latitude to UTM coordinates. In the position coding module, the converted UTM coordinate value (x, y) can be directly used as input, and the geographic location information is encoded into the feature expression through the position coding method.

[0032] Step S104, sending the original sample data set to the hybrid attention model of the encoder for feature extraction processing, determining the cyanobacteria distribution characteristics under different viewing angles and the hybrid encoding of the cyanobacteria distribution characteristics. In one embodiment, the video of the original sample data set after position encoding is fused and modeled through a shared Transformer encoder. The encoder adopts a hybrid attention strategy and uses both standard global self-attention and local attention mechanisms. Among them, global self-attention can capture the long-range dependency between any two positions, and local attention focuses on the local neighborhood pattern of the feature. The outputs of the two attention mechanisms are fused through residual connections, layer normalization, etc. to form the final hybrid attention output. This hybrid strategy can balance global and local information and make full use of the spatial distribution constraints of the video site.

[0033] Step S106, generating Gaussian noise according to the noise parameters of the current time step, and superimposing the Gaussian noise with the mixed code to generate the mixed code under the noise state. In one embodiment, in each iterative training, it is necessary to sample a training sample from the data set, including a video image, geographic location coordinates and a map of cyanobacteria distribution, and then add Gaussian noise to the mixed code to generate a series of gradually damaged intermediate states, and these noise states are input into the diffusion model. Then, through multiple denoising operations, the result that is as close to the real distribution as possible is restored. During the training process, the mean square error can be used as the loss function, and the parameters of the model are continuously optimized through the back propagation algorithm.

[0034] Step S108, using a decoder to gradually denoise the mixed code under the noise state, and iterative training is performed on the denoising process, and the diffusion model that reaches the maximum iteration round is determined as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving the real-time video image data, geographic location coordinate information and cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a target cyanobacteria distribution map. In one embodiment, after determining the trained target diffusion model, it is only necessary to input the newly collected real-time video image data and geographic location coordinates into the target diffusion model to efficiently generate a cyanobacteria distribution map of the corresponding area, thereby realizing the effective fusion and utilization of multi-source heterogeneous data.

[0035] Furthermore, the present invention utilizes the generation capability of the diffusion model to skillfully incorporate real-time video image data and geographic location coordinates into the process of cyanobacteria distribution mapping, greatly improving the spatiotemporal resolution and prediction accuracy. In the deployment stage, the generated cyanobacteria distribution map can be saved as an image file in TIFF format to facilitate subsequent analysis and visualization, and the GDAL library is used to generate the TIFF file, wherein TIFF is a commonly used geospatial data format that supports multi-band, multi-resolution, metadata annotation and other features. GDAL is an open source geospatial data processing library that provides read and write support for a variety of raster and vector data formats. In addition, the present invention can also create a TIFF dataset, specify the file path, image size, number of bands and data type, and write the data of the cyanobacteria distribution map into the band after obtaining the first band object.

[0036] The method for generating a cyanobacteria distribution map based on a diffusion model provided in an embodiment of the present invention can significantly improve the accuracy of the cyanobacteria distribution map.

[0037] join Figure 2A specific flow chart of constructing a target diffusion model is shown. The embodiment of the present invention also provides an implementation method of constructing a target diffusion model, selecting images of multiple video surveillance points that are consistent with the time of multispectral remote sensing image data, and inputting real-time video image data of different sites at the same time and the geographical location coordinate information of the video surveillance points into a diffusion model based on Transformer, so as to fit the above-mentioned cyanobacteria remote sensing inversion image. In the Transformer encoder, a hybrid attention strategy is adopted to simultaneously model global and local dependencies, and fuse visual, spectral and position features. Then, at the Transformer decoder end, a final cyanobacteria distribution map is generated. Finally, through fusion modeling, the video features and the geographical location coordinate information of the video surveillance points are used as input and input into the diffusion model based on Transformer, so as to realize the projection of the two-dimensional scene in the video image into a cyanobacteria distribution map under geographic space coordinates. For details, see (1) to (8) as follows:

[0038] (1) Prepare the data set: collect real-time video image data, geographic location coordinates of video monitoring points, and a corresponding remote sensing inversion of cyanobacteria distribution map to form a training data set (i.e., a set of original sample data).

[0039] (2) Sampling a batch of data: Select a batch of video images, geographic location coordinates, and a map of cyanobacteria distribution from the training dataset.

[0040] (3) Initialize the diffusion model: define the network structure of the encoder and decoder, as well as the hybrid attention mechanism. The diffusion model contains the network structure of the encoder and decoder. The encoder is responsible for extracting the features of the video image and geographic location, while the decoder generates a cyanobacteria distribution map through a step-by-step denoising process. This architecture can effectively capture the complex distribution and spatiotemporal dependencies of the data.

[0041] (4) Start the training loop: Enter the main training loop and iterate continuously until the preset maximum number of rounds is reached.

[0042] (5) Forward propagation: The video image and geographic location coordinates are input into the encoder respectively, and after extracting features and mixing the codes, Gaussian noise is generated according to the noise parameters of the current time step, and superimposed on the mixed code to obtain a series of gradually damaged intermediate states. The mixed code in the noisy state is then input into the decoder to allow it to learn to gradually denoise and restore a complete cyanobacteria distribution map. In particular, an end-to-end training method can be used for gradual denoising, and the mean square error is used as the loss function to directly compare the denoised cyanobacteria distribution map with the true distribution map, thereby ensuring that the model can learn the entire generation process from the original input to the final distribution map. For the mixed code X, the noise addition process of the present invention can be expressed as:

[0043]

[0044] in, is the code after adding noise, X is the original mixed code, σ is a scalar parameter that controls the noise intensity, and ε is standard Gaussian noise. In the above expression, the σ parameter controls the amount of noise added to the original code. The value of σ can be adjusted as needed to control the intensity of the noise. A larger σ value will result in stronger noise, while a smaller σ value will produce weaker noise.

[0045] (6) Calculate the loss: Compare the denoised cyanobacteria distribution map with the true distribution map, and calculate the mean square error loss function.

[0046] (7) Backpropagation and optimization: Calculate the gradient of model parameters based on the loss function, and use the optimizer to update the parameters so that the model learns in the right direction.

[0047] (8) Loop judgment: If the maximum number of training rounds has not been reached, re-enter the main training loop and continue to the next round of iteration; otherwise, save the trained model and end the training process.

[0048] In response to the above scheme, an embodiment of the present invention further proposes a specific data fusion scheme. Data fusion may include a heterogeneous data fusion architecture and a multi-monitoring point fusion mechanism. The heterogeneous data fusion architecture fuses two types of heterogeneous data sources, namely real-time video image data and geographic location coordinates of monitoring points, to ultimately generate a cyanobacteria distribution map that is highly consistent with the remote sensing inversion result. This architecture makes full use of the complementarity of different data sources and effectively improves the accuracy and spatiotemporal resolution of cyanobacteria distribution prediction. The multi-monitoring point fusion mechanism realizes the joint modeling of video sequences and location information of multiple monitoring points through feature extraction and fusion strategies. This mechanism can not only process multiple data sources simultaneously, but also capture the spatial relationship between different monitoring points.

[0049] In one embodiment, a video image consistent with the time node of the multispectral remote sensing image data, as well as video features and coordinate features in the video image and the geographical location coordinate information of the monitoring point corresponding to the video image can be obtained in the real-time video image data, and then position coding processing is performed on the video features and coordinate features to determine the fusion features corresponding to each monitoring point. Finally, the fusion features and the cyanobacteria spatial distribution map are determined as target sample data, and the target sample data is input into the encoder for model training, wherein the fusion features are used to represent the video sequence and position coding corresponding to the monitoring point. In one embodiment, before performing the position coding processing, it is also necessary to perform linear transformation processing on the video features and coordinate features to unify the dimensions of the video features and coordinate features, and then the video features and coordinate features after the linear transformation processing are subjected to position coding processing to determine the fusion features.

[0050] Specifically, the real-time video image data and geographic location coordinates need to be encoded into a format suitable for input into the diffusion model. For video images, a four-dimensional NumPy array can be set with a shape of (num_frames, height, width, channels), where num_frames is the total number of video frames, height and width are both 256, and channels is 3 (corresponding to the three RGB channels). The array is directly used as the input of the diffusion model; the four-dimensional vector generated by the geographic location coordinates not only completely retains the information of the original two-dimensional coordinates, but also provides a nonlinear representation. The periodic characteristics of the sine and cosine functions can be used to encode location information in different dimensions. The sine function is used for even dimensions and the cosine function is used for odd dimensions. This alternating use allows each location to obtain a unique code. Before the two types of features, video images and geographic location coordinates, are sent to the diffusion model, they need to be linearly transformed and adjusted to the same dimension.

[0051] Secondly, the present invention needs to design the network structure of the diffusion model so that it can effectively model the relationship between video features and location features. Considering the situation of multiple monitoring points, the representation of video data is as follows:

[0052]

[0053] Wherein, N is the number of monitoring points, T is the number of frames of each video, H and W are the height and width of the image, respectively, and C is the number of channels (for example, for RGB images, C=3). First, the present invention selects video frames that are consistent with the time nodes of the remote sensing image for the video sequence of each monitoring point, and applies 2D CNN to process the video frames.

[0054]

[0055] Among them, H', W', and C' are the new dimensions of CNN output. The present invention flattens the features of each monitoring point and maps them to the required dimensions through a linear layer:

[0056]

[0057] The position coordinates are processed as follows:

[0058]

[0059] Where N is the number of monitoring points, and 4 represents the four-dimensional position encoding of each point.

[0060] The present invention maps the position coordinates to the same dimension through a linear layer:

[0061]

[0062] The present invention combines the video features of each monitoring point with the corresponding position code:

[0063]

[0064] in, is the fusion feature of the i-th monitoring point. The final input representation is:

[0065]

[0066] This design takes into account the situation of multiple monitoring points, each of which has its own video sequence and position encoding, which allows the model to process the information of all monitoring points simultaneously while capturing the relationship between different monitoring points.

[0067] For further information, see Figure 3 The figure shows a schematic diagram of a diffusion model training deployment. In a complex system that processes the fusion of video surveillance data and remote sensing images, it is crucial to consider geometric factors such as the pitch angle, altitude, and azimuth of video surveillance. These factors directly affect the geometric deformation and visible area of ​​the scene in the video image, which in turn affects the quality of data fusion and cyanobacteria distribution map generation. Therefore, when training the diffusion model, it is necessary to first obtain the global self-attention model and build a local attention model based on a preset dynamic window function and a learnable two-dimensional kernel function. The global self-attention model is used to capture the long-range dependency between any two positions, and the dynamic window function is used to control the size of the attention window from the bottom of the image to the top of the image. The two-dimensional kernel function is used to weight the features in the local area, and the local attention model is used to focus on the local neighborhood pattern of the features. Then, based on the global self-attention model and the local attention model, a hybrid attention model is generated, wherein the hybrid attention model is used to adaptively adjust the attention allocation of different monitoring points according to the coverage of each monitoring point. In one embodiment, it is necessary to set an attenuation function in the global self-attention model and the local attention model through a preset weighting model, and perform model fusion processing on the global self-attention model and the local attention model through a preset layer normalization model to determine the hybrid attention model.

[0068] Specifically, through multi-layer self-attention and feedforward networks, a latent space representation that integrates two types of information is extracted. A hybrid attention mechanism is introduced in the encoder. Combining global self-attention and local attention, it can capture global dependencies and focus on local patterns, thereby improving the representation ability of the model. In addition, in order to make full use of this information and improve the fusion accuracy, in the feature fusion stage, weights need to be assigned according to the coverage of each monitoring point, and an attenuation function is used to assign weights so that nearby areas obtain higher weights. This weighting strategy helps the model better balance information from different distances.

[0069] Among them, the dynamic hybrid attention mechanism can cleverly combine global self-attention and local attention considering the pitch angle, thereby fully considering the changes in scene characteristics brought about by the camera pitch angle, enabling the model to more accurately capture the distribution characteristics of cyanobacteria under different perspectives.

[0070] For input features , where H, W and C represent the height, width and number of channels of the feature map respectively. The present invention first defines a dynamic window size function w(y), which makes the window size increase from the bottom of the image to the Gradually increase to the top , so as to adapt to the scene changes caused by the pitch angle.

[0071]

[0072] Where y is the vertical position in the feature map, and are the predefined minimum and maximum window sizes, respectively. This function ensures that a smaller attention window is used in the lower half of the image and a larger window is used in the upper half. Local attention uses this dynamic window to decide how much pixels to focus on around each position. At the bottom of the image, the window is smaller, so the model only pays attention to very close pixels, while at the top, the window is larger and the model can see farther pixels.

[0073] Based on this dynamic window, the present invention defines local attention as follows:

[0074]

[0075] in, It is a learnable two-dimensional kernel function used to weight features in local regions.

[0076] Next, the present invention combines global self-attention and local attention to form a hybrid attention mechanism:

[0077]

[0078] here, is the standard global self-attention operation, is a learnable parameter used to balance the importance of global and local attention. The model can automatically adjust the proportion of global and local attention to adapt to the needs of different locations. The purpose of this design is to enable the model to finely capture the characteristics of cyanobacteria at the bottom of the image (near) while obtaining broader contextual information at the top (far).

[0079] Finally, the Transformer encoder layer of the present invention is expressed as:

[0080]

[0081] Among them, FFN represents feed-forward neural network, LayerNorm is the layer normalization operation, and Dropout is used for regularization.

[0082] See also Figure 4 Schematic diagram of a hybrid attention model in an encoder shown in FIG. Through the above-mentioned dynamic hybrid attention mechanism, the global self-attention and the local attention considering the camera pitch angle can be cleverly combined. The design fully considers the scene feature changes brought about by the pitch angle, so that the model can more accurately capture the distribution characteristics of cyanobacteria under different viewing angles. Specifically: the dynamic window size function w(y) can make the attention window size gradually increase from the bottom to the top of the image, adapting to the scene changes caused by the pitch angle, so that the model can assign higher weights to nearby areas, thereby better balancing information from different distances. In addition, the local attention operation is based on the dynamic window, and a learnable two-dimensional kernel function is defined to weight the features in the local area; the hybrid attention calculation balances the importance of global and local attention through the learnable parameter α, so that the model can adaptively adjust the attention allocation at different positions.

[0083] Furthermore, after obtaining the mixed code under the noise state, the decoder can be used to gradually denoise the mixed code under the noise state to generate a cyanobacteria distribution map, and the cyanobacteria distribution map is compared with the cyanobacteria spatial distribution map to determine the loss function. Finally, the loss function is used to perform back propagation optimization processing on the decoder, so that the decoder is iteratively trained, and after reaching the maximum number of iterations, the diffusion model is determined as the target diffusion model.

[0084] In one embodiment, see Figure 5A structural schematic diagram of a decoding block is shown, the decoder includes: multiple decoding blocks, each decoding block is provided with a self-attention layer, when the decoder is used to gradually denoise the mixed coding in the noisy state to generate a map of cyanobacteria distribution, the self-attention mechanism of the self-attention layer can be used to capture the global dependency of the mixed coding in the noisy state, and through each decoding block, based on the global dependency, the mixed coding is gradually denoised to reconstruct the cyanobacteria distribution at different scales to generate a map of cyanobacteria distribution.

[0085] Specifically, the latent space representation output by the encoder is concatenated with the mixed coding under the noise state and used as the input of the decoder. The goal of the decoder is to gradually remove the noise and restore a complete cyanobacteria distribution map. First, considering the characteristics of the task, the present invention will design the decoder based on the U-Net structure. The U-Net structure performs well in image generation tasks, especially its jump connection can well preserve multi-scale features, which is crucial for generating detailed cyanobacteria distribution maps.

[0086] On this basis, see Figure 6 A schematic diagram of an improved U-Net structure is shown. The present invention makes some improvements to U-Net: the decoder will be composed of multiple decoding blocks, each decoding block includes an upsampling operation, a convolution layer and a nonlinear activation function. In order to enhance the expressiveness of the model, the present invention introduces a self-attention layer in each decoding block. When generating a cyanobacteria distribution map, the introduction of the self-attention layer can significantly enhance the model's ability to capture global dependencies, so that it can better understand and express complex cyanobacteria distribution patterns. This mechanism allows the model to consider long-range correlations in the image during the generation process, thereby producing a more coherent, reasonable and detailed distribution map. In addition, the introduction of the self-attention layer improves the expressiveness of the model, enabling it to more accurately characterize the spatial characteristics and changing trends of cyanobacteria distribution, especially when processing distribution maps of large sizes and complex scenes, which may bring significant performance improvements. This improvement not only helps to generate more accurate and reliable cyanobacteria distribution predictions, but also provides more valuable information support for water environment management and ecosystem monitoring.

[0087] Through the above design, the decoder of the present invention can effectively utilize the features extracted by the encoder and accurately reconstruct the distribution of cyanobacteria at different scales. It combines the advantages of U-Net and the characteristics of the attention mechanism, while taking into account the computational efficiency and task characteristics. During the training process, the present invention uses a real remote sensing inversion of cyanobacteria distribution map as a supervision signal to optimize the model parameters so that it can predict results as close to the actual distribution as possible based on video features and geographic location coordinates.

[0088] The design and optimization of the Transformer decoder part of the present invention is illustrated by the following formula:

[0089]

[0090] in, represents the input of the decoder, is the latent space representation of the encoder output, is a hybrid code under noise conditions, and are the number of channels of the latent space representation and the noise map, respectively, and H and W are the height and width of the feature map.

[0091] Each decoding block of the decoder is represented as:

[0092]

[0093]

[0094]

[0095]

[0096] in, is the output of the previous decoding block, is the upsampling operation, is the skip connection from the corresponding encoding layer, is the convolution operation, is the self-attention layer, is the activation function.

[0097] The self-attention layer is expressed as:

[0098]

[0099] in, , , are query, key, and value matrices respectively, It is the dimension of attention.

[0100] Finally, the output of the decoder is expressed as:

[0101]

[0102] in, is the output of the last decoding block, is a sigmoid activation function, which is used to map the output to the interval [0, 1], indicating the probability of cyanobacteria distribution.

[0103] During the training process, the present invention uses mean square error (MSE) as the loss function:

[0104]

[0105] in, It is a real remote sensing inversion of cyanobacteria distribution map.

[0106] Through the above formulas and matrix representations, the innovative design of the Transformer decoder part of the present invention can be clearly described. This design combines the multi-scale feature extraction capability of U-Net and the global dependency modeling capability of the self-attention mechanism, effectively utilizes the features extracted by the encoder, and accurately reconstructs the cyanobacteria distribution at different scales. This method not only takes into account the characteristics of the task, but also balances computational efficiency and model performance, providing a powerful and flexible solution for cyanobacteria distribution prediction.

[0107] In summary, the decoder uses the improved U-Net structure and U-Net as the basic framework. Through the design of multiple decoding blocks, including upsampling operations, convolutional layers and nonlinear activation functions, it gradually restores a clear cyanobacteria distribution map. A self-attention layer is embedded in each decoding block to enhance the model's ability to capture the global dependencies of cyanobacteria distribution, making the generated distribution map more reasonable and coherent, effectively improving the model's expressiveness. In addition, by utilizing multi-scale features, through the combination of U-Net structure and self-attention mechanism, accurate reconstruction of cyanobacteria distribution at different scales is also achieved, thereby making full use of the features extracted by the encoder while considering computational efficiency and task characteristics.

[0108] In summary, the present invention adopts an innovative hybrid attention Transformer encoder, combines global self-attention and local attention, improves the model's ability to capture global dependencies and local patterns, balances computational efficiency and modeling capabilities, and comprehensively utilizes feature information of two different modalities of visual position. In addition, by introducing a diffusion model based on the Transformer architecture, it is possible to effectively model the relationship between video features and position features, and use real-time video image data and geographic location coordinate information of video surveillance points as multi-source heterogeneous inputs. The generation capability of the diffusion model is utilized to incorporate video surveillance and geographic location coordinates into the cyanobacteria distribution mapping process. Therefore, a high-fidelity, detailed cyanobacteria distribution map in geographic spatial coordinates can be output based on the generation strategy of the diffusion model, which can provide more intuitive and powerful decision-making support for lake bloom management.

[0109] For the method for generating a cyanobacteria distribution map based on a diffusion model provided in the above-mentioned embodiment, an embodiment of the present invention provides a device for generating a cyanobacteria distribution map based on a diffusion model, and the diffusion model includes: an encoder and a decoder, see Figure 7 The schematic diagram of the structure of a device for generating a map of cyanobacteria distribution based on a diffusion model is shown, and the device includes the following parts:

[0110] The data acquisition module 702 acquires an original sample data set, wherein the original sample data set includes: real-time video image data fed back by video monitoring points around the lake, geographical location coordinate information corresponding to each video monitoring point, and a spatial distribution map of cyanobacteria determined by inversion of multispectral remote sensing image data covering the lake area;

[0111] The hybrid coding module 704 sends the original sample data set to the hybrid attention model of the encoder for feature extraction processing, and determines the distribution characteristics of cyanobacteria under different viewing angles and the hybrid coding of the distribution characteristics of cyanobacteria;

[0112] The noise superposition module 706 generates Gaussian noise according to the noise parameters of the current time step, and superposes the Gaussian noise with the mixed code to generate the mixed code in the noise state;

[0113] The model training module 708 uses a decoder to gradually denoise the mixed code under the noise state, and performs iterative training on the denoising process, and determines the diffusion model that reaches the maximum iteration round as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving real-time video image data, geographic location coordinate information and cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a map of the target cyanobacteria distribution.

[0114] The above-mentioned device for generating a cyanobacteria distribution map based on the diffusion model provided in the embodiment of the present application can significantly improve the accuracy of the cyanobacteria distribution map.

[0115] In one embodiment, after the step of obtaining the original sample data set, the data acquisition module 702 is further used to: obtain video images in real-time video image data that are consistent with the time nodes of the multispectral remote sensing image data, as well as video features and coordinate features in the video images and the geographical location coordinate information of the monitoring points corresponding to the video images; perform position coding processing on the video features and coordinate features to determine the fusion features corresponding to each monitoring point, wherein the fusion features are used to represent the video sequence and position coding corresponding to the monitoring point; determine the fusion features and the cyanobacteria spatial distribution map as target sample data, and input the target sample data into the encoder for model training.

[0116] In one embodiment, when performing position encoding processing on video features and coordinate features to determine the fusion features corresponding to each monitoring point, the above-mentioned data acquisition module 702 is also used to: perform linear transformation processing on video features and coordinate features to unify the dimensions of video features and coordinate features; perform position encoding processing on the video features and coordinate features after linear transformation processing to determine the fusion features.

[0117] In one embodiment, before performing the step of sending the original sample data set to the hybrid attention model of the encoder for feature extraction processing, the above-mentioned hybrid encoding module 704 is also used to: obtain a global self-attention model, wherein the global self-attention model is used to capture the long-range dependency between any two positions; construct a local attention model based on a preset dynamic window function and a learnable two-dimensional kernel function, wherein the dynamic window function is used to control the size of the attention window to gradually increase from the bottom of the image to the top of the image to adapt to the scene changes caused by the pitch angle of the video monitoring point, the two-dimensional kernel function is used to weight the features in the local area, and the local attention model is used to focus on the local neighborhood pattern of the features; based on the global self-attention model and the local attention model, generate a hybrid attention model, wherein the hybrid attention model is used to adaptively adjust the attention allocation of different monitoring points according to the coverage of each monitoring point.

[0118] In one embodiment, when performing the step of generating a hybrid attention model based on the global self-attention model and the local attention model, the above-mentioned hybrid coding module 704 is also used to: set an attenuation function in the global self-attention model and the local attention model through a preset weighted model, and perform model fusion processing on the global self-attention model and the local attention model through a preset layer normalization model to determine the hybrid attention model.

[0119] In one embodiment, when using a decoder to perform step-by-step denoising on a mixed code under a noisy state, and iteratively training the denoising process, and determining the diffusion model that reaches the maximum iteration round as the target diffusion model, the above-mentioned model training module 708 is also used to: use the decoder to perform step-by-step denoising on the mixed code under a noisy state to generate a cyanobacteria distribution map; compare the cyanobacteria distribution map with the cyanobacteria spatial distribution map to determine the loss function; use the loss function to perform back propagation optimization processing on the decoder, so that the decoder is iteratively trained, and after reaching the maximum iteration round, the diffusion model is determined as the target diffusion model.

[0120] In one embodiment, the decoder includes: multiple decoding blocks, each decoding block is provided with a self-attention layer, and when using the decoder to gradually denoise the mixed code in a noisy state to generate a map of cyanobacteria distribution, the above-mentioned model training module 708 is also used to: use the self-attention mechanism of the self-attention layer to capture the global dependency of the mixed code in the noisy state, and through each decoding block, based on the global dependency, gradually denoise the mixed code to reconstruct the cyanobacteria distribution at different scales and generate a map of cyanobacteria distribution.

[0121] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0122] An embodiment of the present invention provides a server. Specifically, the server includes a processor and a storage device. The storage device stores a computer program, and when the computer program is executed by the processor, it executes the method described in any one of the above-mentioned embodiments.

[0123] Figure 8 A structural diagram of a server provided in an embodiment of the present invention, the server 100 includes: a processor 80, a memory 81, a bus 82 and a communication interface 83, wherein the processor 80, the communication interface 83 and the memory 81 are connected via the bus 82; the processor 80 is used to execute an executable module stored in the memory 81, such as a computer program.

[0124] The memory 81 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 83 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0125] The bus 82 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0126] Among them, the memory 81 is used to store programs, and the processor 80 executes the program after receiving the execution instruction. The method executed by the device for flow process definition disclosed in any embodiment of the above-mentioned embodiments of the present invention can be applied to the processor 80 or implemented by the processor 80.

[0127] The processor 80 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 80. The above processor 80 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 81, and the processor 80 reads the information in the memory 81 and completes the steps of the above method in combination with its hardware.

[0128] The computer program product of the readable storage medium provided in the embodiment of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be referred to the previous method embodiments, which will not be repeated here.

[0129] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0130] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for generating a map of cyanobacteria distribution based on a diffusion model, characterized in that: The diffusion model includes: an encoder and a decoder, and the method includes: Acquire an original sample data set, wherein the original sample data set includes: real-time video image data fed back by video monitoring points around the lake, geographic location coordinate information corresponding to each of the video monitoring points, and a spatial distribution map of cyanobacteria determined by inversion of multispectral remote sensing image data covering the lake area; Sending the original sample data set to the hybrid attention model of the encoder for feature extraction processing to determine the cyanobacteria distribution characteristics under different viewing angles and the hybrid encoding of the cyanobacteria distribution characteristics; Generate Gaussian noise according to the noise parameter of the current time step, and superimpose the Gaussian noise with the mixed code to generate the mixed code in the noise state; The decoder is used to perform step-by-step denoising on the mixed code in a noisy state, and iterative training is performed on the denoising process, and the diffusion model that reaches the maximum iteration round is determined as the target diffusion model, so that the target diffusion model automatically performs fusion modeling processing after receiving the real-time video image data, the geographical location coordinate information and the cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a map of the target cyanobacteria distribution; The noise adding process is expressed as: ; in, is the code after adding noise, X is the original mixed code, σ is a scalar parameter for controlling the noise intensity, ε is standard Gaussian noise, in the expression of the noise adding process, the σ parameter is used to control the amount of noise added to the original mixed code, so as to control the intensity of the noise according to the adjustment amount of the σ value, the larger the σ value, the stronger the noise, and the smaller the σ value, the weaker the noise; Among them, for the input features , where H, W and C represent the height, width and number of channels of the feature map respectively; Among them, by defining a dynamic window size function w(y), the window size is increased from the bottom of the image to Gradually increase to the top , to adapt to the scene changes caused by the pitch angle; ; Where y is the vertical position in the feature map, and are the predefined minimum and maximum window sizes, respectively; Among them, based on the dynamic window, the local attention is expressed as: ; in, It is a learnable two-dimensional kernel function used to weight features in local regions; Among them, global self-attention and local attention are combined to form a hybrid attention mechanism: ; in, is the standard global self-attention operation, is a learnable parameter used to balance the importance of global and local attention. , so that the model automatically adjusts the proportion of global and local attention to adapt to the needs of different positions, so that the model can finely capture the characteristics of cyanobacteria at the bottom of the image and obtain broader contextual information above the image.

2. The method for generating a blue algae distribution map based on a diffusion model according to claim 1, characterized in that: After the step of obtaining the original sample data set, the following steps are included: Acquire a video image in the real-time video image data that is consistent with a time node of the multispectral remote sensing image data, as well as video features and coordinate features in the video image and the geographic location coordinate information of the monitoring point corresponding to the video image; Performing position coding processing on the video features and the coordinate features to determine fusion features corresponding to each monitoring point, wherein the fusion features are used to represent the video sequence and position coding corresponding to the monitoring point; The fusion feature and the cyanobacteria spatial distribution map are determined as target sample data, and the target sample data is input into the encoder for model training.

3. The method for generating a blue algae distribution map based on a diffusion model according to claim 2, characterized in that: The step of performing position encoding processing on the video features and the coordinate features to determine the fusion features corresponding to each monitoring point includes: Performing linear transformation processing on the video feature and the coordinate feature to unify the dimensions of the video feature and the coordinate feature; The video features and the coordinate features after the linear transformation are subjected to position encoding processing to determine the fusion features.

4. The method for generating a blue algae distribution map based on a diffusion model according to claim 1, characterized in that: Before the step of sending the original sample data set to the hybrid attention model of the encoder for feature extraction processing, it includes: Obtaining a global self-attention model, wherein the global self-attention model is used to capture long-range dependencies between any two positions; Based on a preset dynamic window function and a learnable two-dimensional kernel function, a local attention model is constructed, wherein the dynamic window function is used to control the size of the attention window to gradually increase from the bottom of the image to the top of the image to adapt to the scene changes caused by the pitch angle of the video surveillance point, the two-dimensional kernel function is used to weight the features in the local area, and the local attention model is used to focus on the local neighborhood pattern of the features; Based on the global self-attention model and the local attention model, the hybrid attention model is generated, wherein the hybrid attention model is used to adaptively adjust the attention allocation of different monitoring points according to the coverage of each monitoring point.

5. The method for generating a blue algae distribution map based on a diffusion model according to claim 4, characterized in that: The step of generating the hybrid attention model based on the global self-attention model and the local attention model comprises: By presetting a weighted model, an attenuation function is set in the global self-attention model and the local attention model, and by presetting a layer normalization model, the global self-attention model and the local attention model are subjected to model fusion processing to determine the hybrid attention model.

6. The method for generating a blue algae distribution map based on a diffusion model according to claim 1, characterized in that: The step of using the decoder to gradually denoise the mixed code in a noisy state, and performing iterative training on the denoising process, and determining the diffusion model that reaches the maximum iteration round as the target diffusion model, includes: Using the decoder to gradually denoise the mixed code in a noisy state to generate a map of cyanobacteria distribution; Comparing the cyanobacteria distribution map with the cyanobacteria spatial distribution map to determine a loss function; The decoder is subjected to back-propagation optimization processing by using the loss function, so that the decoder is subjected to iterative training, and after reaching a maximum number of iteration rounds, the diffusion model is determined as a target diffusion model.

7. The method for generating a blue algae distribution map based on a diffusion model according to claim 6, characterized in that: The decoder includes: a plurality of decoding blocks, each of which is provided with a self-attention layer, and the step of using the decoder to gradually denoise the mixed code in a noisy state to generate a map of cyanobacteria distribution includes: The self-attention mechanism of the self-attention layer is used to capture the global dependency of the mixed code in the noisy state, and the mixed code is gradually denoised based on the global dependency through each decoding block to reconstruct the cyanobacteria distribution at different scales and generate a map of the cyanobacteria distribution.

8. A device for generating a map of cyanobacteria distribution based on a diffusion model, characterized in that: The diffusion model includes: an encoder and a decoder, and the device includes: A data acquisition module is used to acquire an original sample data set, wherein the original sample data set includes: real-time video image data fed back by video monitoring points around the lake, geographical location coordinate information corresponding to each of the video monitoring points, and a spatial distribution map of cyanobacteria determined by inversion of multispectral remote sensing image data covering the lake area; A hybrid coding module sends the original sample data set to the hybrid attention model of the encoder for feature extraction processing to determine the cyanobacteria distribution characteristics under different viewing angles and the hybrid coding of the cyanobacteria distribution characteristics; A noise superposition module generates Gaussian noise according to the noise parameters of the current time step, and superimposes the Gaussian noise with the mixed code to generate the mixed code in the noise state; A model training module, using the decoder to perform step-by-step denoising on the mixed code in a noisy state, and performing iterative training on the denoising process, and determining the diffusion model that reaches the maximum iteration round as the target diffusion model, so that the target diffusion model automatically performs fusion modeling after receiving the real-time video image data, the geographic location coordinate information and the cyanobacteria spatial distribution map collected at the same time and different monitoring points, and generates a map of the target cyanobacteria distribution; The noise adding process is expressed as: ; in, is the code after adding noise, X is the original mixed code, σ is a scalar parameter for controlling the noise intensity, ε is standard Gaussian noise, in the expression of the noise adding process, the σ parameter is used to control the amount of noise added to the original mixed code, so as to control the intensity of the noise according to the adjustment amount of the σ value, the larger the σ value, the stronger the noise, and the smaller the σ value, the weaker the noise; Among them, for the input features , where H, W and C represent the height, width and number of channels of the feature map respectively; Among them, by defining a dynamic window size function w(y), the window size is increased from the bottom of the image to Gradually increase to the top , to adapt to the scene changes caused by the pitch angle; ; Where y is the vertical position in the feature map, and are the predefined minimum and maximum window sizes, respectively; Among them, based on the dynamic window, the local attention is expressed as: ; in, It is a learnable two-dimensional kernel function used to weight features in local regions; Among them, global self-attention and local attention are combined to form a hybrid attention mechanism: ; in, is the standard global self-attention operation, is a learnable parameter used to balance the importance of global and local attention. , so that the model automatically adjusts the proportion of global and local attention to adapt to the needs of different positions, so that the model can finely capture the characteristics of cyanobacteria at the bottom of the image and obtain broader contextual information above the image.

9. A server, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 7.