Single tree instance segmentation method, system and terminal based on scale pyramid graph network
Through a method based on scaled pyramid graph network, the features of hyperspectral images are extracted step by step and combined with sub-image position coding, which solves the problem of poor feature extraction ability of hyperspectral images and improves the accuracy of single tree instance segmentation.
Patent Information
- Application Number
- CN202410731652.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-06
AI Technical Summary
The feature extraction capability of hyperspectral images in the existing technology is poor, resulting in the difficulty and low accuracy of single tree instance segmentation.
Using a method based on scaled pyramid graph network, single tree instance segmentation is achieved by extracting features from three levels: pixel, superpixel and sub-image, combined with sub-image position coding, integrating classification and aggregation results.
It improves the feature extraction capabilities of hyperspectral images, improves the accuracy of single tree instance segmentation, and makes up for the lack of natural spatial position information in the graph structure.
Smart Images

Figure CN118570477A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a single tree instance segmentation method, system, terminal and computer-readable storage medium based on a scale pyramid graph network. Background Art
[0002] Combining images collected by UAVs (Unmanned Aerial Vehicles, UAVs) to perform single tree instance segmentation has become a research hotspot in recent years. UAVs, also known as "unmanned aerial vehicles," can capture high-light images at millimeter spatial resolution, which is a cost-effective alternative to traditional aircraft-based remote sensing methods, making tree mapping more affordable and accessible, even for small projects or areas with limited resources. The spatial resolution of images acquired by UAVs can be higher than that obtained by satellite remote sensing. UAVs equipped with hyperspectral sensors can more accurately identify and calibrate individual trees, with a higher spatial resolution than traditional satellite remote sensing.
[0003] Existing methods usually use RGB image information or point cloud data to perform single tree instance segmentation. The ultra-high spatial resolution of hyperspectral images has not yet been fully and effectively utilized. Since the tree crown is an irregular shape, although hyperspectral images provide more useful information, it will lead to data redundancy in feature extraction, resulting in difficulty and low accuracy in single tree instance segmentation.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0005] The main purpose of the present invention is to provide a single tree instance segmentation method, system, terminal and computer-readable storage medium based on a scale pyramid graph network, aiming to solve the problem that the prior art has poor feature extraction capability for hyperspectral images, resulting in difficulty and low accuracy in single tree instance segmentation.
[0006] To achieve the above object, the present invention provides a single tree instance segmentation method based on a scale pyramid graph network, and the single tree instance segmentation method based on a scale pyramid graph network comprises the following steps:
[0007] Acquire a hyperspectral image to be processed, and perform a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps;
[0008] Performing a pixel-scale feature extraction operation on each of the superpixel images respectively to obtain pixel-scale features corresponding to each of the superpixel images;
[0009] Based on each of the pixel-scale features, a superpixel-scale feature extraction operation is performed to obtain a superpixel-scale feature corresponding to each of the superpixel images, and a global image is constructed based on all the superpixel-scale features;
[0010] Performing a classification feature extraction operation on the global graph to obtain a global classification feature, performing a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and performing a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph;
[0011] Calculation is performed based on the tree sub-graph to obtain edge prediction features corresponding to each of the super-pixel graphs, and edge prediction operations are performed based on all of the edge prediction features to obtain super-pixel aggregation results, and the super-pixel classification results and the super-pixel aggregation results are integrated to obtain a single tree instance segmentation result.
[0012] Optionally, the single tree instance segmentation method based on the scale pyramid graph network, wherein the step of obtaining a hyperspectral image to be processed and performing a feature graph construction operation based on the hyperspectral image to obtain a plurality of superpixel graphs, specifically includes:
[0013] Receive the hyperspectral image to be processed sent by the UAV;
[0014] Performing a super-pixel segmentation operation on the hyperspectral image to obtain a plurality of super-pixel blocks;
[0015] Acquire a pixel edge corresponding to each superpixel block according to a pixel adjacency relationship of each superpixel block;
[0016] A feature map construction operation is performed according to each of the superpixel blocks and the corresponding pixel edges to obtain a superpixel map corresponding to each of the superpixel blocks.
[0017] Optionally, the single tree instance segmentation method based on the scale pyramid graph network, wherein the pixel scale feature extraction operation is performed on each of the superpixel graphs to obtain the pixel scale features corresponding to each of the superpixel graphs, specifically includes:
[0018] Obtaining a superpixel block corresponding to each superpixel image, and performing a global average pooling operation and a one-dimensional convolution operation on each superpixel block in sequence, to obtain a first intermediate feature corresponding to each superpixel block;
[0019] Each of the first intermediate features is processed by an activation function to obtain a weight matrix corresponding to each of the super pixel blocks;
[0020] The de-pooling operation is performed on each of the weight matrices respectively, and each weight matrix after the de-pooling operation is performed element-by-element multiplication operation with the corresponding super-pixel block to obtain the pixel-scale features corresponding to each of the super-pixel images.
[0021] Optionally, the single tree instance segmentation method based on the scale pyramid graph network, wherein the superpixel scale feature extraction operation is performed based on each of the pixel scale features to obtain the superpixel scale feature corresponding to each superpixel graph, and a global graph is constructed based on all the superpixel scale features, specifically including:
[0022] Based on the pixel scale features corresponding to each superpixel image, obtain a first node feature matrix and a first adjacent matrix corresponding to each superpixel image;
[0023] Obtaining a first closed-loop adjacency matrix corresponding to each of the superpixel images according to each of the first adjacency matrices;
[0024] Calculating based on the first node feature matrix and the first closed-loop adjacency matrix corresponding to each of the superpixel graphs to obtain a second intermediate feature corresponding to each of the superpixel graphs;
[0025] Performing a global average pooling operation on each of the second intermediate features respectively to obtain a superpixel scale feature corresponding to each of the superpixel images;
[0026] Acquire an edge set corresponding to each superpixel image according to the superpixel scale feature corresponding to each superpixel image;
[0027] A global graph is constructed based on all of the superpixel graphs and all of the edge sets.
[0028] Optionally, the single tree instance segmentation method based on the scale pyramid graph network, wherein the classification feature extraction operation is performed according to the global graph to obtain the global classification feature, specifically includes:
[0029] Acquire a second node feature matrix and a second adjacent matrix according to the global graph;
[0030] Obtaining a second closed-loop adjacency matrix according to the second adjacency matrix;
[0031] Performing a nonlinear enhancement operation on the second closed-loop adjacency matrix, and performing a batch normalization operation based on a result of the nonlinear enhancement operation and the second node feature matrix to obtain a third intermediate feature;
[0032] The third intermediate feature and the second node feature matrix are fused to obtain a global classification feature corresponding to the global graph.
[0033] Optionally, in the single tree instance segmentation method based on a scale pyramid graph network, the global classification feature includes a classification feature corresponding to each of the superpixel graphs;
[0034] The classification operation is performed on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and the screening operation is performed on the global graph according to the superpixel classification result to obtain a tree subgraph, specifically including:
[0035] Performing classification operations based on each of the classification features respectively to obtain classification results corresponding to each of the superpixel images;
[0036] Integrate all the classification results to obtain a superpixel classification result;
[0037] The global graph is screened according to the superpixel classification result, and the superpixel graph whose classification result is a tree is retained to obtain a tree subgraph.
[0038] Optionally, the single tree instance segmentation method based on the scale pyramid graph network, wherein the calculation is performed based on the tree subgraph to obtain edge prediction features corresponding to each of the superpixel graphs, and an edge prediction operation is performed based on all the edge prediction features to obtain a superpixel aggregation result, and the superpixel classification result and the superpixel aggregation result are integrated to obtain a single tree instance segmentation result, specifically including:
[0039] generating a sub-graph mask based on the tree sub-graph;
[0040] Perform sub-image position coding calculation based on the sub-image mask to obtain the tree sub-image position coding corresponding to each super-pixel image in the tree sub-image;
[0041] Performing a global average pooling operation on all the tree sub-graph position codes to obtain a sub-graph position code corresponding to each super-pixel graph in the global graph;
[0042] Obtain a tree node feature matrix according to the tree subgraph, combine all the subgraph position codes with the tree node feature matrix, and obtain tree edge prediction features, wherein the tree edge prediction features include edge prediction features corresponding to each superpixel graph in the tree subgraph;
[0043] Performing edge prediction operations according to each of the edge prediction features to obtain a superpixel aggregation result;
[0044] The superpixel aggregation result and the superpixel classification result are fused to obtain a final single tree instance segmentation result.
[0045] In addition, to achieve the above-mentioned purpose, the present invention also provides a single tree instance segmentation system based on a scale pyramid graph network, wherein the single tree instance segmentation system based on a scale pyramid graph network comprises:
[0046] A super-pixel map construction module is used to obtain a hyperspectral image to be processed, and perform a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps;
[0047] A pixel feature extraction module, used to perform a pixel scale feature extraction operation on each of the super pixel images to obtain a pixel scale feature corresponding to each of the super pixel images;
[0048] A superpixel feature extraction module, configured to perform a superpixel scale feature extraction operation based on each of the pixel scale features, obtain a superpixel scale feature corresponding to each of the superpixel images, and construct a global image based on all the superpixel scale features;
[0049] A superpixel classification module is used to perform a classification feature extraction operation on the global graph to obtain a global classification feature, perform a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and perform a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph;
[0050] The single tree instance segmentation module is used to perform calculations based on the tree sub-graph to obtain edge prediction features corresponding to each of the superpixel graphs, and perform edge prediction operations based on all the edge prediction features to obtain superpixel aggregation results, integrate the superpixel classification results and the superpixel aggregation results to obtain single tree instance segmentation results.
[0051] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a single tree instance segmentation program based on a scale pyramid graph network stored in the memory and executable on the processor, wherein the single tree instance segmentation program based on a scale pyramid graph network implements the steps of the single tree instance segmentation method based on a scale pyramid graph network as described above when the single tree instance segmentation program based on a scale pyramid graph network is executed by the processor.
[0052] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a single tree instance segmentation program based on a scale pyramid graph network, and when the single tree instance segmentation program based on a scale pyramid graph network is executed by a processor, the steps of the single tree instance segmentation method based on a scale pyramid graph network as described above are implemented.
[0053] In the present invention, a hyperspectral image to be processed is obtained, and a feature map construction operation is performed based on the hyperspectral image to obtain multiple superpixel maps; a pixel-scale feature extraction operation is performed on each of the superpixel maps to obtain pixel-scale features corresponding to each superpixel map; a superpixel-scale feature extraction operation is performed based on each of the pixel-scale features to obtain superpixel-scale features corresponding to each superpixel map, and a global map is constructed based on all the superpixel-scale features; a classification feature extraction operation is performed based on the global map to obtain global classification features, and a classification operation is performed on each superpixel map in the global map based on the global classification features to obtain superpixel classification results, and a screening operation is performed on the global map based on the superpixel classification results to obtain a tree submap; calculations are performed based on the tree submap to obtain edge prediction features corresponding to each superpixel map, and an edge prediction operation is performed based on all the edge prediction features to obtain a superpixel aggregation result, and the superpixel classification results and the superpixel aggregation results are integrated to obtain a single tree instance segmentation result. The present invention designs a scale pyramid module, which is divided into pixel, superpixel, and sub-pixel submaps. Figure 3 It mines features at each level step by step, fully exploits the spatial-spectral features of the hyperspectral image, further improves the feature extraction capability of the graph structure, designs sub-graph position encoding to make up for the defect that the graph structure only has adjacency information, and further enhances the natural spatial position information of the graph structure, making the final single tree segmentation result more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a flow chart of a preferred embodiment of the single tree instance segmentation method based on the scale pyramid graph network of the present invention;
[0055] Figure 2 It is a detailed flow chart of a preferred embodiment of the single tree instance segmentation method based on the scale pyramid graph network of the present invention;
[0056] Figure 3 It is a network model structure diagram of a preferred embodiment of the single tree instance segmentation method based on the scale pyramid graph network of the present invention;
[0057] Figure 4 It is a scale pyramid module diagram of a preferred embodiment of the single tree instance segmentation method based on the scale pyramid graph network of the present invention;
[0058] Figure 5 It is a flowchart of pixel scale feature extraction of a preferred embodiment of a single tree instance segmentation method based on a scale pyramid graph network of the present invention;
[0059] Figure 6 It is a sub-graph scale feature extraction flow chart of a preferred embodiment of a single tree instance segmentation method based on a scale pyramid graph network of the present invention;
[0060] Figure 7 It is a schematic diagram of a sub-image mask of a preferred embodiment of a single tree instance segmentation method based on a scale pyramid graph network of the present invention;
[0061] Figure 8 It is a schematic diagram of the principle of a preferred embodiment of a single tree instance segmentation system based on a scale pyramid graph network of the present invention;
[0062] Fig. 9 Schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. 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.
[0064] The single tree instance segmentation method based on the scale pyramid graph network described in the preferred embodiment of the present invention is as follows: Figure 1 and Figure 2 As shown, the single tree instance segmentation method based on the scale pyramid graph network includes the following steps:
[0065] Step S10: obtaining a hyperspectral image to be processed, and performing a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps.
[0066] Specifically, in the present invention, Figure 3 As shown in the figure, a scale pyramid graph network (SPGN) is proposed. SPGN consists of three key modules: (a) a scale pyramid module for extracting features at three different scales; (b) a GCN decoder for obtaining superpixel aggregation; and (c) an MLP classifier for superpixel classification.
[0067] In a preferred embodiment of the present invention, a hyperspectral image that needs to be segmented into individual tree instances is first acquired, and then a feature map construction operation is performed based on the hyperspectral image, so that a plurality of super-pixel maps corresponding to the hyperspectral image can be obtained.
[0068] Furthermore, the step of acquiring a hyperspectral image to be processed and performing a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps specifically includes:
[0069] Receive a hyperspectral image to be processed sent by a drone; perform a superpixel segmentation operation on the hyperspectral image to obtain a plurality of superpixel blocks; obtain the pixel edge corresponding to each superpixel block according to the pixel adjacency relationship of each superpixel block; perform a feature map construction operation according to each superpixel block and the corresponding pixel edge to obtain a superpixel map corresponding to each superpixel block.
[0070] Specifically, we first receive the hyperspectral image collected by a drone equipped with a hyperspectral sensor, and then use the SLIC algorithm (Simple Linear Iterative Clustering) to perform superpixel segmentation on the hyperspectral image, thereby segmenting the hyperspectral image into multiple superpixel blocks; the hyperspectral image can be defined as a pixel set consisting of H×W pixels, expressed as in, is a hyperspectral image, H and W represent the height and width of the hyperspectral image respectively, and each pixel in the hyperspectral image is a D-dimensional spectral vector, is a D-dimensional real space; through superpixel segmentation, a hyperspectral image It is divided into a superpixel block set containing S superpixel blocks The sth (s=1, ..., S) superpixel block Contains s pixels, of which
[0071] Then, the superpixel block Get a set of pixel edges based on their pixel adjacency s ={(x s,i , x s,j )}, representing a superpixel block Each pixel in x is connected to its four neighboring pixels (top, bottom, left, and right). s,i and x s,j Represents super pixel blocks Finally, the superpixel block is divided into the i-th and j-th pixels according to the superpixel block and the corresponding pixel edge. Converted into superpixel After all superpixel blocks are processed, a superpixel map corresponding to each superpixel block is obtained.
[0072] Step S20: performing a pixel-scale feature extraction operation on each of the super-pixel images to obtain pixel-scale features corresponding to each of the super-pixel images.
[0073] Specifically, in a preferred embodiment of the present invention, a scale pyramid module (SPM) is proposed, through which information of different levels of the hyperspectral image is further extracted, such as Figure 3 (a) and Figure 4 As shown in the figure, the scale pyramid module is composed of pixels, superpixels and sub-pixels. Figure 3Extract features at each scale level; first, perform pixel-scale feature extraction on each superpixel image, so as to capture the pixel-scale features corresponding to each superpixel image.
[0074] Furthermore, the pixel-scale feature extraction operation is performed on each of the super-pixel images to obtain the pixel-scale features corresponding to each of the super-pixel images, specifically including:
[0075] Obtain the superpixel block corresponding to each of the superpixel images, perform global average pooling operations and one-dimensional convolution operations on each of the superpixel blocks in turn, and obtain the first intermediate features corresponding to each of the superpixel blocks; process each of the first intermediate features through an activation function to obtain a weight matrix corresponding to each of the superpixel blocks; perform a reverse pooling operation on each of the weight matrices, and perform element-by-element multiplication operations on each weight matrix obtained by the reverse pooling operation and the corresponding superpixel block to obtain the pixel-scale features corresponding to each of the superpixel images.
[0076] Specifically, Figure 5 As shown, the scale pyramid module in the present invention includes an efficient channel attention module for graph convolution, that is, Figure 5 In the pixel scale feature extraction module (Pixel Scale Feature Extraction, PSFE) shown in the figure, there are significant changes in the spectral information between different tree species, but with the improvement of spectral resolution, there is some redundancy in the spectral information, so it is very important to capture spectral information with representative differences; in addition, although two trees belonging to the same category may show similar spectral information, there may be differences in specific bands, and whether these tiny differences can be captured directly affects the quality of the extracted features. Therefore, the present invention designs a pixel scale feature extraction module to capture information in different bands through channel attention.
[0077] Tree species present unique spectral features in different wavelength bands, so the pixel-scale feature extraction module helps to achieve the weighting of specific bands for species classification, such as Figure 5 As shown, a global average pooling operation is first performed on the superpixel block corresponding to each superpixel map (equivalent to Figure 5 The global mean pooling of the superpixel block is used to convert the superpixel block into a one-dimensional vector, and then a one-dimensional convolution operation is performed using a predefined kernel size k to obtain the corresponding first intermediate feature of each superpixel block; For example, superpixel block The first intermediate feature is expressed as in, is the channel-level global average pooling operation, C1D k is a one-dimensional convolution with a kernel size of k.
[0078] Then, each first intermediate feature is input into the Sigmoid activation function to obtain the weight matrix corresponding to each superpixel block, which is specifically expressed as: Among them, σ is the Sigmoid activation function, ω s Represents a superpixel block The corresponding weight matrix.
[0079] Finally, each calculated weight matrix is first de-pooled. After the de-pooling operation is completed for all weight matrices, they are respectively multiplied element by element with the corresponding super-pixel blocks, which can be specifically expressed as: Among them, unpool is the unpooling operation, which is used to convert ω s Expand to Same size; It is an element-by-element multiplication operation; Superpixel block The corresponding pixel-scale features, that is, superpixel blocks The pixel-scale features of the corresponding superpixel image; the pixel-scale feature extraction module can learn to capture the spectral information of representative differences with fewer parameters, thereby improving the efficiency of the network.
[0080] Step S30: performing a superpixel scale feature extraction operation based on each of the pixel scale features to obtain a superpixel scale feature corresponding to each of the superpixel images, and constructing a global image based on all of the superpixel scale features.
[0081] Specifically, in a preferred embodiment of the present invention, the scale pyramid module further includes a superpixel scale feature extraction module (Superpixel Scale Feature Extraction, SPSFE), which is intended to learn feature representation at the superpixel scale. In the superpixel scale feature extraction module, Figure 3 As shown in the figure, each superpixel block is input into the simple graph convolution (SGC) and global average pooling (GAP) process. Through multiple layers of graph convolution, SGC obtains the representation of each node in the superpixel map, and then global average pooling aggregates the information of all nodes in the superpixel map to obtain the superpixel scale features corresponding to the superpixel map.
[0082] Further, the super-pixel scale feature extraction operation is performed based on each of the pixel-scale features to obtain the super-pixel scale feature corresponding to each of the super-pixel images, and a global image is constructed based on all the super-pixel scale features, specifically including:
[0083] Based on the pixel scale features corresponding to each superpixel map, a first node feature matrix and a first adjacent matrix corresponding to each superpixel map are obtained; based on each of the first adjacent matrices, a first closed-loop adjacency matrix corresponding to each superpixel map is obtained; based on the first node feature matrix and the first closed-loop adjacency matrix corresponding to each superpixel map, a second intermediate feature corresponding to each superpixel map is calculated; each of the second intermediate features is subjected to a global average pooling operation to obtain a superpixel scale feature corresponding to each superpixel map; based on the superpixel scale features corresponding to each superpixel map, an edge set corresponding to each superpixel map is obtained; and a global graph is constructed based on all the superpixel maps and all the edge sets.
[0084] Specifically, firstly, based on the pixel-scale features corresponding to each superpixel graph, the first node feature matrix and the first adjacent matrix corresponding to each superpixel graph are obtained respectively, and then, according to each first adjacent matrix, the corresponding first closed-loop adjacency matrix is obtained respectively; For example, superpixel map The corresponding pixel-scale feature is according to Get the first node feature matrix as The first adjacent matrix is A s , for the first adjacent matrix A s After adding the self-loop, we get the first closed loop adjacency matrix
[0085] Then, the second intermediate feature corresponding to each superpixel image is obtained by calculating the first node feature matrix and the first closed-loop adjacency matrix corresponding to each superpixel image. s and the first closed-loop adjacency matrix Calculate and get the second intermediate feature The specific calculation formula is: Wherein, W is a trainable matrix in the superpixel scale feature extraction module; K represents the number of neighbor hops of SGC, and in a preferred embodiment of the present invention, K is set to 3; is the first node feature matrix A s Diagonal matrices of the same dimension.
[0086] Finally, the second intermediate feature is subjected to global average pooling to obtain the superpixel scale feature corresponding to each superpixel map. Perform global average pooling operation, the specific calculation formula is: Among them, g() represents the global average pooling operation; Representing superpixel graph Corresponding superpixel scale features; after completing the superpixel scale feature extraction operation for each superpixel map, a superpixel scale feature set is obtained The sth (s=1, ..., S) superpixel map The corresponding superpixel scale feature can also be expressed as h s ; After superpixel-scale feature extraction, low-frequency information, such as texture features in uniform areas, is retained, while high-frequency information, such as noise, is greatly reduced.
[0087] Considering that superpixel segmentation often over-segments hyperspectral images and ensures the uniformity of superpixels, this usually causes a single instance information to be scattered across multiple superpixel maps. In addition, the spatial relationship between different instances also plays a vital role in instance recognition. To solve this problem, it is necessary to obtain an edge set based on the adjacency relationship between superpixel maps, obtain the edge set corresponding to each superpixel map according to the superpixel scale features corresponding to each superpixel map, and integrate all edge sets to obtain the global edge set. Finally, according to the super-pixel scale feature set and the global edge set ε g Building a global graph
[0088] Step S40: performing a classification feature extraction operation on the global graph to obtain a global classification feature, performing a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and performing a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph.
[0089] Specifically, in a preferred embodiment of the present invention, Figure 6 As shown in FIG. 1 , the scale pyramid module also includes a subgraph scale feature extraction module. After performing superpixel feature extraction on all superpixel graphs, a global graph is obtained. In the context of the global graph, effective use of the neighborhood information of each node can enhance the understanding of the node environment and its surrounding context. Including neighboring information when extracting features plays a vital role in node classification and edge prediction tasks. Considering the hierarchical and signal propagation characteristics of the graph convolutional network, the present invention designs an N-layer graph convolutional network for extracting domain information and enhancing context understanding. This module is the subgraph scale feature extraction module. The subgraph scale feature extraction module is used to perform classification feature extraction on the global graph to obtain a global classification feature H. class , and then classify the global graph according to the global classification features to obtain the superpixel classification results. Finally, the global graph is filtered according to the superpixel classification results to obtain the corresponding tree subgraph.
[0090] Further, the classification feature extraction operation is performed according to the global graph to obtain the global classification feature, specifically including:
[0091] A second node feature matrix and a second adjacent matrix are obtained according to the global graph; a second closed-loop adjacency matrix is obtained according to the second adjacent matrix; a nonlinear enhancement operation is performed on the second closed-loop adjacency matrix, and a batch normalization operation is performed based on the result of the nonlinear enhancement operation and the second node feature matrix to obtain a third intermediate feature; the third intermediate feature and the second node feature matrix are fused to obtain a global classification feature corresponding to the global graph.
[0092] Specifically, the present invention introduces a nonlinear operation relu() after each graph convolutional network layer to enhance the nonlinear expression ability of features. However, iterative application of linear and nonlinear operations during propagation may distort the feature distribution, thus posing a challenge to the convergence of the network. To alleviate this challenge, a batch normalization layer is introduced to normalize the output to make it closer to a distribution with a mean of 0 and a variance of 1.
[0093] First, according to the global graph Get the second node feature matrix X g =[h1, ..., h S ] T and the second adjacent matrix A g , and then for the second adjacent matrix A g Add self-loops to get the second closed-loop adjacency matrix Then for the second closed-loop adjacency matrix A nonlinear enhancement operation (nonlinear operation) is performed, and then a batch normalization operation is performed based on the result of the nonlinear enhancement operation and the second node feature matrix to obtain the third intermediate feature. The specific formula is: Where l represents the number of layers; Θ l represents the trainable matrix of the lth layer; when l = 0, is the second adjacent matrix A g Diagonal matrices of the same dimension; represents the input of the lth layer, represents the output of the lth layer; considering that the relevant features of the node are mainly concentrated in the low-order area, and as the number of layers of the graph convolutional network increases, the receptive field of the node expands, thereby integrating more heterogeneous information. This may lead to a smoothing effect between features, and ultimately lead to a decrease in model performance. Therefore, it may not be the case that the deeper the network layer, the better the effect. Considering the above situation, in the preferred embodiment of the present invention, l is set to 2; therefore, after processing, the third intermediate feature
[0094] In order to further improve the network performance and effectively utilize the shallow network features, the present invention incorporates the residual block into the design, and the final output global classification feature (sub-graph scale feature) is That is, the third intermediate feature and the second node feature matrix are fused to obtain the global classification feature, which is specifically expressed as in, Represents the classification feature corresponding to the Sth superpixel image.
[0095] Furthermore, the global classification feature includes classification features corresponding to each superpixel map; performing a classification operation on each superpixel map in the global map according to the global classification feature to obtain a superpixel classification result, and performing a screening operation on the global map according to the superpixel classification result to obtain a tree submap, specifically includes:
[0096] Classification operations are performed based on each of the classification features to obtain classification results corresponding to each of the superpixel images; all the classification results are integrated to obtain superpixel classification results; the global image is screened according to the superpixel classification results, and the superpixel images with the classification results as trees are retained to obtain tree sub-images.
[0097] Specifically, Figure 2 and Figure 3 In (c), in a preferred embodiment of the present invention, a multi-layer perceptron (MLP) classifier is used to classify each super-pixel map in the global map, so as to classify each super-pixel map according to the classification features corresponding to each super-pixel map. (i=1, ..., S) Classify each superpixel map separately to obtain the classification result corresponding to each superpixel map Specifically, it can be expressed as: It should be noted that the classification result includes whether it is a tree and the type of tree.
[0098] According to the classification results of all superpixel images, the global image is filtered to remove the superpixel images whose classification results are not trees in the global image, and only the superpixel images whose classification results are trees are retained, thus obtaining the tree sub-image.
[0099] Step S50, performing calculations based on the tree sub-graph to obtain edge prediction features corresponding to each of the superpixel graphs, performing edge prediction operations based on all of the edge prediction features to obtain superpixel aggregation results, integrating the superpixel classification results and the superpixel aggregation results to obtain a single tree instance segmentation result.
[0100] Specifically, in a preferred embodiment of the present invention, since the constructed global graph, superpixel graph and tree subgraph only have adjacency information and cannot capture spatial information well, the present invention proposes subgraph position encoding (SPE) to further enhance the spatial information of the graph; based on the tree subgraph, the subgraph position encoding of each superpixel graph in the global graph can be obtained, and then the edge prediction features corresponding to each superpixel graph are obtained according to all subpixel position encodings, and edge prediction operations are performed on each superpixel graph according to the edge prediction features to obtain superpixel aggregation results. The superpixel aggregation results reveal whether two superpixel graphs are the same tree. Finally, the superpixel aggregation results and the superpixel classification results are fused to obtain the final single tree instance segmentation result.
[0101] Furthermore, the calculation is performed based on the tree sub-graph to obtain edge prediction features corresponding to each of the super-pixel graphs, and edge prediction operations are performed based on all of the edge prediction features to obtain super-pixel aggregation results, and the super-pixel classification results and the super-pixel aggregation results are integrated to obtain a single tree instance segmentation result, specifically including:
[0102] A sub-graph mask is generated based on the tree sub-graph; a sub-graph position encoding is calculated based on the sub-graph mask to obtain a tree sub-graph position encoding corresponding to each super-pixel graph in the tree sub-graph; a global average pooling operation is performed on all the tree sub-graph position encodings to obtain a sub-graph position encoding corresponding to each super-pixel graph in the global graph; a tree node feature matrix is obtained according to the tree sub-graph, and all the sub-graph position encodings are combined with the tree node feature matrix to obtain a tree edge prediction feature, wherein the tree edge prediction feature includes an edge prediction feature corresponding to each super-pixel graph in the tree sub-graph; an edge prediction operation is performed on each edge prediction feature to obtain a super-pixel aggregation result; the super-pixel aggregation result and the super-pixel classification result are fused to obtain a final single tree instance segmentation result.
[0103] Specifically, the original intention of designing subgraph position encoding is to enhance the natural spatial position information lacking in the graph structure. Subgraph position encoding aims to explore the spatial relationship between nodes by combining the use of subgraph masks and position encoding. Since the constructed global graph, superpixel graph and tree subgraph are constructed based on neighborhood relationships, they only have adjacency information and lack the natural spatial position information between superpixel graphs. The natural spatial position information contains the distribution relationship between trees, which has certain guiding significance for the identification of tree canopies, and the natural spatial position relationship can also guide the similarity matching between spatial texture details from different superpixel graphs, so it can be used to assist in judging whether two superpixel graphs belong to the same tree.
[0104] First, according to the tree subgraph Generate a sub-image mask, as follows Figure 7 As shown in (a), the values 1 and 0 represent the presence and absence of a tree, respectively; a subgraph refers to a region consisting of adjacent pixels with the same attributes (i.e., pixel values). Therefore, for each connected subgraph, the corresponding bounding rectangle mask can be obtained according to the subgraph mask, and then the relative position index of the bounding rectangle mask is calculated respectively, and the cumulative sum is calculated along a specific dimension (such as the x-axis and the y-axis). Finally, the subgraph mask and the relative position index are multiplied element by element to obtain the subgraph relative position index. The calculation of the cumulative sum is as follows: Figure 7 As shown in (b) and (c) in .
[0105] Subsequently, the sine-based position encoding technology used in Transformer is calculated with its relative position to obtain the position encoding matrix corresponding to the tree sub-graph. The position encoding matrix contains the tree sub-graph position encoding corresponding to each superpixel graph in the tree sub-graph. The specific calculation formula for the value of each element in the position encoding matrix is: Among them, pos represents the relative position index of the subgraph; i represents the index of the dimension; d model is the dimension output by the superpixel scale feature extraction module, which is set to 128 in the preferred embodiment of the present invention; then, a global average pooling operation is performed on the position codes of all tree sub-graphs in the position coding matrix to obtain the position code corresponding to each superpixel graph in the global graph.
[0106] According to the tree subgraph Get the tree node feature matrix H tree =[h t1 , ..., h tn ] T , where h tn is the nth superpixel map in the tree sub-map; all position codes are combined with the tree node feature matrix H tree Combined, we get the tree edge prediction features for edge prediction in, represents the edge prediction feature corresponding to the nth superpixel image in the nth tree subgraph; Figure 2 and Figure 3 As shown in (b), the preferred embodiment of the present invention performs edge prediction operation through the GCN decoder to achieve the superpixel aggregation task and obtain the superpixel aggregation result; first, the obtained tree edge prediction features are passed through a graph convolution layer, and then through the nonlinear activation function relu() and batch normalization, and finally the cosine similarity between adjacent superpixel graphs is calculated. The calculation formula of cosine similarity is: in, and are the tree edge prediction features Hlink The i-th edge prediction feature and the j-th edge prediction feature (i is not equal to j) are used; finally, the calculated similarity is subjected to batch normalization and sigmoid activation function to generate representation and Whether the corresponding superpixel graph belongs to the aggregation result of the same tree After the superpixel aggregation task is completed for any two superpixel images in the tree sub-image, a superpixel aggregation result is obtained, which indicates whether any two superpixel images in the tree sub-image belong to the same tree.
[0107] Finally, the superpixel aggregation results and superpixel classification results are fused to obtain the final single tree instance segmentation result.
[0108] Furthermore, the superpixel classification loss is measured by the cross entropy loss: in, is the classification result of the i-th superpixel map, and N is the total number of superpixel maps. After completing the classification operation of all superpixel maps, the classification result of each superpixel map is obtained, and all classification results are integrated to obtain the superpixel classification result. In the superpixel aggregation task, the edge prediction loss is measured by the binary cross entropy loss: Therefore, the final loss function can be expressed as: L = L entropy +L BCE .
[0109] Furthermore, if Figure 8 As shown, based on the above-mentioned single tree instance segmentation method based on the scale pyramid graph network, the present invention also provides a single tree instance segmentation system based on the scale pyramid graph network, wherein the single tree instance segmentation system based on the scale pyramid graph network includes:
[0110] A super-pixel map construction module 51 is used to obtain a hyperspectral image to be processed, and perform a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps;
[0111] A pixel feature extraction module 52 is used to perform a pixel scale feature extraction operation on each of the super pixel images to obtain a pixel scale feature corresponding to each of the super pixel images;
[0112] A superpixel feature extraction module 53, configured to perform a superpixel scale feature extraction operation based on each of the pixel scale features, obtain a superpixel scale feature corresponding to each of the superpixel images, and construct a global image based on all the superpixel scale features;
[0113] A superpixel classification module 54 is used to perform a classification feature extraction operation on the global graph to obtain a global classification feature, perform a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and perform a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph;
[0114] The single tree instance segmentation module 55 is used to perform calculations based on the tree sub-graph to obtain edge prediction features corresponding to each of the super-pixel graphs, and perform edge prediction operations based on all the edge prediction features to obtain super-pixel aggregation results, integrate the super-pixel classification results and the super-pixel aggregation results to obtain single tree instance segmentation results.
[0115] Furthermore, if Fig. 9 As shown, based on the above-mentioned single tree instance segmentation method and system based on the scale pyramid graph network, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Fig. 9 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0116] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed in the terminal, such as the program code of the installation terminal, etc. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a single tree instance segmentation program 40 based on a scale pyramid graph network is stored on the memory 20, and the single tree instance segmentation program 40 based on a scale pyramid graph network can be executed by the processor 10, thereby realizing the single tree instance segmentation method based on a scale pyramid graph network in the present application.
[0117] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the single tree instance segmentation method based on the scale pyramid graph network.
[0118] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0119] In one embodiment, when the processor 10 executes the single tree instance segmentation program 40 based on the scale pyramid graph network in the memory 20, the steps of the single tree instance segmentation method based on the scale pyramid graph network are implemented.
[0120] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a single tree instance segmentation program based on a scale pyramid graph network, and when the single tree instance segmentation program based on a scale pyramid graph network is executed by a processor, the steps of the single tree instance segmentation method based on a scale pyramid graph network as described above are implemented.
[0121] In summary, the present invention provides a method, system and terminal for segmenting a single tree instance based on a scale pyramid graph network. The method includes: obtaining a hyperspectral image to be processed, performing a feature graph construction operation based on the hyperspectral image to obtain multiple superpixel graphs; performing a pixel-scale feature extraction operation on each of the superpixel graphs to obtain pixel-scale features corresponding to each of the superpixel graphs; performing a superpixel-scale feature extraction operation based on each of the pixel-scale features to obtain superpixel-scale features corresponding to each of the superpixel graphs, and constructing a global graph based on all of the superpixel-scale features; performing a classification feature extraction operation based on the global graph to obtain global classification features, performing a classification operation on each superpixel graph in the global graph based on the global classification features to obtain superpixel classification results, and performing a screening operation on the global graph based on the superpixel classification results to obtain a tree subgraph; performing calculations based on the tree subgraphs to obtain edge prediction features corresponding to each of the superpixel graphs, and performing edge prediction operations based on all of the edge prediction features to obtain superpixel aggregation results, integrating the superpixel classification results and the superpixel aggregation results to obtain a single tree instance segmentation result. The present invention designs a scale pyramid module, which extracts pixels, superpixels, and subpixels from the pixel, superpixel, and subpixel graphs. Figure 3 It mines features at each level step by step, fully exploits the spatial-spectral features of the hyperspectral image, further improves the feature extraction capability of the graph structure, designs sub-graph position encoding to make up for the defect that the graph structure only has adjacency information, and further enhances the natural spatial position information of the graph structure, making the final single tree segmentation result more accurate.
[0122] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0123] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0124] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A single tree instance segmentation method based on a scale pyramid graph network, characterized in that: The single tree instance segmentation method based on the scale pyramid graph network includes: Acquire a hyperspectral image to be processed, and perform a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps; Performing a pixel-scale feature extraction operation on each of the superpixel images respectively to obtain pixel-scale features corresponding to each of the superpixel images; Based on each of the pixel-scale features, a superpixel-scale feature extraction operation is performed to obtain a superpixel-scale feature corresponding to each of the superpixel images, and a global image is constructed based on all the superpixel-scale features; Performing a classification feature extraction operation on the global graph to obtain a global classification feature, performing a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and performing a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph; Calculation is performed based on the tree sub-graph to obtain edge prediction features corresponding to each of the super-pixel graphs, and edge prediction operations are performed based on all of the edge prediction features to obtain super-pixel aggregation results, and the super-pixel classification results and the super-pixel aggregation results are integrated to obtain a single tree instance segmentation result.
2. The single tree instance segmentation method based on the scale pyramid graph network according to claim 1 is characterized in that: The step of obtaining a hyperspectral image to be processed and performing a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps specifically includes: Receive the hyperspectral image to be processed sent by the UAV; Performing a super-pixel segmentation operation on the hyperspectral image to obtain a plurality of super-pixel blocks; Acquire a pixel edge corresponding to each superpixel block according to a pixel adjacency relationship of each superpixel block; A feature map construction operation is performed according to each of the superpixel blocks and the corresponding pixel edges to obtain a superpixel map corresponding to each of the superpixel blocks.
3. The single tree instance segmentation method based on the scale pyramid graph network according to claim 1 is characterized in that: The step of performing a pixel-scale feature extraction operation on each of the super-pixel images to obtain a pixel-scale feature corresponding to each of the super-pixel images specifically includes: Obtaining a superpixel block corresponding to each superpixel image, and performing a global average pooling operation and a one-dimensional convolution operation on each superpixel block in sequence, to obtain a first intermediate feature corresponding to each superpixel block; Each of the first intermediate features is processed by an activation function to obtain a weight matrix corresponding to each of the super pixel blocks; The de-pooling operation is performed on each of the weight matrices respectively, and each weight matrix after the de-pooling operation is performed element-by-element multiplication operation with the corresponding super-pixel block to obtain the pixel-scale features corresponding to each of the super-pixel images.
4. The single tree instance segmentation method based on scale pyramid graph network according to claim 1 is characterized in that: The step of performing a superpixel scale feature extraction operation based on each of the pixel scale features to obtain a superpixel scale feature corresponding to each of the superpixel images, and constructing a global image based on all of the superpixel scale features, specifically includes: Based on the pixel scale features corresponding to each superpixel image, obtain a first node feature matrix and a first adjacent matrix corresponding to each superpixel image; Obtaining a first closed-loop adjacency matrix corresponding to each of the superpixel images according to each of the first adjacency matrices; Calculating based on the first node feature matrix and the first closed-loop adjacency matrix corresponding to each of the superpixel graphs to obtain a second intermediate feature corresponding to each of the superpixel graphs; Performing a global average pooling operation on each of the second intermediate features respectively to obtain a superpixel scale feature corresponding to each of the superpixel images; Acquire an edge set corresponding to each superpixel image according to the superpixel scale feature corresponding to each superpixel image; A global graph is constructed based on all of the superpixel graphs and all of the edge sets.
5. The single tree instance segmentation method based on scale pyramid graph network according to claim 1 is characterized in that: The performing of a classification feature extraction operation according to the global graph to obtain a global classification feature specifically includes: Acquire a second node feature matrix and a second adjacent matrix according to the global graph; Obtaining a second closed-loop adjacency matrix according to the second adjacency matrix; Performing a nonlinear enhancement operation on the second closed-loop adjacency matrix, and performing a batch normalization operation based on a result of the nonlinear enhancement operation and the second node feature matrix to obtain a third intermediate feature; The third intermediate feature and the second node feature matrix are fused to obtain a global classification feature corresponding to the global graph.
6. The single tree instance segmentation method based on scale pyramid graph network according to claim 1 is characterized in that: The global classification feature includes the classification feature corresponding to each superpixel map; The classification operation is performed on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and the screening operation is performed on the global graph according to the superpixel classification result to obtain a tree subgraph, specifically including: Performing classification operations based on each of the classification features respectively to obtain classification results corresponding to each of the superpixel images; Integrate all the classification results to obtain a superpixel classification result; The global graph is screened according to the superpixel classification result, and the superpixel graph whose classification result is a tree is retained to obtain a tree subgraph.
7. The single tree instance segmentation method based on scale pyramid graph network according to claim 1 is characterized in that: The calculation is performed based on the tree sub-graph to obtain edge prediction features corresponding to each super-pixel graph, and an edge prediction operation is performed based on all the edge prediction features to obtain a super-pixel aggregation result, and the super-pixel classification result and the super-pixel aggregation result are integrated to obtain a single tree instance segmentation result, specifically including: generating a sub-graph mask based on the tree sub-graph; Perform sub-image position coding calculation based on the sub-image mask to obtain the tree sub-image position coding corresponding to each super-pixel image in the tree sub-image; Performing a global average pooling operation on all the tree sub-graph position codes to obtain a sub-graph position code corresponding to each super-pixel graph in the global graph; Obtain a tree node feature matrix according to the tree subgraph, combine all the subgraph position codes with the tree node feature matrix, and obtain tree edge prediction features, wherein the tree edge prediction features include edge prediction features corresponding to each superpixel graph in the tree subgraph; Performing edge prediction operations according to each of the edge prediction features to obtain a superpixel aggregation result; The superpixel aggregation result and the superpixel classification result are fused to obtain a final single tree instance segmentation result.
8. A single tree instance segmentation system based on a scale pyramid graph network, characterized in that: The single tree instance segmentation system based on the scale pyramid graph network includes: A super-pixel map construction module is used to obtain a hyperspectral image to be processed, and perform a feature map construction operation based on the hyperspectral image to obtain a plurality of super-pixel maps; A pixel feature extraction module, used to perform a pixel scale feature extraction operation on each of the super pixel images to obtain a pixel scale feature corresponding to each of the super pixel images; A superpixel feature extraction module, configured to perform a superpixel scale feature extraction operation based on each of the pixel scale features, obtain a superpixel scale feature corresponding to each of the superpixel images, and construct a global image based on all the superpixel scale features; A superpixel classification module is used to perform a classification feature extraction operation on the global graph to obtain a global classification feature, perform a classification operation on each superpixel graph in the global graph according to the global classification feature to obtain a superpixel classification result, and perform a screening operation on the global graph according to the superpixel classification result to obtain a tree subgraph; The single tree instance segmentation module is used to perform calculations based on the tree sub-graph to obtain edge prediction features corresponding to each of the superpixel graphs, and perform edge prediction operations based on all the edge prediction features to obtain superpixel aggregation results, integrate the superpixel classification results and the superpixel aggregation results to obtain single tree instance segmentation results.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a single tree instance segmentation program based on a scale pyramid graph network stored in the memory and executable on the processor. When the single tree instance segmentation program based on a scale pyramid graph network is executed by the processor, the steps of the single tree instance segmentation method based on a scale pyramid graph network as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a single tree instance segmentation program based on a scale pyramid graph network, and when the single tree instance segmentation program based on a scale pyramid graph network is executed by a processor, the steps of the single tree instance segmentation method based on a scale pyramid graph network as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Hyperspectral remote sensing image subgraph reconstruction method based on superpixel segmentation
CN114463173A
Multi-level dense crown segmentation method based on unmanned aerial vehicle image and laser point cloud
CN117765006A
