Near infrared spectrum classification and identification method based on WGAN-GP model considering spectrum first-order differential constraint
By introducing first-order differential constraints of spectrality in the WGAN-GP model, a more realistic near-infrared spectral curve is generated, which solves the problem of inaccurate classification and recognition results of spectral curves in traditional methods, and achieves higher classification and recognition accuracy.
Patent Information
- Application Number
- CN202411799511.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-28
AI Technical Summary
The traditional near-infrared spectral classification recognition method in the prior art has inaccurate results in the classification recognition of spectral curves due to low generation model accuracy.
Based on the WGAN-GP model considering the first-order differential constraints of the spectral, the WGAN-GP model and its target loss function are improved by adding the first-order differential vector of the spectral, and a more realistic near-infrared spectral curve is generated.
By introducing first-order differential constraints of the spectral model, the spectral curve quality of the generative model is improved, the accuracy of classification recognition is improved, and this effect is verified through experiments of multiple classifiers.
Smart Images

Figure CN119719928A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a near-infrared spectrum classification and recognition method, in particular to a near-infrared spectrum classification and recognition method based on a WGAN-GP model considering spectral first-order differential constraints, and belongs to the technical field of near-infrared spectrum classification and recognition. Background Art
[0002] In recent years, deep learning networks have developed rapidly and have been widely studied and applied in the field of computer vision image processing. In deep learning networks, generative models are an important research branch that can generate highly realistic natural scene images. There are many types of generative models. Typical generative models include mainstream models such as Generative Adversarial Networks (GAN) and Variational Auto-Encoder (VAE); among these generative models, the most representative is the generative adversarial network, which has many improved versions. For example, there are improved models such as Deep Convolutional GAN (DCGAN) combined with convolutional neural network, Boundary Equilibrium GAN (BEGAN) with a new training mechanism, and Wasserstein GAN (WGAN) with Wasserstein distance. These improved models mainly solve the problem of convergence difficulties in the training process of generative adversarial networks, including falling into local minima, gradient vanishing, gradient exploding, etc.
[0003] However, the research and application of the above-mentioned generative models in the field of spectral analysis are still relatively rare. There are only a few literature reports on the classification and recognition of 1D (one dimension) spectral curves, and the specific characteristics of 1D spectral curves are not considered to improve the GAN model. In fact, the spectral curve is a 1D signal, which is different from a 2D image. Many GAN improved models in the field of computer vision image processing are directly applied to the field of spectral analysis (such as 1D spectral curve classification and recognition), but generally cannot achieve ideal processing effects.
[0004] At the same time, in the field of 1D near-infrared spectral curve classification and recognition research, the trend of the spectral curve is an important classification feature, which contains important separability information. The trend characteristics of the spectral curve are mainly reflected in the differential information of the curve in mathematics; the spectral differential method can effectively improve the classification and recognition accuracy of the spectral curve of the relevant materials, but there is currently no GAN model that combines the first-order differential of the spectrum.
[0005] In summary, a near-infrared spectral classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum is needed. Summary of the invention
[0006] A brief overview of the present invention is provided below in order to provide a basic understanding of certain aspects of the present invention. It should be understood that this overview is not an exhaustive overview of the present invention. It is not intended to identify key or important parts of the present invention, nor is it intended to limit the scope of the present invention. Its purpose is merely to present certain concepts in a simplified form as a prelude to a more detailed description discussed later.
[0007] In view of this, in order to solve the problem of inaccurate spectral curve classification and recognition results caused by low generation model accuracy in traditional near-infrared spectral classification and recognition methods in the prior art, the present invention provides a near-infrared spectral classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum.
[0008] The technical solution is as follows:
[0009] S1. Based on the WGAN-GP model and its target loss function, by adding the spectral first-order differential vector, the improved WGAN-GP model considering the spectral first-order differential constraint and its target loss function are obtained;
[0010] S2. Generate near-infrared spectral curves by considering the WGAN-GP improved model with the first-order differential constraint of the spectrum, and integrate them into the generated spectral dataset;
[0011] S3. Use part of the generated spectral dataset and the original spectral dataset as the training set of the classifier, use part of the original spectral dataset as the test set of the classifier, and let the classifier output the near-infrared spectral classification and recognition result.
[0012] Furthermore, in S1, the objective loss function L of the WGAN-GP model is expressed as:
[0013]
[0014] Where x is the original spectral vector, D(x) represents the score of the discriminator on the original spectral vector x, τ is the coefficient, P g represents the WGAN-GP model distribution, P r represents the data distribution, represents random sampling of the original spectral vector x, is the spectral vector for random sampling The corresponding gradient of Represents the discriminator for the generated spectral vector Ratings, Represents the discriminator for the randomly sampled spectral vector 's score, E represents the mathematical expectation operation.
[0015] The objective loss function L′ of the WGAN-GP improved model considering the spectral first-order differential constraint is expressed as:
[0016]
[0017] Among them, z is the new vector, z = x ~ x', x' is the first-order differential vector of the spectrum, the dimension of the new vector z is twice that of the original spectrum vector x, and D(z) represents the score of the discriminator for the new vector z. Represents the new vector Random sampling, is the new vector for random sampling The corresponding gradient of Represents the discriminator for the generated new vector Ratings, Represents the discriminator for a new vector randomly sampled 's rating.
[0018] The beneficial effects of the present invention are as follows: the present invention takes into account that the first-order differential characteristics of the spectrum reflect the trend of the spectrum curve, and the trend characteristics play an important role in the classification and recognition of near-infrared spectra. Therefore, the original WassersteinGAN with Gradient Penalty (WGAN-GP) model is improved, and the first-order differential constraint of the spectrum is added to generate a near-infrared spectrum curve with better quality and more realistic. In order to objectively and quantitatively evaluate the quality of the artificially synthesized spectrum curve, three evaluation indicators, namely the vector difference 1 norm, 2 norm and Inception Score, are used. The evaluation results show that the quality of the spectrum curve generated by the differential constraint WGAN-GP model is better than that of the original WGAN-GP model. In addition, three different classifiers, namely Support Vector Machine (SVM), 1D Convolutional Neural Network (1D-CNN) and LeNet-5 deep network, are used to carry out classification and recognition experiments on wood spectrum data sets and apple spectrum data sets. The experimental results once again show that after the spectrum curve generated by the differential constraint WGAN-GP model is used to expand the training set, the classification accuracy of the classifier is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 It is a flowchart of the near infrared spectrum classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum;
[0021] Figure 2 It is a schematic diagram of an embodiment of a near infrared spectrum classification and recognition method based on a WGAN-GP model taking into account the first-order differential constraint of the spectrum;
[0022] Figure 3 is a schematic diagram of the original near-infrared spectrum curve;
[0023] Figure 4 It is a schematic diagram of the first-order differential curve of the original near-infrared spectrum curve;
[0024] Figure 5 This is a schematic diagram of a spectral curve obtained by connecting the original near-infrared spectral curve and the first-order differential curve of the original near-infrared spectral curve in series. DETAILED DESCRIPTION
[0025] In order to make the technical solutions and advantages of the embodiments of the present invention more clearly understood, the exemplary embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0026] refer to Figure 1-Figure 5 The present embodiment is described in detail. The near infrared spectrum classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum specifically includes the following steps:
[0027] S1. Based on the WGAN-GP model and its target loss function, by adding the spectral first-order differential vector, the improved WGAN-GP model considering the spectral first-order differential constraint and its target loss function are obtained;
[0028] S2. Generate near-infrared spectral curves by using the WGAN-GP improved model considering the first-order differential constraint of the spectrum, integrate them into the generated spectral dataset, and evaluate the quality of the generated NIR spectral curves;
[0029] S3. Use part of the generated spectral dataset and the original spectral dataset as the training set of the classifier, use part of the original spectral dataset as the test set of the classifier, and let the classifier output the near-infrared spectral classification and recognition result.
[0030] Furthermore, in S1, the objective loss function L of the WGAN-GP model is expressed as:
[0031]
[0032] Among them, the target loss function L needs to be minimized and optimized, x is the original spectral vector, D(x) represents the score of the discriminator on the original spectral vector x, τ is the coefficient, P g represents the WGAN-GP model distribution (Generator distribution), P r represents the data distribution (true distribution), It represents random sampling of the original spectral vector x. The third term in the corresponding formula is the added GradientPenalty term. The third term is multiplied by the coefficient τ. is the spectral vector for random sampling The corresponding gradient of Represents the discriminator for the generated spectral vector Ratings, Represents the discriminator for the randomly sampled spectral vector 's score, E represents the mathematical expectation operation.
[0033] The objective loss function L′ of the WGAN-GP improved model considering the spectral first-order differential constraint is expressed as:
[0034]
[0035] Among them, z is the new vector, z = x ~ x', x' is the first-order differential vector of the spectrum, the dimension of the new vector z is twice that of the original spectrum vector x, and D(z) represents the score of the discriminator for the new vector z. Represents the new vector Random sampling, is the new vector for random sampling The corresponding gradient of Represents the discriminator for the generated new vector Ratings, Represents the discriminator for a new vector randomly sampled 's rating.
[0036] Specifically, in this embodiment, the original model WGAN-GP of a single category is improved by adding a spectral first-order differential constraint. Considering that the trend of the 1D spectral curve is an important classification feature, it contains important separability information, and the trend characteristics of the spectral curve should be considered in the WGAN-GP model, and the trend characteristics of the spectral curve are mainly reflected in the first-order differential information of the curve. Therefore, the present invention proposes an improved WGAN-GP model considering the spectral first-order differential constraint, corrects the target loss function L of the WGAN-GP model, and obtains the target loss function L′ of the improved WGAN-GP model considering the spectral first-order differential constraint. Among them, taking the near-infrared spectrum curve of wood species samples as an example, x represents the original spectral vector of 128D, and a spectral first-order differential vector x' is added, each of which is dx / ds, x is the component of the original spectral vector x, which represents the original spectral reflectance, and s is the corresponding spectral wavelength. Then, the two vectors x and x' are connected to generate a new vector of 256D series synthesis, that is, z=x~x'. The first half of the new vector z is x and the second half is x'. The new vector z is used to train the WGAN-GP model and generate a near-infrared (NIR) spectral curve. Finally, in the artificially synthesized 256D spectral vector, only the first half of the 128D spectral vector is retained to form an artificially synthesized spectral curve, that is, the generated spectral data set is obtained;
[0037] In S3, the specific steps of collecting the original spectral data set and using the original spectral data set to expand the training set are as follows: collecting the near-infrared spectral curve of the wood species sample, using the Ocean Optics Flame-NIR micro-fiber spectrometer of the American Ocean Company, the experimental device consists of a computer, a spectrometer, a halogen lamp, an optical fiber, a bracket, etc., the sample to be tested is placed on the bracket of the spectrometer, the surface to be tested is the cross-section of the wood sample, the optical fiber probe is about 5mm away from the surface of the object to be tested, the diameter of the circular field of view is 6.35mm, the mirror reflection method is used, the spectral band range is 950-1650nm, and the sampling interval is 5.4nm;
[0038] Before collecting spectra, spectral whiteboard correction and dark correction are required. The whiteboard correction uses a standard polytetrafluoroethylene whiteboard as the background, and the dark correction is performed in a light-shielding manner. At the same time, the electronic dark noise correction and stray light correction buttons need to be turned on. The parameters in the supporting software SpectraSuite are set as follows: the integration time is 600ms, the average is obtained by repeating the scan 900 times, and the smoothness is 5. When collecting samples, 4 points are randomly selected on the cross section of each sample for spectral collection and the average value is calculated. A standard whiteboard correction is required after every 5 samples are measured. The wood species data set includes 20 wood species categories, a total of 1000 spectral curves, and the corresponding near-infrared spectral vector is 128D, and each wood species includes 50 spectral curves;
[0039] The near-infrared spectral curves of apple samples were collected using an open source dataset on the Internet. The dataset was obtained by using ASD's FieldSpecR full-band micro-fiber spectrometer to collect apple leaves. The original spectral band range was 350-2500nm, and the corresponding full-band spectral vector was 2151D. In order to maintain consistency with the wood species spectral dataset, the spectral band was 950-1650nm, and the sampling interval was 4nm. The near-infrared spectral vector was 175D. The apple category dataset includes 10 apple categories, a total of 1000 spectral curves, and each apple category includes 100 spectral curves.
[0040] When using the improved WGAN-GP model with added spectral first-order differential constraints, each original near-infrared spectral curve will generate 5 artificial synthetic spectral curves, and 5,000 artificial synthetic spectral curves for wood species and apple categories will be generated respectively, and put into the training set of the classifier for training set expansion.
[0041] In S2, the process of performing quality evaluation on the generated near infrared spectrum curve is as follows:
[0042] In order to objectively and quantitatively evaluate the quality of the near-infrared spectral curve generated by the WGAN-GP improved model considering the first-order differential constraint of the spectrum, three quantitative indicators are used for evaluation. Refer to Table 1 for the comparison of the quality evaluation indicators of the near-infrared spectral curves generated by the original WGAN-GP and the WGAN-GP improved model. Among them, the formula represents the 1-norm of the difference between two vectors. The first vector y represents the near-infrared spectrum of an original wood or apple sample. is the artificial spectrum corresponding to the first vector y. A first vector y is generated by the WGAN-GP improved model. A first vector y can eventually calculate 5 Since the original wood or apple dataset has 1000 spectral curves, and the WGAN-GP improved model will generate 5000 artificial spectral curves of wood or apple respectively, the formula 5000 1-norm values are calculated, and then these 5000 1-norm values are approximated as normal distributions. After solving the corresponding means and standard deviations, they are listed in Table 1;
[0043] Another evaluation indicator is the formula It represents the 2-norm of the difference between two vectors. The calculation method and formula are same;
[0044] The third evaluation indicator is Inception Score. The calculation requires the use of the deep network InceptionNet-V3, which is a 2D image classification network trained on the ImageNet database. In this embodiment, the 2D InceptionNet-V3 network is replaced by a 1D Convolutional Neural Network (1D-CNN). The indicator is a statistic without a mean and standard deviation. Among the three evaluation indicators, the smaller the values of the first two indicators, the better, indicating that the closer the artificially synthesized spectral curve is to the original spectral curve, and the larger the value of the third indicator Inception Score, the better, which considers two factors: first, whether the generated spectral curve is clear (specifically, a clear spectral curve has a high probability of belonging to a certain category, and a low probability of belonging to other categories, that is, the entropy of the probability distribution of each category is small); second, whether the generated spectral curve is diverse (specifically, the model generates sufficiently diverse spectral curves, and its distribution in each category should be averaged). Therefore, considering the three evaluation indicators comprehensively, it can be seen that in the two near-infrared spectral data sets, the WGAN-GP improved model is superior to the original WGAN-GP model, that is, the WGAN-GP improved model proposed in the present invention can generate better quality and more realistic artificially synthesized near-infrared spectral curves;
[0045] Table 1
[0046]
[0047] In S3, this embodiment uses Support Vector Machine (SVM) classifier, 1D-CNN classifier classification experiment and LeNet-5 classifier for classification experiments, as follows:
[0048] (1) Support Vector Machine (SVM) classifier classification experiment:
[0049] For the LibSVM classifier, the training set is 70% (700 spectral curves) of the original spectral data set plus 70% (3500 spectral curves) of the generated spectral data set; the test set is the remaining 30% (300 spectral curves) of the original data set. The grid method is used to search for the optimal parameters of LibSVM. Referring to Table 2, the classification accuracy of the SVM classifier caused by the original and WGAN-GP improved model spectral curves after the training set expansion is compared. It can be seen that the near-infrared spectral curves generated by the differential constraint WGAN-GP model can better improve the generalization classification ability of the classifier after being added to the training set, thereby achieving a higher classification accuracy.
[0050] Table 2
[0051]
[0052] (2) 1D-CNN classifier classification experiment:
[0053] For the 1D-CNN classifier, the training set is 70% of the original spectral dataset (700 spectral curves) plus 70% of the generated dataset (3500 spectral curves), the validation set is 20% of the original dataset (200 spectral curves) plus 20% of the generated dataset (1000 spectral curves), and the test set is the remaining 10% of the original dataset (100 spectral curves). The model structure of 1D-CNN is a structure of 5 convolutional layers and 5 pooling layers, the convolution kernel is 2×1, and the number is 16, 32, and 6 respectively. 4, 32, 16; step size 1, padding 0, pooling selects maximum pooling, size is 2×1, step size 1, padding 0; initial learning rate 0.005, learning rate reduction factor 0.2, refer to Table 3, the original and WGAN-GP improved model generated spectral curves are used to expand the training set to cause the 1D-CNN classifier classification accuracy to be compared. From the classification accuracy of the test set, it can be seen that the near-infrared spectral curve generated by the WGAN-GP improved model can better improve the generalization classification ability and classification accuracy of the classifier after being added to the training set.
[0054] Table 3
[0055]
[0056] (3) LeNet-5 classifier classification experiment:
[0057] For the LeNet-5 deep network image classifier, the training set is 70% of the original spectral dataset (700 spectral curves) plus 70% of the generated dataset (3500 spectral curves), and the test set is the remaining 30% of the original dataset (300 spectral curves). The spectral vector of the wood dataset 128D is converted to a 10×10 grayscale image, and the spectral vector of the apple dataset 2151D is converted to a 45×45 grayscale image. The LeNet-5 convolutional neural network is used, and the network structure is a 3-convolution layer and 2-pooling layer structure. The convolution kernel is 5×5, and the number is 6, 16, and 120 respectively; the pooling selects the maximum pooling, the size is 2×2, the step size is 2, and no 0 is filled. The initial learning rate is 0.01, and the Adam adaptive learning rate adjustment method is used. The BatchSize is 20. Referring to Table 4, the classification accuracy of the LeNet-5 classifier caused by the original and WGAN-GP improved model spectral curves after the training set expansion is compared. It can be seen that after the 128D vector of the original wood near-infrared spectrum is converted into a 10×10 grayscale image, the corresponding test set classification accuracy is relatively low, basically maintained at around 26% to 28%; the improvement effect of the WGAN-GP improved model is not obvious. Analyzing the reason, we believe that the dimension of the 128D vector of the near-infrared spectrum is too small. After being converted into a very small grayscale image, the extracted convolutional features are not comprehensive and accurate enough. As a result, the classification accuracy of the test set in these three cases is relatively low. In order to objectively evaluate the classification effect of the LeNet-5 convolutional network on wood spectra, the corresponding visible light / near-infrared spectral data sets of the 20 wood species are supplemented. The American Ocean Optics USB2000-VIS-NIR micro-fiber spectrometer is used, with a spectral band range of 376-1026nm, a spectral resolution of 0.33nm, and a corresponding spectral vector of 1950D. After deleting the noise bands at both ends, it is converted into a 40×40 grayscale image. The classification accuracy of the test set in these three cases is shown in the middle three rows of Table 4. It can be seen that the classification accuracy of the LeNet-5 convolutional network at this time is greatly improved, and the classification accuracy of the WGAN-GP improved model is the highest, which once again verifies the high-precision characteristics of the WGAN-GP improved model proposed in the present invention.
[0058] Table 4
[0059]
[0060] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.
Claims
1. A near-infrared spectrum classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum, characterized in that: The following steps are involved: S1. Based on the WGAN-GP model and its target loss function, by adding the spectral first-order differential vector, the improved WGAN-GP model considering the spectral first-order differential constraint and its target loss function are obtained; S2. Generate near-infrared spectral curves by considering the WGAN-GP improved model with the first-order differential constraint of the spectrum, and integrate them into the generated spectral dataset; S3. Use part of the generated spectral dataset and the original spectral dataset as the training set of the classifier, use part of the original spectral dataset as the test set of the classifier, and let the classifier output the near-infrared spectral classification and recognition result.
2. The near infrared spectrum classification and recognition method based on the WGAN-GP model considering the first-order differential constraint of the spectrum according to claim 1 is characterized in that: In S1, the objective loss function L of the WGAN-GP model is expressed as: Where x is the original spectral vector, D(x) represents the score of the discriminator on the original spectral vector x, τ is the coefficient, P g represents the WGAN-GP model distribution, P r represents the data distribution, represents random sampling of the original spectral vector x, is the spectral vector for random sampling The corresponding gradient of Represents the discriminator for the generated spectral vector Rating, Represents the discriminator for the randomly sampled spectral vector 's score, E represents the mathematical expectation operation. The objective loss function L' of the WGAN-GP improved model considering the spectral first-order differential constraint is expressed as: Among them, z is the new vector, z = x ~ x', x' is the first-order differential vector of the spectrum, the dimension of the new vector z is twice that of the original spectrum vector x, and D(z) represents the score of the discriminator for the new vector z. Represents the new vector Random sampling, For the new vector The corresponding gradient of Represents the discriminator for the generated new vector Rating, Represents the discriminator for a new vector randomly sampled 's rating.