Prediction and analysis method of anthocyanin content in red onions based on CIELab color quantification

Through third-order correlation modeling combining CIELab color quantification and near-infrared spectroscopy, the subjectivity and accuracy issues in predicting anthocyanin content in red onions were resolved, achieving efficient and accurate anthocyanin content prediction.

CN120369645BActive Publication Date: 2025-09-30VEGETABLE RES INST OF GANSU ACAD OF AGRI SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510846529.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-09-30
Estimated Expiration
2045-06-24

AI Technical Summary

Technical Problem

In the existing technology, the prediction of anthocyanin content in red onions mainly relies on sensory evaluation, which has the problems of strong subjectivity and poor accuracy, and lacks an effective prediction system based on the Lab color quantification system.

Method used

CIELab color quantification combined with near-infrared spectrometer was used. By improving the continuous projection algorithm and particle swarm optimization algorithm, a third-order correlation model including spectrum-color-anthocyanin content was constructed. Data was collected using a spectrophotometer and near-infrared spectrometer, and prediction was performed by combining the particle swarm optimization algorithm and the neural network model.

Benefits of technology

It improves the accuracy and reliability of anthocyanin content prediction, reduces subjective interference, breaks through the information limitations of single modal data, enhances the ability to capture nonlinear relationships, and achieves accurate prediction of anthocyanin content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120369645B_ABST
    Figure CN120369645B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for predicting and analyzing the anthocyanin content of red onions based on CIELab color quantization, comprising the following steps: S1: using a spectrophotometer to collect color quantization indicators; S2: using a near-infrared spectrometer to collect original spectral data, extracting characteristic wavelengths based on an improved continuous projection algorithm, and obtaining optimal spectral absorption data; S3: performing a tensor fusion operation on the color quantization indicators and the optimal spectral absorption data to obtain a one-dimensional fused feature vector, and constructing a third-order correlation model including spectral data, color parameters, and anthocyanin content based on the one-dimensional fused feature vector in combination with a particle swarm optimization algorithm; and S4: outputting a prediction result of the anthocyanin content of the red onion based on the third-order correlation modeling. The color parameters directly reflect the visual representation of anthocyanins, and the spectral data reveals molecular structure information. The two complement each other, and the fused model can capture more comprehensive feature correlations, thereby significantly improving the prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of anthocyanin content prediction, and in particular to a method for predicting and analyzing anthocyanin content in red onions based on CIELab color quantification. Background Art

[0002] Anthocyanins, essential water-soluble pigments in plants, belong to the flavonoid class of secondary metabolites and are widely present in various plant tissues and organs. Anthocyanins play a crucial role in red onions, not only giving them a unique and vibrant color that attracts consumers, but also significantly enhancing their nutritional value and health benefits through their remarkable antioxidant and anti-inflammatory properties.

[0003] Currently, the color grading of onion bulbs is mainly based on sensory evaluation according to the "Onion Germplasm Resource Data Standard". However, this traditional method has many drawbacks that cannot be ignored. The evaluation results are easily affected by subjective factors of the evaluators. For example, different people have different visual sensitivities and different perception and judgment standards of color. The amount of evaluation experience also affects the accuracy of the evaluation.

[0004] Secondly, in the specific field of anthocyanin content prediction in red onions, in-depth research based on Lab color quantification system is still in its infancy. At present, a mature and effective prediction system has not been formed, which cannot provide strong technical support for the red onion industry. Therefore, a prediction and analysis method for anthocyanin content in red onions based on CIELab color quantification is proposed here. Summary of the Invention

[0005] In order to overcome the above-mentioned defects of the prior art and to achieve the above-mentioned objectives, the present invention proposes the following technical solutions:

[0006] The prediction and analysis method of anthocyanin content in red onions based on CIELab color quantification includes:

[0007] S1: Use a spectrophotometer to collect color quantitative indicators;

[0008] S2: Use a near-infrared spectrometer to collect raw spectral data, extract characteristic wavelengths based on an improved continuous projection algorithm, and obtain optimal spectral absorption data;

[0009] Among them, the improved continuous projection algorithm is achieved by introducing an adaptive parameter adjustment mechanism into the traditional continuous projection algorithm;

[0010] S3: Performing a tensor fusion operation on the color quantification index and the optimal spectral absorption data to obtain a one-dimensional fusion feature vector, and constructing a third-order correlation model including spectral data, color parameters, and anthocyanin content based on the one-dimensional fusion feature vector combined with the particle swarm optimization algorithm;

[0011] Among them, the one-dimensional fusion feature vector is obtained by adjusting the structure of a basic neural network model to obtain a third-order correlation modeling framework. Then, the particle swarm optimization algorithm is used to update the model parameters of the third-order correlation modeling framework and obtain the optimal parameters to construct a third-order correlation model including spectral data, color parameters and anthocyanin content.

[0012] S4: Based on the third-order correlation modeling, output the prediction results of anthocyanin content in red onion.

[0013] The color quantization index acquisition process is as follows:

[0014] Three measurement points were evenly selected along the horizontal diameter of the middle of the red onion bulb. Each measurement point was measured using a CR-9 spectrophotometer to obtain the lightness data, axial coordinate data from green to red, and axial coordinate data from blue to yellow of each point.

[0015] The process of obtaining the best spectral absorption data based on the improved continuous projection algorithm is as follows:

[0016] A band is randomly selected as the initial band, and a characteristic wavelength is selected from the full wavelength range of the initial spectral data. A new wavelength is selected from the remaining wavelengths in the full wavelength range in each iteration, and the condition number of the new set consisting of the current selected wavelength set and the new wavelength is minimized.

[0017] Set an initial adaptation threshold , the final adaptation threshold is iteratively determined through an adaptive parameter adjustment mechanism ;

[0018] Get the linear correlation measure of the new wavelength and the matrix of the currently selected wavelength set ,when And it can minimize the condition number of the new set, select the corresponding wavelength to add to the characteristic wavelength set, and the initial spectral data corresponding to all wavelengths that meet the conditions are the optimal spectral absorption data .

[0019] The process of obtaining the condition number is as follows:

[0020] Get the matrix X consisting of the initial spectral data corresponding to the wavelength, based on the norm of the matrix X and the inverse matrix of matrix X Norm of The condition number is obtained by multiplying .

[0021] The implementation process of the adaptive parameter adjustment mechanism is as follows:

[0022] Defines the ratio of the number of selected characteristic wavelengths to the total number of wavelengths , m is the number of currently selected characteristic wavelengths, and n is the total number of wavelengths in the full wavelength range;

[0023] when When the performance of the selected characteristic wavelength set is evaluated using the mean square error, the performance change rate of two adjacent iterations is calculated, and when the performance change rate is less than the preset minimum value, the initial adaptation threshold is reduced. Get a new threshold , the calculation formula is:

[0024]

[0025] in, is the adjustment factor.

[0026] The adjustment coefficient acquisition process is as follows:

[0027] Through the idea of ​​reinforcement learning, the process of iteratively determining the final adaptation threshold through the adaptive parameter adjustment mechanism is regarded as the behavior of the intelligent agent, the spectral data is regarded as the environment, and the performance index of the selected characteristic wavelength set is regarded as the reward;

[0028] Define the initial adjustment coefficient range, randomly initialize the adjustment coefficient within the initial adjustment coefficient range to form an initial adjustment coefficient set,

[0029] For each adjustment coefficient in the initial adjustment coefficient set, the wavelength selection threshold is adjusted using the corresponding adjustment coefficient, and the corresponding reward value is obtained based on the continuous projection algorithm;

[0030] The state, action, reward, and next state are stored in the experience replay pool. A batch of experience data is randomly extracted and the policy function is represented by a deep neural network. The loss function is minimized to update the neural network parameters.

[0031] Iteratively update the neural network parameters to find the adjustment coefficient that maximizes the reward and obtain the optimal adjustment coefficient.

[0032] The process of obtaining the one-dimensional fusion feature vector is as follows:

[0033] The color quantization index and the optimal spectral absorption data are combined into a two-dimensional tensor, a weight tensor is preset, the dimension of the weight tensor matches the two-dimensional tensor, and a one-dimensional fusion feature vector is obtained through a tensor contraction operation.

[0034] The process of obtaining the third-order association modeling framework is as follows:

[0035] The preset basic neural network model includes input layer, intermediate layer and output layer;

[0036] Modify the number of neurons in the input layer to The dimension of the pre-trained model is , and custom convolutional layers and fully connected layers are added to the middle layer of the pre-trained model. The custom convolutional layers and fully connected layers are 2 to 3 convolutional layers, and the convolution kernel sizes are 3×3 and 5×5 respectively, with a step size of 1 and a padding of 1. The output layer is replaced with a fully connected layer of a single neuron, and the neuron output is the predicted anthocyanin content value.

[0037] The process of updating the model parameters based on the particle swarm optimization algorithm to obtain the optimal model parameters is as follows:

[0038] Based on the particle swarm optimization algorithm, each particle is regarded as a parameter combination, including Parameters to be optimized, and define a fitness function to obtain the fitness value of each particle;

[0039] Update the position and speed of the particle swarm. After each iteration, compare the fitness value of each particle with its own historical optimal fitness value to find the current global optimal position. The model parameters corresponding to the global optimal position are the model parameter combination with the highest fitness value.

[0040] The model is trained and evaluated using the regression task loss function. When the loss function is minimized, a fully trained third-order association model is obtained.

[0041] The present invention has the following beneficial effects:

[0042] First, by tensor fusion of CIELab color quantification indicators and near-infrared spectral data, a third-order correlation model encompassing "spectrum-color-anthocyanin content" was constructed. This model breaks through the information limitations of single-modal data. Color parameters directly reflect the visual representation of anthocyanins, while spectral data reveals molecular structure information. The two complement each other, and the fused model can capture more comprehensive feature correlations, significantly improving prediction accuracy.

[0043] Secondly, an improved continuous projection algorithm introduces an adaptive parameter adjustment mechanism and dynamically optimizes the threshold adjustment coefficient γ through reinforcement learning, enabling the algorithm to automatically adjust the strictness of characteristic wavelength screening based on sample characteristics. When the number of selected wavelengths reaches 20%, the threshold is dynamically adjusted based on the mean square error change rate, avoiding the subjectivity of manual parameter adjustment, effectively reducing redundant wavelength interference, and retaining the most representative spectral features.

[0044] Finally, the particle swarm optimization algorithm is used to optimize the parameters of the third-order correlation model. The tensor fusion weights and neural network parameters are regarded as particles, and the optimal parameter combination is obtained through global search. Compared with the traditional gradient descent method, PSO can more efficiently jump out of the local optimal solution and shorten the model training time. At the same time, the convolutional layer design enhances the ability to capture the nonlinear relationship between spectral and color data, and realizes accurate regression prediction of anthocyanin content. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a diagram of the steps of the method for predicting and analyzing the anthocyanin content in red onions based on CIELab color quantification proposed by the present invention. DETAILED DESCRIPTION

[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0047] Example 1

[0048] like Figure 1 As shown, the present invention proposes a method for predicting and analyzing the anthocyanin content of red onions based on CIELab color quantification, comprising:

[0049] S1: Use a spectrophotometer to collect color quantitative indicators;

[0050] Fully mature red onions were randomly selected as samples and their outer dry skin was removed to avoid interference with color measurement.

[0051] Three measurement points were evenly selected along the central diameter of the red onion bulb. Each point was measured using a CR-9 spectrophotometer to obtain the L (lightness), a (axial coordinate from green to red), and b (axial coordinate from blue to yellow) data for each point.

[0052] Specifically, the L value ranges from 0 to 100, with larger values ​​indicating brighter colors;

[0053] A negative value of a indicates a tendency towards green, and a positive value indicates a tendency towards red;

[0054] Negative b values ​​represent a tendency towards blue, while positive values ​​represent a tendency towards yellow;

[0055] The L, a, and b values ​​obtained at the three measurement points for each bulb were averaged to reduce measurement errors. Ten bulbs were measured for each material, and each bulb was measured three times. The average L, a, and b values ​​of the ten bulbs were averaged again to obtain the representative value of L (lightness) for the final analysis. , a (axial coordinate from green to red) representative value , b (axial coordinate from blue to yellow) representative value ;

[0056] Representative values ​​based on L (lightness), a (axis coordinate from green to red), and b (axis coordinate from blue to yellow) 、 、 Calculate color quantitative indicators, including color value, hue value and color index;

[0057] The color value Chroma is used to measure the concentration of pigments. The larger the Chroma value, the higher the pigment concentration. The calculation formula is:

[0058] ;

[0059] Hue reflects the basic color types such as red, orange, green, blue, and purple, as well as the transition colors between these colors, helping to determine the type and hue tendency of the color. The calculation formula is:

[0060] ;

[0061] The color index CIRG is used to comprehensively reflect the surface color characteristics of a substance. The calculation formula is:

[0062] ;

[0063] The color quantization index is expressed as ;

[0064] Specifically, by selecting a point on the middle of the red onion bulb's transverse diameter for measurement and taking multiple averages to obtain CIELab color parameters (L, a, b), the lightness, red-green, and yellow-blue axial coordinate information of the red onion's epidermis can be accurately reflected. By selecting three measurement points for each bulb and taking the average, 10 bulbs are measured for each material, and each measurement is repeated three times and then averaged. This method of taking the average of multiple measurements can effectively reduce the measurement error caused by factors such as sample unevenness and measurement instrument error, and improve the accuracy and reliability of color parameters. Finally, based on the representative value 、 、 The calculation of derived indicators such as Chroma, Hue, and CIRG enriches the description of the color characteristics of red onions from different perspectives and helps to deeply analyze the relationship between color and the intrinsic properties of anthocyanin content.

[0065] S2: Use a near-infrared spectrometer to collect raw spectral data, extract characteristic wavelengths based on an improved continuous projection algorithm, and obtain optimal spectral absorption data;

[0066] Among them, the improved continuous projection algorithm is achieved by introducing an adaptive parameter adjustment mechanism into the traditional continuous projection algorithm;

[0067] Based on mature peeled red onions, a near-infrared spectrometer was used to scan 10 times in the range of 900-1700 nm with a resolution of 2 nm, and the average spectrum was obtained after normalization.

[0068] Characteristic wavelengths are extracted based on the initial spectral absorption data using an improved continuous projection algorithm;

[0069] A band is randomly selected as the initial band, and a characteristic wavelength is selected from the full wavelength range of the initial spectral data S. Each iteration selects a new wavelength from the remaining wavelengths in the full wavelength range. , so that the currently selected wavelength set (m is the number of currently selected characteristic wavelengths) and the new wavelength The condition number of the new set is the smallest;

[0070] The condition number is used to measure the abnormality of the matrix. The process of obtaining the condition number is as follows:

[0071] Get the matrix X consisting of the initial spectral data corresponding to the wavelength, whose condition number cond(X) is defined as the norm of the matrix X and the inverse matrix of matrix X Norm of The product of , that is:

[0072]

[0073] Continuously select the wavelength that minimizes the condition number of the new set, introduce an adaptive parameter adjustment mechanism to gradually build a characteristic wavelength set ;

[0074] Set an initial adaptation threshold , the final adaptation threshold is iteratively determined through an adaptive parameter adjustment mechanism ;

[0075] During the iteration process, the initial adaptation threshold is adjusted according to the performance index changes of the selected characteristic wavelength set. ;

[0076] Defines the ratio of the number of selected characteristic wavelengths to the total number of wavelengths , m is the number of currently selected characteristic wavelengths, and n is the total number of wavelengths in the full wavelength range;

[0077] when Reach a specific ratio (i.e. ), the mean square error (MSE) is used to evaluate the performance of the selected characteristic wavelength set. Let the performance of the selected characteristic wavelength set at the i-th iteration be , calculate the performance change rate of two adjacent iterations , the calculation formula is:

[0078]

[0079] in, Indicates the The performance of the selected feature wavelength set on the validation set at the iteration;

[0080] Specifically, the mean square error (MSE) is used to evaluate the performance of the selected characteristic wavelength set. First, sample data of the selected characteristic wavelength set is collected, and the spectral intensity data corresponding to the selected characteristic wavelength set is matched with the true anthocyanin content data of the sample. For each sample, the error between its spectral information under the selected characteristic wavelength set and the true anthocyanin content is calculated. The squared errors of all samples are summed and then divided by the total number of samples to obtain the mean square error, which represents the performance of the selected characteristic wavelength set. The smaller the MSE value, the closer and more accurate the correlation between the selected characteristic wavelength set and the anthocyanin content.

[0081] when Less than a preset minimum value ( ) (that is, the performance improvement of the selected characteristic wavelength set begins to slow down), reduce the initial adaptation threshold To obtain a new adaptation threshold , the calculation formula is:

[0082]

[0083] in, is the adjustment factor;

[0084] The process of obtaining the adjustment coefficient is:

[0085] Through a reinforcement learning idea, the final adaptation threshold will be iteratively determined through the adaptive parameter adjustment mechanism The process is regarded as the behavior of the intelligent agent, the spectral data is regarded as the environment, and the performance index of the selected characteristic wavelength set is used as the reward to find the optimal ;

[0086] Define the initial adjustment factor range ( , ), randomly initialize a series of value, forming an initial Candidate set (initial adjustment coefficient set) , is the number of candidates;

[0087] For the initial adjustment coefficient set Each of , use the corresponding To adjust the wavelength selection threshold (according to ), and then obtain the corresponding reward value R based on the continuous projection algorithm (SPA);

[0088] Based on the continuous projection algorithm (SPA), the reward function is defined by the performance change rate, which is expressed as , that is, the smaller the performance change rate, the higher the reward value;

[0089] Construct an experience pool D to store the experience data (state, action, reward, next state) of each iteration, where the state is the state information of the selected feature wavelength set before adjusting the threshold, including the number of selected wavelengths m and the performance change rate , the action is to use the adjustment coefficient The process of adjusting the wavelength selection threshold. The next state is the state information corresponding to the new set of selected characteristic wavelengths after adjusting the threshold and re-screening the wavelengths. The reward is the reward function The value of

[0090] These experiences are stored in the experience replay pool D. A batch of experience data is randomly extracted from the experience replay pool D and the policy function of the experience data is represented by the deep neural network. The network parameters are updated by minimizing the loss function of the deep neural network. The network parameters are continuously updated iteratively, so that the policy function is gradually optimized (the loss function is gradually minimized) and the reward is maximized. , which maximizes the reward The corresponding adjustment coefficient is the optimal adjustment coefficient ;

[0091] Specifically, the gap between the output of the current policy function (i.e., the predicted action) and the actual desired action is updated by minimizing the loss function of the deep neural network. Because the policy function determines what action should be taken in the current state, using the deep neural network as the policy function and minimizing the loss function of the deep neural network is to make this gap (the predicted action and the actual desired action) smaller and smaller, making the policy function more accurate and effective.

[0092] The state is defined as the current Value, selected wavelength set, the action is to select a The value is the threshold value, the reward is the calculated reward value, and the next state is the updated state after the action is performed (such as the new set of selected wavelengths);

[0093] At the same time, consider whether the linear correlation between the new wavelength and the existing wavelength set meets the default threshold , calculate the new wavelength The linear correlation measure r of the matrix X composed of the currently selected wavelength set, let the new wavelength The corresponding initial spectral data is , the spectral data matrix corresponding to the selected wavelength set is X, and the calculation formula of the linear correlation measure r is:

[0094]

[0095] Where N is the number of samples, It is a new wavelength The kth element in It is a new wavelength The mean of all elements in , is a matrix The k-th row vector of is a matrix The mean of each row vector;

[0096] Specifically, when acquiring spectral data, multiple red onion samples are usually measured, each sample at a new wavelength. There will be a corresponding spectral intensity value at each location, and all samples will be The spectral intensity values ​​at the new wavelength are arranged in sample order to form The initial spectral data corresponding to ;

[0097] Only when And only when the condition number of the new set is minimized, the corresponding wavelength is selected to be added to the characteristic wavelength set. In this way, in the iterative process, as the threshold Dynamic adjustment is made to continuously screen out all wavelengths that meet the conditions. Finally, the initial spectral data corresponding to all the wavelengths obtained by screening form the optimal spectral absorption data. .

[0098] S3: Performing a tensor fusion operation on the color quantification index and the optimal spectral absorption data to obtain a one-dimensional fusion feature vector, and constructing a third-order correlation model including spectral data, color parameters, and anthocyanin content based on the one-dimensional fusion feature vector combined with the particle swarm optimization algorithm;

[0099] Among them, the one-dimensional fusion feature vector is obtained by adjusting the structure of a basic neural network model to obtain a third-order correlation modeling framework. Then, the particle swarm optimization algorithm is used to update the model parameters of the third-order correlation modeling framework and obtain the optimal parameters to construct a third-order correlation model including spectral data, color parameters and anthocyanin content.

[0100] The process of performing tensor fusion operation to obtain the tensor one-dimensional fusion feature vector is:

[0101] Color quantization index and optimal spectral absorption data Combined into a two-dimensional tensor , expressed as:

[0102]

[0103] Specifically, this two-dimensional tensor The first row contains normalization parameters related to various colors, and the second row is the normalized spectral data after characteristic wavelength extraction. By integrating different types of data into a tensor structure, it prepares for subsequent fusion operations.

[0104] Use random numbers to initialize a preset weight tensor W. The dimension of the weight tensor W is the same as the tensor Matching, it is a 2×(3+M) tensor, 3 is the color quantization index The basic dimension of , M is the number of derived color indices, and then the one-dimensional fused feature vector F is obtained through the tensor contraction operation;

[0105] Specifically, the tensor contraction operation refers to the tensor The sum of the products of the corresponding elements of the weight tensor W, that is, the tensor Multiply each element in the weight tensor W with the corresponding weight, and then add up all the product results to finally get a one-dimensional fusion feature vector ,This fused feature vector integrates the information of color parameters and spectral absorption ,features and serves as the input for subsequent modeling;

[0106] Preset a basic neural network model and fuse the one-dimensional feature vector As input, the neural network model is adjusted to obtain the third-order correlation model framework. The process is:

[0107] The preset basic neural network model includes input layer, intermediate layer and output layer;

[0108] Input layer adjustment: Modify the input layer of the basic neural network model so that it can receive a one-dimensional fused feature vector , change the number of neurons in the input layer to (2×(3+M) dimensions;

[0109] Middle layer adjustment: Add custom convolutional layers and fully connected layers to the middle layer of the basic neural network model. The number of custom convolutional layers and fully connected layers is 2 to 3, with convolution kernel sizes of 3×3 and 5×5, stride size of 1, and padding of 1.

[0110] Output layer adjustment: The output layer of the basic neural network model is replaced with a fully connected layer of a single neuron. The neuron output is the predicted anthocyanin content value, and the activation function is a linear function.

[0111] After adjustment, a third-order correlation modeling framework was obtained;

[0112] The process of updating model parameters based on particle swarm optimization algorithm to obtain the optimal model parameters is as follows:

[0113] Through a particle swarm optimization algorithm, each particle is regarded as a group of one-dimensional fusion feature vectors Related parameter combinations, including the element values ​​of the weight tensor during tensor fusion, and the parameters of the layer related to processing one-dimensional fusion feature vectors in the neural network model (the connection weight from the input layer to the subsequent layer), are included. parameters to be optimized, and a particle contains a corresponding parameter;

[0114] Define a fitness function Get the fitness value of each particle, such as:

[0115] ,in, is the loss of the corresponding parameters when using particles, is the fitness value, the higher it is, the better the parameter combination;

[0116] Specifically, in the particle swarm optimization process, for each particle, its corresponding parameter combination is substituted into the model, and the preset training set (or validation set) data is used. Through the mean square error function, the one-dimensional fusion feature vector of the sample is input into the model to obtain the predicted value, and then compared with the true value to calculate the loss. , which reflects the loss of the model when using the corresponding parameters of the particle, and is used to calculate the fitness function value and evaluate the quality of the parameter combination;

[0117] Each particle has a velocity vector v, which is used to control the direction and step size of the particle's movement;

[0118] Continuously update the position and speed of the particle swarm, compare the fitness value of each particle with its own historical optimal fitness value to find the current global optimal position. The process is:

[0119] After each iteration, the fitness value of each particle is compared and its own historical optimal fitness value (i.e. the parameter combination corresponding to the best fitness achieved by the particle in the previous iteration). If the current fitness value is higher, the particle's own optimal position is updated. At the same time, compare the fitness values ​​of all particles to find the current global optimal position , the model parameters corresponding to the global optimal position, that is, the model parameter combination with the highest fitness value, are used as the parameters of the third-order association model, and the regression task loss function is used to train and evaluate the model. When the loss function is minimized, the fully trained third-order association model is obtained;

[0120] Specifically, by adjusting the structure of the pre-trained model, at the input layer, the dimension of the fusion feature vector F is adapted (2×(3+m) to ensure effective data input;

[0121] In the middle layer, add 2 to 3 convolutional layers (3×3, 5×5 convolution kernels, stride 1, padding 1) to enhance the local feature extraction capability and capture the nonlinear correlation of spectral-color data;

[0122] Output layer: replaced with a single neuron fully connected layer (linear activation), directly outputting the predicted anthocyanin content value, in line with the model architecture design for regression tasks (no activation function or linear activation, suitable for continuous value prediction);

[0123] At the same time, through the application of particle swarm optimization (PSO), the model parameters (tensor fusion weights, neural network connection weights) are regarded as particles in PSO. The quality of the parameters is evaluated through the fitness function f, and the particle swarm position is updated to search for the global optimal parameter combination. The introduction of PSO solves the optimization problem of nonlinear parameter space and avoids the limitations of traditional manual parameter adjustment.

[0124] S4: Based on the third-order correlation model, output the prediction results of anthocyanin content in red onion;

[0125] The color quantification index and the optimal spectral absorption data are tensor-fused to obtain a one-dimensional fusion feature vector, which is then input into the third-order correlation model to output the quantitative prediction results of the anthocyanin content in red onions. ;

[0126] For example:

[0127] A red onion sample was selected and the outer dry skin was removed. The color parameters were measured as follows: L=35, a=12, b=8 (experimental quantitative data);

[0128] Spectral data: After SPA extraction, three characteristic wavelengths are retained, corresponding to the normalized spectral intensity of [0.6, 0.4, 0.7];

[0129] Step 1: Calculate color quantization index:

[0130] ;

[0131] ;

[0132] ;

[0133] Color quantization index vector: H=[14.42,33.69,2.96]

[0134] Step 2: Construct a 2D tensor and fuse it

[0135] Assuming the number of characteristic wavelengths m = 3 and the spectral data vector is S = [0.6, 0.4, 0.7], the two-dimensional tensor is ;

[0136] The weight tensor W is set to: W=[0.3, 0.2, 0.4, 0.8, 0.7, 0.9] after training;

[0137] Tensor contraction calculation: F=13.638;

[0138] Step 3: Model prediction

[0139] Input F=13.638 into the constructed third-order correlation model. The output layer weight obtained in the optimal model parameters is 2.5 and the bias is 5. The predicted value is: ;

[0140] The predicted anthocyanin content of this red onion sample is 39.1 mg / kg (experimental quantitative data).

[0141] In the application, several formulas involved are calculated by taking their numerical values ​​after removing the dimensions, and the formulas are established by collecting a large amount of data and performing software simulation to obtain a formula for the most recent real situation. Some coefficients or weights in the formulas are set by technical personnel in this field according to actual conditions, so they will not be elaborated here.

[0142] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. Those skilled in the art will appreciate that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution.

[0143] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for predicting and analyzing the anthocyanin content of red onions based on CIELab color quantification, characterized in that: include: S1: Use a spectrophotometer to collect color quantitative indicators; Color quantitative indicators include color value, hue value and color index; The color value Chroma calculation formula is: , a is the axial coordinate data from green to red, are representative values ​​of the axial coordinate data from blue to yellow; The hue value calculation formula is: , are representative values ​​of the axial coordinate data from green to red; The calculation formula of color index CIRG is: , is the representative value of the brightness data; The color quantization index is expressed as ; S2: Use a near-infrared spectrometer to collect raw spectral data, extract characteristic wavelengths based on an improved continuous projection algorithm, and obtain optimal spectral absorption data; Among them, the improved continuous projection algorithm is achieved by introducing an adaptive parameter adjustment mechanism into the traditional continuous projection algorithm; S3: Performing a tensor fusion operation on the color quantification index and the optimal spectral absorption data to obtain a one-dimensional fusion feature vector, and constructing a third-order correlation model including spectral data, color parameters, and anthocyanin content based on the one-dimensional fusion feature vector combined with the particle swarm optimization algorithm; The structure of the basic neural network model is adjusted by one-dimensional fusion feature vectors to obtain a third-order correlation modeling framework. The model parameters of the third-order correlation modeling framework are then updated through the particle swarm optimization algorithm to obtain the optimal parameters to construct a third-order correlation model including spectral data, color parameters, and anthocyanin content. The process of obtaining the third-order association modeling framework is as follows: The preset basic neural network model includes input layer, intermediate layer and output layer; Modify the number of neurons in the input layer to The dimension of , M is the number of derived color indices; Then, we add custom convolutional layers and fully connected layers to the middle layer of the pre-trained model. The number of custom convolutional layers and fully connected layers is 2 to 3, with kernel sizes of 3×3 and 5×5, stride of 1, and padding of 1. We replace the output layer with a fully connected layer of a single neuron, and the neuron output is the predicted anthocyanin content value. S4: Based on the third-order correlation modeling, output the prediction results of anthocyanin content in red onion.

2. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 1, wherein The color quantization index acquisition process is as follows: Three measurement points were evenly selected along the horizontal diameter of the middle of the red onion bulb. Each measurement point was measured using a CR-9 spectrophotometer to obtain the lightness data, axial coordinate data from green to red, and axial coordinate data from blue to yellow of each point.

3. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 1, wherein The process of obtaining the best spectral absorption data based on the improved continuous projection algorithm is as follows: A band is randomly selected as the initial band, and a characteristic wavelength is selected from the full wavelength range of the initial spectral data. A new wavelength is selected from the remaining wavelengths in the full wavelength range in each iteration, and the condition number of the new set consisting of the current selected wavelength set and the new wavelength is minimized. Set an initial adaptation threshold , the final adaptation threshold is iteratively determined through an adaptive parameter adjustment mechanism ; Get the linear correlation measure of the new wavelength and the matrix of the currently selected wavelength set ,when And it can minimize the condition number of the new set, select the corresponding wavelength to add to the characteristic wavelength set, and the initial spectral data corresponding to all wavelengths that meet the conditions are the optimal spectral absorption data .

4. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 3, wherein The process of obtaining the condition number is as follows: Get the matrix X consisting of the initial spectral data corresponding to the wavelength, based on the norm of the matrix X and the inverse matrix of matrix X Norm of The condition number is obtained by multiplying .

5. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 3, wherein The implementation process of the adaptive parameter adjustment mechanism is as follows: Defines the ratio of the number of selected characteristic wavelengths to the total number of wavelengths , m is the number of currently selected characteristic wavelengths, and n is the total number of wavelengths in the full wavelength range; when When the performance of the selected characteristic wavelength set is evaluated using the mean square error, the performance change rate of two adjacent iterations is calculated, and when the performance change rate is less than the preset minimum value, the initial adaptation threshold is reduced. Get a new threshold , the calculation formula is: in, is the adjustment factor.

6. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 5, characterized in that, The adjustment coefficient acquisition process is as follows: Through the idea of ​​reinforcement learning, the process of iteratively determining the final adaptation threshold through the adaptive parameter adjustment mechanism is regarded as the behavior of the intelligent agent, the spectral data is regarded as the environment, and the performance index of the selected characteristic wavelength set is regarded as the reward; Define the initial adjustment coefficient range, randomly initialize the adjustment coefficient within the initial adjustment coefficient range to form an initial adjustment coefficient set, For each adjustment coefficient in the initial adjustment coefficient set, the wavelength selection threshold is adjusted using the corresponding adjustment coefficient, and the corresponding reward value is obtained based on the continuous projection algorithm; The state, action, reward, and next state are stored in the experience replay pool. A batch of experience data is randomly extracted. The policy function of the experience data is represented by a deep neural network, and the parameters of the deep neural network are updated by minimizing the loss function. The state is the state information of the selected characteristic wavelength set before adjusting the threshold, including the number of selected wavelengths m and the performance change rate , the action is to use the adjustment coefficient The process of adjusting the wavelength selection threshold. The next state is the state information corresponding to the new set of selected characteristic wavelengths after adjusting the threshold and re-screening the wavelengths. The reward is the reward function The value of Iteratively update the deep neural network parameters to find the adjustment coefficient that maximizes the reward and obtain the optimal adjustment coefficient.

7. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 1, wherein The process of obtaining the one-dimensional fusion feature vector is as follows: The color quantization index and the optimal spectral absorption data are combined into a two-dimensional tensor, a weight tensor is preset, the dimension of the weight tensor matches the two-dimensional tensor, and a one-dimensional fusion feature vector is obtained through a tensor contraction operation.

8. The red onion anthocyanin content prediction and analysis method based on CIELab color quantification according to claim 1, wherein The process of updating the model parameters of the third-order correlation modeling framework and obtaining the optimal parameters through the particle swarm optimization algorithm is as follows: Based on the particle swarm optimization algorithm, each particle is regarded as a parameter combination, including Parameters to be optimized, and define a fitness function to obtain the fitness value of each particle; Update the position and speed of the particle swarm. After each iteration, compare the fitness value of each particle with its own historical optimal fitness value to find the current global optimal position. The model parameters corresponding to the global optimal position are the model parameter combination with the highest fitness value. The model is trained and evaluated using the regression task loss function. When the loss function is minimized, a fully trained third-order association model is obtained.