A method for judging water bloom based on spatial mining
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2023-03-02
- Publication Date
- 2026-05-12
AI Technical Summary
Existing algal bloom detection models only consider the characteristic data of the target site and fail to accurately reflect the dynamic correlation of different areas of the water body, resulting in inaccurate judgment results and affecting management decisions.
Sensors are deployed in multiple areas of the water body. An algal bloom detection model is constructed by combining local and global water body data through an LSTM network, a fully connected layer, a softmax classifier, a local attention mechanism module, and a global attention mechanism module.
It improves the accuracy of algal bloom assessment, helps management departments take timely emergency measures, and reduces ecological damage and health risks.
Smart Images

Figure CN116304908B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of environmental monitoring technology, specifically relating to a method for judging algal blooms based on spatial mining. Background Technology
[0002] Eutrophication and algal blooms in lakes are major environmental problems facing the world. Algal blooms can destroy the feed base of fisheries and cause fishery production to decline. In the treatment of algal blooms, it is necessary to first understand the basic laws of algal bloom formation and some physicochemical factors that affect algal bloom formation, and to develop sensitive lake areas.
[0003] With the rapid development of the field of deep learning, applying machine learning to learn the basic laws of algal bloom formation and to determine whether an algal bloom has occurred in a current water area is of great significance for environmental management departments to take timely emergency measures and reduce the ecological harm and health risks caused by algal blooms.
[0004] Most existing algal bloom detection models only consider the water body data at the target site. However, due to the fluidity of water bodies, the data in different areas of the water body are dynamically related. Using only the feature information at the target site cannot accurately represent the current water body situation in the area, resulting in inaccurate algal bloom detection results from the model, leading to decision-making errors and wasted resources by management departments. Summary of the Invention
[0005] To address the problems existing in the background technology, this invention provides a method for identifying algal blooms based on spatial mining, thereby improving the accuracy of algal bloom identification and enabling environmental management departments to take timely emergency measures to reduce the ecological harm and health risks caused by algal blooms. The method includes:
[0006] S1: Sensors are deployed in N areas of the water body to collect water data in real time, where N is an integer greater than 1. The water data includes environmental parameters such as water temperature, pH, turbidity, dissolved oxygen, conductivity, permanganate index, ammonia nitrogen, total phosphorus, and total ammonia.
[0007] S2: The sensor deployed in the area to be measured in the water is used as the target sensor, and the sensor deployed in the remaining areas of the water is used as the remaining sensor.
[0008] S3: Arrange the water body data collected by all remaining sensors in sequence to form a remaining water body data sequence;
[0009] S4: Input the water body data and the remaining water body data sequence collected by the remaining sensors into the trained algal bloom judgment model to predict whether an algal bloom has occurred in the area to be tested in the water body.
[0010] Preferably, the algal bloom detection model includes: an LSTM network, a fully connected layer, a softmax classifier, a local attention mechanism module, and a global attention mechanism module.
[0011] Preferably, whether an algal bloom has occurred in the area to be tested in the predicted water body includes:
[0012] S41: Input the water body data collected by the target sensor at time k into the local attention mechanism module. The local attention mechanism module then calculates the hidden state h of the LSTM network at time k-1. k-1 and the memory state of the cell unit k-1 By assigning weights to each parameter of the water body data, the first intermediate feature matrix at time k is obtained;
[0013] S42: Input the remaining water volume data sequence at time k into the global attention mechanism module. The global attention mechanism module determines the hidden state h of the LSTM network at time k-1. k-1 and the memory state of the cell unit k-1 Weights are assigned to the water data collected by each of the remaining sensors to obtain the second intermediate feature matrix at time k.
[0014] S43: Concatenate the first intermediate feature matrix at time k and the second intermediate feature matrix at time t along the feature dimension to generate the third intermediate feature matrix at time k;
[0015] S44: Input the third intermediate feature matrix at time k into the LSTM network to calculate the hidden state h of the LSTM network at time k. k and the memory state of the cell unit k ;
[0016] S45: Within a preset time period, record the hidden states h output by the LSTM network at all times. k A comprehensive feature vector is generated by concatenating features along the feature dimension; the comprehensive feature vector is then input into a fully connected layer for linear combination and then input into a softmax classifier to output whether algal bloom has occurred in the test area.
[0017] The present invention has at least the following beneficial effects
[0018] This invention utilizes a local attention mechanism module to learn the impact of different environmental parameters on algal blooms, and a global attention mechanism module to enable the algal bloom detection model to learn the impact of water data from different areas of the water body on the current area. By fusing local and global information, it can accurately predict whether an algal bloom has occurred in the current area, facilitating timely treatment by water management personnel and playing a significant role in preventing the further aggravation of algal blooms.
[0019] Instruction manual illustrations
[0020] Figure 1 This is a flowchart of the method of the present invention;
[0021] Figure 2 This is a schematic diagram of the workflow of the algal bloom detection model of the present invention. Detailed Implementation
[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0023] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0024] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0025] Please see Figure 1 This invention provides a method for determining algal blooms based on spatial mining, comprising:
[0026] S1: Sensors are deployed in N areas of the water body to collect water data in real time, where N is an integer greater than 1. The water data includes environmental parameters such as water temperature, pH, turbidity, dissolved oxygen, conductivity, permanganate index, ammonia nitrogen, total phosphorus, and total ammonia.
[0027] Preferably, deploying sensors in N areas of the water body includes: dividing the water body into N areas, each with the same area, deploying the sensor at the center of each area, and placing the sensor at a depth of 20-50cm underwater. Most of the substances that cause algal blooms are floating objects and are mostly located in this area. Therefore, setting the sensor at a depth of 20-50cm underwater can more accurately collect the current water quality information.
[0028] S2: The sensor deployed in the area to be measured in the water is used as the target sensor, and the sensor deployed in the remaining areas of the water is used as the remaining sensor.
[0029] S3: Arrange the water body data collected by all remaining sensors in sequence to form a remaining water body data sequence;
[0030] Preferably, the step of sequentially arranging the water data collected by all remaining sensors includes:
[0031] The remaining water data collected by the sensors are sorted according to the distance from the center point of the other areas in the water to the center point of the area to be measured, with the smaller the distance, the higher the sorting order.
[0032] S4: Input the water body data and the remaining water body data sequence collected by the remaining sensors into the trained algal bloom judgment model to predict whether an algal bloom has occurred in the area to be tested in the water body;
[0033] Preferably, the algal bloom detection model includes: an LSTM network, a fully connected layer, a softmax classifier, a local attention mechanism module, and a global attention mechanism module.
[0034] Please see Figure 2 Preferably, whether an algal bloom has occurred in the area to be tested in the predicted water body includes:
[0035] S41: Input the water body data collected by the target sensor at time k into the local attention mechanism module. The local attention mechanism module then calculates the hidden state h of the LSTM network at time k-1. k-1 and the memory state of the cell unit k-1 By assigning weights to each parameter of the water body data, the first intermediate feature matrix at time k is obtained;
[0036] Preferably, the first intermediate feature matrix at time k includes:
[0037]
[0038]
[0039] Among them, a k This represents the first intermediate feature matrix at time k. W l Ul and b l Let tanh represent the learnable parameter matrix, h represent the activation function, and h represent the activation function. k-1 Let x represent the hidden state of the LSTM network at time k-1. k N1 represents the water body data collected by the target sensor at time k; N1 represents the number of environmental parameters in the water body data collected by the target sensor. k-1 ;s k-1 ] indicates that h k-1 and s k-1 splicing, s k-1 This represents the memory state of the LSTM network cell at time k-1.
[0040] S42: Input the remaining water volume data sequence at time k into the global attention mechanism module. The global attention mechanism module determines the hidden state h of the LSTM network at time k-1. k-1 and the memory state of the cell unit k-1 Weights are assigned to the water data collected by each of the remaining sensors to obtain the second intermediate feature matrix at time k.
[0041] Preferably, the second intermediate feature matrix at time k includes:
[0042]
[0043]
[0044] Where tanh represents the activation function. W g 、W′ g U g u g and b g The parameter y represents the learned parameter. l Represents the sequence of environmental parameters in water body data, [h k-1 ;s k-1 ] indicates that h k-1 and s k-1 splicing, s k-1 h represents the memory state of the LSTM network cell at time k-1. k-1 X represents the hidden state of the LSTM network at time k-1. l N represents the remaining water body data sequence. g This indicates the number of remaining sensors.
[0045] S43: Concatenate the first intermediate feature matrix at time k and the second intermediate feature matrix at time k along the feature dimension to generate the third intermediate feature matrix at time k; In this invention, the CONCAT function is used to concatenate the first intermediate feature matrix at time k and the second intermediate feature matrix at time k along the feature dimension.
[0046] S44: Input the third intermediate feature matrix at time k into the LSTM network to calculate the hidden state h of the LSTM network at time k. k and the memory state of the cell unit k ;
[0047] Preferably, the LSTM network includes three gate units: input gate i, output gate o, and forget gate f. The memory unit is calculated through these three gate units. The calculation method of the three gate units (input gate i, output gate o, and forget gate f) is as follows: Let the current time step be k, and the hidden state vector of the previous time step be h. k-1 The current input is x k The initial hidden state vector h0 is 0.
[0048] i k =σ(W i x k +U i h k-1 +b i )
[0049] f k =σ(W f x k +U f h k-1 +b f )
[0050] o k =σ(W o x k +U o h k-1 +b o )
[0051] Where σ represents the sigmoid activation function, W i W f W o These are the weight matrices for the input gate, forget gate, and output gate in an LSTM network, respectively. i U f U o Let h represent the input gate, forget gate, and output gate in the LSTM network, respectively. t-1 The corresponding weight, b i b f b oRepresents the bias vectors of the input gate, forget gate, and output gate in an LSTM network; i k f k o k These represent the outputs of the input gate, forget gate, and output gate in the LSTM network at time k, respectively.
[0052] The feature vector g at the current time step k Depends on the hidden state vector h from the previous time step k-1 And input x k The calculation formula is as follows:
[0053]
[0054] Among them, W g U is the weight matrix corresponding to the feature vector at the current time step of the LSTM. g The eigenvector at the previous time h k-1 The corresponding weight, b g To find the bias vector at the current time step when calculating the feature vector, tanh represents the hyperbolic tangent function used as the activation function.
[0055] Let S be the memory unit from the previous time step. k-1 Given that the characteristic at the current time is g k The initial memory unit S0 is 0. Then, the memory unit S at time k is calculated. k The formula is:
[0056] S k =i k ·g k +f k ·S k-1
[0057] Finally, the hidden state vector h is obtained. k .
[0058] h k =o k ·tanh(S k )
[0059] Among them, i k f represents the input and output of the LSTM network structure. k S represents the result of the forget gate. k-1 This represents the memory unit at time k-1, o k This represents the calculation result of the forget gate in the LSTM cell at time k.
[0060] S45: Within a preset time period, record the hidden states h output by the LSTM network at all times. kA comprehensive feature vector is generated by concatenating features along the feature dimension; the comprehensive feature vector is then input into a fully connected layer for linear combination and then input into a softmax classifier to output whether algal bloom has occurred in the test area.
[0061] This embodiment uses the publicly available dataset "Tianjin Jinhai Lake Water Quality Dataset" as training data. The Tianjin Jinhai Lake Water Quality Dataset is sourced from the National Glacier, Permafrost and Desert Science Data Center (…). http: / / www.ncdc.ac.cn The water quality data collected from Tianjin Jinhu Lake between 2018 and 2020 includes: calcium ions, magnesium ions, potassium, sodium, aluminum, barium, strontium, iron, manganese, fluorine, arsenic, copper, zinc, chromium, active silicates, sulfate, chloride, fluoride, carbonate, bicarbonate, inorganic phosphorus, nitrate, boron, cadmium, lead, mercury, selenium, total dissolved solids, redox potential, suspended solids, total hardness, total alkalinity, phenolphthalein alkalinity, dissolved oxygen, volatile phenols, total organic carbon, chemical oxygen demand, biochemical oxygen demand, oils, chlorophyll a, particle size distribution, and total bacterial count. The Tianjin Jinhai Lake water quality dataset was labeled based on the past occurrence times of algal blooms in Tianjin Jinhai Lake. The Tianjin Jinhai Lake water quality dataset was divided according to step S2 and input into the algal bloom judgment model for training. The algal bloom judgment model was optimized using the Adam optimizer by constructing the loss function of the algal bloom judgment model. The number of iterations was set to 100, and the algal bloom judgment model output a result once every 32 sensor sampling cycles, i.e., the preset time. The initial learning rate of the Adam optimizer was set to 0.001.
[0062] Preferably, the loss function of the algal bloom detection model includes:
[0063]
[0064] Where L represents the loss function of the algal bloom judgment model, y is the binary label indicating whether algal bloom has occurred, specifically represented by 0 or 1, and a is the probability of the output belonging to the label y.
[0065] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0066] This invention enables the algal bloom detection model to learn the influence of different environmental parameters on algal blooms through a local attention mechanism module, and to learn the influence of water data from different areas of the water body on the current area through a global attention mechanism module. By fusing local and global information, it can accurately predict whether an algal bloom has occurred in the current area, which facilitates timely treatment by water management personnel and plays a significant role in preventing the further aggravation of algal blooms.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for identifying algal blooms based on spatial mining, characterized in that, include: S1: Sensors are deployed in N areas of the water body to collect water data in real time, where N is an integer greater than 1. The water data includes environmental parameters such as water temperature, pH, turbidity, dissolved oxygen, conductivity, permanganate index, ammonia nitrogen, total phosphorus, and total ammonia. S2: The sensor deployed in the area to be measured in the water is used as the target sensor, and the sensor deployed in the remaining areas of the water is used as the remaining sensor. S3: Arrange the water body data collected by all remaining sensors in sequence to form a remaining water body data sequence; S4: Input the water body data and the remaining water body data sequence collected by the remaining sensors into the trained algal bloom judgment model to predict whether an algal bloom has occurred in the area to be tested in the water body; Whether an algal bloom has occurred in the area to be tested in the predicted water body includes: S41: Will The water body data collected by the target sensor at any time is input into the local attention mechanism module, and the local attention mechanism module then... Hidden state of the LSTM network at time step and the memory state of cell units Weights are assigned to each parameter of the water body data to obtain The first intermediate feature matrix at time step; S42: Will The remaining water volume data sequence at any given time is input into the global attention mechanism module, which then processes the data according to the given time. Hidden state of the LSTM network at time step and the memory state of cell units Weights are assigned to the water data collected by each of the remaining sensors to obtain The second intermediate feature matrix at time step; S43: Will The first intermediate feature matrix at time t and The second intermediate feature matrix at time step is generated by concatenating the features along the feature dimension. The third intermediate feature matrix at time step; S44: Will The third intermediate feature matrix at time step 3 is input into the LSTM network for computation. Hidden state of the LSTM network at time step and the memory state of cell units ; S45: Within a preset time period, record the hidden states of the LSTM network output at all times. A comprehensive feature vector is generated by concatenating features along the feature dimension; the comprehensive feature vector is then input into a fully connected layer for linear combination and then input into a softmax classifier to output whether algal bloom has occurred in the test area.
2. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, The algal bloom detection model includes: an LSTM network, a fully connected layer, a softmax classifier, a local attention mechanism module, and a global attention mechanism module.
3. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, The The first intermediate feature matrix at time step 1 includes: in, express The first intermediate feature matrix at time step 1, , , and This represents the learnable parameter matrix. This represents the activation function. express The hidden state of the LSTM network at any given time. express Water body data collected by the target sensor at any time; This indicates the number of environmental parameters in the water body data collected by the target sensor. Indicates will and splicing express The memory state of the LSTM network cell at any given time.
4. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, The The second intermediate feature matrix at time step 1 includes: in, This represents the activation function. , , , , and The parameters representing the learning process, This represents the sequence of environmental parameters in water body data. Indicates will and splicing express The memory state of a cell in an LSTM network at any given time. express The hidden state of the LSTM network at any given time. This represents the remaining water body data sequence. This indicates the number of remaining sensors.
5. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, The loss function of the algal bloom detection model includes: Where L represents the loss function of the algal bloom detection model. It is a binary label indicating whether algal bloom has occurred, with a specific value represented as 0 or 1, and 'a' is the probability of the output belonging to the 'y' label.
6. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, Deploying sensors in N regions of a body of water involves dividing the water into N regions, each with the same area, and deploying sensors at the center of each region.
7. The method for determining algal blooms based on spatial mining according to claim 1, characterized in that, The step of arranging the water data collected by all remaining sensors in sequence includes: The remaining water data collected by the sensors are sorted according to the distance from the center point of the other areas in the water to the center point of the area to be measured, with the smaller the distance, the higher the sorting order.