Spectral processing method suitable for convolutional neural network
By screening out characteristic wavelength points with high correlation with the target sample, and combining multiple preprocessing methods and random sequence sorting to generate a multi-dimensional spectral matrix, the problem of convolutional neural networks being difficult to capture the characteristic wavelength of spectral dispersion is solved, achieving higher spectral analysis accuracy and model efficiency.
Patent Information
- Application Number
- CN202510290123.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-27
AI Technical Summary
Existing convolutional neural networks are difficult to capture the characteristic wavelengths of spectral dispersion when processing spectral data, resulting in low accuracy of analysis and processing results.
By setting the target sample variables, using a competitive adaptive reweighting algorithm to filter out feature wavelength points with high correlation with the sample target variables, combining multiple preprocessing methods and random sequence sorting, a multi-dimensional spectral matrix is generated, and grouped convolutional blocks are introduced into the convolutional neural network for training.
The feature extraction capability of convolutional neural networks when processing spectral data is improved, the accuracy of the model's spectral analysis processing results is improved, the number of model parameters is reduced, and overfitting is prevented.
Smart Images

Figure CN120217153A_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical field of spectral data processing, and particularly relates to a spectral processing method suitable for convolutional neural networks. Background Art
[0002] Spectral analysis technology is widely used in fields such as chemistry, biology, and environmental monitoring. In particular, near-infrared spectroscopy (NIR) analysis technology has become an important analysis tool in many industries due to its fast, non-destructive, and efficient characteristics. However, the processing and analysis of spectral data face many challenges, especially feature extraction and model optimization problems.
[0003] Traditional near-infrared spectroscopy analysis methods usually rely on classical algorithms such as partial least squares (PLS). Although these methods perform well in some scenarios, they are often difficult to capture the non-linear relationships in the data when dealing with complex spectral data.
[0004] In recent years, deep learning (DL) technology, especially convolutional neural networks, has shown significant advantages in spectral data processing. Convolutional neural networks can deeply extract features in the spectrum. However, existing convolutional neural networks have certain limitations when processing one-dimensional spectral data. Since the characteristic wavelengths of spectral data may be distributed at any position in the spectrum, especially in each process of the liquor industry, whether it is fermented grains, Daqu, or finished liquor, the substances contained are relatively complex and diverse, and cannot be explained by a single absorption peak. And the characteristic wavelengths of spectral data are generally scattered, so it is difficult for convolution operations to effectively capture these scattered features. In the prior art, the following two methods are usually used to process one-dimensional spectral data:
[0005] 1. Directly using a one-dimensional convolutional neural network: This method has poor effects because the convolution kernel is difficult to capture the scattered characteristic wavelengths in the spectrum.
[0006] 2. Folding one-dimensional data into two-dimensional data: This method improves the spectral processing effect to a certain extent, but still cannot completely solve the problem of scattered characteristic wavelengths.
[0007] In addition, spectral preprocessing is an important link in spectral data modeling. Traditional preprocessing methods such as standard normal variate transformation (SNV) and multiplicative scatter correction (MSC) can improve the convergence speed of the model, but cannot fundamentally solve the problem of scattered characteristic wavelengths. Summary of the Invention
[0008] The technical problem to be solved by the present invention is: to provide a spectral processing method suitable for convolutional neural networks, aiming to solve the problem that when the neural network processes spectral data, it is difficult to capture the scattered characteristic wavelengths of the spectrum, and the accuracy of the analysis and processing results of the spectrum is not high.
[0009] The technical solution adopted by the present invention to solve the above technical problems is as follows:
[0010] A spectral processing method applicable to a convolutional neural network, the method comprising:
[0011] Step 1: Set a target sample variable, and based on the target sample variable, screen out a wavelength points with high correlation with the sample target variable from M wavelength points of the original spectrum as characteristic wavelength points through a competitive adaptive reweighting algorithm, and set the characteristic wavelength points as a fixed wavelength point combination;
[0012] Step 2: Process the original spectrum according to multiple preprocessing methods respectively, and generate a new spectrum after each preprocessing method;
[0013] Step 3: Sort the fixed wavelength point combination and the remaining M - a wavelength points of the original spectrum and each spectrum after preprocessing according to K generated random sequences respectively to generate spectral matrix data;
[0014] Step 4: Train the convolutional neural network based on the generated spectral matrix data.
[0015] Further, step 1 specifically includes: taking M wavelength points in the original spectrum as initial candidate wavelength points, setting the number of iterations of the competitive adaptive reweighting algorithm and the number of wavelength points retained in each iteration. In each round of iteration, assign weights to all wavelength points according to the absolute value of the correlation regression coefficient between the wavelength point and the target sample variable, and screen out the wavelength points with weights higher than the set value from high to low as characteristic wavelength points, and then enter the next round of iteration until a characteristic wavelength points are screened out, and set the a wavelength points with weights higher than the set value as a fixed wavelength point combination.
[0016] Further, step 2 further includes: adding Gaussian noise to the spectrum after preprocessing to improve the anti-interference performance of the spectral data.
[0017] Further, in step 2, different preprocessing methods are selected according to the training purpose of the convolutional neural network by using an adaptive algorithm.
[0018] Further, the preprocessing methods in step 2 specifically include: standard normal variable transformation, multiplicative scatter correction, baseline correction, derivative, normalization, and mean centering.
[0019] Further, in step 3, a pseudo-random number algorithm is used to generate K random sequences each containing M data points.
[0020] Further, the value range of the number K of random sequences generated in step 3 is 0.5*M to 3*M.
[0021] Further, step 4 includes: adding a grouped convolution block to the convolutional neural network. If there are D types of preprocessing methods in step 1, then D + 1 channels are set in the grouped convolution block. The original spectral matrix generated by the random sequence and multiple preprocessed spectral matrices are respectively input into different channels of the grouped convolution block for convolution calculation. Based on the set calculation method for the output feature weights of the grouped convolution block channels, the fused features after weighting the output features of each channel of the grouped convolution block are calculated, and the fused features are used as the output of the grouped convolution block.
[0022] Further, the calculation method for the output feature weights of the grouped convolution block channels includes: ranking the preprocessed spectra and the original spectra in step 2 based on the prediction results of the classification or regression algorithm, numericalizing the ranking results as the weights of the output features of the channels corresponding to the respective spectra in the grouped convolution block, calculating the weighted fused features based on the weights of the output features of each channel, and using the fused features as the output of the grouped convolution block.
[0023] Further, during the training of the convolutional neural network in step 4, the parameters of the convolutional neural network are optimized based on the Adam optimizer, the cross-entropy function or the mean squared error is used as the loss function to evaluate the difference between the predicted value and the true value of the convolutional neural network, and dropout and L2 regularization are used to prevent the convolutional neural network from overfitting during the training process.
[0024] The beneficial effects of the present invention are as follows:
[0025] (1) Before training the convolutional neural network, the present invention processes the original spectra according to different preprocessing methods respectively, shuffles the spectral wavelength points after each preprocessing method through the generated random sequence, and integrates them into a multi-dimensional spectral matrix. Based on the generated multi-dimensional spectral matrix, the convolutional neural network is trained, which can integrate the advantages of different preprocessing methods, enable the data of different wavelength points of the spectrum to perform more effective information fusion in the convolutional neural network, enable the convolutional neural network to more effectively extract the features in the spectrum, improve the training accuracy of the convolutional neural network, and thus improve the accuracy of the spectral analysis and processing results of the trained convolutional neural network model;
[0026] (2) In the present invention, before generating the random sequence, the feature wavelength points with high correlation with the target sample are screened out and combined into a fixed wavelength combination. Based on the fixed wavelength combination, the random sequence is generated, which improves the probability of clustering of the wavelength points with high correlation with the target sample, and enables the convolution operation to more effectively capture the corresponding wavelength features during the training process of the convolutional neural network.
[0027] (3) By introducing grouped convolution blocks, the present invention processes the original spectral matrix and the preprocessed spectral matrix using independent convolutional kernels. On the one hand, each group of convolutional kernels can only perform operations within its own group, avoiding the interference of features between different preprocessing methods and ensuring that the original spectrum and spectral features obtained by various preprocessing methods can be fully and independently extracted. On the other hand, it can reduce parameter redundancy. Compared with traditional full-channel convolution, grouped convolution significantly reduces the number of model parameters, not only improving the computational efficiency but also effectively preventing overfitting. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flowchart of the spectral processing method applicable to a convolutional neural network according to the present invention;
[0029] Figure 2 is a schematic diagram of the generated original spectral matrix or preprocessed spectral matrix. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] As Figure 1 shown, the spectral processing method applicable to a convolutional neural network according to the present invention includes the following steps:
[0031] Step 1: Set the target sample variable. Based on the target sample variable, a competitive adaptive reweighted sampling algorithm is used to screen out a wavelength points with high correlation with the sample target variable from M wavelength points of the original spectrum as characteristic wavelength points, and the characteristic wavelength points are set as a fixed wavelength point combination.
[0032] Take the M wavelength points in the original spectrum as the initial candidate wavelength points. Set the number of iterations of the competitive adaptive reweighted sampling algorithm and the number of wavelength points retained in each iteration. In each round of iteration, weights are assigned to all wavelength points according to the absolute value of the correlation regression coefficient between the wavelength points and the target sample variable. After screening out the wavelength points with weights higher than the set value as characteristic wavelength points according to the weight size from high to low, enter the next round of iteration until a characteristic wavelength points are screened out, and the a wavelength points with weights higher than the set value are set as a fixed wavelength point combination.
[0033] In this embodiment, assume that the original spectrum has only 6 wavelength points, which are sequentially denoted as 1, 2, 3, 4, 5, 6, and the target sample variable Y is a one-dimensional vector of size (N, 1). The wavelength points 3 and 5 with high correlation with the sample target variable Y are screened out from the original spectrum, and then the characteristic wavelength points 3 and 5 are set as a fixed wavelength point combination. The order of the wavelength points within the fixed wavelength point combination can be randomly set.
[0034] Step 2: Preprocess the original spectrum according to multiple preprocessing methods respectively.
[0035] Suppose there are D ways to preprocess the original spectrum. Then, the original spectrum is preprocessed according to these D preprocessing methods respectively, and a new spectrum is obtained for each preprocessing method.
[0036] Add Gaussian noise to the original spectrum and the new spectrum data obtained by preprocessing to improve the anti-interference performance of the spectrum data.
[0037] In this embodiment, the preprocessing of the original spectrum includes standard normal variate transformation, multiplicative scatter correction, baseline correction, derivative, normalization, and mean centering of the original spectrum, etc. Among them, standard normal variate transformation is used to eliminate the influence of spectral scattering and particle size; multiplicative scatter correction is used to eliminate the influence of spectral scattering and particle size; baseline correction is used to remove the baseline interference of the spectrum; derivative processing includes first derivative and second derivative, which are used to enhance the subtle changes of the spectrum and eliminate baseline drift; normalization includes maximum and minimum normalization, which is used to unify the spectral intensity range; mean centering is used to eliminate systematic errors.
[0038] Step 3: Sort the combined fixed wavelength points and the remaining M - a wavelength points of each spectrum after preprocessing according to the generated K random sequences respectively, and generate the original spectrum and multiple preprocessed spectrum matrices as shown in Figure 2 the figure.
[0039] The random sequences are generated using a pseudo-random number algorithm. In this embodiment, the Fisher-Yates shuffle algorithm is used to generate random sequences. To ensure that each wavelength point has an equal probability of being selected to any position, the value range of K is preferably 0.5*M to 3*M. According to experimental verification, when the value of K is less than 0.5*M, the effect of random permutation is not obvious; when the value of K is greater than 3*M, the computational complexity increases significantly while the performance improvement is limited.
[0040] In this embodiment, the selected value of K is 3. Then, the Fisher-Yates shuffle algorithm is used to generate 3 random sequences, and the wavelength points in the original spectrum and the preprocessed spectrum are arranged according to the generated 3 random sequences respectively. At the same time, referring to the fixed wavelength points 3 and 5 generated in step 2, the 3 new spectra generated based on the random sequences in this embodiment are respectively denoted as Spectrum No. 1: 6, 4, 3, 5, 1, 2; Spectrum No. 2: 3, 5, 1, 2, 6, 4; Spectrum No. 3: 1, 3, 5, 6, 4, 2.
[0041] Step 4: Train the convolutional neural network based on the generated spectrum matrix data.
[0042] Add a grouped convolution block to the convolutional neural network. Input the original spectral matrix after random sequence generation and multiple preprocessed spectral matrices into different processing channels of the grouped convolution block, so that each group of channels only performs convolution calculations on one original spectral matrix or preprocessed spectral matrix. The specific structure of the convolutional neural network with the grouped convolution block is as follows:
[0043] Input layer: Receive spectral data of K*M*(D + 1) dimensions.
[0044] Convolution layer: In the convolution layer, set the grouped convolution block to divide the input D + 1 channels into D + 1 groups, and each group is processed separately; Convolution kernel setting: Use 2D convolution, set the convolution kernel size to (3, 3) (or (5, 5) can also be selected according to requirements), the stride is 1, and use appropriate padding (such as same padding). Each group of convolution kernels only operates within its own group; Output features: Each group generates several feature maps to ensure the independence of parameters between different groups.
[0045] Based on the prediction results of the classification or regression algorithm, rank the preprocessed spectra and the original spectra in step 2 in terms of superiority and inferiority. Numerically represent the ranking results of superiority and inferiority as the weights of the output features of the corresponding channels in the grouped convolution block for the spectra. Calculate the weighted fusion features based on the weights of the output features of each channel, and use the fusion features as the output of the grouped convolution block.
[0046] Assume that the output features of each group of channels in the grouped convolution block are F(1), F(2), ……, F(D + 1) respectively. Then the fused output feature F_fused of the grouped convolution block = 1×F(1) + 1 / 2×F(2)…1 / (D + 1)×(D + 1), where 1, 1 / 2, ……1 / (D + 1) are the weights of the corresponding channels.
[0047] Subsequent processing Batch normalization layer: Normalize the output features fused by the grouped convolution block to improve the training stability.
[0048] ReLU activation layer: Introduce non-linear activation to help the model capture more complex patterns.
[0049] Max pooling layer: Use a (2, 2) pooling window to perform dimensionality reduction and local invariance extraction on the feature maps.
[0050] Fully connected layer: 2 - 3 layers of fully connected networks for gradual dimensionality reduction.
[0051] Output layer: Set different activation functions according to the task type (regression or classification).
[0052] During the training process of the convolutional neural network, the Adam optimizer is used to optimize the parameters. The learning rate is set to 0.001, and a learning rate decay strategy is used. The loss function selects the mean squared error (MSE) or cross-entropy loss according to the task type. Dropout (ratio 0.3 - 0.5) and L2 regularization (coefficient 0.0001) are used to prevent the convolutional neural network from overfitting.
Claims
1. A spectral processing method suitable for convolutional neural networks, characterized in that: The method comprises: Step 1: Set the target sample variable. Based on the target sample variable, select a wavelength points with high correlation with the sample target variable from the M wavelength points of the original spectrum through a competitive adaptive reweighting algorithm as characteristic wavelength points, and set the characteristic wavelength points as a fixed wavelength point combination; Step 2: Process the original spectrum according to a plurality of preprocessing methods, and generate a new spectrum after each preprocessing method; Step 3: Sort the original spectrum, the fixed wavelength point combination of each spectrum after preprocessing, and the remaining Ma wavelength points according to the generated K random sequences to generate spectrum matrix data; Step 4: Train the convolutional neural network based on the generated spectral matrix data.
2. The spectrum processing method suitable for convolutional neural network according to claim 1, characterized in that: Step 1 specifically includes: taking the M wavelength points in the original spectrum as the initial candidate wavelength points, setting the number of iterations of the competitive adaptive reweighting algorithm and the number of wavelength points retained in each iteration, and in each round of iteration, assigning weights to all wavelength points according to the absolute value of the correlation regression coefficient between the wavelength point and the target sample variable, and selecting wavelength points with weights higher than the set value as characteristic wavelength points from high to low according to the weight size, and then entering the next round of iteration until a characteristic wavelength points are selected, and the selected a wavelength points with weights higher than the set value are set as the fixed wavelength point combination.
3. The spectrum processing method suitable for convolutional neural network according to claim 1, characterized in that: Step 2 also includes: adding Gaussian noise to the preprocessed spectrum to improve the anti-interference performance of the spectrum data.
4. The spectrum processing method suitable for convolutional neural network according to claim 3, characterized in that: In step 2, an adaptive algorithm is used to select different preprocessing methods according to the training purpose of the convolutional neural network.
5. The spectrum processing method suitable for convolutional neural network according to claim 4, characterized in that: Step 2 preprocessing methods include: standard normal variable transformation, multivariate scatter correction, baseline correction, derivative, normalization, and mean centering.
6. The spectrum processing method suitable for convolutional neural network according to claim 1, characterized in that: In step 3, a pseudo-random number algorithm is used to generate K random sequences containing M data points.
7. The spectrum processing method suitable for convolutional neural network according to claim 6, characterized in that: The number K of random sequences generated in step 3 ranges from 0.5*M to 3*M.
8. The spectrum processing method applicable to convolutional neural network according to claim 1, characterized in that: Step 4 includes: adding a grouped convolution block to the convolutional neural network, if the preprocessing method in step 1 includes D types, then setting D+1 channels in the grouped convolution block, inputting the original spectral matrix generated by the random sequence and multiple preprocessed spectral matrices into different channels of the grouped convolution block for convolution calculation, and calculating the weighted fusion features of the output features of each channel of the grouped convolution block based on the set grouped convolution block channel output feature weight calculation method, and using the fusion features as the output of the grouped convolution block.
9. The spectrum processing method applicable to convolutional neural network according to claim 8, characterized in that: The method for calculating the weight of the channel output feature of the grouped convolution block includes: sorting the spectrum preprocessed in step 2 and the original spectrum based on the prediction result of the classification or regression algorithm, digitizing the sorting result as the weight of the channel output feature corresponding to the corresponding spectrum in the grouped convolution block, calculating the weighted fusion feature based on the weight of each channel output feature, and using the fusion feature as the output of the grouped convolution block.
10. The spectrum processing method applicable to convolutional neural network according to claim 8 or 9, characterized in that: In step 4, during the training of the convolutional neural network, the parameters of the convolutional neural network are optimized based on the Adam optimizer, and the cross entropy function or mean square error is used as the loss function to evaluate the difference between the predicted value and the true value of the convolutional neural network. Dropout and L2 regularization are used to prevent the convolutional neural network from overfitting during the training process.
Citation Information
Cited By
Metallurgy field CO infrared telemetry identification method based on multi-characteristic spectrum fusion
CN122217901A