An automatic bay partitioning method based on graph neural network

Through the automatic partitioning method based on graph neural network, the problem of inconsistent hydrodynamic conditions in the traditional bay partitioning method is solved, and the accuracy and efficiency of partitioning are improved. It is suitable for bay areas with existing hydrodynamic models, simplifying nutritional salt modeling Analysis, realizes flexible and easy-to-use automatic partitioning of the bay.

CN118551676BActive Publication Date: 2024-11-15XIAMEN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411032684.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

The traditional bay partitioning method mainly depends on administrative divisions and topography. It is difficult to ensure that the hydrodynamic conditions of each partition are consistent in the time series, which affects the accuracy of nutrient simulations, and is high in calculation costs, making it difficult to make optimal management decisions.

Method used

The automatic partitioning method based on graph neural network is adopted. By converting the output file of the hydrodynamic model into readable files, extracting time series feature values, and constructing a convolutional graph neural network. The Delaunay triangulation algorithm and matrix are used to determine spatial connectivity. Combined with Louvain or Spectral Clustering algorithms for unsupervised classification and post-processing, output as .shp files to realize automatic partitioning of the bay.

Benefits of technology

Improve the accuracy and efficiency of partitioning, can effectively capture complex geographical and hydrodynamic characteristics, simplify the modeling analysis of bay nutrients by subsequent box models, and is suitable for bay areas with existing hydrodynamic models, without major modification of existing ones Model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118551676B_ABST
    Figure CN118551676B_ABST
Patent Text Reader

Abstract

The invention discloses a method for automatic bay partitioning based on a graph neural network, comprising the following steps: S1, using a modified data package to convert an output file of a hydrodynamic model into a .nc file readable by Python software; S2, reading the converted .nc file and performing data preprocessing; S3, using a tsfresh data package to extract time series eigenvalues ​​of different features; S4, using a Delaunay triangulation algorithm and a four-way matrix or an eight-way matrix to determine spatial connectivity, and constructing an adjacency matrix; S5, constructing a convolutional graph neural network to learn bay features and spatial connectivity; S6, using a Louvain algorithm or a Spectral Clustering algorithm to perform unsupervised classification of the bay; S7, using a neighboring grid unification method to post-process the broken edges of the bay partitions; S8, outputting the partitioning results as a .shp file based on the convolutional graph neural network to realize automatic bay partitioning; the method is flexible and easy to use, and can divide the bay into a small number of partitions with relatively uniform internal hydrodynamic conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hydrodynamics-water quality modeling, and in particular to a bay automatic zoning method based on graph neural network. Background Art

[0002] As the intersection of the ocean and the land, the bay plays a key role in maintaining the balance of the ecosystem, promoting the development of marine resources and protecting the environment. In addition, the bay is also a hot spot for economic activities, which has a far-reaching impact on the development of industries such as marine aquaculture and shipping. Therefore, it is particularly urgent to carry out modeling research on the hydrodynamics and water quality of the bay, deeply analyze the causes of water pollution and eutrophication in the bay, and provide a scientific basis for bay environmental governance and decision-making through simulation and prediction.

[0003] In the field of bay nutrient simulation, many methods such as Delft3D and MIKE have been widely used. However, these methods often have high computational costs due to the pursuit of high spatiotemporal resolution, which is not conducive to the formulation of optimal management decisions. In view of this, the partitioned box model has become a feasible nutrient simulation solution with its low cost, and it is consistent with the bay's zoning management model. However, traditional bay zoning is mainly based on administrative divisions and topography, and it is difficult to ensure that the hydrodynamic conditions of each zone remain consistent in the time series, which will affect the accuracy of the nutrient simulation of the partitioned box model. Summary of the invention

[0004] The purpose of the present invention is to provide a method for automatic bay partitioning based on graph neural network. The method is flexible and easy to use, and can be applied to bays that have been modeled using hydrodynamic models. It can divide the bay into a small number of partitions with relatively uniform internal hydrodynamic conditions, making it convenient to use box models to model and analyze the nutrients in the bay.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for automatic bay partitioning based on graph neural network, comprising the following steps:

[0007] S1. Use the modified data package to convert the output files of the hydrodynamic model into .nc files that can be read by Python software;

[0008] S2, read the converted .nc file and perform data preprocessing;

[0009] S3. Use the tsfresh data package to extract time series feature values ​​of different features;

[0010] S4, using the Delaunay triangulation algorithm and a four-way matrix or an eight-way matrix to determine spatial connectivity and construct an adjacency matrix;

[0011] S5, construct a convolutional graph neural network to learn the bay characteristics and spatial connectivity;

[0012] The convolutional graph neural network described in step S5 is constructed using the existing graph convolutional neural network framework GCN in the pytorch software data package, where the loss function is calculated by distinguishing positive and negative samples and adding their structural losses. The specific calculation formula is as follows: , , ,in, represents the positive sample loss; represents the grid at the i-th row and j-th column; embeddings represents the feature embedding matrix of the node; embeddings[i] represents the embedding vector of the i-th node; embeddings[j] represents the embedding vector of the j-th node; positive_pairs represents the set of all positive sample pairs in the graph; Represents negative sample loss; negative_pairs represents the set of all negative sample pairs in the graph; margin is a hyperparameter used to define the interval between negative sample pairs; represents the total loss;

[0013] S6. Use Louvain algorithm or Spectral Clustering algorithm to perform unsupervised classification of bays;

[0014] S7, the neighboring grid uniformity method is used to post-process the broken edge of the bay partition;

[0015] S8. Based on the convolutional graph neural network, the partitioning results are output as .shp files to realize automatic bay partitioning.

[0016] Preferably, the data packet in step S1 is trim2nc, which was originally compiled and run based on matlab software, and is modified to run through python software, and data conversion codes for grid position, flow velocity, temperature and density are added; the output file of the hydrodynamic model is in .dat format, and the hydrodynamic model is one of the Delft3D model and the MIKE model.

[0017] Preferably, the specific process of step S2 is:

[0018] S21. Data reading: Use Python software to read the converted .nc file and obtain the temperature, salinity, friction coefficient, flow velocity, topography and density data of each grid in the bay;

[0019] S22, time series data filling: temperature, salinity, friction coefficient, flow velocity, topography and density data are expanded into time series data respectively, and the cross-sectional data are matched with the remaining time series data; wherein, friction coefficient and topography are cross-sectional data, and temperature, salinity, flow velocity and density data are the remaining time series data;

[0020] S23, sea and land identification: construct a sea and land mask matrix through the grid data output by the hydrodynamic model, in which the land grid is coded as 0 and the sea grid is coded as 1;

[0021] S24, mask extraction: Based on the sea and land identification results, mask extraction is performed on the bay area through the sea and land mask matrix;

[0022] S25, neighboring interpolation filling: the missing flow velocity values ​​are filled by averaging the surrounding 3×3 grids.

[0023] Preferably, step S3 uses the tsfresh data package in Python software to extract all time series eigenvalues ​​in batches, and the time series eigenvalues ​​include absolute energy, absolute value of continuous change, unit root test results and spectrum centroid of Fourier transform spectrum.

[0024] Preferably, in step S4, the spatial connectivity of the sea area grids is determined; wherein, four-way connectivity means that each grid is connected to its four adjacent grids on the upper, lower, left and right sides, and eight-way connectivity means that each grid is connected to its eight adjacent grids on the upper, lower, left, right and diagonal sides, and the corresponding positions in the adjacency matrix are marked as 1 to indicate their spatial connectivity; the Delaunay triangulation algorithm constructs a large triangle containing all grids, and then repeatedly inserts the center points of the internal grids to split the triangles, and makes the small triangles meet the Delaunay triangulation conditions by edge flipping, and finally removes the external triangles, and the grids corresponding to the three vertices of the split small triangles are also marked as 1 in the corresponding positions of the adjacency matrix to indicate their spatial connectivity.

[0025] Preferably, in step S6, the learned convolutional graph neural network is used for unsupervised classification, wherein the number of clusters of the Louvain algorithm is not optional, and the modularity is optimized based on the greedy algorithm, wherein the calculation formula of the modularity is: ,in, represents modularity; Represents the sum of the weights of all edges in the network; Represents the adjacency matrix of the network; represents the degree of node i; represents the degree of node j; represents the community to which node i belongs; represents the community to which node j belongs; is an indicator function, when = hour is 1, otherwise is 0;

[0026] The number of clusters in the Spectral Clustering algorithm is manually specified, and its calculation requires the construction of a similarity matrix, a degree matrix, and a Laplace matrix. The specific calculation formula is as follows: , , , where A is the similarity matrix; D is the degree matrix; L is the Laplace matrix; represents the square of the Euclidean distance between node i and node j; is the bandwidth parameter of the Gaussian kernel; Represents an element in the degree matrix.

[0027] Preferably, the specific process of step S7 is to use the method of neighboring grid consistency to gradually determine whether the grid with the largest number of 3×3, 5×5 to 11×11 grids around each grid classification is consistent with the central grid classification. If they are consistent, stop, otherwise modify the central grid classification until all grids meet this standard. The method of neighboring grid consistency is used to deal with the problem that some of the classifications become more fragmented grid classifications.

[0028] Preferably, in step S8, different partitions are encoded as different digital numbers and input as field information into a newly created field class of the .shp file output by the hydrodynamic model, thereby realizing a visual presentation of the partition information.

[0029] After adopting the above technical scheme, the present invention has the following beneficial effects: the present invention adopts graph neural network (GNN) technology, which can effectively capture complex geographical and hydrodynamic characteristics and improve the accuracy and efficiency of zoning; this method is not only applicable to new bay areas, but can also be easily applied to bays that have been modeled using hydrodynamic models. Therefore, this method can be seamlessly integrated into the existing water environment management framework without the need for major modifications or redesign of existing models; the present invention can simplify the subsequent modeling and analysis of bay nutrients using a box model by dividing the bay into zones with relatively uniform internal hydrodynamic conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0032] like Figure 1 As shown, a bay automatic partitioning method based on graph neural network includes the following steps:

[0033] S1. Use the modified data package to convert the output files of the hydrodynamic model into .nc files that can be read by Python software;

[0034] The data package in step S1 is trim2nc, which was originally compiled and run based on matlab software, and was modified to run through python software, and data conversion codes for grid position, flow velocity, temperature, and density were added; the output file of the hydrodynamic model is in .dat format, and the hydrodynamic model is one of the Delft3D model and the MIKE model;

[0035] S2, read the converted .nc file and perform data preprocessing;

[0036] The specific process of step S2 is:

[0037] S21. Data reading: Use Python software to read the converted .nc file and obtain the temperature, salinity, friction coefficient, flow velocity, topography and density data of each grid in the bay;

[0038] S22, time series data filling: temperature, salinity, friction coefficient, flow velocity, topography and density data are expanded into time series data respectively, and the cross-sectional data are matched with the remaining time series data; wherein, friction coefficient and topography are cross-sectional data, and temperature, salinity, flow velocity and density data are the remaining time series data;

[0039] S23, sea and land identification: construct a sea and land mask matrix through the grid data output by the hydrodynamic model, in which the land grid is coded as 0 and the sea grid is coded as 1;

[0040] S24, mask extraction: Based on the sea and land identification results, mask extraction is performed on the bay area through the sea and land mask matrix;

[0041] S25, neighboring interpolation filling: the missing flow velocity values ​​are filled by averaging the surrounding 3*3 grids;

[0042] S3. Use the tsfresh data package to extract time series feature values ​​of different features;

[0043] Step S3 uses the tsfresh data package in Python software to extract all time series eigenvalues ​​in batches, and the time series eigenvalues ​​include absolute energy, absolute value of continuous change, unit root test results, and spectrum centroid of Fourier transform spectrum;

[0044] S4, using the Delaunay triangulation algorithm and a four-way matrix or an eight-way matrix to determine spatial connectivity and construct an adjacency matrix;

[0045] In step S4, the spatial connectivity of the sea area grids is determined; wherein, the four-way connectivity means that each grid is connected to the four adjacent grids above, below, left, and right; the eight-way connectivity means that each grid is connected to the eight adjacent grids above, below, left, right, and diagonal; the corresponding positions in the adjacency matrix are marked as 1 to indicate their spatial connectivity; the Delaunay triangulation algorithm constructs a large triangle containing all grids, and then repeatedly inserts the center points of the internal grids to split the triangles, and makes the small triangles meet the Delaunay triangulation conditions by edge flipping, and finally removes the external triangles, and the grids corresponding to the three vertices of the small triangle after the split are also marked as 1 in the corresponding positions of the adjacency matrix to indicate their spatial connectivity.

[0046] S5, construct a convolutional graph neural network to learn the bay characteristics and spatial connectivity;

[0047] The convolutional graph neural network described in step S5 is constructed using the existing graph convolutional neural network framework GCN in the pytorch software data package, where the loss function is calculated by distinguishing positive and negative samples and adding their structural losses. The specific calculation formula is as follows: , , ,in, represents the positive sample loss; represents the grid at the i-th row and j-th column; embeddings represents the feature embedding matrix of the node; embeddings[i] represents the embedding vector of the i-th node; embeddings[j] represents the embedding vector of the j-th node; positive_pairs represents the set of all positive sample pairs in the graph; Represents negative sample loss; negative_pairs represents the set of all negative sample pairs in the graph; margin is a hyperparameter used to define the interval between negative sample pairs; represents the total loss;

[0048] S6. Use Louvain algorithm or Spectral Clustering algorithm to perform unsupervised classification of bays;

[0049] In step S6, the learned convolutional graph neural network is used for unsupervised classification, wherein the number of clusters of the Louvain algorithm is not optional, and the modularity is optimized based on the greedy algorithm, wherein the calculation formula of the modularity is: ,in, represents modularity; Represents the sum of the weights of all edges in the network; Represents the adjacency matrix of the network; represents the degree of node i; represents the degree of node j; represents the community to which node i belongs; represents the community to which node j belongs; is an indicator function, when = hour is 1, otherwise is 0;

[0050] The number of clusters in the Spectral Clustering algorithm is manually specified, and its calculation requires the construction of a similarity matrix, a degree matrix, and a Laplace matrix. The specific calculation formula is as follows: , , , where A is the similarity matrix; D is the degree matrix; L is the Laplace matrix; represents the square of the Euclidean distance between node i and node j; is the bandwidth parameter of the Gaussian kernel; represents the elements in the degree matrix;

[0051] S7, the neighboring grid uniformity method is used to post-process the broken edge of the bay partition;

[0052] The specific process of step S7 is to use the method of neighboring grid consistency to gradually determine whether the grid with the largest number of 3×3, 5×5 to 11×11 grids around each grid classification is consistent with the central grid classification. If they are consistent, stop, otherwise modify the central grid classification until all grids meet this standard. The method of neighboring grid consistency is used to deal with the problem that some of the classifications become relatively fragmented grid classifications;

[0053] S8. Based on the convolutional graph neural network, the partitioning results are output as .shp files to realize automatic bay partitioning;

[0054] In step S8, different partitions are encoded into different digital numbers as field information and input into a newly created field class of the .shp file output by the hydrodynamic model, thereby realizing a visual presentation of the partition information.

[0055] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An automatic bay partitioning method based on graph neural network, It is characterized in that The following steps are involved: S1. Use the modified data package to convert the output files of the hydrodynamic model into .nc files that can be read by Python software; The data package in step S1 is trim2nc, which was originally compiled and run based on matlab software, and was modified to run through python software, and data conversion codes for grid position, flow velocity, temperature, and density were added; the output file of the hydrodynamic model is in .dat format, and the hydrodynamic model is one of the Delft3D model and the MIKE model; S2, read the converted .nc file and perform data preprocessing; The specific process of step S2 is: S21. Data reading: Use Python software to read the converted .nc file and obtain the temperature, salinity, friction coefficient, flow velocity, topography and density data of each grid in the bay; S22, time series data filling: temperature, salinity, friction coefficient, flow velocity, topography and density data are expanded into time series data respectively, and the cross-sectional data are matched with the remaining time series data; wherein, friction coefficient and topography are cross-sectional data, and temperature, salinity, flow velocity and density data are the remaining time series data; S23, sea and land identification: construct a sea and land mask matrix through the grid data output by the hydrodynamic model, in which the land grid is coded as 0 and the sea grid is coded as 1; S24, mask extraction: Based on the sea and land identification results, mask extraction is performed on the bay area through the sea and land mask matrix; S25, neighboring interpolation filling: the missing flow velocity values ​​are filled by averaging the surrounding 3×3 grids; S3. Use the tsfresh data package to extract time series feature values ​​of different features; Step S3 uses the tsfresh data package in Python software to extract all time series eigenvalues ​​in batches, and the time series eigenvalues ​​include absolute energy, absolute value of continuous change, unit root test results, and spectrum centroid of Fourier transform spectrum; S4, using the Delaunay triangulation algorithm and a four-way matrix or an eight-way matrix to determine spatial connectivity and construct an adjacency matrix; S5, construct a convolutional graph neural network to learn the bay characteristics and spatial connectivity; The convolutional graph neural network described in step S5 is constructed using the existing graph convolutional neural network framework GCN in the pytorch software data package, where the loss function is calculated by distinguishing positive and negative samples and adding their structural losses. The specific calculation formula is as follows: , , ,in, represents the positive sample loss; represents the grid at the i-th row and j-th column; embeddings represents the feature embedding matrix of the node; embeddings[i] represents the embedding vector of the i-th node; embeddings[j] represents the embedding vector of the j-th node; positive_pairs represents the set of all positive sample pairs in the graph; Represents negative sample loss; negative_pairs represents the set of all negative sample pairs in the graph; margin is a hyperparameter used to define the interval between negative sample pairs; represents the total loss; S6. Use Louvain algorithm or Spectral Clustering algorithm to perform unsupervised classification of bays; S7, the neighboring grid uniformity method is used to post-process the broken edge of the bay partition; S8. Based on the convolutional graph neural network, the partitioning results are output as .shp files to realize automatic bay partitioning.

2. A method for automatically partitioning a bay based on a graph neural network as claimed in claim 1, Features: In step S4, the spatial connectivity of the sea area grids is determined; wherein, the four-way connectivity means that each grid is connected to the four adjacent grids above, below, left, and right; the eight-way connectivity means that each grid is connected to the eight adjacent grids above, below, left, right, and diagonal; the corresponding positions in the adjacency matrix are marked as 1 to indicate their spatial connectivity; the Delaunay triangulation algorithm constructs a large triangle containing all grids, and then repeatedly inserts the center points of the internal grids to split the triangles, and makes the small triangles meet the Delaunay triangulation conditions by edge flipping, and finally removes the external triangles, and the grids corresponding to the three vertices of the small triangle after the split are also marked as 1 in the corresponding positions of the adjacency matrix to indicate their spatial connectivity.

3. The method for automatically partitioning a bay based on a graph neural network as claimed in claim 1, Features: In step S6, the learned convolutional graph neural network is used for unsupervised classification, wherein the number of clusters of the Louvain algorithm is not optional, and the modularity is optimized based on the greedy algorithm, wherein the calculation formula of the modularity is: ,in, represents modularity; Represents the sum of the weights of all edges in the network; Represents the adjacency matrix of the network; represents the degree of node i; represents the degree of node j; represents the community to which node i belongs; represents the community to which node j belongs; is an indicator function, when = hour is 1, otherwise is 0; The number of clusters in the Spectral Clustering algorithm is manually specified, and its calculation requires the construction of a similarity matrix, a degree matrix, and a Laplace matrix. The specific calculation formula is as follows: , , , where A is the similarity matrix; D is the degree matrix; L is the Laplace matrix; represents the square of the Euclidean distance between node i and node j; is the bandwidth parameter of the Gaussian kernel; Represents an element in the degree matrix.

4. The method for automatically partitioning a bay based on a graph neural network as claimed in claim 1, Features: The specific process of step S7 is to use the method of neighboring grid consistency to gradually determine whether the grid with the largest number of 3×3, 5×5 to 11×11 grids around each grid classification is consistent with the central grid classification. If they are consistent, stop; otherwise, modify the central grid classification until all grids meet this standard.

5. The method for automatically partitioning a bay based on a graph neural network as claimed in claim 1, Features: In step S8, different partitions are encoded into different digital numbers as field information and input into a newly created field class of the .shp file output by the hydrodynamic model, thereby realizing a visual presentation of the partition information.

Citation Information

Patent Citations

  • Water resource and water environment regulation and control method and system based on quantity and quality coupling forecast

    CN115907436A

  • Urban water network area river and lake water quality improvement and water safety guarantee method and system

    CN117236199A

  • Forecasting land-based environmental variables using similarity analysis and temporal graph convoluational neural networks

    US20240112442A1