A deep multi-task learning hyperspectral open set classification method based on graph constraints
By introducing a deep multi-task learning method based on graph constraints into hyperspectral image classification, combining closed sets and multiple binary classifiers, and using the constraints of homogeneous graphs and heterogeneous graphs, the problem of unknown category detection in hyperspectral images is solved , significantly improving the accuracy and robustness of classification results.
Patent Information
- Application Number
- CN202410778502.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-17
AI Technical Summary
Existing hyperspectral image classification methods cannot effectively handle samples of unknown categories, resulting in incorrect classification results.
A deep multi-task learning method based on graph constraints is adopted, combining closed set classifiers and multiple binary classifiers, and introducing homogeneous graphs and heterogeneous graphs during the training process to improve the constraint and accuracy of the classifier.
Effective detection of unknown categories in hyperspectral images is achieved, and the accuracy and robustness of classification results are improved.
Smart Images

Figure CN118365967B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular relates to a deep multi-task learning hyperspectral open set classification method based on graph constraints. Background Art
[0002] Hyperspectral imaging is an advanced remote sensing technology that can capture hundreds of continuous spectral bands of target objects in the visible and infrared spectrum. Compared with traditional photography or remote sensing technology, hyperspectral imaging provides richer spectral information, allowing researchers to more accurately identify, classify and quantitatively analyze surface targets. Hyperspectral images have a huge amount of data and rich information density, and can be applied to multiple fields. For example, the agricultural field can use hyperspectral imaging technology to monitor the health of crops, identify soil types and moisture content, and environmental scientists can also use hyperspectral images to monitor changes in marine ecosystems, detect atmospheric pollutants, and monitor changes in forest cover.
[0003] Hyperspectral image classification is the process of automatically identifying and classifying surface targets using hyperspectral image data. Compared with traditional remote sensing image classification, hyperspectral image classification can more accurately distinguish targets with similar spectral characteristics, such as different types of vegetation, land use types, and surface cover. In hyperspectral image classification, data preprocessing is first performed, mainly including atmospheric correction, noise removal, spectral feature extraction and other steps, aiming to improve the quality and distinguishability of the image; then, the spectral features of each pixel in the image are extracted and converted into feature vectors that can be processed by the classifier; finally, a deep learning algorithm is used to map the highly separable features to the sample space, where each sample has a unique code to achieve the classification function of the sample.
[0004] Hyperspectral imaging sensors, with their nanometer-level spectral resolution and comprehensive imaging advantages of the spectral and spatial dimensions of objects, can perceive the intrinsic distinguishing properties of scene targets in a fine-grained manner, making them an important technology for accurate object recognition. Therefore, hyperspectral image classification has also received widespread attention.
[0005] Currently, there are many hyperspectral image classification methods in the prior art, but these classification methods are usually closed set classifiers, that is, all land object types are known in the classification process, and the classifier can only assign pixels to predefined classes. However, in actual hyperspectral remote sensing applications, unexplored geographical areas often contain unknown land object types or categories, which may be newly discovered, uncommon, or not considered in the data, which is called the open set problem. Different from traditional closed set classification, from the perspective of classification, open set classification can be described as the existence of unknown classes in the test set that are not labeled in the training set. In this case, traditional closed set classification methods tend to classify samples of unknown categories into known categories, resulting in incorrect classification results. Summary of the invention
[0006] In order to solve the above problems existing in the prior art, the present invention provides a deep multi-task learning hyperspectral open set classification method based on graph constraints. The technical problem to be solved by the present invention is achieved by the following technical solutions:
[0007] The present invention provides a deep multi-task learning hyperspectral open set classification method based on graph constraints, comprising:
[0008] Acquire a hyperspectral image to be detected;
[0009] The hyperspectral image is input into a multi-task learning network pre-trained based on a homogeneous graph and a heterogeneous graph, so that the multi-task learning network performs the following steps:
[0010] The pixel blocks in the hyperspectral image are extracted by a feature extractor. Perform feature extraction and obtain the first feature vector. represents the first pixel blocks;
[0011] The first feature vector is input into a closed set classifier and a multiple binary classifier respectively, and a pixel block in the hyperspectral image is determined according to a first prediction probability output by the closed set classifier and a second prediction probability output by each binary classifier in the multiple binary classifiers. The category to which it belongs.
[0012] In one embodiment of the present invention, the closed set classifier comprises a fully connected layer and layer;
[0013] The first feature vector is input into a closed set classifier and a multiple binary classifier respectively, and a pixel block in the hyperspectral image is determined according to a first prediction probability output by the closed set classifier and a second prediction probability output by each binary classifier in the multiple binary classifiers. The steps in this category include:
[0014] Block the pixels The first feature vector is input into the fully connected layer of the closed set classifier to obtain the output feature After that, the output feature Input closed set classifier layer, get the first predicted probability ;in,
[0015] ;
[0016] ;
[0017] In the formula, Represents the pixel block of the feature extractor The first feature vector output after feature extraction, , denote the weight and bias of the feature extractor respectively, and the first prediction probability Include pixel blocks Belong to The probability of a known class , , Indicates the number of known categories;
[0018] Block the pixels The first feature vectors of Binary classifiers corresponding to known categories one by one, and the second prediction probability output by each binary classifier is obtained:
[0019] ;
[0020] In the formula, Indicates the multiple binary classifiers with Binary classifiers corresponding to known categories, Represents a binary classifier Parameters, Represents a binary classifier The second predicted probability of the output is, , represents the pixel block in the second prediction probability Belong to The probability of a known class, represents the pixel block in the second prediction probability Not in The probability of a known class, and ;
[0021] According to the first predicted probability and the second predicted probability , determine the pixel block The category to which it belongs.
[0022] In one embodiment of the present invention, according to the first prediction probability and the second predicted probability , determine the pixel block The steps in this category include:
[0023] According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Belong to The probability of a known class , calculate pixel blocks Predicted probability of belonging to each known class:
[0024] ;
[0025] In the formula, Represents a pixel block Belong to The predicted probability of known categories;
[0026] According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Not in The probability of a known class , calculate pixel blocks Predicted probability of belonging to the unknown class :
[0027] ;
[0028] According to the predicted probability and predicted probability Obtain a predicted probability distribution, and determine the known category or unknown category corresponding to the maximum predicted probability in the predicted probability distribution as a pixel block The category to which it belongs.
[0029] In one embodiment of the present invention, the multi-task learning network is trained according to the following steps:
[0030] Acquiring training data based on the hyperspectral sample image, wherein the training data includes unlabeled samples of known categories, unlabeled samples of unknown categories, labeled samples of known categories, and one-hot labels of the labeled samples of known categories, and the unlabeled samples of known categories, the unlabeled samples of unknown categories, and the labeled samples of known categories all include multiple sample pixel blocks;
[0031] Obtained from the labeled samples of the known categories first sample pixel blocks, and input them into a feature extractor for feature extraction to obtain a second feature vector;
[0032] Inputting the second feature vector into a closed set classifier and a multiple binary classifier respectively, obtaining a first current prediction probability output by the closed set classifier and a second current prediction probability output by each binary classifier in the multiple binary classifiers;
[0033] According to the first current prediction probability and the The one-hot label of the first sample pixel block is calculated, and the first loss function value of the closed set classifier is calculated, and the second current prediction probability and the One-hot labels of the first sample pixel blocks, and calculating the second loss function value of the multiple binary classifier;
[0034] Obtained from the training data a second sample pixel block, and input it into a feature extractor to obtain a third feature vector;
[0035] The third feature vector is input into the fully connected layer of the multiple binary classifier and the closed set classifier respectively to obtain the third current prediction probability output by each binary classifier in the multiple binary classifier and the output features of a second sample pixel block;
[0036] According to the output features of the second sample pixel blocks and a homogeneity graph of each of the second sample pixel blocks, calculating a third loss function value;
[0037] Calculating a fourth loss function value according to the third current prediction probability and a heterogeneity map of each of the second sample pixel blocks;
[0038] Calculate the overall loss function value according to the first loss function value, the second loss function value, the third loss function value and the fourth loss function value;
[0039] Determine whether the overall loss function value meets the preset conditions; if not, return to obtain the labeled samples from the known categories The first sample pixel block is performed; if yes, a trained multi-task learning network is obtained.
[0040] In one embodiment of the present invention, the first loss function value of the closed set classifier is calculated according to the following formula:
[0041] ;
[0042] Wherein, the first current prediction probability includes the first The first sample pixel block belongs to The probability of a known class , Indicates One-hot label of the first sample pixel block, , represents the number of known categories, ;
[0043] The second loss function value of the multiple binary classifier is calculated according to the following formula:
[0044] ;
[0045] In the formula, , Indicates the multiple binary classifier The binary classifiers output The first sample pixel block does not belong to The probability of a known class, represents the 2-norm.
[0046] In one embodiment of the present invention, the third loss function value is calculated according to the following formula:
[0047] ;
[0048] In the formula, , , , Respectively represent The second sample pixel block The output features and The second sample pixel block The output features of , and , express Middle Spectral-position data The corresponding second sample pixel block The output features of express Homogeneous graph, express China-Israel Corresponding spectral-position data And the said Spectral-position data As a vertex, the connection and The weight of the edge, represents the 2-norm.
[0049] In one embodiment of the present invention, the fourth loss function value is calculated according to the following formula:
[0050] ;
[0051] In the formula, represents a constant coefficient, Indicates The second sample pixel block The third current prediction probability includes that each second sample pixel block belongs to the The probability of not belonging to the known category The probability of a known class, Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, Middle The second sample pixel block Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, represents the 2-norm, .
[0052] In one embodiment of the present invention, the training data is obtained Before the step of generating a second sample pixel block, the method further comprises:
[0053] Generate the A homogeneity map and a heterogeneity map of each second sample pixel block in the second sample pixel blocks.
[0054] In one embodiment of the present invention, the homogeneous map and the heterogeneous map of each second sample pixel block are generated according to the following steps:
[0055] Obtain the position information of each second sample pixel block in the hyperspectral sample image and construct a spectrum-position data set :
[0056] ;
[0057] In the formula, represents the preset spectrum-position tradeoff parameter, Respectively represent the second sample pixel block location information, Respectively represent the second sample pixel block corresponding spectrum-position data, the position information comprising coordinates of the second sample pixel block in the hyperspectral sample image;
[0058] Solve the spectrum-position data corresponding to each second sample pixel block in the local neighborhood space A spectrum-position data set in ; where represents the size of the local neighborhood space, The second sample pixel block Corresponding spectral-position data In the local neighborhood space The spectrum-position data set in It is expressed as:
[0059] ;
[0060] In the formula, Represents the spectrum-position data set Located in the hyperspectral sample image The first spectrum-position data corresponding to the second sample pixel block at , , The second sample pixel block Coordinates of the sample in the hyperspectral image;
[0061] Calculate the relationship between each first spectrum-position data and the spectrum-position data set in the spectrum-position data set respectively Spectral-position data Others The distance between the spectrum-position data :
[0062] ;
[0063] In the formula, the empirical parameter , Represents the spectrum-position dataset The Spectral-position data, and , represents the 2-norm;
[0064] According to each first spectrum-position data in the spectrum-position data set and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , generating a homogeneous map and a heterogeneous map of each second sample pixel block.
[0065] In one embodiment of the present invention, according to each first spectrum-position data in the spectrum-position data set and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , the step of generating a homogeneous map and a heterogeneous map of each second sample pixel block comprises:
[0066] For the The second sample pixel block , respectively calculate the spectrum-position data set Each first spectrum-position data and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data And sort them;
[0067] Based on the spectrum-position dataset A preset number of spectrum-position data closest to the first spectrum-position data is generated into a set , based on the spectrum-position dataset A preset number of spectrum-position data that are farthest from the first spectrum-position data are generated into a set ; wherein the set Including: the spectrum-position data set The preset number of spectrum-position data closest to the first spectrum-position data and When it is a vertex, it connects the edges between any two vertices; the set Including: the spectrum-position data set The preset number of first spectrum-position data that are farthest from the first spectrum-position data and When acting as a vertex, connect the edges between any two vertices;
[0068] According to the collection and Collection The weight of each edge in generates a homogeneous graph;
[0069] According to the collection and Collection The weight of each edge in generates a heterogeneous graph.
[0070] Compared with the prior art, the present invention has the following beneficial effects:
[0071] The present invention provides a deep multi-task learning hyperspectral open set classification method based on graph constraints. By combining a closed set classifier with a multiple binary classifier, unknown category detection of hyperspectral images can be achieved. In addition, since homogeneous graphs and heterogeneous graphs are introduced into the multi-task learning network during the training process, the homogeneous graph and the heterogeneous graph can be used to constrain the closed set classifier and the multiple binary classifier, respectively, further increasing the accuracy and robustness of the classification results of the present invention.
[0072] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 It is a flow chart of a hyperspectral open set classification method based on deep multi-task learning with graph constraints provided by an embodiment of the present invention;
[0074] Figure 2 is a schematic diagram of a training process of a multi-task learning network provided by an embodiment of the present invention;
[0075] Figure 3 Schematic diagram of another training process of a multi-task learning network provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0076] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0077] Figure 1 This is a flow chart of a deep multi-task learning hyperspectral open set classification method based on graph constraints provided by an embodiment of the present invention. Figure 1 The embodiment of the present invention provides a deep multi-task learning hyperspectral open set classification method based on graph constraints, including:
[0078] S1, obtaining a hyperspectral image to be detected;
[0079] S2. Input the hyperspectral image into the multi-task learning network pre-trained based on the homogeneous graph and the heterogeneous graph, so that the multi-task learning network performs the following steps:
[0080] S201, using feature extractor to extract pixel blocks in hyperspectral image Perform feature extraction and obtain the first feature vector. Represents the first pixel blocks;
[0081] S202, inputting the first feature vector into a closed set classifier and a multiple binary classifier respectively, and determining the pixel block in the hyperspectral image according to the first prediction probability output by the closed set classifier and the second prediction probability output by each binary classifier in the multiple binary classifiers. The category to which it belongs.
[0082] In this embodiment, the closed set classifier includes a fully connected layer and layer;
[0083] In step S202, the first feature vector is input into a closed set classifier and a multiple binary classifier respectively, and the pixel block in the hyperspectral image is determined according to the first prediction probability output by the closed set classifier and the second prediction probability output by each binary classifier in the multiple binary classifier. The steps in this category include:
[0084] S2021, pixel block The first feature vector of is input into the fully connected layer in the closed set classifier to obtain the output feature After that, the output features Input closed set classifier layer, get the first predicted probability ;in,
[0085] ;
[0086] ;
[0087] In the formula, Represents the pixel block of the feature extractor The first feature vector output after feature extraction, , Represent the weights and biases of the feature extractor, respectively, and the first prediction probability Depend on Layer uses its own The activation function is calculated, including the pixel block output by the closed set classifier Belong to The probability of a known class , , Indicates the number of known categories;
[0088] S2022: pixel blocks The first feature vector of is input into the multiple binary classifiers and Binary classifiers corresponding to known categories one by one, and the second prediction probability output by each binary classifier is obtained:
[0089] ;
[0090] In the formula, Represents the multiple binary classifiers with Binary classifiers corresponding to known categories, Represents a binary classifier Parameters, Represents a binary classifier The second predicted probability of the output is, , Represents the pixel block in the second prediction probability Belong to The probability of a known class, Represents the pixel block in the second prediction probability Not in The probability of a known class, and ;
[0091] S2023. According to the first prediction probability and the second predicted probability , determine the pixel block The category to which it belongs.
[0092] For example, according to the first predicted probability and the second predicted probability , determine the pixel block The steps in this category include:
[0093] According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Belong to The probability of a known class , calculate pixel blocks Predicted probability of belonging to each known class:
[0094] ;
[0095] In the formula, Represents a pixel block Belong to The predicted probability of known categories;
[0096] According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Not in The probability of a known class , calculate pixel blocks Predicted probability of belonging to the unknown class :
[0097] ;
[0098] According to the predicted probability and predicted probability Get the predicted probability distribution, and determine the known category or unknown category corresponding to the largest predicted probability in the predicted probability distribution as the pixel block The category to which it belongs.
[0099] Figure 2-3 is a schematic diagram of a training process of a multi-task learning network provided by an embodiment of the present invention. Figure 2-3 In this embodiment, the multi-task learning network can be trained according to the following steps:
[0100] Acquire training data based on the hyperspectral sample image, wherein the training data includes unlabeled samples of known categories, unlabeled samples of unknown categories, labeled samples of known categories, and one-hot labels of labeled samples of known categories, and the unlabeled samples of known categories, the unlabeled samples of unknown categories, and the labeled samples of known categories all include multiple sample pixel blocks;
[0101] Obtained from labeled samples of known categories first sample pixel blocks, and input them into a feature extractor for feature extraction to obtain a second feature vector;
[0102] Inputting the second feature vector into the closed set classifier and the multiple binary classifiers respectively, obtaining a first current prediction probability output by the closed set classifier and a second current prediction probability output by each binary classifier in the multiple binary classifiers;
[0103] Based on the first current prediction probability and The one-hot label of the first sample pixel block is calculated, and the first loss function value of the closed set classifier is calculated, and the second current prediction probability and One-hot labels of the first sample pixel blocks, and calculating the second loss function value of the multiple binary classifier;
[0104] Get from training data a second sample pixel block, and input it into a feature extractor to obtain a third feature vector;
[0105] The third feature vector is input into the fully connected layer in the multiple binary classifier and the closed set classifier respectively to obtain the third current prediction probability and output of each binary classifier in the multiple binary classifier output features of a second sample pixel block;
[0106] according to output features of the second sample pixel blocks and a homogeneity map of each second sample pixel block, and calculating a third loss function value;
[0107] Calculating a fourth loss function value according to the third current prediction probability and the heterogeneity map of each second sample pixel block;
[0108] Calculate the overall loss function value according to the sum of the first loss function value, the second loss function value, the third loss function value and the fourth loss function value;
[0109] Determine whether the overall loss function value meets the preset conditions; if not, return to the above-mentioned labeled samples obtained from known categories The first sample pixel block is performed; if yes, a trained multi-task learning network is obtained.
[0110] Specifically, the multi-task learning network includes four learning tasks in the training process, namely: closed-set classifier multi-classification learning, multiple binary classifier classification learning, homogeneous learning and heterogeneous learning. Among them, the training data used for closed-set classifier multi-classification learning and multiple binary classifier classification learning are labeled samples of known categories and their one-hot labels, and the training data used for homogeneous learning and heterogeneous learning include: unlabeled samples of known categories, unlabeled samples of unknown categories, labeled samples of known categories and their one-hot labels.
[0111] It should be noted that since the classification of hyperspectral images is pixel-level classification, in order to facilitate the use of convolution kernels for convolution operations during training, the one-hot label of the central pixel of the sample pixel block in the labeled sample of the known category can be used as the one-hot label of the sample pixel block.
[0112] During the training process, we first transform the labeled samples of known categories into The first sample pixel blocks are input into the feature extractor to obtain the second feature vector of each first sample pixel block, and then the second feature vector is input into the closed set classifier and the multiple binary classifiers respectively. The closed set classifier outputs the first current prediction probability, and each binary classifier in the multiple binary classifiers outputs the second current prediction probability. The first current prediction probability includes the first The first sample pixel block belongs to The probability of a known class , the multiple binary classifiers include The known categories correspond to binary classifiers, and similarly, the second current prediction probability output by each binary classifier includes the The first sample pixel block belongs to The probability of the known categories, and the The first sample pixel block does not belong to The probability of a known class.
[0113] The four learning tasks of the multi-task learning network in the training process correspond to four loss functions, among which the closed set classifier multi-classification learning and the multiple binary classifier classification learning are supervised by class labels. Exemplarily, the first loss function value of the closed set classifier is calculated according to the following formula:
[0114] ;
[0115] Where the first current prediction probability includes the output of the closed set classifier The first sample pixel block belongs to The probability of a known class , Indicates One-hot label of the first sample pixel block, , represents the number of known categories, .
[0116] Furthermore, the second loss function value of the multiple binary classifier is calculated according to the following formula:
[0117] ;
[0118] In the formula, , Represents multiple binary classifiers The binary classifiers output The first sample pixel block does not belong to The probability of a known class, represents the 2-norm, for example, if , then it means the output of the first binary classifier in the multiple binary classifiers The probability that the first sample pixel block does not belong to the first known category is 0, that is, The first sample pixel blocks belong to the first known category.
[0119] In order to overcome the small sample problem in hyperspectral image classification, this embodiment introduces homogeneous graphs and heterogeneous graphs in the training process of the multi-task learning network, and unsupervisedly constrains the learning of closed set classifiers and multiple binary classifiers through the relationship between sample pixel blocks contained in the homogeneous graphs and heterogeneous graphs. Before the step of generating a second sample pixel block, a A homogeneity map and a heterogeneity map of each second sample pixel block in the second sample pixel blocks.
[0120] Exemplarily, the homogeneous map and the heterogeneous map of each second sample pixel block are generated according to the following steps:
[0121] Obtain the position information of each second sample pixel block in the hyperspectral sample image and construct a spectrum-position dataset :
[0122] ;
[0123] In the formula, represents the preset spectrum-position tradeoff parameter, Respectively represent the second sample pixel block location information, Respectively represent the second sample pixel block corresponding spectrum-position data, the position information including the coordinates of the second sample pixel block in the hyperspectral sample image;
[0124] Solve the spectrum-position data corresponding to each second sample pixel block in the local neighborhood space A spectrum-position data set in ; where represents the size of the local neighborhood space, The second sample pixel block Corresponding spectral-position data In the local neighborhood space The spectrum-position data set in It is expressed as:
[0125] ;
[0126] In the formula, Represents a spectrum-position data set Located in the hyperspectral sample image The first spectrum-position data at , , The second sample pixel block Coordinates of the sample in the hyperspectral image;
[0127] Calculate the first spectrum-position data and the spectrum-position data set in the spectrum-position data set respectively Spectral-position data Others The distance between the spectrum-position data :
[0128] ;
[0129] In the formula, the empirical parameter , Representing a spectrum-position dataset The Spectral-position data, and , represents the 2-norm;
[0130] According to each first spectrum-position data in the spectrum-position data set and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , generating a homogeneous map and a heterogeneous map of each second sample pixel block.
[0131] Specifically, in this embodiment, the position information of the second sample pixel block is used as one of its attributes to break the limitation of spatial information extraction and construct a spectrum-position data set. , where the position information can be the coordinates of the second sample pixel block in the hyperspectral sample image. For each second sample pixel block, let its local neighborhood space be , then The second sample pixel block Corresponding spectral-position data In the local neighborhood space The spectrum-position data set in It is expressed as: ,gather Contains a plurality of first spectrum-position data , each first spectrum-position data The coordinates of the corresponding second sample pixel block in the hyperspectral sample image are ,in, , .by For example, , , that is to say, The value of is: , The value of is: , at this time the spectrum-position data set The first spectrum-position data of 25 pieces are included.
[0132] Further, according to each first spectrum-position data and spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , generating a homogeneous map and a heterogeneous map of each second sample pixel block, the specific steps include:
[0133] For the The second sample pixel block , respectively calculate the spectrum-position data set Each first spectrum-position data and spectrum-position data set Spectral-position data Others The distance between the spectrum-position data And sort them;
[0134] Based on the spectral-position dataset A preset number of spectrum-position data closest to the first spectrum-position data is generated into a set , based on the spectrum-position dataset A preset number of spectrum-position data that are farthest from the first spectrum-position data are generated into a set ; Among them, the set Includes: Spectral-position dataset The preset number of spectrum-position data closest to the first spectrum-position data and When acting as a vertex, it connects the edges between any two vertices; the set Includes: Preset number of spectra-position data at the farthest distance and When acting as a vertex, connect the edges between any two vertices;
[0135] According to the collection and Collection The weight of each edge in generates a homogeneous graph;
[0136] According to the collection and Collection The weight of each edge in generates a heterogeneous graph.
[0137] It should be understood that in fact, both homogeneous graphs and heterogeneous graphs are undirected graphs. In a homogeneous graph, the vertices are the preset number of spectrum-position data and spectrum-position data closest to each other. , the vertices are connected by edges, and in the heterogeneous graph, the vertices are the preset number of spectrum-position data and spectrum-position data with the longest distance. ,Similarly, vertices are connected by edges.
[0138] In a homogeneous or heterogeneous graph, each edge can be assigned a weight according to the following formula:
[0139] ;
[0140] In the formula, Indicates that in a homogeneous or heterogeneous graph, the spectrum-position data is connected , As the weight of the edge between two vertices, , Indicates the preset quantity, It represents the sum of the distances between the first spectrum-position data and the preset number of spectrum-position data that are closest or farthest in the homogeneous graph or the heterogeneous graph.
[0141] After generating the homogeneous map and heterogeneous map of each second sample pixel block according to the above process, obtain The second sample pixel blocks are used for homogeneous graph learning and heterogeneous graph learning. The second sample pixel blocks are input into the feature extractor, and the output of the feature extractor is the third feature vector of each second sample pixel block. Then, the third feature vector is input into the multiple binary classifier and the closed set classifier to obtain the third current prediction probability output by each binary classifier in the multiple binary classifier and the output feature of the second sample pixel block.
[0142] Optionally, according to The output features of the second sample pixel blocks and the homogeneity map of each second sample pixel block are used to calculate the third loss function value according to the following formula:
[0143] ;
[0144] In the formula, , , , Respectively represent The second sample pixel block The output features and The second sample pixel block The output features of , and , express Middle Spectral-position data The corresponding second sample pixel block The output features of express Homogeneous graph, express China-Israel Corresponding spectral-position data Pass Spectral-position data As a vertex, the connection and The weight of the edge, represents the 2-norm.
[0145] Further, according to the third current prediction probability and the heterogeneity map of each second sample pixel block, the fourth loss function value is calculated according to the following formula:
[0146] ;
[0147] In the formula, represents a constant coefficient, Indicates The second sample pixel block The third current prediction probability includes each second sample pixel block belonging to the first The probability of not belonging to the known category The probability of a known class, Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, Middle The second sample pixel block Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, represents the 2-norm, .
[0148] Finally, according to the first loss function value, the second loss function value, the third loss function value and the fourth loss function value, the overall loss function value can be calculated:
[0149] ;
[0150] In the formula, , Respectively represent the first preset weight and the second preset weight.
[0151] At this time, it is determined whether the overall loss function value meets the preset conditions, for example, whether the overall loss function value meets the preset accuracy. If not, the above-mentioned method of obtaining the labeled samples from the known categories is returned. The first sample pixel block is performed; if yes, a trained multi-task learning network is obtained.
[0152] Next, the hyperspectral open set classification method based on deep multi-task learning with graph constraints provided by the present invention is further illustrated through simulation experiments.
[0153] Specifically, the simulation experiment uses the PaviaU hyperspectral dataset, which contains 9 categories of samples: asphalt, grass, gravel, trees, painted metal plates, bare soil, asphalt mixture, self-locking bricks, and shadows. The first 8 categories are selected as known categories, and the last category is selected as an unknown category. The unknown category only appears in the test set. The experimental results use the overall closed set classification accuracy (OA_C), average closed set classification accuracy (AA_C), closed set Kappa coefficient (kappa_C), overall open set classification accuracy (OA_O), average open set classification accuracy (AA_O), open set Kappa coefficient (kappa_O), and unknown class accuracy (UK) as measurement indicators. Among them, the higher the OA_C, AA_C, and kappa_C, the better the closed set classification effect, the higher the UK, the better the recognition effect of the unknown category samples, and the higher the OA_O, AA_O, and kappa_O, the better the open set classification effect.
[0154] The above-mentioned deep multi-task learning hyperspectral open set classification method based on graph constraints was run on the PyTorch framework. The initial learning rate was set to 0.001, and the Adam optimizer was used for parameter optimization. The data batch input into the multi-task learning network was set to 100 each time, and the epoch was set to 400. The constant coefficient , the first preset weight and the second preset weight All are 0.5, preset quantity . Experimental hardware platform: CPU i7-13650HX, GPU: RTX4060, memory: 16G.
[0155] The closed set classification methods used in the simulation process include DFSL (Deep Few-Shot Learning) method and SSTN (Spectral-Spatial Transformer Network), and the open set classification methods include MDL4OW (Multitask Deep Learning Method for Open World) method, SSLR (Spectral-Spatial Latent Reconstruction Network) and the graph-constrained deep multi-task learning hyperspectral open set classification method provided by the present invention. It should be noted that for the closed set classification method, if the maximum value of the final probability prediction distribution is less than 0.5, it is classified as an unknown category. The specific results are shown in Table 1:
[0156] Table 1
[0157]
[0158] In Table 1, 1, 2, ..., 8 represent the eight known categories of asphalt, grass, gravel, trees, painted metal plates, bare soil, asphalt mixtures, and self-locking bricks, respectively. It can be seen that the overall closed set classification accuracy (OA_C), average closed set classification accuracy (AA_C) and closed set Kappa coefficient (kappa_C) of the present invention are the highest, indicating that the classification accuracy of the known categories of the present invention is also optimal. In terms of open set classification, the overall open set classification accuracy (OA_O), average open set classification accuracy (AA_O) and open set Kappa coefficient (kappa_O) of the present invention are the highest, indicating that the overall effect of the present invention is optimal.
[0159] It can be seen from the above embodiments that the beneficial effects of the present invention are:
[0160] The present invention provides a deep multi-task learning hyperspectral open set classification method based on graph constraints. By combining a closed set classifier with a multiple binary classifier, unknown category detection of hyperspectral images can be achieved. In addition, since homogeneous graphs and heterogeneous graphs are introduced into the multi-task learning network during the training process, the homogeneous graph and the heterogeneous graph can be used to constrain the closed set classifier and the multiple binary classifier, respectively, further increasing the accuracy and robustness of the classification results of the present invention.
[0161] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0162] The description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine different embodiments or examples described in this specification.
[0163] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.
Claims
1. A deep multi-task learning hyperspectral open set classification method based on graph constraints, characterized by: include: Acquire a hyperspectral image to be detected; The hyperspectral image is input into a multi-task learning network pre-trained based on a homogeneous graph and a heterogeneous graph, so that the multi-task learning network performs the following steps: The pixel blocks in the hyperspectral image are extracted by a feature extractor. Perform feature extraction and obtain the first feature vector. represents the first pixel blocks; The first feature vector is input into a closed set classifier and a multiple binary classifier respectively, and a pixel block in the hyperspectral image is determined according to a first prediction probability output by the closed set classifier and a second prediction probability output by each binary classifier in the multiple binary classifiers. The category to which it belongs; The closed set classifier includes a fully connected layer and layer; The first feature vector is input into a closed set classifier and a multiple binary classifier respectively, and a pixel block in the hyperspectral image is determined according to a first prediction probability output by the closed set classifier and a second prediction probability output by each binary classifier in the multiple binary classifiers. The steps in this category include: Block the pixels The first feature vector is input into the fully connected layer of the closed set classifier to obtain the output feature After that, the output features Input closed set classifier layer, get the first predicted probability ;in, ; ; In the formula, Represents the feature extractor for the pixel block The first feature vector output after feature extraction, , denote the weight and bias of the feature extractor respectively, and the first prediction probability Include pixel blocks Belong to The probability of a known class , , Indicates the number of known categories; Block the pixels The first feature vectors of Binary classifiers corresponding to known categories one by one, and the second prediction probability output by each binary classifier is obtained: ; In the formula, Indicates the multiple binary classifiers with Binary classifiers corresponding to known categories, Represents a binary classifier Parameters, Represents a binary classifier The second predicted probability of the output is, , represents the pixel block in the second prediction probability Belong to The probability of a known class, represents the pixel block in the second prediction probability Not in The probability of a known class, and ; According to the first predicted probability and the second predicted probability , determine the pixel block The category to which it belongs; Among them, according to the first prediction probability and the second predicted probability , determine the pixel block The steps in this category include: According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Belong to The probability of a known class , calculate pixel blocks Predicted probability of belonging to each known class: ; In the formula, Represents a pixel block Belong to The predicted probability of known categories; According to the first predicted probability Medium pixel block Belong to The probability of a known class and the second predicted probability Medium pixel block Not in The probability of a known class , calculate pixel blocks Predicted probability of belonging to the unknown class : ; According to the predicted probability and predicted probability Obtain a predicted probability distribution, and determine the known category or unknown category corresponding to the maximum predicted probability in the predicted probability distribution as a pixel block The category to which it belongs.
2. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 1, characterized in that: The multi-task learning network is trained according to the following steps: Acquiring training data based on the hyperspectral sample image, wherein the training data includes unlabeled samples of known categories, unlabeled samples of unknown categories, labeled samples of known categories, and one-hot labels of the labeled samples of known categories, and the unlabeled samples of known categories, the unlabeled samples of unknown categories, and the labeled samples of known categories all include multiple sample pixel blocks; Obtained from the labeled samples of the known categories first sample pixel blocks, and input them into a feature extractor for feature extraction to obtain a second feature vector; Inputting the second feature vector into a closed set classifier and a multiple binary classifier respectively, obtaining a first current prediction probability output by the closed set classifier and a second current prediction probability output by each binary classifier in the multiple binary classifiers; According to the first current prediction probability and the The one-hot label of the first sample pixel block is calculated, and the first loss function value of the closed set classifier is calculated, and the second current prediction probability and the One-hot labels of the first sample pixel blocks, and calculating the second loss function value of the multiple binary classifier; Obtained from the training data a second sample pixel block, and input it into a feature extractor to obtain a third feature vector; The third feature vector is input into the fully connected layer of the multiple binary classifier and the closed set classifier respectively to obtain the third current prediction probability output by each binary classifier in the multiple binary classifier and the output features of a second sample pixel block; According to the output features of the second sample pixel blocks and a homogeneity graph of each of the second sample pixel blocks, calculating a third loss function value; Calculating a fourth loss function value according to the third current prediction probability and a heterogeneity map of each of the second sample pixel blocks; Calculate the overall loss function value according to the first loss function value, the second loss function value, the third loss function value and the fourth loss function value; Determine whether the overall loss function value meets the preset conditions; if not, return to obtain the labeled samples from the known categories The first sample pixel block is performed; if yes, a trained multi-task learning network is obtained.
3. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 2, characterized in that: The first loss function value of the closed set classifier is calculated according to the following formula: ; Wherein, the first current prediction probability includes the first The first sample pixel block belongs to The probability of a known class , Indicates One-hot label of the first sample pixel block, , represents the number of known categories, ; The second loss function value of the multiple binary classifier is calculated according to the following formula: ; In the formula, , Indicates the multiple binary classifier The binary classifiers output The first sample pixel block does not belong to The probability of a known class, represents the 2-norm.
4. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 2, characterized in that: The third loss function value is calculated according to the following formula: ; In the formula, , , , Respectively represent The second sample pixel block The output features and The second sample pixel block The output features of , and , express Middle Spectral-position data The corresponding second sample pixel block The output features of express Homogeneous graph, express China-Israel Corresponding spectral-position data And the said Spectral-position data As a vertex, the connection and The weight of the edge, represents the 2-norm.
5. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 2, characterized in that: The fourth loss function value is calculated according to the following formula: ; In the formula, represents a constant coefficient, Indicates The second sample pixel block The third current prediction probability includes that each second sample pixel block belongs to the The probability of not belonging to the known category The probability of a known class, Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, Middle The second sample pixel block Belong to The set of probabilities of known classes , Respectively Belong to The probability of a known class, represents the 2-norm, .
6. The deep multi-task learning hyperspectral open set classification method based on graph constraints according to claim 2 is characterized in that: Get from training data Before the step of generating a second sample pixel block, the method further comprises: Generate the A homogeneity map and a heterogeneity map of each second sample pixel block in the second sample pixel blocks.
7. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 6, characterized in that: Generate a homogeneous map and a heterogeneous map of each second sample pixel block according to the following steps: Obtain the position information of each second sample pixel block in the hyperspectral sample image and construct a spectrum-position data set : ; In the formula, represents the preset spectrum-position tradeoff parameter, Respectively represent the second sample pixel block location information, Respectively represent the second sample pixel block corresponding spectrum-position data, the position information comprising coordinates of the second sample pixel block in the hyperspectral sample image; Solve the spectrum-position data corresponding to each second sample pixel block in the local neighborhood space A spectrum-position data set in ; where represents the size of the local neighborhood space, The second sample pixel block Corresponding spectral-position data In the local neighborhood space The spectrum-position data set in It is expressed as: ; In the formula, Represents the spectrum-position data set The coordinates of the hyperspectral sample image are The first spectrum-position data corresponding to the second sample pixel block at , , The second sample pixel block Coordinates of the sample in the hyperspectral image; Calculate the relationship between each first spectrum-position data and the spectrum-position data set in the spectrum-position data set respectively Spectral-position data Others The distance between the spectrum-position data : ; In the formula, the empirical parameter , Represents the spectrum-position dataset The Spectral-position data, and , represents the 2-norm; According to each first spectrum-position data in the spectrum-position data set and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , generating a homogeneous map and a heterogeneous map of each second sample pixel block.
8. The method for hyperspectral open set classification based on deep multi-task learning with graph constraints according to claim 7, characterized in that: According to each first spectrum-position data in the spectrum-position data set and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data , the step of generating a homogeneous map and a heterogeneous map of each second sample pixel block comprises: For the The second sample pixel block , respectively calculate the spectrum-position data set Each first spectrum-position data and the spectrum-position data set Spectral-position data Others The distance between the spectrum-position data And sort them; Based on the spectrum-position dataset A preset number of spectrum-position data closest to the first spectrum-position data is generated into a set , based on the spectrum-position dataset A preset number of spectrum-position data that are farthest from the first spectrum-position data are generated into a set ; wherein the set Including: the spectrum-position data set The preset number of spectrum-position data closest to the first spectrum-position data and When it is a vertex, it connects the edges between any two vertices; the set Including: the spectrum-position data set The preset number of spectrum-position data that are farthest from the first spectrum-position data and When acting as a vertex, connect the edges between any two vertices; According to the collection and Collection The weight of each edge in generates a homogeneous graph; According to the collection and Collection The weight of each edge in generates a heterogeneous graph.
