Hyperspectral image classification method, device, equipment and storage medium
By obtaining the spectral and spatial features of hyperspectral remote sensing images for feature fusion compensation, the problem of spectral and spatial information separation is solved, the accuracy of hyperspectral image classification is improved, and the simultaneous identification and classification of large and small scale objects is achieved.
Patent Information
- Application Number
- CN202111341226.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-11-12
AI Technical Summary
In existing hyperspectral image classification methods, the separation of spectral and spatial information is irrelevant, resulting in poor integrity and structure, and the lack of multi-scale spatial information, resulting in low classification accuracy.
By acquiring the spectral features and spatial features of hyperspectral remote sensing images, candidate spectral vectors and multi-scale features are constructed, feature fusion compensation is performed, and spectral-spatial joint features are obtained for image classification.
Effectively mine rich spectral features, enhance spectral spatial information correlation, improve classification performance, achieve simultaneous identification of large-scale and small-scale ground objects, maintain the continuity of ground objects, reduce over-smoothing phenomena, and improve the accuracy of ground object identification and classification.
Smart Images

Figure CN114120033B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a hyperspectral image classification method, device, equipment and storage medium. Background Art
[0002] The vigorous development of deep learning theory has made great successes in computer vision, biomedicine and text detection. Therefore, it has also been introduced into the field of hyperspectral image classification. In recent years, hyperspectral remote sensing image classification methods based on deep learning have emerged in an endless stream. However, due to the very complex data characteristics of hyperspectral images, the field of hyperspectral image classification is also facing the following challenges: The first challenge exists in the process of spectral spatial feature extraction; Generally speaking, there are two existing spectral spatial joint extraction methods. One is to design two completely independent branch networks for spectral and spatial feature extraction respectively, which means that the spectral domain and spatial domain of hyperspectral images are completely independent. Obviously, this type of method divides the spectral and spatial information into two unrelated parts, which does not conform to the integrity and structure of the hyperspectral image data cube. In order to better match the hyperspectral image data cube, the second method based on three-dimensional convolutional neural network has emerged in large numbers, but due to the three-dimensional Convolution extracts spectral features and spatial features indiscriminately, which often results in the spectral information extraction process being in a weak position. The rich spectral information in the image is not fully utilized, and the features learned by the network are also coarser and more smoothed. The second challenge is the lack of multi-scale spatial information. Generally, the deeper the neural network, the richer and more abstract the extracted features; therefore, many methods are committed to deepening the network to obtain detailed features. However, in this process, the common global features are ignored, resulting in a serious lack of multi-scale features, which means that large-scale objects (such as vegetation, farmland, etc.) and small-scale objects (such as roads, rivers, etc.) are difficult to identify at the same time, resulting in low classification accuracy. The third challenge is the inequality between spectral feature extraction and spatial feature extraction. In the process of feature extraction, spatial features always take precedence, which makes spectral features ignored to a certain extent, causing misclassification of small-scale targets and excessive salt and pepper noise. Summary of the invention
[0003] The main purpose of the present invention is to provide a hyperspectral image classification method, device, equipment and storage medium, aiming to solve the technical problems in the prior art that the spectral and spatial information separation layers are two unrelated parts, the integrity and structure are poor, and the hyperspectral image classification accuracy is low due to the lack of multi-scale spatial information.
[0004] In a first aspect, the present invention provides a hyperspectral image classification method, the hyperspectral image classification method comprising the following steps:
[0005] Obtain the spectral and spatial characteristics of the original hyperspectral remote sensing image;
[0006] Obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature;
[0007] The original hyperspectral remote sensing image is classified according to the spectral-spatial joint features to obtain an image classification result.
[0008] Optionally, the acquiring of spectral features and spatial features of the original hyperspectral remote sensing image includes:
[0009] Get the ground truth object distribution label map, get the number of principal components, and extract the length and width parameters of the image block;
[0010] Extracting a spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and using the spectral vector as a spectral feature;
[0011] The original hyperspectral remote sensing image is subjected to dimensionality reduction processing according to the number of principal components and the length-width parameters to obtain spatial features.
[0012] Optionally, performing dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features includes:
[0013] Using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components, to obtain image data after dimensionality reduction;
[0014] Each image block corresponding to each pixel is obtained according to the length and width parameters by taking each pixel in the image data after dimensionality reduction as the center, and each image block is used as a spatial feature.
[0015] Optionally, the using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components to obtain image data after dimensionality reduction includes:
[0016] Obtaining a covariance matrix of the original hyperspectral remote sensing image, performing singular value decomposition on the covariance matrix according to the number of principal components, and obtaining matrix eigenvalues and corresponding matrix eigenvectors;
[0017] Sorting the matrix eigenvalues in descending order, and adjusting the matrix eigenvectors in corresponding order;
[0018] A target matrix is formed according to the sorted eigenvectors, and image data after dimensionality reduction is generated according to the target matrix and the original hyperspectral remote sensing image.
[0019] Optionally, obtaining a candidate spectral vector according to the spectral feature, obtaining a multi-scale feature according to the spatial feature, and performing feature fusion compensation on the candidate spectral vector and the multi-scale feature to obtain a spectral-spatial joint feature includes:
[0020] Constructing corresponding spectral training samples according to the spectral features, and inputting the spectral training samples into a plurality of different long short-term memory networks to obtain candidate spectral vectors;
[0021] Constructing corresponding spatial training samples according to the spatial features, and inputting the spatial training samples into a multi-branch network to obtain multi-scale features;
[0022] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature, and spectral information compensation is performed again to obtain a spectral-spatial joint feature.
[0023] Optionally, the step of sending the candidate spectral vector to a multi-branch network to perform spectral information compensation, fusing the compensated candidate spectral vector with the multi-scale feature, and performing spectral information compensation again to obtain a spectral-spatial joint feature includes:
[0024] Obtaining a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function;
[0025] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature according to the total loss function, spectral information compensation is performed again to obtain spectral-spatial joint features.
[0026] Optionally, the acquiring a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function comprises:
[0027] Obtain a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determine a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function by the following formula:
[0028]
[0029]
[0030] Among them, L is the total loss function, L joint is the joint main loss function, Lspectral is the spectral-assisted loss function, L spatial is the spatial auxiliary loss function, is the result label of the spectral-spatial joint prediction of the i-th training pixel, is the result label predicted by the ith training pixel using only spectral information, is the result label of the i-th training pixel predicted using only spatial information, y i is the true label, and M is the total number of pixels in the training set.
[0031] In a second aspect, to achieve the above-mentioned purpose, the present invention further proposes a hyperspectral image classification device, the hyperspectral image classification device comprising:
[0032] A feature acquisition module is used to obtain the spectral features and spatial features of the original hyperspectral remote sensing image;
[0033] A compensation module, used to obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature;
[0034] The classification module is used to classify the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain an image classification result.
[0035] In a third aspect, to achieve the above-mentioned purpose, the present invention further proposes a hyperspectral image classification device, comprising: a memory, a processor, and a hyperspectral image classification program stored in the memory and executable on the processor, wherein the hyperspectral image classification program is configured to implement the steps of the hyperspectral image classification method described above.
[0036] In a fourth aspect, to achieve the above objective, the present invention further proposes a storage medium, on which a hyperspectral image classification program is stored, and when the hyperspectral image classification program is executed by a processor, the steps of the hyperspectral image classification method described above are implemented.
[0037] The hyperspectral image classification method proposed in the present invention obtains the spectral features and spatial features of the original hyperspectral remote sensing image; obtains candidate spectral vectors according to the spectral features, obtains multi-scale features according to the spatial features, performs feature fusion compensation on the candidate spectral vectors and the multi-scale features, and obtains spectral-spatial joint features; classifies the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain image classification results; can effectively mine rich spectral features, improve classification performance by enhancing the correlation of spectral-spatial information, take into account the global spatial distribution of the image without losing detail information, can realize the simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in the hyperspectral remote sensing image, maintain the continuity of internal objects, reduce over-smoothing, balance the contributions of the spectral domain and the spatial domain, and thus realize higher-precision object recognition and classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0039] Figure 2 It is a schematic diagram of the process of the first embodiment of the hyperspectral image classification method of the present invention;
[0040] Figure 3 It is a flow chart of the second embodiment of the hyperspectral image classification method of the present invention;
[0041] Figure 4 It is a schematic diagram of the process of the third embodiment of the hyperspectral image classification method of the present invention;
[0042] Figure 5 This is a flow chart of a fourth embodiment of a hyperspectral image classification method according to the present invention;
[0043] Figure 6 It is a schematic diagram of the process of the fifth embodiment of the hyperspectral image classification method of the present invention;
[0044] Figure 7 This is a functional module diagram of the first embodiment of the hyperspectral image classification device of the present invention.
[0045] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] 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.
[0047] The solution of the embodiment of the present invention is mainly: by obtaining the spectral features and spatial features of the original hyperspectral remote sensing image; obtaining a candidate spectral vector according to the spectral features, obtaining a multi-scale feature according to the spatial features, performing feature fusion compensation on the candidate spectral vector and the multi-scale feature to obtain a spectral-spatial joint feature; classifying the original hyperspectral remote sensing image according to the spectral-spatial joint feature to obtain an image classification result; it can effectively mine rich spectral features, improve the classification performance by enhancing the correlation of spectral-spatial information, take into account the global spatial distribution of the image without losing detail information, and can achieve the simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in the hyperspectral remote sensing image, maintain the continuity of internal objects, reduce over-smoothing, balance the contribution of the spectral domain and the spatial domain, thereby achieving higher-precision object recognition and classification, and solving the technical problem in the prior art that the spectral and spatial information are separated into two unrelated parts, the integrity and structure are poor, and the classification accuracy of the hyperspectral image is low due to the lack of multi-scale spatial information.
[0048] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0049] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (Non-Volatile Memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0050] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0051] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a hyperspectral image classification program.
[0052] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and performs the following operations:
[0053] Obtain the spectral and spatial characteristics of the original hyperspectral remote sensing image;
[0054] Obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature;
[0055] The original hyperspectral remote sensing image is classified according to the spectral-spatial joint features to obtain an image classification result.
[0056] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0057] Get the ground truth object distribution label map, get the number of principal components, and extract the length and width parameters of the image block;
[0058] Extracting a spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and using the spectral vector as a spectral feature;
[0059] The original hyperspectral remote sensing image is subjected to dimensionality reduction processing according to the number of principal components and the length-width parameters to obtain spatial features.
[0060] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0061] Using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components, to obtain image data after dimensionality reduction;
[0062] Each image block corresponding to each pixel is obtained according to the length and width parameters by taking each pixel in the image data after dimensionality reduction as the center, and each image block is used as a spatial feature.
[0063] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0064] Obtaining a covariance matrix of the original hyperspectral remote sensing image, performing singular value decomposition on the covariance matrix according to the number of principal components, and obtaining matrix eigenvalues and corresponding matrix eigenvectors;
[0065] Sorting the matrix eigenvalues in descending order, and adjusting the matrix eigenvectors in corresponding order;
[0066] A target matrix is formed according to the sorted eigenvectors, and image data after dimensionality reduction is generated according to the target matrix and the original hyperspectral remote sensing image.
[0067] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0068] Constructing corresponding spectral training samples according to the spectral features, and inputting the spectral training samples into a plurality of different long short-term memory networks to obtain candidate spectral vectors;
[0069] Constructing corresponding spatial training samples according to the spatial features, and inputting the spatial training samples into a multi-branch network to obtain multi-scale features;
[0070] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature, and spectral information compensation is performed again to obtain a spectral-spatial joint feature.
[0071] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0072] Obtaining a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function;
[0073] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature according to the total loss function, spectral information compensation is performed again to obtain spectral-spatial joint features.
[0074] The device of the present invention calls the hyperspectral image classification program stored in the memory 1005 through the processor 1001, and also performs the following operations:
[0075] Obtain a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determine a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function by the following formula:
[0076]
[0077] Among them, L is the total loss function, L joint is the joint main loss function, L spectral is the spectral-assisted loss function, L spatial is the spatial auxiliary loss function, is the result label of the spectral-spatial joint prediction of the i-th training pixel, is the result label predicted by the ith training pixel using only spectral information, is the result label of the i-th training pixel predicted using only spatial information, y i is the true label, and M is the total number of pixels in the training set.
[0078] Through the above scheme, this embodiment obtains the spectral features and spatial features of the original hyperspectral remote sensing image; obtains candidate spectral vectors according to the spectral features, obtains multi-scale features according to the spatial features, performs feature fusion compensation on the candidate spectral vectors and the multi-scale features, and obtains spectral-spatial joint features; classifies the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain image classification results; can effectively mine rich spectral features, improve classification performance by enhancing the correlation of spectral-spatial information, take into account the global spatial distribution of the image without losing detail information, and can achieve simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in hyperspectral remote sensing images, maintain internal object continuity, reduce over-smoothing, and balance the contributions of spectral domain and spatial domain, thereby achieving higher-precision object recognition and classification.
[0079] Based on the above hardware structure, an embodiment of the hyperspectral image classification method of the present invention is proposed.
[0080] Reference Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the hyperspectral image classification method of the present invention.
[0081] In a first embodiment, the hyperspectral image classification method comprises the following steps:
[0082] Step S10: Acquire the spectral characteristics and spatial characteristics of the original hyperspectral remote sensing image.
[0083] It should be noted that the spectral features are complete spectral features of each pixel extracted from the original hyperspectral remote sensing image, and the spatial features are spatial features of each pixel extracted from the original hyperspectral remote sensing image.
[0084] Step S20: obtaining a candidate spectral vector according to the spectral feature, obtaining a multi-scale feature according to the spatial feature, performing feature fusion compensation on the candidate spectral vector and the multi-scale feature to obtain a spectral-spatial joint feature.
[0085] It can be understood that by training the spectral features, candidate spectral vectors can be obtained, and by training the spatial features, multi-scale features can be obtained. The candidate spectral vectors and the multi-scale features are fused and spectral information is compensated to obtain the joint features of spectral features and spatial features.
[0086] Step S30: classify the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain an image classification result.
[0087] It should be understood that the original hyperspectral remote sensing image can be classified by the spectral-spatial joint feature, thereby obtaining the classification of the entire hyperspectral image.
[0088] Furthermore, the step S30 specifically includes the following steps:
[0089] The spectral-spatial joint features are sent to a Softmax classifier to obtain an image classification result corresponding to the original hyperspectral remote sensing image.
[0090] It can be understood that after obtaining the spectral-spatial joint features, the joint features can be sent to the Softmax classifier for classification, and then the pixels of the hyperspectral image data can be classified for the entire image to obtain the image classification results.
[0091] Through the above scheme, this embodiment obtains the spectral features and spatial features of the original hyperspectral remote sensing image; obtains candidate spectral vectors according to the spectral features, obtains multi-scale features according to the spatial features, performs feature fusion compensation on the candidate spectral vectors and the multi-scale features, and obtains spectral-spatial joint features; classifies the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain image classification results; can effectively mine rich spectral features, improve classification performance by enhancing the correlation of spectral-spatial information, take into account the global spatial distribution of the image without losing detail information, and can achieve simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in hyperspectral remote sensing images, maintain internal object continuity, reduce over-smoothing, and balance the contributions of spectral domain and spatial domain, thereby achieving higher-precision object recognition and classification.
[0092] Further, Figure 3 FIG. 1 is a flow chart of a second embodiment of the hyperspectral image classification method of the present invention. Figure 3 As shown, a second embodiment of the hyperspectral image classification method of the present invention is proposed based on the first embodiment. In this embodiment, the step S10 specifically includes the following steps:
[0093] Step S11, obtaining a ground truth object distribution label map, obtaining the number of principal components, and extracting length and width parameters of the image block.
[0094] It should be noted that the ground truth object distribution label map is the distribution of large-scale ground truth objects corresponding to the hyperspectral image and the label map of related objects, the number of principal components is the value of the principal component of the hyperspectral image pre-set by the technician, and the length and width parameters are the length and width values of the image block used to extract the hyperspectral image.
[0095] In a specific implementation, the length and width of the extracted image block need to be consistent. The value ranges of the number of principal components and the length and width of the image block can be preferably 5-7, 40-45, 40-45, respectively. Of course, they can also be other values, such as 5-10, 20-50, 20-60, etc. The corresponding units can be mm or cm, etc. The corresponding length and width values are related to the actual size of the hyperspectral image, and this embodiment does not limit this.
[0096] Step S12: extracting a spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and using the spectral vector as a spectral feature.
[0097] It can be understood that the length and width parameters can be used to extract the spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image, and then the complete spectral vector can be extracted as the spectral feature.
[0098] Step S13: performing dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features.
[0099] It should be understood that the original hyperspectral remote sensing image can be processed for dimensionality reduction through the number of principal components and the length-width parameters, that is, the data corresponding to the original hyperspectral remote sensing image can be converted from high dimension to low dimension, so as to obtain spatial features.
[0100] Through the above scheme, this embodiment obtains the number of principal components and extracts the length and width parameters of the image block by obtaining the ground real object distribution label map; extracts the spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and uses the spectral vector as the spectral feature; performs dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features; can extract spectral features and spatial features, effectively mine rich spectral features, and further improve the precision and accuracy of hyperspectral image classification.
[0101] Further, Figure 4 FIG. 4 is a flow chart of a third embodiment of the hyperspectral image classification method of the present invention. Figure 4As shown, a third embodiment of the hyperspectral image classification method of the present invention is proposed based on the second embodiment. In this embodiment, the step S13 specifically includes the following steps:
[0102] Step S131: using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components to obtain image data after dimensionality reduction.
[0103] It should be noted that the principal component analysis (PCA) algorithm can be used to reduce the dimension of the hyperspectral image data according to the number of principal components; the hyperspectral data corresponding to the original hyperspectral remote sensing image is processed by the PCA algorithm for dimension reduction and then sent to the multi-branch network (MBN).
[0104] It can be understood that the PCA algorithm finds some orthogonal projection directions so that the variance of the data is maximized after projection in these directions. Therefore, as a common dimensionality reduction method, the PCA method can convert data from high dimensions to low dimensions with less "information" loss, thereby reducing redundancy. After dimensionality reduction processing by the PCA algorithm, the reduced dimensionality image data can be obtained.
[0105] Step S132: taking each pixel in the image data after dimensionality reduction as the center and obtaining each image block corresponding to each pixel according to the length and width parameters, and using each image block as a spatial feature.
[0106] It can be understood that by taking each pixel in the reduced-dimensional image data as the center, according to the pre-set length and width values of the extracted image block, the image block of the corresponding size in the neighborhood of the pixel can be taken as the spatial feature, thereby serving as the feature sample for the subsequent input network model.
[0107] Through the above scheme, this embodiment uses the principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components to obtain image data after dimensionality reduction; by taking each pixel in the image data after dimensionality reduction as the center and obtaining each image block corresponding to each pixel according to the length and width parameters, each image block is used as a spatial feature, and each image block can be extracted in detail and accurately as a spatial feature, thereby further improving the precision and accuracy of hyperspectral image classification, and improving the efficiency and speed of hyperspectral image classification.
[0108] Further, Figure 5 FIG. 4 is a flow chart of a fourth embodiment of the hyperspectral image classification method of the present invention. Figure 5 As shown, a fourth embodiment of the hyperspectral image classification method of the present invention is proposed based on the third embodiment. In this embodiment, the step S131 specifically includes the following steps:
[0109] Step S1311, obtaining the covariance matrix of the original hyperspectral remote sensing image, performing singular value decomposition on the covariance matrix according to the number of principal components, and obtaining matrix eigenvalues and corresponding matrix eigenvectors.
[0110] It should be noted that the hyperspectral remote sensing image is denoted by X∈R m*n , where n is the total number of spectral features, m is the total number of image pixels, and R represents the real number domain. The covariance matrix C of the image X is calculated. The singular value decomposition operation is performed on the covariance matrix C to obtain the eigenvalues of the matrix C and the corresponding matrix eigenvectors.
[0111] Step S1312: sort the matrix eigenvalues in descending order, and adjust the matrix eigenvectors in corresponding order.
[0112] It can be understood that the matrix eigenvalues are arranged in descending order, and the corresponding eigenvectors are also arranged and adjusted according to the order of the eigenvalues.
[0113] Step S1313: forming a target matrix according to the sorted eigenvectors, and generating image data after dimensionality reduction according to the target matrix and the original hyperspectral remote sensing image.
[0114] It should be understood that the target matrix is formed according to the sorted eigenvectors, for example, the first p eigenvectors u1, u2…u p Take out and form the matrix U = [u1, u2, ... u p ]∈R n*p ; Then, the reduced-dimensional image data can be generated according to the target matrix and the original hyperspectral remote sensing image, that is, the reduced-dimensional image data can be obtained by calculating using the formula Z=XU.
[0115] Through the above scheme, this embodiment obtains the covariance matrix of the original hyperspectral remote sensing image, performs singular value decomposition on the covariance matrix according to the number of principal components, obtains matrix eigenvalues and corresponding matrix eigenvectors; sorts the matrix eigenvalues in descending order, and performs corresponding sorting adjustment on the matrix eigenvectors; forms a target matrix according to the sorted eigenvectors, generates reduced-dimensional image data according to the target matrix and the original hyperspectral remote sensing image, and can obtain reduced-dimensional image data, thereby further improving the precision and accuracy of hyperspectral image classification and improving the efficiency and speed of hyperspectral image classification.
[0116] Further, Figure 6 FIG. 5 is a flow chart of a fifth embodiment of the hyperspectral image classification method of the present invention. Figure 6As shown, a fifth embodiment of the hyperspectral image classification method of the present invention is proposed based on the first embodiment. In this embodiment, the step S20 specifically includes the following steps:
[0117] Step S21: construct corresponding spectral training samples according to the spectral features, and input the spectral training samples into a plurality of different long short-term memory networks to obtain candidate spectral vectors.
[0118] It should be noted that, corresponding spectral training samples are constructed according to the spectral features, and the spectral training samples are input into a plurality of different long short-term memory (LSTM) networks to obtain candidate spectral vectors.
[0119] Furthermore, assuming that n is the number of hidden units of the kth LSTM network, its calculation method is as follows: n=128+32*(k-1). The number of hidden units n is proportional to the ordinal number k of the LSTM network. The larger the ordinal value k of the LSTM network, the more hidden units there are, and the extracted spectral features are more abstract and robust.
[0120] Step S22: construct corresponding spatial training samples according to the spatial features, and input the spatial training samples into a multi-branch network to obtain multi-scale features.
[0121] It can be understood that the corresponding spatial training samples are constructed through the spatial features, that is, the image blocks corresponding to the spatial training samples are input into the MBN network to obtain multi-scale features.
[0122] In a specific implementation, technicians in this field can set the number of candidate spectral vectors to be generated according to the number of branches of the MBN network; the LSTM network alleviates the long-term dependency learning problem through a gate mechanism, and removes or adds information to the cell state through a carefully designed gate structure; in the LSTM, there are three gates to control the cell state: a forget gate, an input gate, and an output gate, thereby capturing long-distance spectral features.
[0123] Step S23: sending the candidate spectral vector to a multi-branch network to perform spectral information compensation, fusing the compensated candidate spectral vector with the multi-scale feature, performing spectral information compensation again, and obtaining a spectral-spatial joint feature.
[0124] It should be understood that the candidate spectral vector is sent into the multi-branch network MBN, and then the candidate spectral vector can be sent into the MBN network accordingly to perform the first stage of spectral information compensation, and the subsequent spectral vectors participating in the compensation are fused, and the features extracted by the MBN network are fused at the same time, and then the above two types of fused features are combined to perform the second stage of spectral information compensation to obtain the spectral space joint feature, and the joint feature is sent to the Softmax classifier for classification. In actual operation, the number of branches of the MBN network can be in the range of [4, 6] to ensure better model effect.
[0125] In the specific implementation, the addition operation is adopted in the first stage of spectral information compensation; on the one hand, the addition operation allows the superposition of spectral information and spatial information, thereby increasing the amount of information used to describe the hyperspectral image; on the other hand, the addition operation allows the spectral features to be mixed with the spatial features, so that new features are generated under the guidance of the spectral features; the concatenation operation is adopted in the second stage of spectral information compensation; the concatenation operation splices all the original features so that they can be fully utilized in subsequent network learning; in addition, it allows the network to automatically learn how to integrate features; therefore, the concatenation operation is more suitable for strengthening the combination of spectral features and spatial features; in the second stage, through multiple concatenation operations, the spectral features can be further compensated, which is helpful to determine the category to which the features belong. When performing spectral information compensation, only compensating the spectral features after the third pooling layer can provide better performance.
[0126] Furthermore, the step S23 specifically includes the following steps:
[0127] Obtaining a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function;
[0128] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature according to the total loss function, spectral information compensation is performed again to obtain spectral-spatial joint features.
[0129] It can be understood that the total loss function can be determined by the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function, and then compensation is performed to solve the problem of imbalance between spectral feature extraction and spatial feature extraction.
[0130] Further, the obtaining of the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function, and determining the total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function, includes:
[0131] Obtain a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determine a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function by the following formula:
[0132]
[0133] Among them, L is the total loss function, L joint is the joint main loss function, L spectral is the spectral-assisted loss function, L spatial is the spatial auxiliary loss function, is the result label of the spectral-spatial joint prediction of the i-th training pixel, is the result label predicted by the ith training pixel using only spectral information, is the result label of the i-th training pixel predicted using only spatial information, y i is the true label, and M is the total number of pixels in the training set.
[0134] It can be understood that the total loss function can be obtained through the above formula, so as to perform back propagation.
[0135] Through the above scheme, this embodiment constructs corresponding spectral training samples according to the spectral features, inputs the spectral training samples into multiple different long short-term memory networks, and obtains candidate spectral vectors; constructs corresponding spatial training samples according to the spatial features, inputs the spatial training samples into a multi-branch network, and obtains multi-scale features; sends the candidate spectral vectors into the multi-branch network, performs spectral information compensation, fuses the compensated candidate spectral vectors with the multi-scale features, and performs spectral information compensation again to obtain spectral-spatial joint features, which can realize the simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in hyperspectral remote sensing images, maintain the continuity of internal objects, reduce over-smoothing, and balance the contributions of spectral domain and spatial domain, thereby achieving higher-precision object recognition and classification.
[0136] Accordingly, the present invention further provides a hyperspectral image classification device.
[0137] Reference Figure 7 , Figure 7 This is a functional module diagram of the first embodiment of the hyperspectral image classification device of the present invention.
[0138] In a first embodiment of the hyperspectral image classification device of the present invention, the hyperspectral image classification device comprises:
[0139] The feature acquisition module 10 is used to acquire the spectral features and spatial features of the original hyperspectral remote sensing image.
[0140] The compensation module 20 is used to obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature.
[0141] The classification module 30 is used to classify the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain an image classification result.
[0142] The steps implemented by the functional modules of the hyperspectral image classification device may refer to the various embodiments of the hyperspectral image classification method of the present invention, and will not be described in detail here.
[0143] In addition, an embodiment of the present invention further provides a storage medium, on which a hyperspectral image classification program is stored. When the hyperspectral image classification program is executed by a processor, the following operations are implemented:
[0144] Obtain the spectral and spatial characteristics of the original hyperspectral remote sensing image;
[0145] Obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature;
[0146] The original hyperspectral remote sensing image is classified according to the spectral-spatial joint features to obtain an image classification result.
[0147] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0148] Get the ground truth object distribution label map, get the number of principal components, and extract the length and width parameters of the image block;
[0149] Extracting a spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and using the spectral vector as a spectral feature;
[0150] The original hyperspectral remote sensing image is subjected to dimensionality reduction processing according to the number of principal components and the length-width parameters to obtain spatial features.
[0151] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0152] Using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components, to obtain image data after dimensionality reduction;
[0153] Each image block corresponding to each pixel is obtained according to the length and width parameters by taking each pixel in the image data after dimensionality reduction as the center, and each image block is used as a spatial feature.
[0154] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0155] Obtaining a covariance matrix of the original hyperspectral remote sensing image, performing singular value decomposition on the covariance matrix according to the number of principal components, and obtaining matrix eigenvalues and corresponding matrix eigenvectors;
[0156] Sorting the matrix eigenvalues in descending order, and adjusting the matrix eigenvectors in corresponding order;
[0157] A target matrix is formed according to the sorted eigenvectors, and image data after dimensionality reduction is generated according to the target matrix and the original hyperspectral remote sensing image.
[0158] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0159] Constructing corresponding spectral training samples according to the spectral features, and inputting the spectral training samples into a plurality of different long short-term memory networks to obtain candidate spectral vectors;
[0160] Constructing corresponding spatial training samples according to the spatial features, and inputting the spatial training samples into a multi-branch network to obtain multi-scale features;
[0161] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature, and spectral information compensation is performed again to obtain a spectral-spatial joint feature.
[0162] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0163] Obtaining a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function;
[0164] The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature according to the total loss function, spectral information compensation is performed again to obtain spectral-spatial joint features.
[0165] Furthermore, when the hyperspectral image classification program is executed by the processor, the following operations are also implemented:
[0166] Obtain a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determine a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function by the following formula:
[0167]
[0168] Among them, L is the total loss function, L joint is the joint main loss function, L spectral is the spectral-assisted loss function, L spatial is the spatial auxiliary loss function, is the result label of the spectral-spatial joint prediction of the i-th training pixel, is the result label predicted by the ith training pixel using only spectral information, is the result label of the i-th training pixel predicted using only spatial information, y i is the true label, and M is the total number of pixels in the training set.
[0169] Through the above scheme, this embodiment obtains the spectral features and spatial features of the original hyperspectral remote sensing image; obtains candidate spectral vectors according to the spectral features, obtains multi-scale features according to the spatial features, performs feature fusion compensation on the candidate spectral vectors and the multi-scale features, and obtains spectral-spatial joint features; classifies the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain image classification results; can effectively mine rich spectral features, improve classification performance by enhancing the correlation of spectral-spatial information, take into account the global spatial distribution of the image without losing detail information, and can achieve simultaneous extraction of large-scale objects with a wide coverage range and small-scale objects with narrow and subtle shapes in hyperspectral remote sensing images, maintain internal object continuity, reduce over-smoothing, and balance the contributions of spectral domain and spatial domain, thereby achieving higher-precision object recognition and classification.
[0170] 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 system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0171] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0172] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A hyperspectral image classification method, characterized in that: The hyperspectral image classification method comprises: Obtain the spectral and spatial characteristics of the original hyperspectral remote sensing image; Obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature; Classifying the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain an image classification result; Wherein, the spectral characteristics and spatial characteristics of the original hyperspectral remote sensing image are obtained, including: Get the ground truth object distribution label map, get the number of principal components, and extract the length and width parameters of the image block; Extracting a spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and using the spectral vector as a spectral feature; Performing dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features; The step of performing dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features includes: Using a principal component analysis algorithm to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components, to obtain image data after dimensionality reduction; By taking each pixel in the image data after dimensionality reduction as the center and according to the length and width parameters, each image block corresponding to each pixel is obtained, and each image block is used as a spatial feature; The step of performing dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components using a principal component analysis algorithm to obtain image data after dimensionality reduction includes: Obtaining a covariance matrix of the original hyperspectral remote sensing image, performing singular value decomposition on the covariance matrix according to the number of principal components, and obtaining matrix eigenvalues and corresponding matrix eigenvectors; Sorting the matrix eigenvalues in descending order, and adjusting the matrix eigenvectors in corresponding order; Forming a target matrix according to the sorted eigenvectors, and generating image data after dimensionality reduction according to the target matrix and the original hyperspectral remote sensing image; The step of obtaining a candidate spectral vector according to the spectral feature, obtaining a multi-scale feature according to the spatial feature, and performing feature fusion compensation on the candidate spectral vector and the multi-scale feature to obtain a spectral-spatial joint feature includes: Constructing corresponding spectral training samples according to the spectral features, and inputting the spectral training samples into a plurality of different long short-term memory networks to obtain candidate spectral vectors; Constructing corresponding spatial training samples according to the spatial features, and inputting the spatial training samples into a multi-branch network to obtain multi-scale features; The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature, and spectral information compensation is performed again to obtain a spectral-spatial joint feature.
2. The hyperspectral image classification method according to claim 1, characterized in that: The step of sending the candidate spectral vector into a multi-branch network to perform spectral information compensation, fusing the compensated candidate spectral vector with the multi-scale feature, and performing spectral information compensation again to obtain a spectral-spatial joint feature includes: Obtaining a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function; The candidate spectral vector is sent to a multi-branch network to perform spectral information compensation, the compensated candidate spectral vector is fused with the multi-scale feature according to the total loss function, spectral information compensation is performed again to obtain spectral-spatial joint features.
3. The hyperspectral image classification method according to claim 2, characterized in that: The obtaining of a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determining a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function, comprises: Obtain a spectral auxiliary loss function, a spatial auxiliary loss function and a joint main loss function, and determine a total loss function according to the spectral auxiliary loss function, the spatial auxiliary loss function and the joint main loss function by the following formula: in, is the total loss function, is the joint main loss function, is the spectral-assisted loss function, is the spatial auxiliary loss function, is the result label of the spectral-spatial joint prediction of the i-th training pixel, is the result label predicted by the ith training pixel using only spectral information, is the result label of the i-th training pixel predicted using only spatial information, is the true label, and M is the total number of pixels in the training set.
4. A hyperspectral image classification device, characterized in that: The hyperspectral image classification device comprises: A feature acquisition module is used to obtain the spectral features and spatial features of the original hyperspectral remote sensing image; A compensation module, used to obtain a candidate spectral vector according to the spectral feature, obtain a multi-scale feature according to the spatial feature, perform feature fusion compensation on the candidate spectral vector and the multi-scale feature, and obtain a spectral-spatial joint feature; A classification module, used for classifying the original hyperspectral remote sensing image according to the spectral-spatial joint features to obtain an image classification result; The feature acquisition module is further used to obtain a ground truth object distribution label map, obtain the number of principal components, and extract the length and width parameters of the image block; extract the spectral vector corresponding to each pixel from the hyperspectral data of the original hyperspectral remote sensing image according to the length and width parameters, and use the spectral vector as the spectral feature; perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components and the length and width parameters to obtain spatial features; The feature acquisition module is further used to perform dimensionality reduction processing on the original hyperspectral remote sensing image according to the number of principal components using a principal component analysis algorithm to obtain image data after dimensionality reduction; obtain image blocks corresponding to each pixel according to the length and width parameters by taking each pixel in the image data after dimensionality reduction as the center, and use each image block as a spatial feature; The feature acquisition module is also used to obtain the covariance matrix of the original hyperspectral remote sensing image, perform singular value decomposition on the covariance matrix according to the number of principal components, obtain matrix eigenvalues and corresponding matrix eigenvectors; sort the matrix eigenvalues in descending order, and perform corresponding sorting adjustment on the matrix eigenvectors; form a target matrix according to the sorted eigenvectors, and generate reduced-dimensional image data according to the target matrix and the original hyperspectral remote sensing image; The feature acquisition module is also used to construct corresponding spectral training samples according to the spectral features, input the spectral training samples into multiple different long short-term memory networks, and obtain candidate spectral vectors; construct corresponding spatial training samples according to the spatial features, input the spatial training samples into a multi-branch network, and obtain multi-scale features; send the candidate spectral vectors into the multi-branch network, perform spectral information compensation, fuse the compensated candidate spectral vectors with the multi-scale features, perform spectral information compensation again, and obtain spectral-space joint features.
5. A hyperspectral image classification device, characterized in that: The hyperspectral image classification device comprises: a memory, a processor, and a hyperspectral image classification program stored in the memory and executable on the processor, wherein the hyperspectral image classification program is configured to implement the steps of the hyperspectral image classification method according to any one of claims 1 to 3.
6. A storage medium, characterized in that: The storage medium stores a hyperspectral image classification program, which implements the steps of the hyperspectral image classification method according to any one of claims 1 to 3 when executed by the processor.
