Birch juice product detection method and system, electronic equipment and storage medium

By combining near-infrared spectroscopy with machine learning models, the problem of detecting adulteration in birch sap products has been solved, achieving highly accurate and precise identification and concentration analysis of adulterants, thus ensuring the quality of birch sap products and protecting consumer rights.

CN121521794APending Publication Date: 2026-02-13NORTHEAST FORESTRY UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511947010.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing technologies are insufficient to effectively distinguish and detect adulterants in birch sap products. In particular, because birch sap and purified water are highly similar in physical properties, adulteration methods that dilute birch sap with water are difficult to identify, affecting product quality and consumer rights.

Method used

By combining near-infrared spectroscopy with a machine learning model and using preprocessing methods to eliminate spectral interference, the adulteration of birch sap products can be detected through a qualitative analysis model (a support vector machine model optimized based on the dung beetle algorithm) and a quantitative analysis model (a hybrid convolutional neural network-Transformer model).

Benefits of technology

It improves the accuracy and precision of detecting adulteration in birch sap products, reduces human intervention, and provides efficient capabilities for identifying adulterants and quantifying their concentrations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121521794A_ABST
    Figure CN121521794A_ABST
Patent Text Reader

Abstract

The invention discloses a birch juice product detection method and system, electronic equipment and a storage medium, and belongs to the field of birch juice product detection. The method specifically comprises the following steps: preprocessing a near infrared absorption spectrum of a birch juice product sample, and determining to-be-analyzed spectrum data so as to eliminate negative effects caused by non-target physical factors; and based on a pre-trained qualitative analysis model and / or a pre-trained quantitative analysis model, determining a qualitative analysis result and / or a quantitative analysis result corresponding to the birch juice product sample according to the to-be-analyzed spectral data. According to the birch juice product detection method, the near infrared spectrum and the learning model are combined to aim at nonlinear interaction between adulterated components and the spectrum, so that the detection accuracy of the adulteration condition of the birch juice sample is improved. Furthermore, feature extraction is automatically executed from multiple levels, spectral information of the birch juice sample is comprehensively represented from local to overall, and manual intervention in the detection process is reduced while the detection accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to a method for testing birch sap products, a system for testing birch sap products, an electronic device, and a computer-readable storage medium, and belongs to the field of birch sap product testing. Background Technology

[0002] Birch sap is rich in active ingredients such as amino acids, minerals, polysaccharides, and phenols. It has potential effects such as anti-oxidation, immune regulation, and liver protection. As a unique medicinal and edible resource, it has attracted much attention and also provides a model for the green development of natural health products.

[0003] Therefore, the current market demand and high prices for birch sap products inevitably lead to economically motivated practices that lower the quality of birch sap. Because purified water and raw birch sap are highly similar in physical properties, and raw birch sap contains over 99% water, it is difficult to effectively distinguish between qualified and adulterated products based on appearance alone. Therefore, adulteration by diluting raw birch sap with water is the simplest, most concealed, and lowest-cost method, severely impacting the quality of birch sap beverages, infringing on consumer rights, and posing significant technical challenges to the classification and identification of birch sap products.

[0004] Currently, quality testing of liquid foods such as coconut milk, tea seed oil, and corn oil is generally achieved based on the near-infrared spectrum of the product and using partial least squares analysis. However, research on quality testing methods for birch sap is lacking, and the analytical methods used in the aforementioned technologies still have limitations when testing complex mixtures like birch sap, which are difficult to distinguish. The linear modeling nature of partial least squares results in insufficient analytical capability for nonlinear spectral responses. Furthermore, in the analysis of the complex system of birch sap quality testing, there is often a highly nonlinear interaction mechanism between adulterants and spectral characteristics, which fundamentally compromises the accuracy of the aforementioned analytical methods. Summary of the Invention

[0005] This application specifically discloses a method for testing birch sap products, a system for testing birch sap products, an electronic device, and a computer-readable storage medium.

[0006] The birch sap product testing method in this application includes the following steps: Preprocessing is performed on the near-infrared absorption spectra of birch sap product samples to determine the spectral data to be analyzed, in order to eliminate the negative impact of non-target physical factors, wherein the near-infrared absorption spectra are pre-acquired based on a preset spectral acquisition device; Based on a pre-trained qualitative analysis model and / or a pre-trained quantitative analysis model, and according to the spectral data to be analyzed, the qualitative and / or quantitative analysis results corresponding to the birch sap product sample are determined. The qualitative analysis model is a support vector machine model with hyperparameter optimization based on the dung beetle algorithm, and the quantitative analysis model is a convolutional neural network-Transformer hybrid model with an efficient channel attention mechanism. The qualitative analysis results are configured to qualitatively characterize the probability of adulteration of the birch sap product sample and the corresponding prediction confidence level, and the quantitative analysis results are configured to quantitatively characterize the content of birch sap concentrate in the birch sap product sample and the corresponding prediction confidence level.

[0007] In some implementations, in the qualitative analysis model, the dung beetle algorithm optimizes the penalty coefficient and regularization coefficient of the RBF core of the support vector machine model to optimize the penalty coefficient and the regularization coefficient to a relatively optimal solution.

[0008] In some implementations, the qualitative analysis model and / or quantitative analysis model based on the pre-trained qualitative analysis model, according to the spectral data to be analyzed, determines the qualitative analysis results and / or quantitative analysis results corresponding to the birch sap product sample, including: Based on the convolutional neural network included in the quantitative analysis model, and based on the spectral data to be analyzed, scale detail acquisition and standardization and activation processing are performed to determine local spectral feature data; Based on the Transformer model included in the quantitative analysis model, and based on the local spectral feature data, the overall spectral feature data are determined by associating wavelength parameters. Based on the efficient channel attention mechanism module included in the quantitative analysis model, channel optimization is performed on the overall spectral feature data based on the screening criteria features obtained from the judgment, and the quantitative analysis results are obtained. The birch sap product testing method also includes: Based on the batch normalization layer included in the quantitative analysis model, channel attention pruning is performed on the quantitative analysis model.

[0009] The birch sap product testing system in this application embodiment, wherein the system is arranged on a pre-set computer device, is characterized in that the system comprises: The product testing module is used to execute the birch sap product testing method in the above embodiments. An interactive control module is used to perform human-computer interaction with the user, so that the product testing module executes the birch sap product testing method, and displays the interaction results to the user and / or displays the qualitative analysis results and / or the quantitative analysis results determined by executing the birch sap product testing method.

[0010] In some embodiments, the interactive control module is further configured with a human-computer interaction interface, and the method by which the interactive control module performs human-computer interaction with the user includes: In response to a user’s first operation in the first area of ​​the human-computer interaction interface, the near-infrared absorption spectrum of the birch sap product sample is imported into the birch sap product detection system, wherein the near-infrared absorption spectrum is pre-acquired based on a preset spectral acquisition device. In response to a second operation by the user in the first area, the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample are displayed in the second area of ​​the human-computer interaction interface; and / or In response to a third operation by the user in the first area, the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample are displayed in the second area; In response to the second operation, the near-infrared absorption spectrum, the parameter information of the qualitative analysis model, and the qualitative analysis results are displayed in text form in a text box within the first area; In response to the third operation, the near-infrared absorption spectrum, the parameter information of the quantitative analysis model, and the quantitative analysis results are displayed in text form in the text box.

[0011] In some implementations, the step of importing the near-infrared absorption spectrum of a birch sap product sample into the birch sap product detection system in response to a first operation by a user in a first area of ​​the human-computer interaction interface includes: In response to the user's click operation on the first button in the first area, the near-infrared absorption spectrum is imported into the birch sap product detection system; The first text message is displayed in the first area to indicate to the user that the near-infrared absorption spectrum has been imported.

[0012] In some implementations, the step of displaying the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample in a second area of ​​the human-computer interface in response to a second operation by the user in the first area includes: In response to the user's selection operation of the drop-down menu in the first area, the birch sap product sample is selected; In response to a user's click on the second button in the first area, the near-infrared absorption spectrum and the qualitative analysis results corresponding to the selected birch sap product sample are displayed in the second area.

[0013] In some implementations, the step of displaying the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample in the second region in response to a third user operation in the first region includes: In response to the user's selection operation of the drop-down menu in the first area, the birch sap product sample is selected; In response to the user's click on the third button in the first area, the near-infrared absorption spectrum and the quantitative analysis results corresponding to the selected birch sap product sample are displayed in the second area.

[0014] The electronic device in this application includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the birch sap product detection method in the above-described embodiments is implemented.

[0015] The computer-readable storage medium in the embodiments of this application stores a computer program that, when executed by one or more processors, implements the birch sap product testing method described in the above embodiments.

[0016] The beneficial effects of this application are as follows: The birch sap product detection method in this application combines near-infrared spectroscopy with machine learning and deep learning models to target the highly nonlinear interaction between adulterants and spectral features, thereby improving the detection accuracy of birch sap sample adulteration in terms of the analytical capability of nonlinear spectral response. Furthermore, it utilizes a convolutional neural network-Transformer hybrid architecture to automatically perform feature extraction at multiple levels, comprehensively characterizing the spectral information of the birch sap sample from local to global perspectives, improving detection accuracy while reducing manual intervention in the detection process. Attached Figure Description

[0017] Figure 1 This is one of the flowcharts illustrating the birch sap product testing method in the embodiments of this application; Figure 2 This is a schematic diagram of the near-infrared absorption spectra of five birch sap product samples with different adulteration ratios corresponding to a certain birch sap concentrate product in the embodiments of this application. Figure 3 This is a schematic diagram of the confusion matrix of the qualitative analysis model in the embodiments of this application; Figure 4 This is the second flowchart of the birch sap product testing method in the embodiments of this application; Figure 5 This is a schematic diagram illustrating the correlation between the actual value of the adulteration concentration and the predicted value of the quantitative analysis model in the embodiments of this application; Figure 6 This is a schematic diagram comparing the predicted adulteration concentration of the additional birch sap product sample with the actual adulteration concentration using the quantitative analysis model in the embodiments of this application. Figure 7 This is one of the flowcharts illustrating the method of human-computer interaction between the interactive control module and the user in the embodiments of this application; Figure 8 This is one of the application scenario diagrams of the human-computer interaction interface in the embodiments of this application; Figure 9 This is the second flowchart illustrating the method of human-computer interaction between the interactive control module and the user in the embodiments of this application; Figure 10 This is the second schematic diagram of the application scenario of the human-computer interaction interface in the embodiments of this application; Figure 11 This is the third schematic diagram of the application scenario of the human-computer interaction interface in the embodiments of this application; Figure 12 This is the third flowchart illustrating the method of human-computer interaction between the interactive control module and the user in the embodiments of this application; Figure 13 This is the fourth flowchart illustrating the method of human-computer interaction between the interactive control module and the user in the embodiments of this application; Figure 14 This is the fourth schematic diagram of the application scenario of the human-computer interaction interface in the embodiments of this application; Figure 15 This is the fifth illustration of an application scenario of the human-computer interaction interface in the embodiments of this application; Figure 16 This is the sixth illustration of the application scenario of the human-computer interaction interface in the embodiments of this application; Figure 17 This is the seventh schematic diagram of the application scenario of the human-computer interaction interface in the embodiments of this application. Detailed Implementation

[0018] Please see Figure 1 The birch sap product testing method in this application includes the following steps: Step 01: Perform preprocessing on the near-infrared absorption spectrum of the birch sap product sample to determine the spectral data to be analyzed, in order to eliminate the negative impact of non-target physical factors. The near-infrared absorption spectrum is pre-acquired based on a preset spectral acquisition device; Step 02: Based on the pre-trained qualitative analysis model and / or pre-trained quantitative analysis model, determine the qualitative and / or quantitative analysis results corresponding to the birch sap product sample according to the spectral data to be analyzed. The qualitative analysis model is a support vector machine model with hyperparameter optimization based on the dung beetle algorithm, and the quantitative analysis model is a convolutional neural network-transformer hybrid model with an efficient channel attention mechanism. The qualitative analysis results are configured to qualitatively characterize the probability of adulteration in birch sap product samples and the corresponding prediction confidence level, while the quantitative analysis results are configured to quantitatively characterize the content of birch sap concentrate in birch sap product samples and the corresponding prediction confidence level.

[0019] Specifically, the birch sap product detection method in this application is mainly used for qualitative detection of whether birch sap concentrate is adulterated and / or quantitative detection of adulteration concentration. The overall logic of qualitative detection is based on the near-infrared spectrum of birch sap product samples, and uses a qualitative analysis model to perform qualitative detection, thereby determining whether the birch sap concentrate is adulterated, and simultaneously providing the probability and confidence level of the qualitative judgment result. The overall logic of quantitative detection is based on the near-infrared spectrum of birch sap product samples, and uses a quantitative analysis model to perform quantitative detection, thereby determining the quantitative result of the adulteration concentration in the birch sap concentrate, and the probability and confidence level corresponding to the quantitative result.

[0020] Based on the above overall logic, it is necessary to obtain the near-infrared spectral data of birch sap products before conducting testing. Therefore, in some embodiments, the near-infrared absorption spectrum of birch sap product samples can be obtained in the following manner: Based on the spectral acquisition device, the dark current spectrum of the acquisition environment and the reflectance spectrum of a standard white board are obtained; After eliminating interference from the spectral acquisition device and the acquisition environment by using dark current spectroscopy and standard whiteboard reflectance spectroscopy, multiple sets of absorption spectral data at multiple locations of birch sap product samples were obtained; Based on multiple sets of absorption spectral data, the near-infrared absorption spectrum of birch sap product samples was calculated and determined.

[0021] Specifically, based on the above embodiments, the spectral acquisition device generally includes a sample container, a spectrometer, a detector array, and a light source. For example, a quartz cuvette with an optical path length of 5 mm can be used as the sample container, taking 5 mL of birch sap product sample at a time. The spectrometer is equipped with an indium gallium arsenide (InGaAs) detector array to efficiently capture near-infrared light signals to form near-infrared spectral data, and is used in conjunction with a halogen light source with an operating voltage of 5V. Regarding the relevant parameters of the acquisition process, the wavelength range of the spectral measurement can be set to the near-infrared light range of 850 nm to 1700 nm, the spectral resolution can be selected as 3 nm, and the experimental environment temperature is a constant indoor temperature of 20°C. In practical applications, the selected instruments, devices, and set parameters can be adjusted according to the actual situation; the above is only an example.

[0022] In actual spectral acquisition, the spectrometer is first calibrated. This can generally be achieved by canceling out bright and dark spectra. Specifically, the spectrometer is first used to acquire the dark current spectrum (i.e., dark spectrum) as the background reference spectrum. Then, the spectrometer is used to acquire the reflectance spectrum of a standard white board (i.e., bright spectrum) under the same environmental conditions. The bright spectrum data is then subtracted from the dark spectrum data to eliminate the interference of the spectrometer itself and environmental conditions on the spectral acquisition.

[0023] Having eliminated the aforementioned interferences, the next step is to perform spectral measurements on the birch sap product samples in the sample container. During the measurement process, to minimize variability caused by the sampling location, three repeated measurements were performed at different locations on each sample, resulting in multiple sets of spectral data. Finally, the average of these data was taken as the near-infrared absorption spectrum corresponding to that sample.

[0024] In practical applications, the process and results of near-infrared absorption spectroscopy can be visually presented by simulating adulteration and collecting spectra. For example, various commercially available birch sap concentrate products can be used to simulate the high-proportion adulteration commonly found in actual birch sap products. A volumetric water-addition method can be employed, with a 25% volume percentage gradient within the true subset range of 0-100%. The birch sap concentrate product itself and the pure water itself can be used as controls. This allows for the creation of birch sap product samples with adulteration ratios of 0%, 25%, 50%, 75%, and 100% for each birch sap concentrate product. The sample with an adulteration ratio of 0% represents the original birch sap concentrate product without added pure water, while the sample with an adulteration ratio of 100% represents the pure water itself. Please refer to [reference needed]. Figure 2 , Figure 2The above image is a near-infrared absorption spectrum image. It is used to characterize the near-infrared absorption spectra of five birch sap product samples with different adulteration ratios corresponding to a certain birch sap concentrate product. Each line shape in the image corresponds to the average near-infrared absorption spectrum of multiple birch sap product samples with a certain adulteration ratio.

[0025] Therefore, once the near-infrared absorption spectrum is obtained, it can be used as the data basis for qualitative and quantitative analysis models to perform qualitative and quantitative detection on birch sap product samples. Because near-infrared spectra have a high information content, they are very susceptible to negative impacts from non-target physical factors such as stray light, noise interference, and baseline drift. These negative impacts reduce the accuracy and stability of the qualitative and quantitative analysis models. Therefore, before inputting the near-infrared absorption spectrum into the qualitative and quantitative analysis models, it is necessary to eliminate the influence of potential non-target physical factors in the acquired near-infrared absorption spectrum. For example, after obtaining the near-infrared absorption spectrum, it is preprocessed to eliminate the aforementioned non-target physical factors. The specific preprocessing methods generally include Standard Normal Variate Transformation (SNV), Multiplicative Scatter Correction (MSC), First Derivative Processing (1st), and Savitzky-Golay Convolution Smoothing (SG Convolution Smoothing). The specific implementation methods can refer to relevant technologies and be adjusted and selected according to the actual situation. This application does not impose specific limitations.

[0026] In some implementations, in the qualitative analysis model, the dung beetle algorithm optimizes the penalty coefficient and regularization coefficient of the RBF core of the support vector machine model to optimize the penalty coefficient and regularization coefficient to a relatively optimal solution.

[0027] Specifically, based on the above implementation method, the qualitative detection process generally uses the pre-processed spectral data to be analyzed as input data, which is input into the qualitative analysis model for detection. After analysis and detection, the qualitative analysis model can output the corresponding qualitative analysis results. The qualitative analysis results generally include three sets of information: first, qualitative characterization information, which is used to characterize whether the current birch sap product sample is adulterated; second, the probability corresponding to the above-mentioned qualitative characterization information; and third, the confidence level data of the qualitative analysis results.

[0028] For example, for a birch sap product sample, after inputting its corresponding spectral data to be analyzed into the qualitative analysis model, the qualitative analysis model outputs the following qualitative analysis results: it is identified as an adulterated sample with a probability of 0.989, and it is identified as a undiluted sample with a probability of 0.011 and a confidence level of 0.989.

[0029] For constructing a qualitative analysis model, for example, a Support Vector Machine (SVM) model is used as the basis, and the Dung Beetle Algorithm (DBO) is employed to optimize the hyperparameters in the SVM model, particularly the penalty coefficient C and regularization coefficient of the radial basis function (RBF) core in the SVM model. γ Optimization is performed to ensure that the values ​​of both are moderate. The penalty coefficient C represents the width of the classification boundary; a small C value may lead to an overly smooth decision boundary, while a large C value may lead to overfitting. Regularization coefficient... γ This determines the shape of the RBF kernel function; a smaller one... γ Values ​​that lead to underfitting and large values γ An excessively high value can lead to overfitting.

[0030] In a specific implementation of the DBO algorithm, for example, the search range of the penalty coefficient C can be set to [0.1, 100], while the regularization coefficient... γ The search range can be set to [0.0001, 1]. Then, the size of the dung beetle population is set to 30. In this population, 6 dung beetles perform ball-rolling behavior, 6 dung beetles perform reproductive behavior, 7 dung beetles perform foraging behavior, and the remaining 11 dung beetles are defined as performing stealing behavior. The maximum number of iterations can be set to 100. The fitness function is calculated as the average classification accuracy through multiple cross-validation, so that the entire qualitative analysis process automatically converges to the relatively optimal solution.

[0031] For evaluating qualitative analysis models, metrics such as accuracy (ACC), precision (PRE), recall (REC), and F1 score (F1S) are commonly used. Accuracy measures the overall correctness of the model's classification, i.e., the proportion of correctly predicted samples out of the total sample count. Precision reflects the proportion of samples correctly classified as positive by the model, used to evaluate the reliability of the positive classification. Recall represents the proportion of samples that are actually positive and is successfully identified, used to measure the model's coverage of positive examples. The F1 score is the harmonic mean of precision and recall, effectively coordinating the trade-off between the two, thus providing a more balanced overall performance evaluation. The formulas for calculating these parameters are as follows:

[0032]

[0033]

[0034]

[0035] Where TP represents the number of true positive samples, that is, the number of samples correctly predicted as positive by the model; TN represents the number of true negative samples, that is, the number of samples correctly predicted as negative by the model; FP represents the number of false positive samples, that is, the number of negative samples incorrectly predicted as positive by the model; and FN represents the number of false negative samples, that is, the number of positive samples incorrectly predicted as negative by the model.

[0036] For the evaluation of the qualitative analysis model results, we used the absorption spectrum of the birch sap product sample prepared using the method described in the above embodiments as the original near-infrared absorption spectrum data. We combined the spectral data to be analyzed corresponding to the four preprocessing methods (SNV, MSC, 1st, SG) in the above embodiments with the original near-infrared absorption spectrum data (RAW), and compared them with the qualitative analysis model (DBO-SVM) in this application, as well as the partial least squares discriminant analysis (PLS-DA) and random forest (RF) methods in current related technologies. The results are shown in Table 1. Table 1 Comparison of Prediction Results from Qualitative Analysis Models

[0037] From an overall performance perspective, the three models in Table 1 all exhibited high classification accuracy under most preprocessing methods, generally exceeding 0.92, indicating that the constructed models possess good discriminative ability. Among them, the qualitative analysis model in this application's implementation achieved the best accuracy (0.98) and F1 score (0.97) under MSC preprocessing conditions, demonstrating that the model has a strong advantage in handling scattering interference. Combined with its high precision (0.97) and recall (0.96), it indicates that it has a good balance in adulteration identification.

[0038] For the PLS-DA model, its overall performance under MSC preprocessing is the most outstanding, with accuracy, precision, recall, and F1 score all exceeding 0.96. This indicates that multivariate scattering correction effectively improves the model's ability to extract spectral features from samples and reduces interference from scattering effects. The RF model performs best under SNV preprocessing, with an F1 score of 0.97 and a recall of 0.98, demonstrating high coverage of positive class samples. However, the recall of this model is relatively low under RAW and MSC preprocessing, indicating differences in its sensitivity to samples under different preprocessing conditions.

[0039] In terms of the impact of preprocessing methods, SNV and MSC scattering correction methods are generally superior to other preprocessing methods, especially in improving the performance of RF and the qualitative analysis model in the embodiments of this application. SG smoothing and first derivative (1st) processing can also bring performance gains in most cases, but the improvement is relatively limited.

[0040] In summary, model performance depends not only on the algorithm itself but also closely on the preprocessing method. A key observation is that all models perform well on the prediction set, with most achieving over 90% accuracy, precision, recall, and F1 score in classifying adulteration concentration categories. However, while some differences in accuracy and other metrics can be observed, overall, among the three types of qualitative analysis models mentioned above, the qualitative analysis model in this application's embodiment is relatively the most reliable in distinguishing adulteration concentrations.

[0041] For the method of preparing birch sap product samples in the above embodiments, for example, four different birch sap concentrate products can be selected. For each product, 20 birch sap product samples are prepared at adulteration ratios of 0%, 25%, 50%, 75%, and 100%, respectively, for a total of 400 birch sap product samples. Then, a sample partitioning algorithm based on xy distance is used to partition the 400 birch sap concentrate adulterated samples at a ratio of 7:3, resulting in a training set of 280 samples and a prediction set of 120 samples.

[0042] Based on this, please refer to Figure 3 , Figure 3 This is the confusion matrix of the qualitative analysis model for the prediction set samples in the embodiments of this application. According to this confusion matrix, two samples with an adulteration concentration of 25% were misclassified as samples with an adulteration concentration of 50%. These misclassified samples are located near the critical boundary of the adulteration gradient, and because their spectral characteristics are highly similar to those of adjacent gradient categories, the model faces a challenge in distinguishing between them when defining the decision boundary. However, since these misclassifications only occur between 25% and 50%, and there are no cases of adulterated samples being misclassified as birch sap concentrate, this still demonstrates to some extent the robustness and reliability of the qualitative analysis model in the birch sap identification task described above.

[0043] Please see Figure 4 In some implementations, step 02 further includes: Step 021: Based on the convolutional neural network included in the quantitative analysis model, and based on the spectral data to be analyzed, perform scale detail acquisition and standardization and activation processing to determine local spectral feature data; Step 022: Based on the Transformer model included in the quantitative analysis model, determine the overall spectral characteristic data by correlating wavelength parameters with local spectral characteristic data; Step 023: Based on the efficient channel attention mechanism module included in the quantitative analysis model, and based on the screening criteria features obtained by judgment, channel optimization is performed on the overall spectral feature data to obtain the quantitative analysis results.

[0044] Specifically, based on the above implementation method, the quantitative detection process generally uses the pre-processed spectral data to be analyzed as input data, which is input into the quantitative analysis model for detection. After analysis and detection, the quantitative analysis model can output the corresponding quantitative analysis results. The quantitative analysis results generally include three sets of information: first, quantitative characterization information, which is used to characterize the adulteration ratio of the current birch sap product sample; second, the probability corresponding to the above quantitative characterization information; and third, the confidence level data of the quantitative analysis results.

[0045] For example, for a birch sap product sample, after inputting its corresponding spectral data to be analyzed into the qualitative analysis model, the qualitative analysis model outputs the following qualitative analysis results: the adulteration rate is 0, with a corresponding probability of 0.940; the adulteration rate is 25%, with a corresponding probability of 0.015; the adulteration rate is 50%, with a corresponding probability of 0.015; the adulteration rate is 75%, with a corresponding probability of 0.015; the adulteration rate is 100%, with a corresponding probability of 0.015, and a confidence level of 0.940.

[0046] The construction of quantitative analysis models is generally based on the Convolutional Neural Network-Transformer (CNN-Transformer) model, followed by an Efficient Channel Attention (ECA) mechanism. The CNN module typically employs a three-layer convolutional structure composed of a one-dimensional CNN (1D-CNN), with kernel sizes of 7×1, 5×1, and 3×1, respectively. This extracts multi-scale information from macroscopic spectral contours to local feature patterns. Batch standardization and ReLU activation are performed after each convolutional layer to ensure model stability and enhance nonlinear expressive power. The ECA mechanism is then introduced, using adaptive global average pooling and one-dimensional convolution to generate channel weight vectors, enabling autonomous selection and enhancement of key spectral feature channels. For the Transformer encoder, sine and cosine positional encoding preserves the spectral sequence order information. A multi-head self-attention mechanism models the global dependencies between different bands. Finally, a global average pooling layer and a fully connected classifier map the spectral features, fusing local details and global context, into continuous predicted values ​​of adulteration concentration, forming the quantitative analysis framework.

[0047] In practical applications, a convolutional neural network is first used to acquire scale details based on the spectral data to be analyzed. Then, batch normalization and ReLU activation are performed on the acquired scale details to obtain local spectral feature data. A Transformer encoder is then used to correlate the local spectral feature data with global wavelength parameters, thereby forming overall spectral feature data for the entire spectral band.

[0048] The core of the Transformer encoder lies in its sequence modeling capability based on a self-attention mechanism. Specifically, for a given input sequence... X (Its dimension is L×d, where L is the sequence length and d is the feature dimension.) The Transformer encoder first obtains the query matrix Q, the key matrix K, and the value matrix V through linear transformation:

[0049]

[0050]

[0051] in, , , For a learnable parameter matrix, Let be the dimension of the key matrix. is the dimension of the value matrix.

[0052] Scaling dot product attention follows the formula below:

[0053] The dimension of the key matrix Acting as a scaling factor to prevent gradient vanishing, the softmax function is used for row-wise normalization.

[0054] Furthermore, to capture features of multiple subspaces, a multi-head attention mechanism is introduced:

[0055] Where MultiHead represents multi-head attention, and h is the number of attention heads. To output the projection matrix, head1 is the first attention head, head h This is the h-th (and last) attention head. In spectral analysis applications, the dimension of the bond matrix is... and the dimension of the value matrix Generally, the following equality relationships are used:

[0056] For any attention head, the calculation method is as follows:

[0057] head i Indicates the first i One point of attention, here i It should be no less than 1 and no greater than h. , as well as In order to be with the first i The parameter matrix corresponding to each attention head.

[0058] Since self-attention lacks positional awareness, additional positional information needs to be injected. Generally, sine and cosine positional encoding is used, as follows:

[0059]

[0060] in For sinusoidal position encoding, This is a cosine positional encoding, where pos is the position index. s For dimensional indexing.

[0061] Furthermore, the quantitative analysis model in this application employs a two-layer Transformer encoder, with each layer including four attention heads. The hidden layer dimension of the feedforward network is 512, and the input feature dimension is 256. To prevent the gradient vanishing problem during deep network training, residual connections and layer normalization are generally used to ensure model stability. Specifically, regarding the layer normalization method, let the object of layer normalization corresponding to a certain encoder layer be... Y Therefore, in mathematics, the normalization function can be expressed as follows:

[0062] in μ Y The mean value of the encoder input for this layer. σ Y The standard deviation of the encoder input for this layer. ε For learnable scaling parameters, β These are learnable translation parameters.

[0063] Based on this, the specific methods to ensure model stability through residual connections and layer normalization are as follows:

[0064]

[0065]

[0066] MSA stands for Multi-head Self-Attention Sublayer. To apply residual connections to the reference output obtained by layer normalization for multi-head self-attention sublayers, FFN represents the feedforward neural network sublayer. To apply residual connections to the reference output obtained by layer normalization in a feedforward neural network sublayer, ReLU is used as the activation function. W 1 represents the weight matrix of the first-layer encoder. W 2 represents the weight matrix of the second-layer encoder. b 1 represents the bias vector of the first-layer encoder. b 2 is the bias vector of the second layer encoder.

[0067] In spectral analysis, the attention weight matrix explicitly quantifies the correlation strength between different bands, thus providing an interpretable physical basis for adulteration concentration detection. The above model achieves global context modeling through a pure attention mechanism, thereby complementing the local features extracted by the convolutional neural network.

[0068] The calculation process for the ECA module is as follows: First, let the input overall spectral feature data be... Global average pooling is used to compress the input global spectral feature data along the spatial dimension to obtain channel descriptors. :

[0069] in For the c-th channel of the input overall spectral feature data, This indicates that the c-th channel of the overall spectral feature data is located at coordinate ( p , q The pixel value at () H The height parameter of the overall spectral feature data. W This is the width parameter for the overall spectral feature data. This step compresses the two-dimensional features of each channel into a one-dimensional statistic.

[0070] Next, an adaptive one-dimensional convolution is used to capture cross-channel interaction information. It's important to note the kernel size of this adaptive one-dimensional convolution. κ It is adaptively determined based on the number of channels, as detailed below:

[0071] in DFor the channel dimension, the subscript "odd" indicates taking the nearest odd number. This design allows the quantitative analysis model to automatically adjust the receptive field size based on the complexity of the features, thereby maintaining optimal performance at different network depths.

[0072] Finally, attention weights are generated using the Sigmoid function and multiplied channel-by-channel with the input global spectral feature data to achieve feature recalibration, thereby obtaining the final quantitative analysis results. The details are as follows:

[0073] in These are the convolutional layer weights obtained after applying the Sigmoid function.

[0074] Through the above calculation method, the ECA module can perform channel optimization in spectral processing with low computational cost, thereby enhancing discriminative bands, suppressing noise, and thus improving the performance of quantitative analysis models in spectral tasks.

[0075] The evaluation of quantitative prediction models generally relies on multidimensional parameters, such as the calibration coefficient of determination (CCD). ) and predictive determination coefficient ( The two coefficients of determination mentioned above reflect the goodness of fit of the model; the closer the values ​​of the two coefficients are to 1, the higher the fitting accuracy. Furthermore, the evaluation metrics for model accuracy among multidimensional parameters generally include the root mean square error of calibration (RMSE). C ) and Root Mean Square Error (RMSE) P The two indicators mentioned above quantify the distribution of prediction bias; the lower the value, the higher the model's accuracy. The relative analytical error (RPD), as a comprehensive evaluation parameter of model robustness and predictive ability, is graded as follows: 1.5 ≤ RPD < 2.0 indicates limited predictive ability, 2.0 ≤ RPD < 2.5 indicates moderate predictive reliability, and RPD ≥ 2.5 indicates the model has high predictive potential. For example, the calibration determination coefficient mentioned above... ) and predictive determination coefficient ( The mathematical expressions for the relative analysis error (RPD) are as follows:

[0076]

[0077]

[0078]

[0079] in The first term determined by the quantitative analysis model iPredicted values ​​of adulteration concentration in individual birch sap product samples. Indicates the first i The true value of adulteration concentration in a birch sap product sample. This represents the average adulteration concentration of each birch sap product sample in the training set. This indicates the average adulteration concentration of each birch sap product sample in the prediction set. This indicates the number of birch sap product samples in the training set. This indicates the number of birch sap product samples predicted. This represents the relative analysis error with respect to the training set. This represents the relative analysis error for the prediction set.

[0080] As for the evaluation of the results of the quantitative analysis model, we used the absorption spectrum of the birch sap product sample prepared by the method described in the above embodiments as the original near-infrared absorption spectrum data. We compared the quantitative analysis model (CNN-Transformer-ECA) in this application with the quantitative analysis models such as PLSR, SVR, RF, LSTM and BP in the current related technologies on the above indicators, and obtained the comparison results shown in Table 2.

[0081] Table 2 Comparison of Prediction Results from Quantitative Analysis Models

[0082] It should be noted that the CNN-Transformer-ECA, LSTM, and BP models mentioned above were developed using the PyTorch framework and trained on a GPU. During training, optimized hyperparameter configurations were employed, such as using the AdamW optimizer (learning rate 1e-3, weight decay 1e-4) combined with a cosine annealing learning rate scheduling strategy (minimum learning rate 1e-6), selecting a smooth L1 loss function for regression training, setting the batch size to 32, training epochs to 200, and introducing an early stopping mechanism (patience value of 15 epochs). Data standardization and 10-fold cross-validation were also used to ensure the stability and generalization ability of the model training. The PLSR and SVR models mentioned above were implemented using the Scikit-learn library through the PLSRegression and SVC interfaces, respectively, and executed on the aforementioned platform.

[0083] According to Table 2, on the training set, the CNN-Transformer-ECA model in this application embodiment exhibits the best overall performance, with a coefficient of determination (...). The highest (0.9610) was the root mean square error (RMSE). C The lowest (3.1574), relative analysis error ( The value was also the largest (5.06), indicating that the model has excellent fitting ability and predictive stability during the training phase. The BP model on the training set... Second only to CNN-Transformer-ECA, with a score of 0.9467, and The value is relatively high (4.33), indicating good data adaptability.

[0084] On the prediction set, the CNN-Transformer-ECA and LSTM models performed particularly well. The values ​​were 0.9482 and 0.9379 respectively, indicating that both have strong generalization ability. From the RMSE... P The CNN-Transformer-ECA algorithm exhibits the smallest error (3.6382), further validating its advantage in prediction accuracy. Overall, the CNN-Transformer-ECA algorithm demonstrates the best fitting performance during training and also performs robustly in predicting unknown data.

[0085] Please see Figure 5 , Figure 5 The results of the quantitative analysis model described above are shown, intuitively demonstrating the correlation between the actual adulteration concentration and the model's predicted value. As can be seen from the figure, the data in the training and prediction sets are relatively evenly distributed on both sides of the fitted line, and no significant outliers appear. These distribution characteristics indicate that the quantitative analysis model in the above embodiment has excellent prediction accuracy and reliability for birch sap adulteration concentration.

[0086] Please see Figure 6 , Figure 6 The results show the comparison between the predicted values ​​of adulteration ratios obtained by using the quantitative analysis model in the above embodiments for 50 additional birch sap product samples and the actual values ​​of adulteration ratios of the samples themselves. It can be seen that there is no obvious systematic deviation between the actual values ​​and the predicted values, which shows that the quantitative analysis model in the above embodiments has high accuracy in predicting the adulteration concentration of birch sap concentrate products.

[0087] In some embodiments, the birch sap product testing method in this application further includes: Based on the batch normalization layer included in the quantitative analysis model, channel attention pruning is performed.

[0088] Specifically, based on the above implementation methods, and exemplarily speaking, in addition to CNN-Transformer and ECA mechanisms, a channel attention pruning algorithm is also set up for the quantitative analysis model. Its core principle is to first train a sub-model containing batch normalization (BN) layers, and apply L1 regularization to the scaling factor of the BN layers during training. After training, the channels are sorted according to the magnitude of their scaling factors. Then, a global threshold or a layer-specific threshold is set, and channels with scaling factors below the threshold, along with their corresponding weights and biases, are all pruned. The final step is to fine-tune this "narrower network" to effectively restore the performance of the quantitative analysis model, potentially even surpassing the accuracy before pruning. In this way, redundant structures in the quantitative analysis model can be pruned, reducing its size. Specifically, in convolutional neural networks, each convolutional layer is typically followed by a batch normalization (BN) layer. The BN layer normalizes each channel and then applies scaling and offset.

[0089]

[0090] in For the first i The input activation value for each channel, The output value is the standardized value. This is the offset value corresponding to the input activation value. For this batch of data in the channel i The mean of the above, For this batch of data in the channel i The standard deviation on and For learnable affine transformation parameters, These are hyperparameters used to protect data stability.

[0091] Channel attention pruning is achieved by adjusting the scaling factor for each channel. Applying L1 regularization reduces a portion of the scaling factor. If the scaling factor of a certain channel approaches 0, If the value is very small, then the offset value corresponding to that channel after transformation will also be suppressed, further implying that the contribution of that channel to subsequent layers approaches 0. Under such conditions, the model's loss function... L as follows:

[0092] in For the original task loss, This represents the set of scaling factors for all BN layers. ν To control the hyperparameters of sparsification intensity, ν The larger the scaling factor, the stronger the regularization penalty, approaching zero. The more, the better. Scaling factor for all BN layers The sum of the L1 norms. Training based on the above loss function allows the model to automatically ignore channels where the scaling factor contribution approaches zero while completing the main task. Under this training context, it is possible to... Perform a global sort on all channels and prune the data for the quantitative analysis model.

[0093] As for the contribution evaluation of channel attention pruning, the CNN model, CNN-Transformer model, CNN-Transformer-ECA model and CNN-Transformer-ECA-NS model (that is, the quantitative analysis model that performed channel attention pruning in the above embodiments) can be compared. The module ablation experiment was carried out on the prediction set of birch sap product samples in the above embodiments, and the comparison results are shown in Table 3.

[0094] Table 3 Comparison of results from ablation experiments using the quantitative analysis model

[0095] Ablation experiments show that the RMSE of the CNN-Transformer model is improved after introducing the Transformer module. P The decrease was from 4.2574% to 3.9476%. The accuracy improved from 0.8917 to 0.9346. This indicates that the Transformer module effectively captures global dependencies, enhancing the model's representational capabilities and thus significantly improving prediction accuracy. Further integration of the ECA module resulted in the CNN-Transformer-ECA model achieving optimal accuracy with a lower RMSE. P It dropped to 3.6382%. The accuracy was improved to 0.9482. The ECA module optimizes feature extraction through a lightweight channel attention mechanism, enhancing the model's ability to focus on key information, thus achieving further improvements in accuracy. Furthermore, by utilizing the channel attention pruning algorithm (NS), the model size was reduced to 5.28MB, and the inference time was lowered to 2.9ms, significantly lower than other configurations. Despite the improved RMSE... P It increased slightly to 3.8733%. The accuracy dropped slightly to 0.9315, but it still maintained a high level of accuracy compared to the benchmark CNN model, thus verifying the effectiveness of the channel attention pruning algorithm in balancing model accuracy and efficiency.

[0096] The birch sap product testing system in this application is configured on a pre-set computer device, and the system includes: The product testing module is used to execute the birch sap product testing method in the above embodiments. The interactive control module is used to perform human-computer interaction with the user, so that the product testing module can execute the birch sap product testing method, and display the interaction results to the user and / or display the qualitative and / or quantitative analysis results determined by executing the birch sap product testing method.

[0097] Specifically, based on the above embodiments, this application also provides a birch sap product testing system arranged on a preset computer device. The system is divided into a back-end module (i.e., a product testing module) and a front-end module (i.e., an interactive control module). The back-end module is mainly used to execute the birch sap product testing method provided in the above embodiments. The back-end module is mainly divided into three parts: a preprocessing submodule, which is used to perform preprocessing on near-infrared spectral data; a qualitative analysis submodule, which carries a qualitative analysis model to perform qualitative analysis on the preprocessed spectral data to be analyzed; and a quantitative analysis submodule, which carries a quantitative analysis model to perform quantitative analysis on the preprocessed spectral data to be analyzed.

[0098] The front-end module is primarily responsible for human-computer interaction with the user, controlling the back-end module based on user-inputted commands. The back-end module then executes the birch sap product testing method according to these commands. Furthermore, the front-end module is responsible for providing real-time feedback on the human-computer interaction results to the user, and displaying the qualitative and / or quantitative analysis results output by the back-end module from the birch sap product testing method, thus providing feedback to the customer. In the above embodiment, the qualitative and quantitative analysis models included in the birch sap product testing method are incorporated into the aforementioned birch sap product testing system and are deployed together on a pre-set computer device. The hardware conditions of the aforementioned computer device should ensure that the qualitative and quantitative analysis models can always operate normally. Under these conditions, the selection and construction of equipment components are based on actual costs; this application does not impose specific limitations.

[0099] Thus, the birch sap product detection method in this application combines near-infrared spectroscopy with machine learning and deep learning models to target the highly nonlinear interaction between adulterants and spectral features, thereby improving the accuracy of detecting adulteration in birch sap samples in terms of the ability to resolve nonlinear spectral responses. Furthermore, it utilizes a convolutional neural network-Transformer hybrid architecture to automatically perform feature extraction at multiple levels, comprehensively characterizing the spectral information of birch sap samples from local to global perspectives, improving quantitative detection accuracy while reducing manual intervention in the detection process.

[0100] Please see Figure 7 In some implementations, the interactive control module is further configured with a human-computer interaction interface, and the method for the interactive control module to perform human-computer interaction with the user includes: Step 0001: In response to the user's first operation in the first area of ​​the human-computer interaction interface, import the near-infrared absorption spectrum of the birch sap product sample into the birch sap product detection system. The near-infrared absorption spectrum is pre-acquired based on a preset spectral acquisition device; Step 0002: In response to the user's second operation in the first area, display the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample in the second area of ​​the human-computer interaction interface; Step 0003: In response to the user's third operation in the first area, display the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample in the second area.

[0101] It should be noted that, under normal circumstances, step 0001 should be executed before steps 0002 and 0003. Steps 0002 and 0003 can be executed according to the user's actual needs through corresponding operations. The execution order and whether they are executed depend on the user's needs. Figure 7 The process shown is for illustrative purposes only and should not be construed as limiting.

[0102] Specifically, based on the above implementation method, the front-end module is equipped with a human-computer interaction interface (HCI) for human-computer interaction with the user. This interface is generally displayed to the user through the computer device's monitor. The user performs operations on the HCI using a mouse, keyboard, or voice control, thereby achieving human-computer interaction. For a detailed explanation of the implementation of HCI, please refer to [link to relevant documentation]. Figure 8 , Figure 8The overall structure of the human-computer interaction interface is illustrated exemplarily. The first area is the functional area where the user interacts with the front-end module through operations. This area can include interactive components such as buttons, text boxes, and drop-down menus, and is typically set to gray as the background color. The second area is the results display area, used to present qualitative or quantitative analysis results to the user through charts or other methods. Specifically, it can be represented as a display window set within the first area. In this interface, the user can interact with the front-end module by performing operations on the interactive components included in the first interface, such as buttons, text boxes, and drop-down menus, thereby obtaining interactive feedback or qualitative / quantitative analysis results of birch sap product samples from the human-computer interaction interface.

[0103] Furthermore, in some implementations, please refer to... Figure 9 Step 0001 specifically includes: Step 00011: In response to the user's click operation on the first button in the first area, import the near-infrared absorption spectrum into the birch sap product detection system; Step 00012: Display the first text message in the first area to indicate to the user that the near-infrared absorption spectrum import is complete.

[0104] Specifically, please refer to Figure 10 For applying the pre-acquired near-infrared absorption spectrum to the birch sap product detection method in the above embodiments, exemplarily, the user can import the pre-acquired near-infrared absorption spectrum into the back-end module of the birch sap product detection system by operating the first button on the first interface. For example... Figure 10 As shown, the first interface has a first button. After the user clicks the first button, the human-computer interaction interface will display a checkbox, allowing the user to select the file path corresponding to the near-infrared absorption spectrum. Once the user has selected the path, the file corresponding to the near-infrared absorption spectrum is imported into the backend module. Simultaneously, the frontend module displays text information below the first button to indicate to the user that the spectrum import is complete. For example... Figure 11 The situation is shown.

[0105] Furthermore, in some implementations, please refer to Figure 12 Step 0002 specifically includes: Step 00021: In response to the user's selection of the drop-down menu in the first area, select the birch sap product sample; Step 00022: In response to the user's click on the second button in the first area, display the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample in the second area.

[0106] Similarly, in some implementations, please refer to Figure 13 Step 0003 specifically includes: Step 00031: In response to the user's selection operation of the drop-down menu in the first area, select the birch sap product sample; Step 00032: In response to the user's click on the third button in the first area, display the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample in the second area.

[0107] Specifically, based on the above implementation method, after successfully importing near-infrared absorption spectra, the user can select the birch sap product sample to be analyzed using the drop-down menu in the first area, and then control the computer device to execute the birch sap product detection method in the above implementation method by clicking the corresponding model button (corresponding to the second button or the third button). Finally, the front-end module displays the qualitative / quantitative analysis results corresponding to the model selected by the user in the second area in the form of multiple charts.

[0108] For example, please refer to Figure 14 Users can extract data from various sample fields in the imported file by clicking the expand button in the drop-down menu. The data will then be displayed in the drop-down menu. Users can select the sample to be analyzed by clicking the drop-down menu. The interface after selection will then appear as shown. Figure 15 As shown.

[0109] Then, users can perform qualitative or quantitative analysis by clicking the buttons corresponding to different models, for example, in Figure 15 Based on the scenario shown, when the user clicks the second button, the front-end module controls the back-end module to execute the birch sap product testing method described above. Using a qualitative analysis model, the qualitative analysis results corresponding to the sample are determined, and then the near-infrared absorption spectrum chart and qualitative analysis chart corresponding to the sample are displayed in the second area, such as... Figure 16 As shown in the figure. The near-infrared absorption spectrum chart is displayed in the upper left of the second area. The qualitative analysis chart generally includes two parts. The first is the qualitative analysis result chart, which is used to characterize the qualitative judgment result of whether the birch sap product sample is an adulterated sample or a pure sample, and the probability corresponding to the above qualitative judgment result. It is displayed in the upper right of the second area. The second is the prediction confidence chart, which characterizes the prediction confidence of the qualitative analysis. It is displayed in the lower left of the second area.

[0110] For example, in Figure 15As shown, when the user selects the corresponding sample and clicks the third button, the front-end module controls the back-end module to execute the birch sap product detection method described above. Using a quantitative analysis model, the quantitative analysis result corresponding to the sample is determined, and then the near-infrared absorption spectrum chart and quantitative analysis chart corresponding to the sample are displayed in the second area. Figure 17 As shown. The near-infrared absorption spectrum chart is displayed in the upper left of the second area. The quantitative analysis chart generally includes two parts: one is the quantitative analysis result chart, which is used to characterize the predicted proportion of adulteration in the birch sap product sample and the probability corresponding to each predicted result, and is displayed in the upper right of the second area; the other is the prediction confidence chart, which characterizes the prediction confidence of the quantitative analysis and is displayed in the lower left of the second area.

[0111] It should be noted that the display positions of the near-infrared absorption spectrum chart and the qualitative / quantitative analysis chart in the second area can be adjusted according to user habits. The above implementation method is only an example and should not be construed as limiting.

[0112] Furthermore, for the qualitative / quantitative analysis models corresponding to the second and third buttons in the above embodiments, in addition to the preferred analysis model of the birch sap product detection method in the above embodiments, other qualitative / quantitative analysis models in the current related technologies can also be selected. For details, please refer to Tables 1 and 2 in the above embodiments for other qualitative / quantitative analysis models. If multiple qualitative / quantitative analysis models are deployed simultaneously on the computer device, a second (third) button can be set for each analysis model for the user to select.

[0113] Furthermore, in some implementations, the method for the interactive control module to perform human-computer interaction with the user also includes: In response to the second operation, the near-infrared absorption spectrum, the parameter information of the qualitative analysis model, and the qualitative analysis results are displayed in text form in the text box within the first area; or In response to the third operation, the near-infrared absorption spectrum, the parameter information of the quantitative analysis model, and the quantitative analysis results are displayed in text form in the text box.

[0114] For details, please continue reading Figure 16 as well as Figure 17For example, when the user clicks the second or third button, the human-computer interface, in addition to displaying the qualitative / quantitative analysis results in a chart format in the second area, will simultaneously display the selected sample, its spectral characteristics, the qualitative / quantitative analysis results, and the prediction confidence level in a text box located at the bottom of the first area. However, unlike the chart in the second area, the text-based qualitative / quantitative analysis results generally only include the prediction result with the highest probability. Thus, the user can directly copy the text displayed in the text box to save it as the analysis result of the current qualitative / quantitative analysis.

[0115] The electronic device in this application includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the birch sap product testing method in the above-described embodiments is implemented.

[0116] The computer-readable storage medium in the embodiments of this application stores a computer program that, when executed by one or more processors, implements the birch sap product testing method described in the above embodiments.

[0117] The above description is merely a preferred embodiment of this application and is not intended to limit this application in any way. Although this application has disclosed the preferred embodiment as above, it is not intended to limit this application. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the technical solution of this application. Any simple modifications, equivalent substitutions, and improvements made to the above embodiments without departing from the technical solution of this application, based on the technical essence of this application and within the spirit and principles of this application, shall still fall within the protection scope of the technical solution of this application.

Claims

1. A method for testing birch sap products, characterized in that, The method includes: Preprocessing is performed on the near-infrared absorption spectra of birch sap product samples to determine the spectral data to be analyzed, in order to eliminate the negative impact of non-target physical factors, wherein the near-infrared absorption spectra are pre-acquired based on a preset spectral acquisition device; Based on a pre-trained qualitative analysis model and / or a pre-trained quantitative analysis model, and according to the spectral data to be analyzed, the qualitative and / or quantitative analysis results corresponding to the birch sap product sample are determined. The qualitative analysis model is a support vector machine model with hyperparameter optimization based on the dung beetle algorithm, and the quantitative analysis model is a convolutional neural network-Transformer hybrid model with an efficient channel attention mechanism. The qualitative analysis results are configured to qualitatively characterize the probability of adulteration of the birch sap product sample and the corresponding prediction confidence level, and the quantitative analysis results are configured to quantitatively characterize the content of birch sap concentrate in the birch sap product sample and the corresponding prediction confidence level.

2. The method for detecting birch sap products according to claim 1, characterized in that, In the qualitative analysis model, the dung beetle algorithm optimizes the penalty coefficient and regularization coefficient of the core of the support vector machine model RBF to optimize the penalty coefficient and the regularization coefficient to a relatively optimal solution.

3. The method for detecting birch sap products according to claim 1, characterized in that, The pre-trained qualitative analysis model and / or pre-trained quantitative analysis model, based on the spectral data to be analyzed, determines the qualitative and / or quantitative analysis results corresponding to the birch sap product sample, including: Based on the convolutional neural network included in the quantitative analysis model, and based on the spectral data to be analyzed, scale detail acquisition and standardization and activation processing are performed to determine local spectral feature data; Based on the Transformer model included in the quantitative analysis model, and based on the local spectral feature data, the overall spectral feature data are determined by associating wavelength parameters. Based on the efficient channel attention mechanism module included in the quantitative analysis model, channel optimization is performed on the overall spectral feature data based on the screening criteria features obtained from the judgment, and the quantitative analysis results are obtained. The birch sap product testing method also includes: Based on the batch normalization layer included in the quantitative analysis model, channel attention pruning is performed on the quantitative analysis model.

4. A birch sap product testing system, said system being arranged on a pre-set computer device, characterized in that, The system includes: The product testing module is used to perform the birch sap product testing method as described in any one of claims 1-3; An interactive control module is used to perform human-computer interaction with the user, so that the product testing module executes the birch sap product testing method, and displays the interaction results to the user and / or displays the qualitative analysis results and / or the quantitative analysis results determined by executing the birch sap product testing method.

5. The birch sap product testing system according to claim 4, characterized in that, The interactive control module is also configured with a human-computer interaction interface, and the method by which the interactive control module performs human-computer interaction with the user includes: In response to a user’s first operation in the first area of ​​the human-computer interaction interface, the near-infrared absorption spectrum of the birch sap product sample is imported into the birch sap product detection system, wherein the near-infrared absorption spectrum is pre-acquired based on a preset spectral acquisition device. In response to a second operation by the user in the first area, the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample are displayed in the second area of ​​the human-computer interaction interface; and / or In response to a third operation by the user in the first area, the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample are displayed in the second area; In response to the second operation, the near-infrared absorption spectrum, the parameter information of the qualitative analysis model, and the qualitative analysis results are displayed in text form in a text box within the first area; In response to the third operation, the near-infrared absorption spectrum, the parameter information of the quantitative analysis model, and the quantitative analysis results are displayed in text form in the text box.

6. The birch sap product testing system according to claim 5, characterized in that, The step of importing the near-infrared absorption spectrum of a birch sap product sample into the birch sap product detection system in response to a first operation by the user in the first area of ​​the human-computer interaction interface includes: In response to the user's click operation on the first button in the first area, the near-infrared absorption spectrum is imported into the birch sap product detection system; The first text message is displayed in the first area to indicate to the user that the near-infrared absorption spectrum has been imported.

7. The birch sap product testing system according to claim 5, characterized in that, In response to a second user operation within the first area, displaying the near-infrared absorption spectrum and qualitative analysis results corresponding to the selected birch sap product sample within the second area of ​​the human-computer interaction interface includes: In response to the user's selection operation of the drop-down menu in the first area, the birch sap product sample is selected; In response to a user's click on the second button in the first area, the near-infrared absorption spectrum and the qualitative analysis results corresponding to the selected birch sap product sample are displayed in the second area.

8. The birch sap product testing system according to claim 5, characterized in that, In response to a third user action in the first area, displaying the near-infrared absorption spectrum and quantitative analysis results corresponding to the selected birch sap product sample in the second area includes: In response to the user's selection operation of the drop-down menu in the first area, the birch sap product sample is selected; In response to a user's click on the third button in the first area, the near-infrared absorption spectrum and the quantitative analysis results corresponding to the selected birch sap product sample are displayed in the second area.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program that, when executed by the processor, implements the birch sap product testing method as described in any one of claims 1-3.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by one or more processors, implements the birch sap product testing method as described in any one of claims 1-3.