Spectral quantitative detection model updating method applied to recessive decision boundary

By acquiring spectral frequency features and designing a representative sample screening strategy, the problem of updating the spectral detection model under the implicit decision boundary was solved, achieving efficient model updating and improved adaptability.

CN121917468APending Publication Date: 2026-04-24HUZHOU UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUZHOU UNIVERSITY
Filing Date
2023-11-09
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing spectral detection models are difficult to update effectively in quantitative detection tasks facing implicit decision boundaries, and traditional methods for calculating spectral differences or similarities lack reliability, resulting in insufficient ability of models to adapt to new sample patterns.

Method used

By collecting spectral data of unlabeled samples, frequency features are obtained, the distance between spectral amplitude and frequency features is calculated, representative samples are screened using hierarchical clustering and local linear reconstruction methods, and a batch training strategy and model parameter correction strategy based on information extraction ratio are designed to construct an objective function to achieve efficient model updating.

Benefits of technology

It improves the accuracy and stability of value sample judgment, reduces model update costs, ensures that the model can adapt in a timely manner when faced with new sample patterns, and enhances the flexibility and completeness of quantitative detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121917468A_ABST
    Figure CN121917468A_ABST
Patent Text Reader

Abstract

The invention provides a spectrum quantitative detection model updating method applied to a recessive decision boundary, which comprises the following steps of: (1) collecting spectrum data of an unmarked sample, and obtaining frequency characteristics of a spectrum; (2) calculating the distance between the unmarked sample and the modeling sample on the spectral amplitude characteristic and the spectral frequency characteristic; (3) selecting a valuable sample through a statistical inference algorithm based on the calculated distance between the two types of features; (3) selecting representative samples from the valuable samples by using hierarchical clustering and local linear reconstruction methods, and manually marking label values of the representative samples; and (4) designing a target function for model updating, and updating the model by adopting a batch training method based on an information extraction ratio. The method focuses on the updating problem of the spectrum quantitative detection model, the representative sample is obtained based on the implicit decision boundary mode, and rapid, reliable and low-cost updating of the model is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spectral detection technology, specifically a method for updating a quantitative spectral detection model applied to implicit decision boundaries. Background Technology

[0002] In practical applications of spectral detection, due to individual spectral feature differences and the inability to collect large amounts of effective training data for some sample types, it is difficult to guarantee that the established detection model can be applied to all possible sample patterns once and for all. Therefore, updating and maintaining the detection model during operation is extremely important. However, compared to the construction of spectral detection models, there is much less research on the updating and maintenance of spectral detection models, and existing research on detection model updates mainly focuses on qualitative detection tasks (i.e., classification tasks). Unlike qualitative detection models, quantitative detection models do not have explicit decision boundaries, making it difficult to determine the value of unlabeled samples based on the decision boundaries of the established model. Therefore, it is necessary to design a value sample determination strategy based on implicit decision boundaries for quantitative detection tasks. In actual production processes, valuable samples are often acquired in batches, and the spectral distribution characteristics of some samples may show high homogeneity. Manually labeling each valuable sample would increase the cost of model updates. Therefore, it is necessary to further select representative samples from the valuable samples to reduce labeling costs. After acquiring the spectral and label data for model updates, the update strategy adopted will directly affect the update effect and efficiency of the model. Therefore, it is necessary to design a reasonable update strategy based on the specific characteristics of the data and the model to ensure that the model avoids destroying the original features as much as possible when learning new features.

[0003] To address the aforementioned key issues, this invention aims to propose a method for updating a spectral quantitative detection model applied to implicit decision boundaries. This method statistically infers valuable samples based on the distance between spectral amplitude features and spectral frequency features, as well as the spatial distribution characteristics of the modeling samples. While ensuring the integrity of the feature space of valuable samples, it further extracts representative samples using hierarchical clustering and local linear reconstruction methods. Based on the actual application scenario, it constructs an objective function to evaluate the model update effect and adopts a batch training method based on the information extraction ratio to achieve efficient updating of the spectral quantitative detection model. Summary of the Invention

[0004] The purpose of this invention is to provide a method for updating a spectral quantitative detection model applied to implicit decision boundaries. To achieve this purpose, the technical solution adopted in this invention is as follows:

[0005] S1: Collect spectral data of unlabeled samples and obtain the frequency characteristics of the spectrum.

[0006] Spectral data of the analyte, such as reflectance spectrum, absorption spectrum, and scattering spectrum, are acquired using a spectrometer or hyperspectral imaging system. The frequency characteristics of the spectrum are then obtained through amplitude-frequency conversion, such as Fourier transform or wavelet transform.

[0007] S2: Based on the unlabeled sample spectral data and frequency characteristics obtained in S1, calculate the distance between the unlabeled sample and each modeled sample in terms of spectral amplitude and spectral frequency characteristics.

[0008] For example, cosine similarity can be used to calculate the amplitude distance between the spectrum X of an unlabeled sample and the spectrum Y of a modeled sample:

[0009]

[0010] To calculate the distance between the unlabeled sample spectrum X and the modeled sample spectrum Y on the frequency feature matrix using singular value decomposition (SVD), we first perform SVD on the frequency feature matrix: F = LWR, where L is the left singular matrix, R is the right singular matrix, and W is the singular diagonal matrix. Let F... X and F Y Let X and Y be the frequency characteristic matrices corresponding to spectra respectively. Then their distance is:

[0011]

[0012] In the formula, L X L Y The frequency characteristic matrix F X F Y The left singular matrix, R X R Y The frequency characteristic matrix F X F Y The right singular matrix is ​​denoted by || ||, where || represents the Euclidean 2 norm.

[0013] S3: Based on the two types of feature distances obtained from S2, valuable samples are selected through statistical inference and swarm intelligence algorithms.

[0014] The distances between unlabeled samples and each modeled sample are sorted in ascending order to obtain the amplitude feature distance sequence A and the frequency feature distance sequence F. The average value of each sequence (A) is calculated. avg F avg ), maximum value (A) max F max ), minimum value (A) min F min ), standard deviation (A) std F std For samples within the modeling set, iterate through each modeling sample and sort the distances between each sample and other modeling samples in ascending order to obtain the amplitude feature distance sequence A. innerDistance sequence F with frequency features inner Calculate the average value of each sequence. Maximum value Minimum value Standard deviation The initial value of unlabeled samples is calculated according to the following rules:

[0015] val(X) = W A ·val A +W F ·val F

[0016]

[0017]

[0018]

[0019]

[0020] stw A +w F =1

[0021]

[0022] In the formula, val(X) represents the value of the unlabeled sample X to the detection model, and W A W represents the value weight of the amplitude feature. F Val represents the value weight of frequency features. A Val represents the sample value calculated based on the amplitude characteristics. F w represents the sample value calculated based on frequency characteristics. stat σ represents the weight value of the specific statistical indicator; N represents the number of samples in the modeling set; C represents the mean of all modeling samples under the specific statistical indicator, i.e., the distribution center; σ represents the width of the distribution confidence interval of all modeling samples under the specific statistical indicator; and exp represents the exponential operation with the natural number e as the base.

[0023] Based on the calculated value val(X) of the unlabeled sample X, we set 1 as the lower limit and 2 as the upper limit. Unlabeled samples within this range are considered valuable samples; those below 1 are considered worthless samples, and those above 2 are considered abnormal samples.

[0024] S4: Further extract representative samples from the valuable samples obtained in S3 to reduce the cost of model updates.

[0025] S4.1, a hierarchical clustering algorithm is used to divide the selected valuable samples into different subsets based on the characteristics of the spectral data, and each subset is considered to correspond to a different factor level;

[0026] S4.2, the local linear reconstruction method is used to select representative samples from each subset. The basic idea is that if the most representative samples in the subset are selected, the loss of reconstructing the entire data space using these samples will be minimized.

[0027] S4.3, Manually calibrate the extracted representative samples.

[0028] S5: Design model training and update strategies.

[0029] S5.1, Construct an objective function to evaluate the effectiveness of the detection model update;

[0030] If the root mean square error (RMSE) is used to evaluate the performance of a quantitative detection model, its objective function can be expressed as:

[0031]

[0032]

[0033] In the formula, the subscript "add" represents the representative sample set of the new annotation, the subscript "original" represents the original modeling set, the superscript "renew" indicates after the model update, the superscript "previous" indicates before the model update, and α represents the penalty / reward coefficient. y represents the label value predicted by the model. i The cost value represents the true label value of the sample, and n represents the number of samples used to evaluate the model performance; the smaller the cost value, the better.

[0034] S5.2, Design a batch training strategy based on information extraction ratio;

[0035] S5.2.1 In each batch of training, a certain proportion of newly labeled representative samples and original modeling samples are selected to form a training set, requiring that the proportion of newly labeled representative samples in the training set is not less than 5%.

[0036] S5.2.2, after training the model with this batch of samples, calculate the information extraction ratio of the model for this batch of newly labeled samples; if the information extraction ratio does not meet the preset value T set Repeat the training until the preset value is met;

[0037] S5.2.3, Take the next batch of samples and perform the above training until all newly labeled samples are used up;

[0038] Following the training strategy described above, as the number of training batches increases, the model, having already learned a high degree from previous batches of samples, will, according to formula N...t +(e -(p-1) -1)·d gradually decreases the number of repetitions set, where N t represents the training base, p represents the learning batch, and d is used to adjust the reduction gradient for the number of repetitions.

[0039] S5.3, Parameter correction strategy for design model;

[0040] If a non-artificial neural network or shallow artificial neural network detection model is used, the model is updated according to the original variable coefficients or connection weight generation and modification strategy.

[0041] If a deep artificial neural network is used, the gradient of the modification of the weights of the underlying connections is reduced, and the network is designed with redundancy to ensure that the basic knowledge already learned by the network is not destroyed, and to save the newly learned knowledge through the redundant parts of the network.

[0042] S6: Update the detection model based on the representative samples obtained in S4 and the strategy designed in S5.

[0043] Optionally, when calculating the spectral amplitude characteristic distance in S2, it is not limited to cosine similarity. Euclidean distance, p-norm distance, Mahalanobis distance, and other distance definition methods that can quantitatively describe the differences or similarities in spectral amplitudes can be selected according to the spectral type and distribution characteristics. Similarly, when calculating the spectral frequency characteristic distance, it is not limited to the matrix similarity calculation method based on singular value decomposition described in S2. The appropriate method can be selected according to the frequency characteristic expression form obtained. For example, if the calculated frequency characteristic data is a one-dimensional vector, Euclidean distance, Mahalanobis distance, p-norm distance, and other distance definition methods suitable for quantitatively describing the differences or similarities in one-dimensional vector data can be selected.

[0044] Optionally, in S3, when initially calculating the value of unlabeled samples, it is not limited to combinations of amplitude or frequency characteristic distance sequence mean, maximum, minimum, and standard deviation. Other combinations of statistical values ​​can be selected based on spectral type and distribution characteristics. For example, if the distance between unlabeled value samples and modeling samples fluctuates by more than 15%, the ratio of the maximum to minimum value (max / min) can be used as an input variable, and its corresponding weight can be increased. The effect of different spectral amplitudes or frequency dimensions on the calculation of sample value is balanced by the value of fl, where fl represents the range of fluctuation.

[0045] Optionally, in S4, the selection of representative samples is not limited to the combination of hierarchical clustering algorithm and local linear reconstruction method. Other representative sample screening methods that can satisfy the integrity of the feature space can be selected according to the type and distribution of the obtained valuable samples. For example, if the number of factor levels involved in the valuable samples is less than 16, a representative sample screening method based on continuous projection can be selected.

[0046] (1) Randomly select a sample from the value sample as the first representative sample Sample1;

[0047] (2) Calculate the projection distance between other value samples and sample Sample1 respectively, and select the sample with the projection distance as the second representative sample Sample2;

[0048] (3) Calculate the projection distance between other value samples and samples Sample1 and Sample2 respectively, and select the sample with the projection distance as the third representative sample Sample3;

[0049] This process continues until a number of representative samples, equivalent to or a predetermined number, are selected, representing the rank of the spectral matrix of the value samples.

[0050] Optionally, the objective function constructed in S5 is not limited to the loss function based on the root mean square error. It can be selected based on the dimensions of the label values, using other indicators that can accurately describe changes in model performance. For example, if the dimensions of the label values ​​are greater than 10, an objective function based on the coefficient of determination (R²) can be used. 2 The objective function constructed is as follows:

[0051]

[0052]

[0053] In the formula, the subscript "add" represents the representative sample set of the new annotation, the subscript "original" represents the original modeling set, the superscript "renew" indicates after the model update, the superscript "previous" indicates before the model update, and α represents the penalty / reward coefficient. y represents the label value predicted by the model. i This represents the true label value of the sample. represents the mean of the label values ​​of all samples used to evaluate model performance, and n represents the number of samples used to evaluate model performance.

[0054] Compared with current spectral detection technologies, the advantages of this invention are as follows:

[0055] (1) Traditional spectral detection schemes often neglect model updating. However, in practical work, models frequently encounter new sample patterns near the modeling sample boundary, requiring timely updates to adapt to these new patterns. Currently, however, no complete scheme for updating quantitative spectral detection models is available for practical working environments. Unlike common qualitative detection model updating schemes, quantitative detection models lack explicit decision boundaries. This invention innovatively proposes value sample judgment based on implicit decision boundaries, providing a feasible solution to the bottleneck problem of quantitative detection model updating.

[0056] (2) Traditional methods for calculating spectral difference or similarity often only consider the amplitude characteristics of the spectrum. However, in actual production processes, due to the complexity of the detection environment, the spectra of the same type of sample, or even the same sample, may differ significantly under different environmental parameters (such as different light intensities, different detection distances, and different sample orientations). Therefore, calculating sample difference or similarity solely based on spectral amplitude characteristics lacks reliability. This invention introduces frequency characteristic distance and uses a weighted summation method to combine amplitude characteristic distance and frequency characteristic distance to determine sample difference or similarity, thereby improving the accuracy, stability, and flexibility of valuable sample judgment.

[0057] (3) Valuable samples are usually located near the latent boundary of the space formed by the modeling samples. The farther away from the latent boundary, the lower the degree to which the unlabeled spectral data satisfies the basis for establishing the quantitative model (i.e., the data are independent and identically distributed). Therefore, it is necessary to reasonably control the screening range of valuable samples. In addition, there are differences in distance between the modeling sample set, between valuable samples and the modeling sample set, and between abnormal samples and the modeling sample set. Moreover, a sequence of multiple distances provides a more comprehensive and stable description of the sample location. Therefore, the present invention has complete theoretical support for statistically inferring the distribution range of valuable samples based on distance sequences.

[0058] (4) In actual detection processes, a large number of valuable samples of the same type will appear at the same time. If each valuable sample is manually labeled, it will not only increase the labeling cost but also lead to data redundancy. This project further selects representative samples from the valuable samples before labeling them, which is more suitable for real-time detection scenarios with large batches of samples. In addition, this invention designs an objective function that can comprehensively describe the model update effect for quantitative detection tasks, and designs sample training strategies and model parameter correction strategies for specific situations. Therefore, this invention has a high degree of completeness. Attached Figure Description

[0059] The accompanying drawings, which are provided to further illustrate the invention and form part of this invention, are not intended to limit the invention. In the drawings:

[0060] Figure 1 This is a flowchart illustrating the overall process of the present invention.

[0061] Figure 2 A schematic diagram of the operation process provided for an embodiment of the invention. Detailed Implementation

[0062] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.

[0063] See Figure 1 and Figure 2 This invention provides a method for updating a spectral quantitative detection model applied to implicit decision boundaries, the method comprising:

[0064] S1: Collect spectral data of unlabeled samples and obtain the frequency characteristics of the spectrum.

[0065] Spectral data of the analyte, such as reflectance spectrum, absorption spectrum, and scattering spectrum, are acquired using a spectrometer or hyperspectral imaging system. The frequency characteristics of the spectrum are then obtained through amplitude-frequency conversion, such as Fourier transform or wavelet transform.

[0066] For example, spectral data of 240 samples of Kyoho, Shine Muscat, and Summer Black grapes were acquired using a hyperspectral image acquisition system (FX17, Specim, Finland; spectral range: 900-1700nm; number of spectral bands: 256; linear array pixel resolution: 640). Sweetness data of the samples were obtained using a saccharimeter (Densito 30PX, Mettler-Toledo, Switzerland; measurement accuracy: 0.1 Brix). A deep convolutional neural network model was constructed based on the acquired spectral and sweetness data for online grape sweetness detection. However, some unlabeled samples (specifically, Red Globe and Yellow Queen cherry tomatoes) on the production line caused the model's predicted sweetness data to deviate significantly from the normal range. This indicates that the existing model is not suitable for the newly emerging sample patterns and needs to be updated.

[0067] To determine the value of the samples, the frequency characteristics of the spectrum are calculated using the Discrete Fourier Transform (DFT). The DFT formula used is as follows:

[0068]

[0069] Where x represents the original spectrum, N represents the sequence length (i.e., the window length of the discrete Fourier transform), n is the frequency point index of the spectrum, and k is the time point index of the spectrum (i.e., the band index of the spectrum). By moving the window, the frequency and phase characteristics of different spectral intervals are obtained.

[0070] First, set N to 256 and calculate the frequency characteristics of the entire spectrum. Then, set N to 100 and calculate the frequency characteristics of each interval of the spectrum by moving the window. Finally, integrate the obtained band frequency characteristics and interval frequency characteristics into a matrix using a superposition method.

[0071] S2: Based on the unlabeled sample spectral data and frequency characteristics obtained in S1, calculate the distance between the unlabeled sample and each modeled sample in terms of spectral amplitude and spectral frequency characteristics.

[0072] For example, cosine similarity can be used to calculate the amplitude distance between the spectrum X of an unlabeled sample and the spectrum Y of a modeled sample:

[0073]

[0074] To calculate the distance between the unlabeled sample spectrum X and the modeled sample spectrum Y on the frequency feature matrix using singular value decomposition (SVD), we first perform SVD on the frequency feature matrix: F = LWR, where L is the left singular matrix, R is the right singular matrix, and W is the singular diagonal matrix. Let F... X and F Y Let X and Y be the frequency characteristic matrices corresponding to spectra respectively. Then their distance is:

[0075]

[0076] In the formula, L X L Y The frequency characteristic matrix F X F Y The left singular matrix, R X R Y The frequency characteristic matrix F X F Y The right singular matrix is ​​denoted by || ||, where || represents the Euclidean 2 norm.

[0077] For example, the angular distance between the unlabeled sample and the modeled grape sample in terms of spectral amplitude can be calculated using the cosine similarity formula, and the angular distance between the unlabeled sample and the modeled grape sample in terms of spectral frequency features can be obtained using the matrix similarity calculation method based on singular value decomposition.

[0078] S3: Based on the two types of feature distances obtained from S2, valuable samples are selected through statistical inference and swarm intelligence algorithms.

[0079] The distances between unlabeled samples and each modeled sample are sorted in ascending order to obtain the amplitude feature distance sequence A and the frequency feature distance sequence F. The average value of each sequence (A) is calculated. avg F avg ), maximum value (A) maxF max ), minimum value (A) min F min ), standard deviation (A) std F std For samples within the modeling set, iterate through each modeling sample and sort the distances between each sample and other modeling samples in ascending order to obtain the amplitude feature distance sequence A. inner Distance sequence F with frequency features inner Calculate the average value of each sequence. Maximum value Minimum value Standard deviation The initial value of unlabeled samples is calculated according to the following rules:

[0080] val(X) = W A ·val A +W F ·val F

[0081]

[0082]

[0083]

[0084]

[0085] stW A +W F =1

[0086]

[0087] In the formula, val(X) represents the value of the unlabeled sample X to the detection model, and W A W represents the value weight of the amplitude feature. F Val represents the value weight of frequency features. A Val represents the sample value calculated based on the amplitude characteristics. F w represents the sample value calculated based on frequency characteristics. stat σ represents the weight value of the specific statistical indicator; N represents the number of samples in the modeling set; C represents the mean of all modeling samples under the specific statistical indicator, i.e., the distribution center; σ represents the width of the distribution confidence interval of all modeling samples under the specific statistical indicator; and exp represents the exponential operation with the natural number e as the base.

[0088] Based on the calculated value val(X) of the unlabeled sample X, we set 1 as the lower limit and 2 as the upper limit. Unlabeled samples within this range are considered valuable samples; those below 1 are considered worthless samples, and those above 2 are considered abnormal samples.

[0089] For example, the distances between unlabeled samples and each modeled grape sample are sorted in ascending order to obtain amplitude feature distance sequences and frequency feature distance sequences, and the mean, maximum, minimum, and standard deviation of each sequence are calculated. When W is set... A 0.3, W F Set to 0.7 0.45 0.3 0.2 Set to 0.05 0.45 0.3 0.2 The val value was 0.05. Based on the sample value calculation formula, the val value range for the large red grapes was [0.901, 1.322], and the val value range for the yellow cherry tomatoes was [3.635, 5.416]. Finally, the large red grape samples with val values ​​in the range (1, 1.322) were selected as valuable samples, while all yellow cherry tomato samples were identified as outliers. A total of 34 large red grape samples were selected as valuable samples.

[0090] S4: Further extract representative samples from the valuable samples obtained in S3 to reduce the cost of model updates.

[0091] Valuable samples typically appear in batches. If all initially acquired valuable samples are labeled, the cost of model updates will increase significantly. Therefore, it is necessary to further screen representative samples while ensuring information content is met.

[0092] A representative sample selection method based on continuous projection is adopted:

[0093] (1) Randomly select a sample from the value sample as the first representative sample Sample1;

[0094] (2) Calculate the projection distance between other value samples and sample Sample1 respectively, and select the sample with the projection distance as the second representative sample Sample2;

[0095] (3) Calculate the projection distance between other value samples and samples Sample1 and Sample2 respectively, and select the sample with the projection distance as the third representative sample Sample3;

[0096] This process continues until a number of representative samples, equivalent to or a predetermined number, are selected, representing the rank of the spectral matrix of the value samples.

[0097] Finally, the extracted representative samples were manually calibrated.

[0098] For example, since the number of factor levels involved in the unlabeled red grape samples is relatively small, a continuous projection-based method is used to select representative samples from the valuable samples:

[0099] (1) Randomly select a large red grape sample from the valuable samples as the first representative sample Sp1;

[0100] (2) Calculate the projection distance between other value samples and sample Sp1 respectively, and select the sample with the projection distance as the second representative sample Sp2;

[0101] (3) Calculate the projection distance between other value samples and samples Sp1 and Sp2 respectively, and select the sample with the projection distance as the third representative sample Sp3;

[0102] Similarly, a total of 12 representative samples of red grapes were selected.

[0103] Finally, the sweetness value of a representative red grape sample was determined using a saccharimeter.

[0104] S5: Design model training and update strategies.

[0105] S5.1, Construct an objective function to evaluate the effectiveness of the detection model update;

[0106] If the root mean square error (RMSE) is used to evaluate the performance of a quantitative detection model, its objective function can be expressed as:

[0107]

[0108]

[0109] In the formula, the subscript "add" represents the representative sample set of the new annotation, the subscript "original" represents the original modeling set, the superscript "renew" indicates after the model update, the superscript "previous" indicates before the model update, and α represents the penalty / reward coefficient. y represents the label value predicted by the model. i The cost value represents the true label value of the sample, and n represents the number of samples used to evaluate the model performance; the smaller the cost value, the better.

[0110] S5.2, Design a batch training strategy based on information extraction ratio;

[0111] S5.2.1 In each batch of training, a certain proportion of newly labeled representative samples and original modeling samples are selected to form a training set, requiring that the proportion of newly labeled representative samples in the training set is not less than 5%.

[0112] S5.2.2, after training the model with this batch of samples, calculate the information extraction ratio of the model for this batch of newly labeled samples; if the information extraction ratio does not meet the preset value T set Repeat the training until the preset value is met;

[0113] S5.2.3, Take the next batch of samples and perform the above training until all newly labeled samples are used up;

[0114] Following the training strategy described above, as the number of training batches increases, the model, having already learned a high degree from previous batches of samples, will, according to formula N... t +(e -(p-1) -1)·d gradually decreases the number of repetitions set, where N t represents the training base, p represents the learning batch, and d is used to adjust the reduction gradient for the number of repetitions.

[0115] S5.3, Parameter correction strategy for design model;

[0116] If a non-artificial neural network or shallow artificial neural network detection model is used, the model is updated according to the original variable coefficients or connection weight generation and modification strategy.

[0117] If a deep artificial neural network is used, the gradient of the modification of the bottom-level connection weights should be reduced, and the network should be designed with redundancy to ensure that the basic knowledge already learned by the network is not destroyed, and to save newly learned knowledge through the redundant parts of the network. For example, the objective function for the update effect of a deep convolutional neural network model used to describe the sweetness detection of grapes is:

[0118]

[0119] The reward coefficient α is set to 1.

[0120] Set the information extraction ratio threshold T set Set the training base to 8% and the training number N. t The training iteration count was set to 200, and the coefficient d for reducing the number of repetitions was set to 60. The convolutional neural network used has two channels: an amplitude feature channel and a frequency feature channel. Each channel has 15 layers: 1 input layer, 6 convolutional layers, 6 pooling layers, 1 fully connected layer, and 1 output layer. To ensure that features at different scales can be utilized, the network uses a dense connection method.

[0121] The connection weights are corrected through backpropagation of the error. The connection weights directly connected to the output layer are corrected according to the full gradient. For each additional layer away from the output layer, the correction gradient of the connection weights decreases by 10%.

[0122] S6: Update the detection model based on the representative samples obtained in S4 and the strategy designed in S5.

[0123] For example, four samples are randomly selected from 12 representative red grape samples, and 80 samples are randomly selected from the original modeling samples to form a batch of training data. The convolutional neural network model is updated according to the S5 training strategy. Then, the model is updated again by randomly selecting another batch of samples from the remaining samples according to a preset ratio, until all the newly labeled samples are used up. Under the same model complexity, the prediction effects of the model before and after the update on the original modeling samples and the value samples are shown in Table 1.

[0124] Table 1 shows the prediction results for the original modeling samples and value samples before and after the model update.

[0125]

[0126]

[0127] In the table, RMSE represents the root mean square error, R 2 The coefficient of determination is represented by RPD, which is the ratio of the standard deviation of the prediction set to the standard deviation of the prediction error. The subscript C represents the modeling set, and the subscript P represents the prediction set.

Claims

1. A method for updating a spectral quantitative detection model applied to implicit decision boundaries, characterized in that, Includes the following steps: S1: Collect spectral data of unlabeled samples and obtain the frequency characteristics of the spectrum; Spectral data of the analyte, such as reflectance spectrum, absorption spectrum, and scattering spectrum, are acquired using a spectrometer or hyperspectral imaging system. The frequency characteristics of the spectrum are then obtained through amplitude-frequency conversion, such as Fourier transform or wavelet transform. S2: Based on the unlabeled sample spectral data and frequency characteristics obtained in S1, calculate the distance between the unlabeled sample and each modeling sample in terms of spectral amplitude and spectral frequency characteristics; For example, cosine similarity can be used to calculate the amplitude distance between the spectrum X of an unlabeled sample and the spectrum Y of a modeled sample: To calculate the distance between the unlabeled sample spectrum X and the modeled sample spectrum Y on the frequency feature matrix using singular value decomposition (SVD), we first perform SVD on the frequency feature matrix: F = LWR, where L is the left singular matrix, R is the right singular matrix, and W is the singular diagonal matrix. Let F... X and F Y Let X and Y be the frequency characteristic matrices corresponding to spectra respectively. Then their distance is: In the formula, L X L Y The frequency characteristic matrix F X F Y The left singular matrix, R X R Y The frequency characteristic matrix F X F Y The right singular matrix, |||| denotes the Euclidean second norm; S3: Based on the two types of feature distances obtained from S2, valuable samples are selected through statistical inference and swarm intelligence algorithms; The distances between unlabeled samples and each modeled sample are sorted in ascending order to obtain the amplitude feature distance sequence A and the frequency feature distance sequence F. The average value of each sequence (A) is calculated. avg F avg ), maximum value (A) max F max ), minimum value (A) min F min ), standard deviation (A) std F std For samples within the modeling set, iterate through each modeling sample and sort the distances between each sample and other modeling samples in ascending order to obtain the amplitude feature distance sequence A. inner Distance sequence F with frequency features inner Calculate the average value of each sequence. Maximum value Minimum value Standard deviation The initial value of unlabeled samples is calculated according to the following rules: val(X)=W A ·val A +W F ·val F s.t.W A +W F =1 In the formula, val(X) represents the value of the unlabeled sample X to the detection model, and W A W represents the value weight of the amplitude feature. F Val represents the value weight of frequency features. A Val represents the sample value calculated based on the amplitude characteristics. F w represents the sample value calculated based on frequency characteristics. stat σ represents the weight value of the specific statistical indicator; N represents the number of samples in the modeling set; C represents the mean of all modeling samples under the specific statistical indicator, i.e., the distribution center; σ represents the width of the distribution confidence interval of all modeling samples under the specific statistical indicator; and exp represents the exponential operation with the natural number e as the base. Based on the calculated value val(X) of the unlabeled sample X, we set 1 as the lower limit and 2 as the upper limit. Unlabeled samples within this range are considered valuable samples; those below 1 are considered worthless samples, and those above 2 are considered abnormal samples. S4: Further extract representative samples from the valuable samples obtained in S3 to reduce the cost of model updates; S4.1, a hierarchical clustering algorithm is used to divide the selected valuable samples into different subsets based on the characteristics of the spectral data, and each subset is considered to correspond to a different factor level; S4.2, the local linear reconstruction method is used to select representative samples from each subset. The basic idea is that if the most representative samples in the subset are selected, the loss of reconstructing the entire data space using these samples will be minimized. S4.3, Manually calibrate the extracted representative samples; S5: Design model training and update strategies; S5.1, Construct an objective function to evaluate the effectiveness of the detection model update; If the root mean square error (RMSE) is used to evaluate the performance of a quantitative detection model, its objective function can be expressed as: In the formula, the subscript "add" represents the representative sample set of the new annotation, the subscript "original" represents the original modeling set, the superscript "renew" indicates after the model update, the superscript "previous" indicates before the model update, and α represents the penalty / reward coefficient. y represents the label value predicted by the model. i The cost value represents the true label value of the sample, and n represents the number of samples used to evaluate the model performance; the smaller the cost value, the better. S5.2, Design a batch training strategy based on information extraction ratio; S5.2.1 In each batch of training, a certain proportion of newly labeled representative samples and original modeling samples are selected to form a training set, requiring that the proportion of newly labeled representative samples in the training set is not less than 5%. S5.2.2, after training the model with this batch of samples, calculate the information extraction ratio of the model for this batch of newly labeled samples; if the information extraction ratio does not meet the preset value T set Repeat the training until the preset value is met; S5.2.3, Take the next batch of samples and perform the above training until all newly labeled samples are used up; Following the training strategy described above, as the number of training batches increases, the model, having already learned a high degree from previous batches of samples, will, according to formula N... t +(e -(p-1) -1)·d gradually decreases the number of repetitions set, where N t represents the training base, p represents the learning batch, and d is used to adjust the reduction gradient for the number of repetitions. S5.3, Parameter correction strategy for design model; If a non-artificial neural network or shallow artificial neural network detection model is used, the model is updated according to the original variable coefficients or connection weight generation and modification strategy. If a deep artificial neural network is used, the gradient of the modification of the weights of the bottom connection is reduced, and the network is designed with redundancy to ensure that the basic knowledge already learned by the network is not destroyed, and to save the newly learned knowledge through the redundant part of the network. S6: Update the detection model based on the representative samples obtained in S4 and the strategy designed in S5.

2. The method for updating a spectral quantitative detection model applied to implicit decision boundaries as described in claim 1, characterized in that, When calculating the characteristic distance of spectral amplitude in S2, it is not limited to cosine similarity. Euclidean distance, p-norm distance, Mahalanobis distance, and other distance definition methods that can quantitatively describe the difference or similarity of spectral amplitude can be selected according to the spectral type and distribution characteristics. When calculating the spectral frequency feature distance in S2, it is not limited to the matrix similarity calculation method based on singular value decomposition described in S2. The appropriate method can be selected according to the expression form of the obtained frequency feature. For example, if the calculated frequency feature data is a one-dimensional vector, Euclidean distance, Mahalanobis distance, p-norm distance and other distance definition methods suitable for quantitatively describing the differences or similarities of one-dimensional vector data can be selected.

3. The method for updating a spectral quantitative detection model applied to implicit decision boundaries as described in claim 1, characterized in that, In S3, when initially calculating the value of unlabeled samples, it is not limited to combinations of amplitude or frequency characteristic distance sequence mean, maximum, minimum, and standard deviation. Other combinations of statistical values ​​can be selected based on spectral type and distribution characteristics. For example, if the distance between unlabeled value samples and modeling samples fluctuates by more than 15%, the ratio of the maximum to minimum value (max / min) can be used as an input variable, and its corresponding weight increased. The effect of different spectral amplitudes or frequency dimensions on the calculation of sample value is balanced by the value of fl, where fl represents the range of fluctuation.

4. The method for updating a spectral quantitative detection model applied to implicit decision boundaries as described in claim 1, characterized in that, In S4, the selection of representative samples is not limited to the combination of hierarchical clustering algorithm and local linear reconstruction method. Other representative sample screening methods that can satisfy the integrity of the feature space can be selected according to the type and distribution of the valuable samples obtained. For example, if the number of factor levels involved in the valuable samples is less than 16, a representative sample screening method based on continuous projection can be selected. (1) Randomly select a sample from the value sample as the first representative sample Sample1; (2) Calculate the projection distance between other value samples and sample Sample1 respectively, and select the sample with the projection distance as the second representative sample Sample2; (3) Calculate the projection distance between other value samples and samples Sample1 and Sample2 respectively, and select the sample with the projection distance as the third representative sample Sample3; This process continues until a representative number of samples, comparable to the rank of the spectral matrix of the value samples, is selected.

5. The method for updating a spectral quantitative detection model applied to implicit decision boundaries as described in claim 1, characterized in that, The objective function constructed in S5 is not limited to the loss function based on the root mean square error. It can be selected based on the dimensions of the label values, choosing an objective function that accurately describes changes in model performance based on other metrics. For example, if the dimensions of the label values ​​are greater than 10, an objective function based on the coefficient of determination (R²) can be used. 2 The objective function constructed is as follows: In the formula, the subscript "add" represents the representative sample set of the new annotation, the subscript "original" represents the original modeling set, the superscript "renew" indicates after the model update, the superscript "previous" indicates before the model update, and α represents the penalty / reward coefficient. y represents the label value predicted by the model. i This represents the true label value of the sample. represents the mean of the label values ​​of all samples used to evaluate model performance, and n represents the number of samples used to evaluate model performance.