Hyperspectral image classification method for agriculture
Through the method of fuzzy C-mean clustering, morphological operation and three-dimensional convolutional neural network combined with graph attention network, the data redundancy and spatial relationship neglect in hyperspectral image classification are solved, and a higher precision agricultural hyperspectral image classification is achieved.
Patent Information
- Application Number
- CN202510427234.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-29
AI Technical Summary
The classification of hyperspectral images in agriculture faces high data dimensions, high processing complexity and difficult classification. The existing methods ignore spatial relationship information in the images, resulting in limited classification accuracy.
The fuzzy C-mean clustering algorithm and morphological operations are used for preprocessing, and dimensionality reduction is reduced in combination with principal component analysis; the three-dimensional convolutional neural network is used for preliminary classification; the spatial relationship is captured through the graph attention network, and the spatial relationship is optimized in combination with morphological features, and the hyperspectral image classification results are finally output.
It improves the accuracy and reliability of hyperspectral image classification, can more accurately reflect the category and distribution information of objects, and provides technical support for agricultural production.
Smart Images

Figure CN120388212A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of hyperspectral image classification, and in particular to a hyperspectral image classification method for agriculture. Background Art
[0002] With the rapid development of remote sensing technology, hyperspectral imaging technology has become an important tool in the field of agricultural monitoring because it can provide rich spectral information. Hyperspectral images can reveal the detailed chemical and physical properties of objects by capturing the reflection or emission characteristics of surface objects in different spectral bands. In the agricultural field, this technology is widely used in crop identification, pest and disease monitoring, soil fertility assessment, and precision agriculture practices.
[0003] However, despite the significant advantages of hyperspectral imaging technology in agriculture, its image classification still faces a series of challenges. First, the data dimension of hyperspectral images is extremely high, containing hundreds or even thousands of spectral bands, which leads to large data redundancy and high processing complexity. Second, the surface cover types in agricultural scenes are diverse, and the spectral characteristics of different crops, weeds, soils, and pests and diseases may highly overlap, increasing the difficulty of classification. In addition, existing hyperspectral image classification methods often focus on the extraction and classification of spectral features while ignoring the spatial relationship information in the images, which limits the further improvement of classification accuracy. Summary of the Invention
[0004] In view of this, the present invention proposes a hyperspectral image classification method for agriculture, which can effectively solve the defects of high processing complexity, large classification difficulty, and limited classification accuracy existing in the prior art.
[0005] The technical solution of the present invention is realized as follows:
[0006] A hyperspectral image classification method for agriculture, comprising:
[0007] Data preprocessing: Preprocessing the hyperspectral image using the fuzzy C-means clustering algorithm and morphological operations to obtain clustering features and morphological features, and performing dimensionality reduction processing in combination with principal component analysis;
[0008] Initial classification: Using a three-dimensional convolutional neural network to perform initial classification on the dimensionality-reduced clustering features to extract the spatial and spectral features of the hyperspectral image;
[0009] Spatial relationship capture: Processing the spatial and spectral features of the hyperspectral image through a graph attention network to capture the spatial relationship in the hyperspectral image;
[0010] Optimization of classification results: Combining the obtained morphological features to optimize the spatial relationship in the hyperspectral image to obtain an optimized spatial relationship;
[0011] Output classification result: According to the optimized spatial relationship, output the final hyperspectral image classification result.
[0012] As a further optional solution of the hyperspectral image classification method for agriculture, the fuzzy C-means clustering algorithm preprocesses the hyperspectral image to obtain clustering features, specifically including:
[0013] Randomly select C clustering centers, where C is the preset number of clusters;
[0014] Calculate the membership degree of each pixel to each cluster according to the distance between each pixel and the clustering center;
[0015] Update the center position of each cluster according to the membership degree matrix;
[0016] Repeat the steps of calculating the membership degree matrix and updating the clustering center until the convergence condition is met;
[0017] After clustering is completed, each pixel will be assigned to a cluster, thus obtaining clustering features.
[0018] As a further optional solution of the hyperspectral image classification method for agriculture, the morphological operation preprocesses the hyperspectral image to obtain morphological features, specifically including:
[0019] Select multiple spectral bands of the hyperspectral image;
[0020] Apply the opening operation to each selected spectral band to obtain morphological features.
[0021] As a further optional solution of the hyperspectral image classification method for agriculture, the dimensionality reduction processing is performed by combining principal component analysis, specifically including:
[0022] Calculate the covariance matrices of the clustering features and the morphological features respectively;
[0023] Calculate the eigenvalues and eigenvectors of the covariance matrices of the clustering features and the morphological features respectively;
[0024] According to the magnitudes of the eigenvalues, select the first K principal components, where K is the preset number of dimensions after dimensionality reduction;
[0025] Project the clustering features and the morphological features into the space composed of the selected principal components respectively to obtain the dimensionality-reduced clustering features and morphological features.
[0026] As a further optional solution of the hyperspectral image classification method for agriculture, the dimensionality-reduced clustering features are initially classified by using a three-dimensional convolutional neural network to extract the spatial and spectral features of the hyperspectral image, specifically including:
[0027] Combine the dimensionality-reduced clustering features with the original spectral features to form a new four-dimensional input tensor;
[0028] Input the four-dimensional input tensor into a three-dimensional convolutional neural network for processing to obtain the spatial and spectral features of the hyperspectral image. Among them, the three-dimensional convolutional neural network includes an input layer, a first convolutional layer, a second convolutional layer, a fully connected layer, and an output layer. The input layer is used to receive the four-dimensional input tensor. The first convolutional layer includes a 3D convolutional kernel with a size of 3×3×3, a batch normalization layer, a ReLU activation function, and a first 3D max pooling layer. The second convolutional layer includes a 3D convolutional kernel with a size of 5×5×5, a batch normalization layer, a ReLU activation function, and a first 3D max pooling layer. The fully connected layer is used for feature integration and preliminary classification, and the output layer uses a softmax activation function to output classification probabilities.
[0029] As a further alternative of the hyperspectral image classification method for agriculture, process the spatial and spectral features of the hyperspectral image through a graph attention network to capture the spatial relationships in the hyperspectral image, specifically including:
[0030] Represent the spatial and spectral features of the hyperspectral image as graph nodes, and construct a graph structure according to spatial positions and spectral similarities;
[0031] Input the constructed graph structure and its node features into the graph attention network;
[0032] In the graph attention network, capture the spatial relationships between nodes through neighborhood aggregation operations to obtain the adjacent nodes of each node;
[0033] Use the attention mechanism to weight the features of the adjacent nodes to obtain the final spatial relationships in the hyperspectral image.
[0034] As a further alternative of the hyperspectral image classification method for agriculture, combine the obtained morphological features to optimize the spatial relationships in the hyperspectral image to obtain optimized spatial relationships, specifically including:
[0035] Based on the extracted morphological features, construct a spatial relationship model in the hyperspectral image, where nodes represent pixels or objects in the image, and edges represent the spatial relationships between them;
[0036] Adjust the edge weights or node positions in the spatial relationship model according to the morphological features to obtain an optimized spatial relationship model;
[0037] Extract the optimized spatial relationships from the optimized spatial relationship model.
[0038] A hyperspectral image classification system for agriculture, including:
[0039] A data preprocessing module, which is used to perform clustering processing on the hyperspectral image using the fuzzy C-means clustering algorithm to obtain clustering features, extract morphological features through morphological operations, and perform dimensionality reduction processing on the clustering features and morphological features in combination with principal component analysis;
[0040] A preliminary classification module, connected to the output end of the data preprocessing module, which is used to perform preliminary classification on the dimensionality-reduced clustering features using a three-dimensional convolutional neural network, so as to extract the spatial features and spectral features of the hyperspectral image;
[0041] A spatial relationship capturing module, connected to the output end of the preliminary classification module, which is used to input the extracted spatial features and spectral features of the hyperspectral image into a graph attention network for processing to capture the spatial relationship in the hyperspectral image;
[0042] A classification result optimization module, connected to the output end of the spatial relationship capturing module, which is used to optimize the spatial relationship captured by the graph attention network in combination with the morphological features obtained from the data preprocessing module to obtain an optimized spatial relationship;
[0043] An output classification result module, connected to the output end of the classification result optimization module, which is used to output the final hyperspectral image classification result according to the optimized spatial relationship.
[0044] A computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of any one of the above hyperspectral image classification methods for agriculture are implemented.
[0045] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above hyperspectral image classification methods for agriculture are implemented.
[0046] The beneficial effects of the present invention are as follows: By using the fuzzy C-means clustering algorithm and morphological operations to preprocess hyperspectral images, the clustering features and morphological features of the images can be effectively extracted. The fuzzy C-means clustering algorithm improves the accuracy of clustering by considering the spatial distribution characteristics among samples, and the morphological operations can highlight the key structural information in the images, providing strong support for subsequent classification. Combining with principal component analysis for dimensionality reduction processing can significantly reduce the dimensionality of the data, reduce redundant information, and at the same time retain the main features in the images. Using a three-dimensional convolutional neural network to preliminarily classify the clustering features after dimensionality reduction processing can fully extract the spatial and spectral features of hyperspectral images. The three-dimensional convolutional neural network simulates the connection mode of human brain neurons to perform in-depth learning and analysis on the images, so as to accurately identify the complex information in the images. Processing the spatial and spectral features of hyperspectral images through a graph attention network can capture the spatial relationships in the images. The graph attention network can focus on the key regions and features in the images by simulating the attention mechanism in the human visual system, thus accurately capturing the spatial relationships in the images. Combining with the obtained morphological features to optimize the spatial relationships in hyperspectral images can further improve the accuracy of the classification results. The morphological features can reflect the structural information and detailed features in the images. Through the comprehensive analysis of these features, the classification results can be further optimized. The optimized spatial relationships can more accurately reflect the actual distribution and mutual relationships of objects in the images, thereby improving the reliability and practicality of the classification results. According to the optimized spatial relationships, the final classification results of hyperspectral images are output. The classification results can accurately reflect the category and distribution information of different objects in the images, providing strong technical support for agricultural production. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0048] Figure 1 It is a schematic flowchart of a hyperspectral image classification method for agriculture according to the present invention;
[0049] Figure 2 It is a schematic diagram of the composition of a hyperspectral image classification system for agriculture according to the present invention;
[0050] Figure 3 It is a schematic diagram of the composition of a computing device according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0052] Reference Figures 1 to 3 , a hyperspectral image classification method for agriculture, comprising:
[0053] Data preprocessing: using the fuzzy C-means clustering algorithm and morphological operations to preprocess the hyperspectral image, obtaining clustering features and morphological features, and performing dimensionality reduction processing in combination with principal component analysis;
[0054] Initial classification: using a three-dimensional convolutional neural network to initially classify the clustering features after dimensionality reduction processing, and extracting the spatial and spectral features of the hyperspectral image;
[0055] Spatial relationship capture: processing the spatial and spectral features of the hyperspectral image through a graph attention network to capture the spatial relationship in the hyperspectral image;
[0056] Classification result optimization: combining the obtained morphological features to optimize the spatial relationship in the hyperspectral image to obtain an optimized spatial relationship;
[0057] Output classification result: outputting the final hyperspectral image classification result according to the optimized spatial relationship.
[0058] In this embodiment, the fuzzy C-means clustering algorithm and morphological operations are used to preprocess the hyperspectral image, which can effectively extract the clustering features and morphological features of the image. The fuzzy C-means clustering algorithm improves the accuracy of clustering by considering the spatial distribution features between samples. The morphological operations can highlight the key structural information in the image and provide strong support for subsequent classification. Combining with principal component analysis for dimensionality reduction processing can significantly reduce the dimension of the data, reduce redundant information, and retain the main features in the image. Using a three-dimensional convolutional neural network to perform preliminary classification on the clustering features after dimensionality reduction processing can fully extract the spatial and spectral features of the hyperspectral image. The three-dimensional convolutional neural network simulates the connection mode of human brain neurons to perform in-depth learning and analysis on the image, so as to accurately identify the complex information in the image. Processing the spatial and spectral features of the hyperspectral image through a graph attention network can capture the spatial relationships in the image. The graph attention network can focus on the key regions and features in the image by simulating the attention mechanism in the human visual system, so as to accurately capture the spatial relationships in the image. Combining the obtained morphological features to optimize the spatial relationships in the hyperspectral image can further improve the accuracy of the classification results. The morphological features can reflect the structural information and detailed features in the image. Through comprehensive analysis of these features, the classification results can be further optimized. The optimized spatial relationships can more accurately reflect the actual distribution and mutual relationships of objects in the image, thereby improving the reliability and practicality of the classification results. According to the optimized spatial relationships, the final classification results of the hyperspectral image are output. The classification results can accurately reflect the category and distribution information of different objects in the image and provide strong technical support for agricultural production.
[0059] Preferably, the fuzzy C-means clustering algorithm preprocesses the hyperspectral image to obtain clustering features, which specifically includes:
[0060] Randomly select C clustering centers, where C is the preset number of clusters;
[0061] Calculate the membership degree of each pixel to each cluster according to the distance between each pixel and the clustering center;
[0062] Update the center position of each cluster according to the membership degree matrix;
[0063] Repeat the steps of calculating the membership degree matrix and updating the clustering center until the convergence condition is met;
[0064] After clustering is completed, each pixel will be assigned to a cluster, thereby obtaining clustering features.
[0065] In this embodiment, the fuzzy C-means clustering algorithm allows pixels to belong to multiple clusters with a certain membership degree by introducing the concept of membership degree, rather than the either-or situation in traditional hard clustering. This soft partitioning method is more in line with the continuity of pixel spectral characteristics in hyperspectral images, enhancing the flexibility and accuracy of feature extraction. By iteratively updating the membership degree matrix and cluster centers, the optimal solution is gradually approximated. This iterative process helps to reduce the influence of the initial cluster center selection on the final result and improve the stability and robustness of the clustering result. Hyperspectral images contain a large number of spectral bands, with high data dimensionality and complexity. The fuzzy C-means clustering algorithm effectively processes high-dimensional data and reduces the complexity of data processing by calculating the distance between pixels and cluster centers and updating the cluster centers based on these distances. After clustering, each pixel is assigned to a cluster, forming clustering features that reflect the spectral similarity of different ground objects or vegetation types in the image.
[0066] Preferably, the morphological operation preprocesses the hyperspectral image to obtain morphological features, specifically including:
[0067] Select multiple spectral bands of the hyperspectral image;
[0068] Apply the opening operation to each selected spectral band to obtain morphological features.
[0069] In this embodiment, the morphological operation can highlight the key structural information in the hyperspectral image, such as edges, contours, etc., by selecting multiple spectral bands of the hyperspectral image and applying the opening operation to each selected band. These structural information are crucial for subsequent image classification and recognition tasks. The opening operation can eliminate isolated points, noise, and small objects smaller than the structuring element in the image and smooth the boundaries of larger objects through a process of erosion followed by dilation. This property makes the opening operation very useful in the image preprocessing stage and helps to extract clear and accurate morphological features. The morphological operation emphasizes the spatial structure information of the image, which is particularly important for hyperspectral images. Hyperspectral images contain not only rich spectral information but also important spatial structure information. Through the morphological operation, the spatial structure information of the image can be further enhanced. As one of the important bases for image classification, the accuracy and robustness of morphological features directly affect the quality of the classification results. The morphological features extracted through the morphological operation can reflect the key structural information in the image, and these information are of great significance for distinguishing different types of ground objects or vegetation types. Therefore, this technical solution helps to improve the accuracy and robustness of image classification. Hyperspectral images contain a large number of spectral bands, with high data dimensionality and complexity. By extracting morphological features through the morphological operation, the complexity of data processing can be reduced to a certain extent because the morphological operation mainly focuses on the spatial structure information of the image and does not require complex processing and analysis of all spectral bands. This helps to speed up the data processing speed and improve the efficiency of the overall algorithm.
[0070] Preferably, the dimensionality reduction process in combination with principal component analysis specifically includes:
[0071] Calculate the covariance matrices of the clustering features and the morphological features respectively;
[0072] Calculate the eigenvalues and eigenvectors of the covariance matrices of the clustering features and the morphological features respectively;
[0073] According to the magnitudes of the eigenvalues, select the first K principal components, where K is the preset number of dimensions after dimensionality reduction;
[0074] Project the clustering features and the morphological features into the space composed of the selected principal components respectively to obtain the dimensionality-reduced clustering features and morphological features.
[0075] In this embodiment, through principal component analysis, the covariance matrices of the clustering features and morphological features are calculated respectively, and the first K principal components are selected based on the magnitudes of the eigenvalues, achieving data dimensionality reduction. This method effectively reduces data redundancy and complexity and alleviates the computational burden of subsequent processing. By selecting the first K principal components with the largest eigenvalues, it is ensured that the data after dimensionality reduction still retains most of the key information in the original data, and these principal components represent the main variation directions and structural features in the data. The clustering features and morphological features after dimensionality reduction are more concise and clear, facilitating the understanding of the key information and structural features in the data. The dimensionality reduction process reduces the dimensionality and complexity of the data, enabling subsequent classification algorithms to operate more efficiently. At the same time, the dimensionality-reduced features that retain key information contribute to improving the accuracy of classification. In the low-dimensional space, the classification algorithm can more easily find the internal relationships and boundaries between data, thereby achieving more accurate classification.
[0076] Preferably, the three-dimensional convolutional neural network is used to preliminarily classify the clustering features after dimensionality reduction to extract the spatial and spectral features of the hyperspectral image, which specifically includes:
[0077] Combining the clustering features after dimensionality reduction with the original spectral features to form a new four-dimensional input tensor;
[0078] Inputting the four-dimensional input tensor into the three-dimensional convolutional neural network for processing to obtain the spatial and spectral features of the hyperspectral image. Among them, the three-dimensional convolutional neural network includes an input layer, a first convolutional layer, a second convolutional layer, a fully connected layer, and an output layer. The input layer is used to receive the four-dimensional input tensor. The first convolutional layer includes a 3D convolutional kernel with a size of 3×3×3, a batch normalization layer, a ReLU activation function, and a first 3D max pooling layer. The second convolutional layer includes a 3D convolutional kernel with a size of 5×5×5, a batch normalization layer, a ReLU activation function, and a first 3D max pooling layer. The fully connected layer is used for feature integration and preliminary classification, and the output layer uses a softmax activation function to output classification probabilities.
[0079] In this embodiment, by combining the dimension-reduced clustering features with the original spectral features, a new four-dimensional input tensor is formed. This fusion strategy not only preserves the richness of the original spectral information but also utilizes the low-dimensional representation of the dimension-reduced features, which helps the 3D CNN capture complex information in hyperspectral images more effectively. The 3D CNN, through its unique three-dimensional convolutional kernel structure, can capture both the spatial (two-dimensional) and spectral (one-dimensional) features of the image simultaneously. The first convolutional layer uses a 3D convolutional kernel with a size of 3×3×3, which helps extract local spatial and spectral features in the image. The second convolutional layer then uses a larger 3D convolutional kernel with a size of 5×5×5, which can capture a wider range of spatial and spectral context information. This multi-level feature extraction strategy enables the 3D CNN to understand hyperspectral images more comprehensively. The introduction of the batch normalization layer and the ReLU activation function helps accelerate the convergence speed of the model and improve its generalization ability at the same time. The batch normalization layer reduces the internal covariate shift problem by normalizing each batch of data, making the model more stable. The ReLU activation function introduces non-linearity through non-linear transformation, enhancing the expressive power of the model. 3D max-pooling layers are respectively set after the first convolutional layer and the second convolutional layer. By downsampling operations, the dimension of the data is reduced, which helps reduce the risk of overfitting. At the same time, the max-pooling layer can also retain the key features in the image, making the model more robust to minor changes in the image. The fully connected layer, as a key part of feature integration and preliminary classification, globally integrates the features extracted by the convolutional layer and outputs the classification probability through the softmax activation function. This structure enables the model to preliminarily classify hyperspectral images based on the extracted features, providing strong support for subsequent classification tasks.
[0080] Preferably, processing the spatial and spectral features of the hyperspectral image through a graph attention network to capture the spatial relationships in the hyperspectral image specifically includes:
[0081] Represent the spatial and spectral features of the hyperspectral image as graph nodes and construct a graph structure according to the spatial position and spectral similarity;
[0082] Input the constructed graph structure and its node features into the graph attention network;
[0083] In the graph attention network, capture the spatial relationships between nodes through neighborhood aggregation operations to obtain the adjacent nodes of each node;
[0084] Use the attention mechanism to weight the features of the adjacent nodes to obtain the final spatial relationships in the hyperspectral image.
[0085] In this embodiment, a graph structure is constructed to represent the spatial and spectral features in the hyperspectral image, such that each node can represent a specific position or spectral feature in the image. Through the neighborhood aggregation operation, the graph attention network can capture the spatial relationships between nodes, thereby revealing the interconnections between different positions or features in the image; the attention mechanism is introduced to weight the features of adjacent nodes, enabling the network to dynamically adjust the importance of different node features. This mechanism helps to highlight key features and suppress redundant information, thereby enhancing the feature representation ability and robustness; compared with traditional methods such as convolutional neural networks, the graph attention network has higher computational efficiency when processing hyperspectral images because the graph structure can naturally represent the sparsity and locality in the image, enabling the network to process large-scale data more efficiently.
[0086] Preferably, the obtained morphological features are combined to optimize the spatial relationships in the hyperspectral image to obtain optimized spatial relationships, which specifically include:
[0087] Based on the extracted morphological features, a spatial relationship model in the hyperspectral image is constructed, where the nodes represent pixels or objects in the image, and the edges represent the spatial relationships between them;
[0088] The edge weights or node positions in the spatial relationship model are adjusted according to the morphological features to obtain an optimized spatial relationship model;
[0089] The optimized spatial relationships are extracted from the optimized spatial relationship model.
[0090] In this embodiment, a spatial relationship model in the hyperspectral image is constructed based on the extracted morphological features. As important structural information in the image, morphological features can reflect key structures such as edges and contours in the image. Therefore, the spatial relationship model constructed using morphological features can more accurately represent the spatial relationships between pixels or objects in the image; by adjusting the edge weights or node positions in the spatial relationship model according to the morphological features, an optimized spatial relationship model can be obtained. This optimization process can further refine the spatial relationships in the image, making the model more in line with the spatial distribution law in the actual image. The optimized spatial relationship model can more accurately reflect the spatial correlation and interaction between different pixels or objects in the image; by combining morphological features to optimize the spatial relationships, the robustness and generalization ability of the model can be enhanced. The optimized spatial relationship model can better adapt to image data under different scenarios and conditions, enabling the model to still maintain good performance when facing unknown or complex images.
[0091] A hyperspectral image classification system for agriculture, comprising:
[0092] A data preprocessing module, which is used to perform clustering processing on hyperspectral images using the fuzzy C-means clustering algorithm to obtain clustering features, extract morphological features through morphological operations, and perform dimensionality reduction processing on the clustering features and morphological features in combination with principal component analysis;
[0093] A preliminary classification module, connected to the output end of the data preprocessing module, which is used to perform preliminary classification on the dimensionality-reduced clustering features using a three-dimensional convolutional neural network, so as to extract the spatial features and spectral features of the hyperspectral image;
[0094] A spatial relationship capturing module, connected to the output end of the preliminary classification module, which is used to input the extracted spatial features and spectral features of the hyperspectral image into a graph attention network for processing to capture the spatial relationship in the hyperspectral image;
[0095] A classification result optimization module, connected to the output end of the spatial relationship capturing module, which is used to optimize the spatial relationship captured by the graph attention network in combination with the morphological features obtained from the data preprocessing module to obtain an optimized spatial relationship;
[0096] An output classification result module, connected to the output end of the classification result optimization module, which is used to output the final hyperspectral image classification result according to the optimized spatial relationship.
[0097] A computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any of the above-mentioned hyperspectral image classification methods for agriculture are implemented.
[0098] A computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned hyperspectral image classification methods for agriculture are implemented.
[0099] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A hyperspectral image classification method for agriculture, characterized in that, Including: Data preprocessing: The hyperspectral image is preprocessed using the fuzzy C-means clustering algorithm and morphological operations to obtain clustering features and morphological features, and dimensionality reduction is performed in combination with principal component analysis; Initial classification: A three-dimensional convolutional neural network is used to perform initial classification on the dimensionality-reduced clustering features to extract the spatial and spectral features of the hyperspectral image; Spatial relationship capture: The spatial and spectral features of the hyperspectral image are processed through a graph attention network to capture the spatial relationships in the hyperspectral image; Optimization of classification results: Combining the obtained morphological features, the spatial relationships in the hyperspectral image are optimized to obtain optimized spatial relationships; Output of classification results: According to the optimized spatial relationships, the final classification results of the hyperspectral image are output.
2. The hyperspectral image classification method for agriculture according to claim 1, wherein, The fuzzy C-means clustering algorithm preprocesses the hyperspectral image to obtain clustering features, specifically including: Randomly select C clustering centers, where C is a preset number of clusters; Calculate the membership degree of each pixel to each cluster according to the distance between each pixel and the clustering center; Update the center position of each cluster according to the membership degree matrix; Repeat the steps of calculating the membership degree matrix and updating the clustering centers until the convergence condition is met; After clustering is completed, each pixel will be assigned to a cluster, thereby obtaining clustering features.
3. A hyperspectral image classification method for agriculture according to claim 2, characterized in that, The morphological operations preprocess the hyperspectral image to obtain morphological features, specifically including: Select multiple spectral bands of the hyperspectral image; Apply the opening operation to each selected spectral band to obtain morphological features.
4. A hyperspectral image classification method for agriculture according to claim 3, characterized in that, The dimensionality reduction processing in combination with principal component analysis specifically includes: Calculate the covariance matrices of the clustering features and morphological features respectively; Calculate the eigenvalues and eigenvectors of the covariance matrices of the clustering features and morphological features respectively; According to the magnitudes of the eigenvalues, select the first K principal components, where K is the preset number of dimensions after dimensionality reduction; Project the clustering features and morphological features into the space composed of the selected principal components respectively to obtain the dimensionality-reduced clustering features and morphological features.
5. A hyperspectral image classification method for agriculture according to claim 4, characterized in that, The use of a three-dimensional convolutional neural network to perform initial classification on the dimensionality-reduced clustering features to extract the spatial and spectral features of the hyperspectral image specifically includes: Combine the dimensionality-reduced clustering features with the original spectral features to form a new four-dimensional input tensor; Input the four-dimensional input tensor into a three-dimensional convolutional neural network for processing to obtain the spatial and spectral features of the hyperspectral image. Among them, the three-dimensional convolutional neural network includes an input layer, a first convolutional layer, a second convolutional layer, a fully connected layer, and an output layer. The input layer is used to receive the four-dimensional input tensor. The first convolutional layer includes a 3D convolutional kernel with a size of 3×3×3, a batch normalization layer, a ReLU activation function, and a first 3D max pooling. The second convolutional layer includes a 3D convolutional kernel with a size of 5×5×5, a batch normalization layer, a ReLU activation function, and a first 3D max pooling. The fully connected layer is used for feature integration and initial classification, and the output layer uses the softmax activation function to output classification probabilities.
6. The hyperspectral image classification method for agriculture according to claim 5, wherein The processing of the spatial and spectral features of the hyperspectral image through a graph attention network to capture the spatial relationships in the hyperspectral image specifically includes: Represent the spatial and spectral features of the hyperspectral image as graph nodes, and construct a graph structure according to the spatial position and spectral similarity; Input the constructed graph structure and its node features into the graph attention network; In the graph attention network, capture the spatial relationship between nodes through neighborhood aggregation operation to obtain the adjacent nodes of each node; Use the attention mechanism to weight the features of the adjacent nodes to obtain the spatial relationship in the final hyperspectral image.
7. A hyperspectral image classification method for agriculture according to claim 6, characterized in that, Combined with the obtained morphological features, optimize the spatial relationship in the hyperspectral image to obtain the optimized spatial relationship, specifically including: Based on the extracted morphological features, construct a spatial relationship model in the hyperspectral image, where the nodes represent pixels or objects in the image, and the edges represent the spatial relationship between them; Adjust the edge weights or node positions in the spatial relationship model according to the morphological features to obtain an optimized spatial relationship model; Extract the optimized spatial relationship from the optimized spatial relationship model.
8. A hyperspectral image classification system for agriculture, characterized in that, Include: A data preprocessing module, which is used to perform clustering processing on the hyperspectral image using the fuzzy C-means clustering algorithm to obtain clustering features, extract morphological features through morphological operations, and perform dimensionality reduction processing on the clustering features and morphological features in combination with principal component analysis; A preliminary classification module, connected to the output end of the data preprocessing module, which is used to perform preliminary classification on the dimensionality-reduced clustering features using a three-dimensional convolutional neural network, so as to extract the spatial features and spectral features of the hyperspectral image; A spatial relationship capture module, connected to the output end of the preliminary classification module, which is used to input the extracted spatial features and spectral features of the hyperspectral image into the graph attention network for processing to capture the spatial relationship in the hyperspectral image; A classification result optimization module, connected to the output end of the spatial relationship capture module, which is used to combine the morphological features obtained from the data preprocessing module to optimize the spatial relationship captured by the graph attention network to obtain an optimized spatial relationship; An output classification result module, connected to the output end of the classification result optimization module, which is used to output the final hyperspectral image classification result according to the optimized spatial relationship.
9. A computing device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the hyperspectral image classification method for agriculture according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the storage medium. When the computer program is executed by the processor, it implements the steps of the hyperspectral image classification method for agriculture according to any one of claims 1-7.