Feature waveband selection method based on neural network model pruning
Using neural network model pruning technology to filter hyperspectral data bands solves the problem of insufficient discriminability of classification models in the existing technology, improves classification accuracy and generalization, and reduces the cost of acquiring hyperspectral data.
Patent Information
- Application Number
- PCT/CN2023/086494
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-10
- Filing Date
- 2023-04-06
- Publication Date
- 2024-09-19
AI Technical Summary
Existing hyperspectral classification models cannot effectively describe the discriminability of classification tasks, resulting in weak generalization performance. In addition, hyperspectral lenses in the infrared band are expensive, making it difficult to promote hyperspectral analysis technology.
A feature band selection method based on neural network model pruning is used to select discriminative hyperspectral data bands by building a classification network model and training using the cross-entropy loss function and small-batch stochastic gradient descent method. The classification is retained after pruning. Bands with greater discriminability.
It significantly improves the classification accuracy and generalization, reduces the cost of hyperspectral data acquisition, and reduces the number of required bands.
Smart Images

Figure CN2023086494_19092024_PF_FP_ABST
Abstract
Description
A feature band selection method based on neural network model pruning Technical Field
[0001] The present invention relates to the technical field of hyperspectral non-destructive testing, and in particular to a feature band selection method based on neural network model pruning. Background Art
[0002] Hyperspectral imaging can simultaneously image a specific area using dozens or even hundreds of continuous bands. The resulting image is called a hyperspectral image. Hyperspectral images, composed of hundreds of continuous bands, contain rich spectral information, which provides excellent conditions for object recognition and detection. Currently, analysis techniques based on hyperspectral data are widely used in applications such as food adulteration detection, drug classification, and building material quality testing. Hyperspectral data classification is the foundation of hyperspectral image applications. Feature extraction algorithms extract spectral information for classification, and classifiers are then used to classify the extracted features into different object categories. Common hyperspectral classification algorithms include partial least squares discriminant analysis (PLSDA), support vector machines (SVM), and artificial neural networks (ANN). However, many classification algorithms still rely on full hyperspectral band information, and the high cost of infrared hyperspectral lenses makes hyperspectral analysis technology difficult to promote.
[0003] Zhejiang University proposed a hyperspectral band selection method based on a neural network in its patent application document "A Hyperspectral Band Selection Method and Device Based on Transformer Network" (Patent Application Number: 202211210073.4, Application Publication Number: CN 115641503 A). They obtained the band mask and correlation matrix through a reconstruction model with an attention mechanism, and designed a scoring function to describe the representativeness and redundancy of the bands, thereby selecting bands with high representativeness and low redundancy. However, the above-mentioned literature method uses the minimization of reconstruction loss as the optimization function. The resulting band mask and correlation matrix cannot describe the discriminability of the classification task. The classification model has difficulty detecting the optimal classification surface for each category, resulting in weak generalization performance of the classification model on the prediction set.
[0004] Summary of the Invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a feature band selection method based on neural network model pruning, which effectively solves the problem that the classification model cannot describe the discriminability of the classification task, resulting in weak generalization performance.
[0006] The present invention provides a method for selecting characteristic bands based on neural network model pruning, comprising the following steps:
[0007] S1. Obtain hyperspectral dataset;
[0008] S2. Divide the data set into a training set, a validation set, and a prediction set;
[0009] S3. Building a classification network model based on the data set;
[0010] S4. Constructing a loss function for training the classification network model;
[0011] S5, inputting the training set and the validation set into the classification network model for training, pruning the characteristic bands, and screening out the discriminative hyperspectral data bands;
[0012] S6. Classify the prediction set using the trained classification network model and the screened characteristic bands to obtain a classification result.
[0013] Preferably, the prediction set in step S2 is used to evaluate the model accuracy corresponding to the screened bands.
[0014] Preferably, the classifier network model constructed in step S3 consists of a fully connected layer, a batch processing layer, a nonlinear operation layer and an output layer.
[0015] Preferably, the loss function of the classifier network in step S4 adopts a cross entropy function, and the cross entropy function is:
[0016] Among them, N is the total number of data samples, C is the total number of data categories, and y i,t The binary label of category t, p i,t is the probability of the i-th data sample with respect to category t.
[0017] As preferably, the p i,t Calculated by the Softmax function:
[0018] Among them, f(x i ) t is the predicted value of the i-th data sample for category t.
[0019] Preferably, step S5 includes:
[0020] S51, initializing the classification network model and saving the initialization weights;
[0021] S52, use the mini-batch stochastic gradient descent method to train the discriminator and generator, use the Adam optimizer, and the learning rate is 0.0001;
[0022] S53, randomly collecting a sample subset from the training set and optimizing the loss function until the number of training steps reaches a first set threshold;
[0023] S54, randomly collecting a sample subset from the validation set and optimizing the loss function until the number of training steps reaches a second set threshold;
[0024] S55, summing the training set learning weight direction corresponding to each band of the input layer of the classification network model and the gradient direction on the validation set, measuring the information content of each candidate band, and deleting the hyperspectral band with the least information;
[0025] S56. Determine whether the selected bands reach the set number of bands. If so, proceed to step S6. Otherwise, reset the classification network model to the initialization state and remove the unselected bands, and perform steps S52-S56 again.
[0026] Preferably, the step S54 further includes:
[0027] A sample subset is randomly collected from the validation set to optimize the loss function until the cross entropy between the quantitative analysis prediction value and the label value of the validation set converges to less than a third set threshold.
[0028] The present invention provides a feature band selection method based on neural network model pruning. The method reduces the required bands while ensuring the accuracy of the analysis technology through the neural network model pruning technology, and can retain the hyperspectral data bands with stronger discriminability for classification, thereby significantly improving the classification accuracy, improving the generalization of the classification model, and reducing the cost of acquiring hyperspectral data in industrial sites. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] FIG1 is a flow chart of a method for selecting feature bands based on neural network model pruning according to an embodiment of the present invention;
[0031] FIG2 is a flow chart of a method for training a classification network model according to an embodiment of the present invention;
[0032] FIG3 is a graph showing the relationship between the band deletion ratio and the model classification accuracy in the visible light-near infrared shortwave band according to an embodiment of the present invention;
[0033] FIG4 is a graph showing the relationship between the band deletion ratio and the model classification accuracy in the near-infrared shortwave-near-infrared longwave bands according to an embodiment of the present invention;
[0034] FIG5 is a graph showing the relationship between the band deletion ratio and the model classification accuracy in the visible light-near infrared long-wave band according to an embodiment of the present invention; DETAILED DESCRIPTION
[0035] To make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be further clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be noted that the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0036] In the embodiments of the present application, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone.
[0037] The terms "first" and "second" in the embodiments of the present application are only used for descriptive purposes and are not to 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 at least one of the features. In the description of the present application, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a system, product or device comprising a series of components or units is not limited to the listed components or units, but may optionally also include components or units that are not listed, or may optionally also include other components or units that are inherent to these products or devices. In the description of the present application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0038] As shown in FIG1 , it is a flow chart of a feature band selection method based on neural network model pruning of the present invention, which includes the following steps:
[0039] S1. Obtain hyperspectral dataset;
[0040] S2. Divide the data set into a training set, a validation set, and a prediction set;
[0041] Different samples are randomly selected from the dataset as training sets, validation sets, and prediction sets, where the prediction set is used to evaluate the model accuracy corresponding to the selected band.
[0042] S3. Building a classification network model based on the data set;
[0043] A classifier network consisting of a fully connected layer, a batch processing layer, a nonlinear operation layer and an output layer is constructed for the hyperspectral data to be processed. The network has the function of distinguishing multiple data categories.
[0044] S4. Constructing a loss function for training the classification network model;
[0045] The loss function of the classifier network adopts the cross entropy function, which is:
[0046] Among them, N is the total number of data samples, C is the total number of data categories, and y i,t The binary label of category t, p i,t is the probability of the i-th data sample with respect to category t.
[0047] p i,t Calculated by the Softmax function:
[0048] Among them, f(x i ) t is the predicted value of the i-th data sample for category t.
[0049] S5, inputting the training set and the validation set into the classification network model for training, pruning the characteristic bands, and screening out the discriminative hyperspectral data bands;
[0050] FIG2 is a flow chart of a method for training a classification network model according to an embodiment of the present invention, which specifically includes the following steps:
[0051] S51, initializing the classification network model and saving the initialization weights;
[0052] S52, use the mini-batch stochastic gradient descent method to train the discriminator and generator, use the Adam optimizer, and the learning rate is 0.0001;
[0053] S53, randomly collecting a sample subset from the training set and optimizing the loss function until the number of training steps reaches a first set threshold;
[0054] S54, randomly collecting a sample subset from the validation set and optimizing the loss function until the number of training steps reaches a second set threshold, or until the cross entropy between the quantitative analysis prediction value and the label value of the validation set converges to less than a third set threshold;
[0055] S55, summing the training set learning weight direction corresponding to each band of the input layer of the classification network model and the gradient direction on the validation set, measuring the information content of each candidate band, and deleting the hyperspectral band with the least information;
[0056] S56. Determine whether the selected bands reach the set number of bands. If so, proceed to step S6. Otherwise, reset the classification network model to the initialization state and remove the unselected bands, and perform steps S52-S56 again.
[0057] S6. Classify the prediction set using the trained classification network model and the screened bands to obtain a classification result.
[0058] The effects of the present invention are further described below with reference to specific application examples. In this embodiment, wild kudzu root varieties are identified and classified using hyperspectral methods. The specific steps are as follows:
[0059] Step 1: Measure hyperspectral data of 1897 roots and vines of Pueraria lobata, with a total of 1008 vine data and 889 root data; the hyperspectral bands are 410-990nm (visible light-near infrared shortwave lens) and 950-2500nm (near infrared shortwave-near infrared longwave lens), and the two band lenses are used separately or simultaneously for data analysis.
[0060] Step 2: Randomly select 1213 samples as training set D tr , 304 samples as the validation set D val , the remaining 380 unlabeled samples are used as the prediction set D te , which is used to evaluate the model accuracy corresponding to the selected band.
[0061] Step 3: Build a classification network model based on hyperspectral data: Build a classifier network for hyperspectral data consisting of a fully connected layer, a batch processing layer, a nonlinear operation layer, and an output layer. This network has the function of distinguishing multiple data categories.
[0062] Step 4: Constructing a loss function for training the classification network model;
[0063] The loss function of the classifier network adopts the cross entropy function, which is:
[0064] Where N is the total number of hyperspectral data samples, C is the total number of hyperspectral data categories, and y i,t The binary label of category t, p i,t is the probability of the i-th hyperspectral data sample with respect to category t.
[0065] p i,tCalculated by the Softmax function:
[0066] Among them, f(x i ) t is the predicted value of the i-th hyperspectral data sample for category t.
[0067] Step 5: Using the training set and the validation set to train the classification network model, and screening out discriminative hyperspectral data bands;
[0068] Initialize the classification network model and save the initialization weights. Use the mini-batch stochastic gradient descent method to train the discriminator and generator. Use the Adam optimizer with a learning rate of 0.0001.
[0069] From the training set D tr Randomly collect sample subsets to optimize the loss function until the number of training steps reaches 45,000; val Randomly collect sample subsets to optimize the loss function until the number of training steps reaches a certain set value or until the cross entropy between the quantitative analysis prediction value and the label value of the validation set converges to less than a certain set value;
[0070] The training set learning weight direction corresponding to each band in the input layer of the classification network model is summed with the gradient direction on the validation set to measure the information content of each candidate band, and the hyperspectral band with the least information content is deleted. It is determined whether the selected bands reach the set number of bands. If so, the predicted set is classified using the trained classification network model and the selected bands to obtain the classification results. Otherwise, the classification network model is reset to the initial state for retraining and unselected bands are removed until the selected bands reach the set number of bands.
[0071] To further verify the effectiveness of this invention, five random cross-validations were performed on the training, validation, and prediction sets for the visible-near-infrared shortwave (410-950nm), near-infrared shortwave-near-infrared longwave (950-2500nm), and visible-near-infrared longwave (410-2500nm) bands. A band selection algorithm based on partial least squares discriminant analysis was used as a comparison method. The classification performance comparison results of the two band selection methods on the neural network are shown in the following table:
[0072] As shown in the table above, in the data set of near-infrared shortwave-near-infrared longwave band lenses (950-2500nm), the results of five calculations of the partial least squares method with 90% deletion are: the classification accuracy of the training set is 91.46%, the classification accuracy of the validation set is 87.42%, and the classification accuracy of the prediction set is 86.26%; while the classification accuracy of the training set obtained by the method of the present invention is 99.98%, the classification accuracy of the validation set is 98.61%, and the classification accuracy of the prediction set is 98.58%.
[0073] Figure 3 shows a graph of the relationship between the band deletion ratio and model classification accuracy for the visible-to-near-infrared shortwave band; Figure 4 shows a graph of the relationship between the band deletion ratio and model classification accuracy for the near-infrared shortwave-to-near-infrared longwave band; and Figure 5 shows a graph of the relationship between the band deletion ratio and model classification accuracy for the visible-to-near-infrared longwave band. As can be seen from these graphs, the partial least squares-based methods all experience a downward trend in classification accuracy when the band deletion ratio exceeds 30%. However, due to the band deletion method used by the present invention through model pruning, the accuracy only declines when the band deletion ratio exceeds 60%. This means that the present invention retains bands that are more discriminative for classification, resulting in a significant improvement in classification accuracy.
[0074] In summary, the feature band selection method based on neural network model pruning provided by the present invention ensures the accuracy of analysis technology while reducing the required bands through neural network model pruning technology, and can retain hyperspectral data bands with stronger discriminability for classification, thereby significantly improving the classification accuracy, improving the generalization of the classification model, and reducing the cost of hyperspectral data acquisition in industrial sites.
[0075] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0076] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A feature band selection method based on neural network model pruning, characterized in that: The steps include: S1, obtain hyperspectral dataset; S2, dividing the data set into a training set, a validation set and a prediction set; S3, constructing a classification network model according to the data set; S4, constructing a loss function for training the classification network model; S5, inputting the training set and the validation set into the classification network model for training, pruning the characteristic bands, and screening out discriminative hyperspectral data bands; S6. Classify the prediction set using the trained classification network model and the screened characteristic bands to obtain a classification result.
2. The feature band selection method based on neural network model pruning according to claim 1, characterized in that: The prediction set in step S2 is used to evaluate the model accuracy corresponding to the selected bands.
3. The feature band selection method based on neural network model pruning according to claim 1, characterized in that: The classifier network model constructed in step S3 consists of a fully connected layer, a batch processing layer, a nonlinear operation layer and an output layer.
4. The feature band selection method based on neural network model pruning according to claim 1, characterized in that: The loss function of the classifier network in step S4 adopts a cross entropy function, and the cross entropy function is: Among them, N is the total number of data samples, C is the total number of data categories, and y i,t The binary label of category t, p i,t is the probability of the i-th data sample with respect to category t.
5. The method for selecting characteristic bands based on neural network model pruning according to claim 4, characterized in that: The p i,t Calculated by the Softmax function: Among them, f(x i ) t is the predicted value of the i-th data sample for category t.
6. The method for selecting characteristic bands based on neural network model pruning according to claim 1, characterized in that: The step S5 comprises: S51, initializing the classification network model and saving the initialization weights; S52, use the small batch stochastic gradient descent method to train the discriminator and generator, the optimizer uses the Adam optimizer, and the learning rate is 0.0001; S53, randomly collecting a sample subset from the training set to optimize the loss function until the number of training steps reaches a first set threshold; S54, randomly collecting a sample subset from the verification set to optimize the loss function until the number of training steps reaches a second set threshold; S55, summing the training set learning weight direction corresponding to each band of the classification network model input layer and the gradient direction on the validation set, measuring the information amount of each candidate band, and deleting the hyperspectral band with the least information; S56, determine whether the screened bands reach the set number of bands. If so, perform step S6, otherwise reset the classification network model to the initialization state and remove the unselected bands, and perform steps S52-S56 again.
7. The method for selecting characteristic bands based on neural network model pruning according to claim 6, characterized in that: The step S54 further comprises: A sample subset is randomly collected from the validation set to optimize the loss function until the cross entropy between the prediction value and the label value of the validation set quantitative analysis converges to less than a third set threshold.
Citation Information
Patent Citations
Hyperspectral band selection method based on separable convolution and hard threshold function
CN109344698A
Knowledge distillation-based hyperspectral image unsupervised waveband selection method and system
CN113470036A
Hyperspectral band selection method and device based on Transform network
CN115641503A
Gabor cube feature selection-based classification method and system for hyperspectral remote sensing images
US20180268195A1
Cited By
Intelligent screening system and method for peony damp-heat-resistant offspring based on data analysis
CN118861901A
Mars surface mineral characteristic wave band screening method
CN119249123A
Hyperspectral face spoofing detection method based on band selection
CN119832611A
Neural network construction method for hyperspectrum and laser radar fusion classification
CN120259794A
Method and device for identifying traditional Chinese medicine decoction pieces based on multispectrum
CN121121229A
