Substance content prediction method based on near infrared spectrum and computer equipment
The characteristics of the near-infrared spectrum are extracted through continuous wavelet transformation and a two-dimensional spectrum map is generated, and the material content prediction is predicted by combining the deep learning model, which solves the problem of low prediction accuracy of one-dimensional near-infrared spectrum, achieving higher prediction accuracy and richer spectral feature representation.
Patent Information
- Application Number
- CN202411564896.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-28
AI Technical Summary
The deep learning algorithm model is used to directly extract and image processing of one-dimensional near-infrared spectra, resulting in low prediction accuracy of substance content.
Feature extraction of the near-infrared spectrum is performed through continuous wavelet transformation, wavelet coefficients at different scales and wave numbers are generated, and wavelet coefficients are mapped into two-dimensional spectrograms, and predictions are made in combination with deep learning models (such as EfficientNetV2).
The prediction accuracy of target substance content is improved, the problem of insufficient one-dimensional near-infrared spectral data is solved, and a richer spectral feature representation is provided.
Smart Images

Figure CN119534390A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of content prediction, and in particular relates to a material content prediction method and computer equipment based on near infrared spectroscopy. Background Art
[0002] Near infrared spectrometers are known for their non-invasiveness and rapid capabilities and have been widely used to determine the composition of various substances in various application scenarios, including offline and online settings. Current near infrared instruments can quickly provide massive amounts of data, which need to be accurately and efficiently processed to produce useful analytical information. Therefore, near infrared spectroscopic chemometric models need to be developed to extract as much relevant information as possible from the analytical data. Models usually include partial least squares regression, artificial neural networks, and deep learning. Among them, partial least squares regression has been proven to be an effective modeling method for near infrared spectra due to its sensitivity to multicollinearity between wavenumbers. However, building a robust partial least squares regression model requires finding the best principal components and latent variables, which takes a lot of time and effort. In contrast, deep learning algorithms have the advantages of automatically extracting features and effectively processing complex image data. The effectiveness of deep learning algorithms is highly related to the completeness of the input data representation. However, the information contained in one-dimensional near infrared spectra may not be sufficient to predict the content of target compounds because its data source is the overtones and combinations of functional group vibrations, which will affect the performance of content prediction using deep learning algorithms. Summary of the invention
[0003] The purpose of the present invention is to provide a substance content prediction method and computer equipment based on near-infrared spectroscopy, so as to solve the problem of low substance content prediction accuracy caused by directly performing feature extraction and image processing on one-dimensional near-infrared spectra using a deep learning algorithm model.
[0004] In order to solve the above technical problems, the present invention provides a substance content prediction method based on near-infrared spectroscopy, comprising the following steps: 1) obtaining a near-infrared spectrum of a sample to be tested; regarding the wavenumber in the near-infrared spectrum as time, and then using continuous wavelet transform to extract features of the near-infrared spectrum, and extracting wavelet coefficients at different scales and different wavenumbers; 2) mapping the extracted wavelet coefficients at different scales and different wavenumbers into a two-dimensional spectrum graph; 3) inputting the two-dimensional spectrum graph into a substance content prediction model corresponding to the target substance to predict the content of the target substance in the sample to be tested; wherein the substance content prediction model is obtained by training a deep learning model using a two-dimensional spectrum graph containing multiple samples and a data set of the target substance content in the samples.
[0005] Furthermore, the extracted wavelet coefficients at different scales and wavenumbers are mapped into a two-dimensional spectrum diagram by using a direct digital mapping method or a pseudo color mapping method; when using the direct digital mapping method, the position of each point in the two-dimensional spectrum diagram is determined by the scale and wavenumber, and the pixel value of each point is determined by the wavelet coefficient corresponding to the scale and wavenumber that determine the position of the point; when using the pseudo color mapping method, the vertex position of each grid unit in the two-dimensional spectrum diagram is determined by the scale and wavenumber, the pixel value of each grid unit is determined by the wavelet coefficient corresponding to the scale and wavenumber that determine the vertex position of the grid unit, and the pixel values between the grid units are determined by the interpolation method.
[0006] Furthermore, when determining the pixel value, the wavelet coefficients are mapped using the Gray color mapping method or the Jet color mapping method.
[0007] Furthermore, the wavelet function used in the continuous wavelet transform is a non-orthogonal wavelet function.
[0008] Furthermore, the non-orthogonal wavelet function is a complex wavelet function.
[0009] Furthermore, the complex wavelet function is a Cmor wavelet function.
[0010] Furthermore, the bandwidth and frequency center of the Cmor wavelet function are determined in the following manner: determine the absolute values of the wavelet coefficients corresponding to different bandwidths and frequency centers, select the largest absolute value of the wavelet coefficients, and the bandwidth and frequency center corresponding to the selected value are the bandwidth and frequency center of the Cmor wavelet function finally determined.
[0011] Furthermore, different scales include S0, S1, ... S j ……、S J , j = 0, 1, ..., j, S0 represents the minimum resolvable scale, S J represents the maximum scale, δ j represents the scale resolution, δ t represents the wavelength interval and N represents the wave number.
[0012] Furthermore, the deep learning model is a convolutional neural network model.
[0013] Furthermore, the convolutional neural network model is EfficientNetV2.
[0014] Furthermore, the two-dimensional spectrum graph included in the data set is a two-dimensional spectrum graph after SG smoothing processing.
[0015] To solve the above technical problem, the present invention further provides a computer device, including a processor, which executes a computer program to implement the steps of the above-mentioned method.
[0016] The present invention is an improved invention creation, and the beneficial effect is: when the content of the target substance is predicted based on the deep learning model, the present invention no longer directly uses the one-dimensional near-infrared spectrum as the input of the trained deep learning model, but extracts the features of the one-dimensional near-infrared spectrum, and uses the extracted features as the input of the trained deep learning model. Specifically, the near-infrared spectrum is feature extracted by continuous wavelet transform, and the feature information of the time domain and frequency domain of the near-infrared spectrum is fully extracted by continuous wavelet transform and the corresponding wavelet coefficients are generated. The wavelet coefficients can show more abundant spectral information of different resolutions, and then generate a two-dimensional spectrum map based on the information. The two-dimensional spectrum map can fully reflect the useful information contained in the one-dimensional near-infrared spectrum, and intends to provide a richer spectral feature representation. On this basis, the two-dimensional spectrum map is input into the substance content prediction model corresponding to the target substance (obtained by training the deep learning model), and the content of the target substance contained in the sample to be tested can be effectively predicted, which improves the prediction accuracy of the target substance content and solves the technical problem that the data source of the one-dimensional near-infrared spectrum is limited to the overtones and combinations of group vibrations in the prior art and is not enough to accurately predict the content of the target substance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is an implementation flow chart of the substance content prediction method based on near infrared spectroscopy introduced in the method embodiment of the present invention;
[0018] Figure 2 is a flow chart of the progressive screening strategy used in the embodiment of the method of the present invention;
[0019] Figure 3 This is a diagram of the EfficientNetV2 model architecture used in the embodiment of the method of the present invention;
[0020] Figure 4 This is a flow chart of model training verification and testing of EfficientNetV2 in an embodiment of the method of the present invention;
[0021] Figure 5 is a 3D graph of wavelet coefficients after continuous wavelet transform in an embodiment of the method of the present invention;
[0022] Figure 6 is a correlation diagram between the target substance content and the wavelet coefficient in an embodiment of the method of the present invention;
[0023] Figure 7 Schematic diagram of the absolute value of the maximum wavelet coefficient of various wavelet functions in the embodiment of the method of the present invention;
[0024] Figure 8It is a schematic diagram of the correlation with wavelet coefficients corresponding to the original spectrum, the spectrum after MSC treatment, the spectrum after SNV treatment, and the spectrum after SG treatment respectively, which are shown by taking neochlorogenic acid as an example in the embodiment of the method of the present invention. DETAILED DESCRIPTION
[0025] The core concept of the present invention is to use continuous wavelet transform to extract features from the near-infrared spectrum of the sample to be tested, extract wavelet coefficients at different scales and wave numbers, and map the extracted results into a two-dimensional spectrum diagram, and then combine the two-dimensional spectrum diagram with the deep learning model to predict the content of the target substance in the sample to be tested. This method uses continuous wavelet transform to extract richer spectral information of different resolutions to generate a two-dimensional spectrum diagram, providing a richer spectral feature representation to improve the accuracy of substance content prediction. Based on this concept, a substance content prediction method based on near-infrared spectroscopy and a computer device of the present invention can be realized.
[0026] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
[0027] Method Example:
[0028] The following takes tobacco leaves as the detected object, and the content of target chemical substances (such as neochlorogenic acid) in tobacco leaves is detected as an example to illustrate the implementation process of a substance content prediction method based on near infrared spectroscopy of the present invention. The flow chart is as follows: Figure 1 Of course, the object to be detected in the method of the present invention can also be other objects, but the principle of the specific implementation process is the same.
[0029] Step 1: Collect multiple representative tobacco samples and extract near-infrared spectral data and corresponding chemical substance content data of each tobacco leaf sample.
[0030] After extracting the near-infrared spectrum, an optimized processing method is to first perform SG smoothing (Savitzky-Golay, also known as polynomial smoothing or convolution smoothing) on it. This process aims to eliminate multicollinearity and enhance the correlation between the target substance content and each data point, thereby improving the prediction performance of the model.
[0031] Step 2: The wave number in the near-infrared spectrum extracted in step 1 is regarded as time, and the near-infrared spectrum is feature extracted using continuous wavelet transform (CWT) to obtain wavelet coefficients at different scales and different wave numbers.
[0032] Finally, it can be presented in the form of wavelet coefficient matrix (CWT coefficient matrix). The 3D graph of wavelet coefficients after continuous wavelet transform is as follows: Figure 5 shown.
[0033] Continuous wavelet transform is a multi-resolution analysis method, which is often used to decompose time series vectors into coefficient matrices to analyze signals of different frequencies at different resolutions. A time series represents a collection of values obtained from continuous measurements over time, while the near-infrared spectrum represents absorbance values at different wave numbers. The continuous wavelet transform introduces the concept of scale as an alternative to frequency and maps the time series to the time scale plane. The wave number axis in the near-infrared spectrum is regarded as the time axis in the time series, and the formula for continuous wavelet transform data processing is as follows:
[0034]
[0035] Where W f (a, b) represents the wavelet coefficients, f(λ n ) represents the near infrared spectral function, λ n represents the spectral wavelength point, ψ * represents the wavelet function, a represents the displacement factor, and b represents the scale.
[0036] In order to give full play to the effectiveness of continuous wavelet transform, it is necessary to determine the optimal scale value in the continuous wavelet transform process. In this embodiment, a progressive screening strategy is selected, and its specific process is as follows: Figure 2 As shown, rather than relying on experience selection. The specific process of this strategy is as follows:
[0037] 1) Establish a candidate library of wavelet functions, which covers all wavelet functions, to select from. This approach ensures that a wide range of potential wavelet functions are considered in the analysis.
[0038] 2) Based on the orthogonality and non-orthogonality of wavelet functions, non-orthogonal wavelet functions are selected.
[0039] According to the computational characteristics of the wavelet function, a larger scale will reveal more low-frequency information, while a smaller scale value will reveal more high-frequency information. Although both orthogonal wavelets and non-orthogonal wavelets are used for signal processing, they process data in different ways. According to the orthogonality and non-orthogonality of the wavelet function, the wavelet spectrum generated by the orthogonal wavelet analysis has a discrete wavelet power block, that is, the wave spectrum generated by the orthogonal wavelet analysis presents a discrete "block" wavelet power, which causes periodicity and discontinuity during spectrum analysis; and the non-orthogonal analysis has a high degree of redundancy on a large scale, making it suitable for generating continuous wavelet images, and this redundancy can capture complex waveform structures and effectively reduce noise, which is very useful for analyzing near-infrared spectra. Therefore, in this embodiment, non-orthogonal wavelets are selected for continuous wavelet transform to improve the accuracy and reliability of data analysis.
[0040] 3) Based on the category of wavelet function, four complex wavelet functions are selected.
[0041] In terms of wavelet function types (i.e., categories), complex wavelet functions can provide amplitude and phase information, while real wavelet functions only provide a single component. In this case, complex wavelet functions are more effective in capturing and describing the complex frequency changes and signal characteristics in near-infrared spectra, which is crucial for analyzing the subtle differences in chemical composition and physical properties. In this process, there are four complex wavelet functions in the non-orthogonal wavelet class: complex Morlet (Cmor), complex Gaussian (cgau), frequency B-spline (fbsp), and Shannon (shan).
[0042] 4) Based on the width selection of the complex wavelet function, the Cmor wavelet function family is selected.
[0043] Consider the width of the wavelet function, defined as the folding time of the wavelet amplitude, which determines the resolution of the wavelet function in time and frequency. Complex wavelet functions can be divided into wide functions and narrow functions based on their width. Wide functions (such as CGAU wavelets) provide good frequency resolution but poor time resolution, while narrow functions (such as FBSP and SHAN wavelets) have the opposite characteristics.
[0044] The key parameter of Cmor wavelet is Gaussian width, which balances time and frequency resolution. In addition, Cmor wavelet convolution retains the time resolution of the original signal and is computationally efficient, using fast Fourier transform (FFT) for most of the calculations. Therefore, Cmor wavelets are often used for time-frequency analysis of non-stationary time series data, which makes them very suitable for near-infrared spectroscopy in the present invention. The function formula of Cmor wavelet family is:
[0045]
[0046] In the formula, B represents the bandwidth, which controls the time domain expansion of the wavelet function. As B increases, ψ CmorB-C (λ n ) will also increase; C represents the center frequency, which controls the frequency expansion of the wavelet function. As C increases, ψ CmorB-C (λ n ) will also increase in resolution.
[0047] 5) Scale selection, determine the optimal scale range. Calculate the scale according to the following formula:
[0048]
[0049] In the formula, S0 represents the minimum resolvable scale; J determines the maximum scale; δ j Indicates the scale resolution, which affects the fineness of scale sampling; δt Represents the wavelength interval. The above formula can be used to obtain the optimal number of scales J and the scale range S0~S j (j=0,1,…,J), N represents the wave number (number of wavelength points).
[0050] 6) Perform continuous wavelet transform based on Cmor wavelet family and optimal scale range.
[0051] The wavelet functions of different scales and wavelengths are moved along the near-infrared spectral data and multiplied by the sampling interval, thereby generating wavelet coefficient matrices at different frequencies. The specific formula is as follows:
[0052]
[0053] In the formula, ψ * cmorB-C Represents the wavelet function of CmorB-C.
[0054] 7) The absolute value of the maximum wavelet coefficient is used to determine the parameters of CmorB-C.
[0055] The wavelet function should be as similar to the near-infrared spectrum as possible to better capture and reflect the spectral characteristics. n ) is quantified by the wavelet coefficients. Specifically, the wavelet coefficients are f(λ n ) and the inner product of the wavelet function. This coefficient reflects the similarity between the two functions, and the larger the coefficient, the higher the similarity. Since the wavelet coefficient quantifies this similarity, the wavelet function that produces the largest absolute value wavelet coefficient can best represent the potential spectral characteristics. Different bandwidths and frequency centers correspond to wavelet coefficients. In this embodiment, within the selected optimal scale range, the CmorB-C wavelet function with the largest absolute value wavelet coefficient is selected to ensure the best match with the spectral data. By comparing the maximum absolute values of the wavelet coefficients of different CmorB-C wavelet functions, the optimal wavelet function is determined.
[0056] Step 3: Map the wavelet coefficients at different scales and wave numbers into two-dimensional feature maps of near-infrared spectra. Specifically:
[0057] With wave number as the horizontal coordinate and scale as the vertical coordinate, the wavelet coefficient matrix is mapped into a two-dimensional spectrum image, which is the two-dimensional characteristic map of the near-infrared spectrum. The correlation diagram between the target substance content and the wavelet coefficient with neochlorogenic acid as the target substance is shown in Figure 6 As shown, this is the generated two-dimensional spectrum diagram.
[0058] Different spectrogram generation methods can be used, namely pseudo color mapping (PCM) and direct digital mapping (DDM). Two methods are described in detail below. (1) Pseudo color mapping converts the wavelet coefficient matrix into a two-dimensional grid representation. The pixel value of each grid cell is determined by the corresponding matrix value, and the grid size is defined by the matrix dimension. The grid vertices are used to accurately locate each cell to ensure alignment with the wavenumber or scale position of the data point. This method calculates the pixel values of the 145×1557 wavelet coefficient matrix and introduces smooth interpolation between grid cells to fill in the color and generate a continuously changing spectrogram. (2) Direct digital mapping directly maps the wavelet coefficient matrix to the pixel position of the spectrogram, with the horizontal and vertical coordinates being the wavenumber and scale. Compared with PCM, it is faster to execute, and in this method, the pixel values of the wavelet coefficient matrix are directly filled into the corresponding positions without interpolation.
[0059] In addition, to distinguish pixel values and assign colors, one of the following two color mapping schemes can be selected: Jet color mapping and Gray color mapping. Jet color mapping outputs RGB pixel values, showing a blue-green-red color distribution; while Gray color mapping converts the values to the same value in three color channels (R, G, and B), resulting in a white-gray-black color distribution. After PCM and DDM conversion, spectrograms are generated using these color mappings and saved accordingly.
[0060] In this embodiment, the grayscale spectrum is used for color mapping to distinguish pixel values at different positions of the wavelet coefficient matrix and assign colors. The grayscale spectrum directly converts the values in the three color channels (R, G and B) into the same value, thereby generating a two-dimensional spectrum image.
[0061] It should also be noted that, if necessary, the image size of the two-dimensional spectrum graph can be modified to be suitable for the model in the subsequent step five.
[0062] Step 4: Build and develop a near-infrared spectroscopy quantitative analysis regression prediction algorithm model, specifically select a deep learning model and train it to obtain a substance content prediction model.
[0063] The substance content prediction model of this embodiment is a model for qualitatively predicting the content of a certain substance. When it is necessary to predict the content of another substance, it is necessary to build a substance content prediction model for the other substance, that is, one substance corresponds to one substance content prediction model. The construction process and principle of each substance content prediction model are consistent, and the data set used in the corresponding training deep learning model needs to be adaptively changed to achieve the purpose of different substance content prediction models being able to predict the contents of different substances.
[0064] Deep learning frameworks are efficient tools for image recognition and analysis. Among them, convolutional neural network frameworks have shown excellent performance, such as GoogLeNet, ResNet, MobileNet, and EfficientNetV2. EfficientNetV2 is a new family of smaller and faster neural networks that shows great potential in image analysis. Therefore, this embodiment selects the lightweight network architecture EfficientNetV2. According to the requirements of lightweight applications and online analysis applications, it is suitable to use the EfficentNetV2 network architecture containing 19M parameters. Figure 3 As shown in the figure, EfficentNetV2 is a new convolutional network family designed to reduce parameter size and improve speed. The EfficentNetV2 network model consists of 7 stages: stage 0 consists of a normal convolution layer, batch normalization and Swish activation function, stages 1-3 are Fused-MBConv structures, while stages 4-6 are MBConv structures, and stage 7 includes convolutional layers, pooling layers, and fully connected layers. The Fused-MBConv module starts with a 3×3 dilated convolution with low-dimensional data input, aiming to increase the dimension of the data; the data is then processed by the Swish activation function (i.e. SiLU in the figure) and batch normalization BN to enhance the nonlinear characteristics and stability of the network; it then passes through a 1×1 convolution layer to reduce the number of channels in the feature map and the complexity of the calculation; in addition, the output is adjusted again by the batch normalization BN operation, and then the adjusted output is added to the residual of the original input to obtain the final output. Among them, when the stride is 1, the 1×1 convolution layer and batch normalization are omitted, which helps to reduce the model size and parameters, thereby achieving a more lightweight and efficient design that meets the requirements of online prediction. Unlike the Fused-MBConv structure, the 3×3 dilated convolution in the MBConv module is transformed into a 1×1 dilated convolution and a 3×3 deep convolution. After the original input undergoes a 1×1 dilated convolution, it is processed by batch normalization BN and Swish function, and the feature map of the channel output is weighted by the attention mechanism module SE to highlight important features; similarly, when the stride is 1, the initial three operations are skipped and the input features are directly input into the 3×3 deep convolution layer. The rest of the content can be referred to. Figure 2 , which will not be described here. In stage 7, the data is reshaped into 256×1×1 and flattened into a one-dimensional vector of 256, which is used as the input feature of the fully connected layer. For the quantitative analysis of the target content, the output layer contains a single neuron with a linear activation function to directly predict the value of the variable.
[0065] Step 5. After building the model framework, the two-dimensional spectrum of the sample obtained in step 3 and the corresponding target substance content in step 1 are integrated into a data set, and randomly divided into a training data set (80%) and a test data set (20%). The model framework built in step 4 is trained and tested, and after the training and testing are completed, a material content prediction model that can be used to predict the target substance content is obtained.
[0066] The process of training and testing the constructed model framework is as follows Figure 4 As shown. During the model training process, the weight parameters of the model are optimized by minimizing the mean square error. During the training process, the mean square error loss curve first decreases and then tends to be stable, indicating that the model has converged and the training is completed. Moreover, the model is verified in two stages, specifically: first, the same data set is used for 10-fold cross-validation method for training and verification; second, the root mean square error, mean absolute error and relative percentage difference are selected to evaluate the accuracy and robustness of the model. Moreover, the optimal weight parameters are determined in the verification stage and deployed to an independent test data set for evaluation. By analyzing the prediction results of the test data set, the generalization ability and prediction accuracy of the model are verified to ensure the reliability and effectiveness of the model in practical applications.
[0067] Step six, obtaining the near-infrared spectrum of the sample to be tested, and performing SG smoothing processing on it; regarding the wave number in the near-infrared spectrum after SG smoothing processing as time, and then adopting the same method as step two to extract features of the near-infrared spectrum using continuous wavelet transform, and extracting wavelet coefficients at different scales and different wave numbers; adopting the same method as step three, mapping the extraction result into a two-dimensional feature map of the near-infrared spectrum; inputting the obtained two-dimensional feature map of the near-infrared spectrum into the substance content prediction model finally obtained in step five, and predicting the content of the target substance contained in the sample to be tested.
[0068] At this point, the entire method is completed. The following is an effect description of some details in the above solution.
[0069] According to the proposed stepwise screening strategy, S calculated by formula (3) j The value ranges from 7.71 to 3949.50. In the Cmor wavelet family, δ j When δ is 0.5, it can provide the maximum value of sufficient sampling on the scale. j The values are 0.5, 0.25, 0.125 and 0.0625. j = 0.0625, the features in the spectrum become more continuous and smooth, providing the highest resolution without affecting the speed of the model. jThe values were not considered further because they did not provide significant additional wavelet functions. In addition, quantitative validation at the model level confirmed that the wavelet function selected by this stepwise screening strategy is optimal. As shown in Table 1, when the Cmor0.5-0.5 wavelet function was applied to the CWT-EfficientNetV2 model, the lowest RMSEP and the highest R2P and RPD values were obtained on the independent test dataset (the last row of Table 1). Therefore, Cmor0.5-0.5 was selected as the preferred wavelet function. Improvements in feature extraction may increase computational complexity, so when δ j When is 0.0625, the J value calculated by formula (3) is 144. In addition, based on the proposed wavelet selection method, the Cmor wavelet family is selected for experimental comparison. Figure 7 The absolute values of the maximum wavelet coefficients of various wavelet functions are shown, including Cmor2.5-1.5, Cmor2.5-1.0, Cmor2.5-0.5, etc. Initially, the bandwidth and center frequency are both set to 0.5, and the Cmor0.5-0.5 wavelet function exhibits the widest range and the highest maximum value among the selected wavelet functions. 36 To S 72 , whose absolute coefficient always exceeds that of other wavelet functions. 69 The peak value reached 0.018 when the scale ranged from S 90 To S 126 , its coefficient still significantly exceeds that of other wavelet functions.
[0070] Table 1
[0071]
[0072] The CWT-EfficientNetV2 model (i.e., the entire method model of the present invention) often faces problems such as gradient vanishing and overfitting during training due to its deep network structure. In order to solve these problems, the present invention applies SG smoothing to the raw near-infrared spectral data, followed by CWT. This process aims to eliminate multicollinearity and enhance the correlation between the target compound content and each data point, thereby improving the prediction performance of the model. The correlation between the target compound content and the wavelet coefficients in the four pretreatment methods is compared, and the results are as follows Figure 8 As shown, Figure 8 From left to right in the figure, they represent the original spectra (corresponding to Figure 8 The schematic diagram of the correlation with wavelet coefficients of the spectrum after processing with MSC (multiple scatter correction), SNV (standard orthogonal variable transformation) and SG respectively, which can highlight the advantages of combining SG smoothing with CWT. Figure 8As shown, taking neochlorogenic acid as an example, each correlation is calculated by comparing the vectors derived from the 3D matrix formed by stacking 1447 wavelet coefficient matrices. Specifically, for each corresponding point in the 3D matrix, a vector of length 1447 is generated. The vector is then compared with the neochlorogenic acid content vector of the 1447 samples to calculate the correlation. The correlation curve of the absorbance after SG treatment shows more peaks and valleys than the original spectrum and the spectrum of other processing methods, and the value of the correlation coefficient is improved after pretreatment. On the scale of 500 to 1500, the correlation between the wavelet coefficient obtained after SG treatment and the compound content is stronger than the corresponding feature. As the scale increases, the correlation coefficients of the original spectrum and other pretreatment methods approach zero, while the absolute coefficient of SG rises to 0.6 at a specific wave number. The application of the SG-CWT method (i.e., the method of combining SG with CWT in the present invention) can produce stronger maximum spectral correlations at various scales, thereby effectively enhancing the correlation between the target compound content and the spectrum. Therefore, this shows the comprehensive advantages of the SG-CWT method in amplifying the spectral features related to the analysis of the target compound content.
[0073] Moreover, after applying CWT, choosing a suitable spectrogram generation method is crucial to effectively convert features in the wavelet coefficient matrix into pixel values, which helps to preserve the integrity of spectral information and achieve more accurate analysis and prediction. Taking neochlorogenic acid as an example, Table 2 shows the impact of two different spectrogram generation methods (DDM and PCM) on the performance of the EfficientNetV2 model. It can be seen that spectra generated using gray color mapping are generally better than those generated using Jet color mapping. For example, in the prediction of neochlorogenic acid content, the RMSEP of DDM-Gray is 0.14, while that of DDM-Jet is 0.16. This difference stems from the fact that gray color mapping directly maps pixel values to the same three values in the RGB channels, avoiding interpolation and inaccurate drawing. Similarly, the RDP using DDM-Gray is 2.69, while the PCM-Gray color mapping shows an RDP of 2.56 when predicting the content of neochlorogenic acid. The data strongly indicate that the DDM-Gray method effectively represents the wavelet coefficients and preserves the spectral features, thereby achieving a more accurate prediction of the content of the target compound. In this regression task, resizing in the conversion method can significantly improve accuracy and speed. By evaluating different sizes: 200×200, 300×300, and 400×400, it is observed that increasing the pixel size improves accuracy but also reduces processing speed. In order to balance accuracy and computational burden, the optimal size of 300×300 was selected, achieving satisfactory prediction results while ensuring fast detection.
[0074] Table 2
[0075]
[0076] Computer equipment example:
[0077] A computer device embodiment of the present invention includes a memory, a processor, an internal bus and a computer program stored in the memory, and the processor and the memory communicate and exchange data with each other through the internal bus. The processor executes the computer program to implement the steps of a method for predicting material content based on near-infrared spectroscopy introduced in the method embodiment of the present invention. Among them, the processor can be a processing device such as a microprocessor MCU, a programmable logic device FPGA, etc.; the memory can be various memories that use electrical energy to store information, such as RAM, ROM, etc., or it can be a memory that uses other methods.
[0078] In summary, the present invention has the following characteristics:
[0079] 1) The present invention aims to provide an online near-infrared quantitative analysis method based on continuous wavelet transform, which solves the limitations of unclear one-dimensional near-infrared spectral features, low integration at a single resolution, and low accuracy when combined with traditional models. The present invention extracts richer spectral information of different resolutions to generate a two-dimensional spectrogram, provides a richer spectral feature representation, and can solve the problem of overlapping spectra, significantly improving the prediction accuracy and making it more suitable for real-time calculation.
[0080] 2) The present invention uses continuous wavelet transform to provide more comprehensive information, thereby improving model performance. For the continuous wavelet transform used, a progressive screening strategy is introduced to adopt a more effective method to select wavelet functions and scales, significantly improving the adaptability of wavelet function and scale selection in continuous wavelet transform, so that the two-dimensional spectrum can fully reflect the features contained in the one-dimensional near-infrared spectrum, promoting more accurate and robust analysis of the model, and improving the prediction accuracy of the model.
[0081] 3) The present invention converts the one-dimensional near-infrared spectrum into a two-dimensional spectrogram to present more features of other frequencies of the target compound and explore the relationship between the above spectral representations; further, the two-dimensional near-infrared spectrogram (i.e., the two-dimensional spectrogram) obtained by coefficient matrix transformation is combined with the EfficientNetV2 model, which significantly improves the efficiency of online analysis. Moreover, the method improves the accuracy of prediction while maintaining representative wavelet coefficients, and the inference time of the model is very short, which is particularly suitable for real-time online quantitative analysis applications. Overall, it expands the research perspective of the intersection of near-infrared spectroscopy and deep learning algorithms, and provides new insights and methods for these two fields. Compared with traditional methods such as partial least squares regression, the two-dimensional spectrogram generated by continuous wavelet transform based on the optimal wavelet function and scale is combined with the EfficientNetV2 model, showing higher accuracy and robustness, which is reflected in the increase of relative percentage difference and the decrease of root mean square error and mean absolute error. The model parameters are only 19M and the inference time is 7ms, which illustrates its efficiency and applicability to real-time situations. The model has high accuracy, robustness and fast inference time, making it very suitable for lightweight online monitoring applications, making it possible to use near-infrared spectroscopy to accurately and quickly analyze the content of multiple compounds simultaneously in various industries.
[0082] Specific implementation methods are given above, but the present invention is not limited to the described implementation methods. The basic idea of the present invention lies in the above basic scheme. For ordinary technicians in this field, it does not take creative work to design various deformed models, formulas, and parameters according to the teachings of the present invention. Changes, modifications, substitutions, and variations of the implementation methods without departing from the principles and spirit of the present invention still fall within the scope of protection of the present invention.
Claims
1. A method for predicting substance content based on near infrared spectroscopy, characterized in that: The steps include: 1) Obtaining the near-infrared spectrum of the sample to be tested; considering the wave number in the near-infrared spectrum as time, and then using continuous wavelet transform to extract features of the near-infrared spectrum, and extracting wavelet coefficients at different scales and different wave numbers; 2) The extracted wavelet coefficients at different scales and wave numbers are mapped into a two-dimensional spectrum diagram; 3) Inputting the two-dimensional spectrum graph into a material content prediction model corresponding to the target substance to predict the content of the target substance in the sample to be tested; wherein the material content prediction model is obtained by training a deep learning model using a data set containing two-dimensional spectrum graphs of multiple samples and the content of the target substance in the samples.
2. The method for predicting substance content based on near infrared spectroscopy according to claim 1, characterized in that: Direct digital mapping or pseudo-color mapping is used to map the extracted wavelet coefficients at different scales and wave numbers into a two-dimensional spectrum diagram; When the direct digital mapping method is used, the position of each point in the two-dimensional spectrum is determined by the scale and wave number, and the pixel value of each point is determined by the wavelet coefficient corresponding to the scale and wave number that determine the position of the point; When the pseudo-color mapping method is used, the vertex position of each grid unit in the two-dimensional spectrum is determined by the scale and wave number, the pixel value of each grid unit is determined by the wavelet coefficient corresponding to the scale and wave number that determine the vertex position of the grid unit, and the pixel values between the grid units are determined by the interpolation method.
3. The method for predicting substance content based on near infrared spectroscopy according to claim 2, characterized in that: When determining the pixel value, the wavelet coefficients are mapped using the Gray color mapping method or the Jet color mapping method.
4. The method for predicting substance content based on near infrared spectroscopy according to claim 1, characterized in that: The wavelet function used in continuous wavelet transform is a non-orthogonal wavelet function.
5. The method for predicting substance content based on near infrared spectroscopy according to claim 4, characterized in that: The non-orthogonal wavelet function is a complex wavelet function.
6. The method for predicting substance content based on near infrared spectroscopy according to claim 5, characterized in that: The complex wavelet function is a Cmor wavelet function.
7. The method for predicting substance content based on near infrared spectroscopy according to claim 6, characterized in that: The bandwidth and frequency center of the Cmor wavelet function are determined in the following way: determine the absolute values of the wavelet coefficients corresponding to different bandwidths and frequency centers, select the largest absolute value of the wavelet coefficients, and the bandwidth and frequency center corresponding to the selected value are the bandwidth and frequency center of the Cmor wavelet function finally determined.
8. The method for predicting substance content based on near infrared spectroscopy according to any one of claims 1 to 7, characterized in that: Different scales include S0, S1, ... S j ……、S J , j = 0, 1, ..., J, S0 represents the minimum resolvable scale, S J represents the maximum scale, δ j represents the scale resolution, δ t represents the wavelength interval and N represents the wave number.
9. The method for predicting substance content based on near infrared spectroscopy according to claim 1, characterized in that: The deep learning model is a convolutional neural network model.
10. The method for predicting substance content based on near infrared spectroscopy according to claim 9, characterized in that: The convolutional neural network model is EfficientNetV2.
11. The method for predicting substance content based on near infrared spectroscopy according to claim 1, characterized in that: The two-dimensional spectrogram contained in the data set is a two-dimensional spectrogram after SG smoothing.
12. A computer device comprising a processor, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 11.