Method for pre-judging lovibond color of rapeseed oil through RGB color of rapeseed

The nonlinear relationship between the Rapeseed RGB color space and the Rapeseed Oil Luoweipeng color space is established through the BP neural network, and the Rapeseed Oil color of Rapeseed Oil is predicted, which solves the problem of inaccurate measurement results of the Rapeseed Colorimetric Method, and achieves efficient and accurate Rapeseed Oil color prediction.

CN120043973APending Publication Date: 2025-05-27HUAZHONG AGRI UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510130491.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-05
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing Luoweipang colorimetry has artificial errors and environmental factors in the measurement of oil color, resulting in inaccurate measurement results.

Method used

The BP neural network is used to establish a nonlinear relationship between the color space value of rapeseed RGB and the color space value of rapeseed oil. The color of rapeseed oil is predicted by the color of rapeseed RGB.

Benefits of technology

The advance prediction of the color of rapeseed oil is achieved, which avoids the influence of artificial errors and environmental factors, and improves the accuracy and efficiency of measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120043973A_ABST
    Figure CN120043973A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of food quality detection, in particular to a method for pre-judging the lovibond color of rapeseed oil through the RGB color of the rapeseed, and the method comprises the steps: taking RR, RG and RB stimulus values of the rapeseed as an input layer, taking LR, LY and LB of the lovibond of the rapeseed oil as an output layer, and building a BP neural network model; lovibond LR, LY and LB of the rapeseed oil are obtained through conversion of RR, RG and RB measured values of the rapeseed oil; collecting rapeseed oil and rapeseed oil sample data prepared by squeezing the same batch of rapeseed oil; a BP neural network model is obtained through training; and pre-judging the lustre of the rapeseed oil Lovibond by using the trained BP neural network model. According to the method, the BP neural network is adopted to establish the nonlinear relation between the rapeseed RGB color space value and the rapeseed oil Lovibond color space value, the rapeseed oil color is predicted in advance according to the rapeseed RGB color, and the influence of personal errors and environmental factors in the visual measurement process of finished oil is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food quality detection, in particular to a method for predicting the Lovibond color of rapeseed oil through the RGB color of rapeseeds. Background Technique

[0002] There are mainly three major types of rapeseeds: Brassica rapa L., Brassica juncea, and Brassica napus L. The rapeseeds of Brassica rapa L. are brown, yellow, or variegated; the rapeseeds of Brassica juncea are yellow, red, brown, or black; and the rapeseeds of Brassica napus L. are black or dark brown. The diversity of rapeseed colors results in different colors of rapeseed oil extracted from rapeseeds of different colors. Rapeseeds are rich in fat and protein and are susceptible to mildew or discoloration due to factors such as temperature, moisture, and microorganisms. Some studies have shown that the color reversion of edible oils is largely related to the color of the oilseeds themselves. The color of rapeseed oil is affected by the color of rapeseeds and the types and contents of pigments contained in the fat itself. In addition, chlorophyll in the seeds enters the rapeseed oil during the pressing process, which also affects the color of rapeseed oil and thus the quality of rapeseed oil. Moreover, during the processing of oils, substances such as proteins, carbohydrates, phenols, and vitamins undergo oxidation, degradation, or polymerization reactions, generating oil-soluble colored bodies such as brown, red, and yellow, which color the colorless triglycerides.

[0003] In the industry of oil color measurement, the Lovibond color system is currently widely used. It is an internationally unified oil color measurement standard that can represent the color of oil in the form of three primary colors. The Lovibond colorimeter is the detection equipment corresponding to the Lovibond color system. It uses the visual operation method to measure the color of the object to be measured, can measure the colors of various samples such as solids and liquids, and has the characteristics of easy operation, low price, and high cost performance. Therefore, it is widely used in the international color measurement industry. The oil color measurement method specified in China's national standard is also the Lovibond colorimetric method. However, since this method uses the visual method for measurement, the accuracy of the measurement results of the manual Lovibond colorimeter is affected by many factors. First, different observers have certain differences in the ability to distinguish different colors. Therefore, when using the same instrument to measure the same sample, the measurement results obtained by different observers are also different. Second, it is affected by subjective factors. The psychological and physiological factors of the observer will also affect the color difference. Color is a physical quantity related to psychology and physiology, and the psychological factors of the observer will greatly affect the judgment of color. Long-term continuous measurement reduces the resolution of the human eye and makes it impossible to detect the color difference between the oil sample to be measured and the standard color filter. Moreover, the standard color filter made of colored glass is easily contaminated. For example, cooking oil is spilled on the color filter, or it is placed in a room with high humidity and a lot of dust. Finally, the color of the same oil itself is uneven, and the yellow value is required to be fixed during measurement. Because the yellow and red values of the Lovibond colorimeter are related, there are too many variables when the yellow value is not fixed, which is not convenient for comparison. The measurement of RGB color is relatively simple and fast, and the RGB color data of rapeseed can be obtained in a short time.

[0004] The BP neural network is a widely used supervised learning algorithm, suitable for dealing with complex non-linear problems with multiple inputs and outputs. In the problem of predicting the color of finished rapeseed oil, the neural network can be trained to learn and understand the complex relationship between rapeseed types, refining degrees, and other factors that may affect the color of rapeseed oil and the final color of rapeseed oil. By continuously adjusting its internal weights and biases, the BP neural network can gradually improve the accuracy of predicting the color of rapeseed oil. Due to the differences in the color of rapeseed grains, fat content, chlorophyll content, etc., the colors of rapeseed oil obtained by pressing are also significantly different. Taking the measured RGB values of rapeseed as the input signal of the BP neural network, and the Lovibond yellow, red, and blue values of rapeseed oil as the expected output values, the association between the RGB color space values of rapeseed and the Lovibond color space values of rapeseed oil is established through the non-linear mapping of the hidden layer of the BP neural network, thereby eliminating the subjective factors in detecting the color of oil. Summary of the Invention

[0005] In view of the above problems, the present invention proposes a method for predicting the Lovibond color of rapeseed oil through the RGB color of rapeseed. A non-linear relationship between the RGB color space values of rapeseed and the Lovibond color space values of rapeseed oil is established using a BP neural network, realizing the early prediction of the color of rapeseed oil based on the RGB color of rapeseed, and avoiding the influence of human errors and environmental factors during the visual measurement of the refined oil.

[0006] To achieve the above object, the present invention is implemented according to the following technical solutions:

[0007] A method for predicting the Lovibond color of rapeseed oil through the RGB color of rapeseed, characterized by comprising the following steps:

[0008] Step S1: Using the R R 、R G 、R B stimulation values of rapeseed as the input layer, and the Lovibond L R ,L Y ,L B of rapeseed oil as the output layer, a three-layer BP neural network model is established; wherein, the R R 、R G 、R B stimulation values of rapeseed are obtained by measuring with a measuring instrument, and R R 、R G 、R B are respectively the percentages of the brightness values of red, green, and blue measured, and the Lovibond L R ,L Y ,L B of rapeseed oil are obtained by conversion from the R R 、R G 、R B measurement values of rapeseed oil;

[0009] Step S2: Collect sample data of rapeseed and rapeseed oil pressed from the same batch of rapeseed. The data set composed of several groups of sample data is randomly divided into a training set, a validation set, and a test set; during the training process, the model parameters are adjusted to make the model converge, and the best model is saved after verification with the test set to obtain the BP neural network model;

[0010] Step S3: Use the trained BP neural network model to predict the Lovibond color of rapeseed oil.

[0011] In the above technical solution, in step S1, the method for converting the Lovibond L R ,L Y ,L B of rapeseed oil from the R R 、R G 、R B measurement values of rapeseed oil includes the following steps:

[0012] Step S1.1 Select Lovibond red and yellow filters with values of 0.1 - 0.9, 1 - 9, and 10 - 70 respectively; blue filters with values of 0.1 - 0.9, 1 - 9, and 10 - 40; and neutral gray filters with values of 0.1 - 0.9 and 1 - 3, a total of 84 filters, as the measurement samples. For each group of measurements, fix two of the variables and change the third. By measuring the R R 、R G 、R B stimulus values of the standard Lovibond color filters, obtain sample data, that is, obtain sample data that satisfies the correspondence between R R 、R G 、R B and L R ,L Y ,L B . Among them, R R 、R G 、R B are the percentages of the brightness values of the measured red, green, and blue colors respectively;

[0013] Step S1.2 Obtain the R R 、R G 、R B of rapeseed oil through measurement. Correlate the R R 、R G 、R B of rapeseed oil with the sample data in Step S1.1 and calculate the corresponding L R ,L Y ,L B . The specific calculation method is as follows:

[0014] Step S1.2.1 Assume that the color brightness values of the collected sample are R R0 、R G0 、R B0 , and their corresponding coordinates are K(r0, g0). Point K will be one of the sample data set. First, find a quadrilateral area that contains K. Assume that the coordinates of the four vertices of this quadrilateral are A(r1, g1), B(r2, g2), C(r3, g3), and D(r4, g4) respectively. This quadrilateral is called the smallest quadrilateral formed by points A, B, C, and D. The specific method is as follows: Use the area method to calculate the areas of triangles KAB, KBC, KCD, and KAD respectively, and calculate whether there is:

[0015]

[0016] If they are equal, the point is inside the quadrilateral ABCD; otherwise, it is outside. Search step by step within the entire sample data points through this method until this smallest quadrilateral is found;

[0017] Step S1.2.2 has found the smallest quadrilateral containing the point K(r0, g0) through the area method, and the four vertices of this smallest quadrilateral are: A(r1, g1), B(r2, g2), C(r3, g3), D(r4, g4). Draw a line passing through point K with a slope equal to the average of the slopes of line AB and line CD, which intersects the quadrilateral ABCD at points G and F respectively. The coordinate value of point G in the Lovibond color space is (L YG , L RG ), and the Lovibond yellow value corresponding to point F is L YF , and the red value is L RF ; According to the interpolation principle, for a line with two known quantities, the abscissa or ordinate of any point on the line formed by these two points can be obtained; therefore, the Lovibond yellow value L YK corresponding to point K can be calculated as follows:

[0018] L YK = L YG + GK / GF * (L YF - L YG )

[0019] Similarly, the Lovibond red value corresponding to point K can be obtained:

[0020] L RK = L RE + EK / EH * (L RH - L RE )

[0021] Therefore, the Lovibond yellow value L YK and red value L RK;

[0022] of the sample to be measured can be calculated. To calculate the blue value of point K, the interpolation algorithm needs to be used again; first, find the smallest quadrilateral containing point K, and similarly use the interpolation algorithm to calculate the blue value of point K. According to the principle of the smallest blue value, if the point we need to interpolate falls within the regions contained by both blue 0 and blue 1, then take the Lovibond value of point K falling within the blue 0 region.

[0023] In the above technical solution, the number of hidden layer neurons of the BP neural network model in step S1 satisfies:

[0024]

[0025] Where: n is the number of nodes in the input layer; m is the number of nodes in the output layer; a is a constant between 0 and 10; n - 1 is the upper limit of the number of hidden layer neurons; the trial and error method is used to obtain the optimal value by experimenting point by point within the range of the number of hidden layer nodes limited by formula (1).

[0026] In the above technical solution, in step S1, the hidden layer of the BP neural network model adopts a logarithmic sigmoid transfer function and a tangent sigmoid transfer function, and the output layer adopts a linear function as the transfer function.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] The color of the finished rapeseed oil can be predicted by measuring the RGB color of rapeseed at the time of harvest, eliminating the Lovibond method measurement of the color of the refined oil, realizing the early prediction of the color of rapeseed oil, avoiding the influence of human error and environmental factors in the visual measurement of the refined oil, effectively saving economic costs and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0030] Figure 1 It is a schematic diagram of the interpolation principle;

[0031] Figure 2 It is a schematic diagram of the implementation of the bilinear interpolation algorithm;

[0032] Figure 3 It is a neural network structure diagram;

[0033] Figure 4 It is a training state diagram of the rapeseed color value data in the Huanggang production area input into the BP neural network;

[0034] Figure 5 It is an operation error analysis diagram of the rapeseed color value data in the Huanggang production area input into the BP neural network;

[0035] Figure 6 It is an error distribution diagram of the rapeseed color value data in the Huanggang production area input into the BP neural network;

[0036] Figure 7 It is a regression analysis diagram of the rapeseed color value data in the Huanggang production area input into the BP neural network;

[0037] Figure 8 It is a training state diagram of the rapeseed color value data in the Xiangyang production area input into the BP neural network;

[0038] Figure 9 It is an operation error analysis diagram of the rapeseed color value data in the Xiangyang production area input into the BP neural network;

[0039] Figure 10 Error distribution diagram of rapeseed color value data in Xiangyang production area input into the BP neural network;

[0040] Figure 11 Regression analysis diagram of rapeseed color value data in Xiangyang production area input into the BP neural network. Specific implementation manners

[0041] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention.

[0042] An embodiment of the present invention provides a method for predicting the Lovibond color of rapeseed oil through the RGB color of rapeseed, including the following steps:

[0043] Step S1: Taking the R R , R G , R B stimulation values of rapeseed as the input layer and taking the Lovibond L R , L Y , L B of rapeseed oil as the output layer to establish a three-layer BP neural network model; wherein, the R R , R G , R B stimulation values of rapeseed are obtained by measuring with a measuring instrument, R R , R G , R B are respectively the percentages of the brightness values of red, green and blue measured, and the Lovibond L R , L Y , L B of rapeseed oil are obtained by conversion from the R R , R G , R B measurement values of rapeseed oil;

[0044] In step S1, the R R , R G , R B stimulation values of rapeseed can be measured by a color sensor. As the optical path changes, the brightness value of the object measured by the color sensor also changes, but the proportional value does not change. Therefore, R R , R G , R B here are respectively the percentages of the brightness values of red, green and blue measured.

[0045] In the Lovibond color system, the primary colors are not RGB, but RYB. Due to the color differences in rapeseed oil, traditional colorimeters match the color obtained by moving the standard Lovibond filter combination with the color of the sample to be measured, thereby obtaining the Lovibond color value. Based on this, by measuring the RGB color space value and the Lovibond color space value of the standard Lovibond filter, the proportional relationship between the two is calculated, and then the conversion between the RGB color value and the Lovibond color value of the rapeseed oil to be measured is realized through the bilinear interpolation method.

[0046] Lovibond L of rapeseed oil R , L Y , L B Through the R of rapeseed oil R , R G , R B The conversion method of the measured values includes the following steps:

[0047] Step S1.1 Select 84 Lovibond red, yellow, and blue filters with values of 0.1 - 0.9, 1 - 9, 10 - 70 for red, 0.1 - 0.9, 1 - 9, 10 - 40 for blue, and 0.1 - 0.9, 1 - 3 for neutral gray as measurement samples. For each group of measurements, two variables are fixed and the third is changed. By measuring the R R , R G , R B stimulus values of the standard Lovibond filters, sample data is obtained, that is, sample data satisfying the correspondence between R R , R G , R B and L R , L Y , L B is obtained, where R R , R G , R B are the percentages of the brightness values of red, green, and blue measured respectively;

[0048] Since blue is rarely used in the measurement of oils and fats, the principle of minimizing blue is adopted when selecting the representation method at a certain point. Each point falling in the RGB space represents a combination of Lovibond red, yellow, and blue filters. The RGB brightness values are measured for this combination, and then the normalized ratio of each color filter is obtained, that is:

[0049]

[0050] The abscissa represents the brightness ratio R% of red, and the ordinate represents the brightness ratio G% of green.

[0051] Step S1.2 Obtain the R of rapeseed oil through measurement R , R G , RB , calculate the corresponding L for the sample data of rapeseed oil's R R , R G , R B ; specifically, the calculation method is as follows: R , L Y , L B ;

[0052] In step S1.2.1, assuming the collected sample color brightness values are R R0 , R G0 , R B0 , and their corresponding coordinates are K(r0, g0). Point K will be one of the sample data set. First, find a quadrilateral area that contains K. Assume the coordinates of the four vertices of this quadrilateral are A(r1, g1), B(r2, g2), C(r3, g3), D(r4, g4) respectively. This quadrilateral is called the smallest quadrilateral formed by points A, B, C, and D; specifically, use the area method to calculate the areas of triangles KAB, KBC, KCD, and KAD respectively, and calculate whether there is:

[0053]

[0054] If they are equal, the point is inside the quadrilateral ABCD; otherwise, it is outside. Search step by step within the entire sample data points through this method until this smallest quadrilateral is found;

[0055] In step S1.2.2, as shown in Figure 2 , the smallest quadrilateral that contains point K(r0, g0) has been found by the area method, and the four vertices of this smallest quadrilateral are: A(r1, g1), B(r2, g2), C(r3, g3), D(r4, g4). Draw a line through point K with a slope equal to the average of the slopes of line AB and line CD, and intersect the quadrilateral ABCD at points G and F respectively. The coordinate value of point G in the Lovibond color space is (L YG , L RG ), and the Lovibond yellow value corresponding to point F is L YF , and the red value is L RF ; According to the interpolation principle, as shown in Figure 1 , for a line with two known quantities, the abscissa or ordinate of any point on the line formed by these two points can be obtained; therefore, the Lovibond yellow value L YK corresponding to point K can be calculated as follows:

[0056] L YK = L YG + GK / GF * (L YF - L YG )

[0057] Similarly, the Lovibond red value corresponding to point K can be obtained:

[0058] L RK = L RE + EK / EH * (L RH - L RE )

[0059] Therefore, the Lovibond yellow value L YK and red value L RK of the sample to be measured can be calculated;

[0060] To calculate the blue value of point K, the interpolation algorithm needs to be used again; first, find the smallest quadrilateral containing point K, and similarly use the interpolation algorithm to calculate the blue value of point K. According to the principle of the smallest blue value, if the point we need to interpolate falls within the regions contained by both blue 0 and blue 1, then take the Lovibond value of point K in the blue 0 region.

[0061] In actual implementation, the established standard Lovibond sample data is stored inside the single-chip microcomputer (data processing module), and a program is written to implement the interpolation algorithm. When the R R 、R G 、R B color data of rapeseed oil is input, the single-chip microcomputer can calculate the Lovibond value of the rapeseed oil sample to be measured according to the written algorithm; then connect the single-chip microcomputer to the digital tube (display module), and the data processed by the single-chip microcomputer can be displayed.

[0062] In the BP neural network structure, the number of neurons in the hidden layer needs to be selected appropriately. In step S1, the number of neurons in the hidden layer of the BP neural network model satisfies:

[0063]

[0064] In the formula: n is the number of nodes in the input layer; m is the number of nodes in the output layer; a is a constant between 0 and 10; n - 1 is the upper limit of the number of neurons in the hidden layer; the trial-and-error method is used to obtain the optimal value by gradually experimenting at each point within the range of the number of hidden layer nodes limited by formula (1). According to the above empirical formula, it is verified that the number of neurons in the hidden layer is selected as 5.

[0065] Step S2: Collect the sample data of rapeseeds and rapeseed oil pressed from the same batch of rapeseeds. The data set composed of several groups of sample data is randomly divided into a training set, a validation set, and a test set. For example, 80% is the training set, 10% is the validation set, and 10% is the test set; during the training process, the model parameters are adjusted to make the model converge, and the best model is saved after verification with the test set to obtain the BP neural network model, as Figure 3 shown;

[0066] Assume W ijis the connection weight between the i-th node of the input layer and the j-th node of the hidden layer, W jk is the connection weight between the j-th node of the hidden layer and the k-th node of the output layer; θ j is the threshold of the hidden layer, θ k is the threshold of the output layer. The input net of the j-th node of the hidden layer j is the weighted sum of the outputs of the previous layer's units. The output of the input layer is its input value. Let the input of the i-th node of the input layer be x i , then there is:

[0067] net j= W ij* x i+ θ j (2)

[0068] Then the output of the hidden layer is:

[0069] a j= f(∑W ij* x i+ θ j )(3)

[0070] where f includes the logarithmic sigmoid transfer function and the tangent sigmoid transfer function, etc. Select the linear function as the activation function of the output layer nodes. Therefore, the output value is the weighted sum of the input values. For the k-th node of the output layer, the output value is:

[0071] Y k= ∑W jk a j+ θ k (4)

[0072] The embodiments of the present invention list the R R , R G , R B of rapeseed from two production areas of Huanggang and Xiangyang, as well as the Lovibond L R , L Y , L B color value data of rapeseed oil obtained by pressing rapeseed of the same batch are input into the training process and results of the BP neural network to characterize the effect of the method of the present invention.

[0073] Tables 1 to 8 show the specific weight and threshold values of the two production area samples during the training and verification of the BP neural network, indicating that the hidden layer continuously adjusts and optimizes the parameters during the training process of the BP neural network, and thus can accurately predict the Lovibond color value of rapeseed oil.

[0074] Table 1 Input layer - Hidden layer weights (Huanggang)

[0075]

[0076] Table 2 Hidden Layer Thresholds (Huanggang)

[0077]

[0078] Table 3 Hidden Layer - Output Layer Weights (Huanggang)

[0079]

[0080] Table 4 Output Layer Thresholds (Huanggang)

[0081]

[0082] Table 5 Input Layer - Hidden Layer Weights (Xiangyang)

[0083]

[0084]

[0085] Table 6 Hidden Layer Thresholds (Xiangyang)

[0086]

[0087] Table 7 Hidden Layer - Output Layer Weights (Xiangyang)

[0088]

[0089] Table 8 Output Layer Thresholds (Xiangyang)

[0090]

[0091] Figures 4 to 11 Respectively show the training analysis results of the datasets from two different production areas, Huanggang and Xiangyang, input into the BP neural network. Figure 4 and Figure 8 Are visual graphs of the error during the training process. The abscissa represents the number of iterations, and the ordinate represents the root mean square error between the predicted value and the measured value of the BP neural network model. The smaller the root mean square error, the closer the predicted value of the BP neural network model is to the measured value. As can be seen from the figure, after training the rapeseed data in the Huanggang production area 1000 times, iterating 7 times, the MSE of the validation set reaches the lowest, and the training result of the BP neural network is the most ideal; while after training the rapeseed data in the Xiangyang production area 1000 times, iterating 4 times, the MSE of the validation set reaches the lowest, and the training result of the BP neural network is the most ideal. Figure 7 and Figure 11It is the error regression curve of the BP neural network model, which shows the relationship between the predicted values and the measured values in the three stages of training, validation, and testing. The abscissa represents the target value, and the ordinate represents the predicted value of the BP neural network model. "R" is the regression coefficient. The closer the "R" value is to 1, the higher the prediction accuracy of the BP neural network model. The regression coefficients R of the training set, R of the validation set, and R of the test set of the BP neural network regression in the three sample sets of Huanggang are 0.88543, 0.92573, and 0.91887 respectively; the regression coefficients R of the training set, R of the validation set, and R of the test set of the BP neural network regression in the three sample sets of Xiangyang are 0.82279, 0.8653, and 0.75495 respectively. The sample points are distributed near the network fitting line, indicating that the constructed BP neural network has a high approximation accuracy and the prediction effect of the model is good. After the model training is completed, the network "net" is saved. When new data needs to be predicted, the network "net" can be called and a new data set (which needs to be normalized) can be brought in. The predicted data obtained needs to be de-normalized.

[0092]

[0093] Where Y1 and Y2 are the two outputs of this neural network layer; represents the position of the weight in the matrix, and (k,n) represents the weight of the k-th connection; The superscript (k) represents the bias of the k-th layer, and the subscript (j) represents the bias of the j-th layer; X1 and X2 are the variables input to the neural network layer; tan sig(x) is the hyperbolic tangent sigmoid function, which performs a non-linear transformation on the input so that the neural network can handle non-linear problems; purelin(x) is a linear function used to perform a linear combination on the result after being processed by the activation function.

[0094] Step S3: Use the trained BP neural network model to predict the Lovibond color of rapeseed oil.

[0095] A comparative experiment is used to verify the prediction of the obtained BP neural network model. The comparative experiment uses 6 different rapeseeds as raw materials, two of each kind, and measures the R R 、R G 、R B of the rapeseeds respectively, and measures the Lovibond color of the rapeseed oil based on the neural network of the present invention; the rapeseeds are pressed to obtain rapeseed oil, and then the Lovibond color of the rapeseed oil is measured by the visual method respectively. The measurement result takes the average of the two times. Among them, the user of the Lovibond colorimeter in the visual method is an observer who has been trained and has measurement experience. To ensure the consistency of the measurement environment, the colorimeter is used by the same person, and the experimental results are recorded in the above table. By comparing the experimental results in the table, it can be seen that the results of the two measurement methods are relatively close, further indicating the accuracy of the neural network model of the present invention.

[0096] Comparison of Measurement Results between Visual Method and the Method of the Present Invention in Table 9

[0097]

[0098] The method of predicting the Lovibond color of rapeseed oil through the RGB color of rapeseed in the present invention, compared with the existing Lovibond colorimetry, realizes the early prediction of the color of rapeseed oil, avoids the human error and the influence of environmental factors in the visual measurement process of refined oil, has low cost, meets the national edible oil grade definition standard, has stable performance and can be continuously measured.

[0099] The above is only the preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A method for predicting the color of rapeseed oil Lovibond by rapeseed RGB color, characterized in that: The following steps are involved: Step S1: Using the R of rapeseed R , R G , R B The stimulus value is used as the input layer, with rapeseed oil Lovibond L R , L Y , L B As the output layer, a three-layer BP neural network model was established; among them, the R R , R G , R B The stimulus value is obtained by measuring the instrument, R R , R G , R B are the percentages of the measured red, green, and blue brightness values, respectively, and the Lovibond L R , L Y , L B R through rapeseed oil R , R G , R B The measured value is converted to obtain; Step S2: collecting rapeseed and rapeseed oil sample data obtained by squeezing rapeseed from the same batch of rapeseed, and randomly dividing the data sets consisting of several groups of sample data into a training set, a validation set and a test set; the training process adjusts the model parameters to make the model converge, and saves the best model after verification with the test set to obtain a BP neural network model; Step S3: using the trained BP neural network model to predict the color of rapeseed oil Lovibond.

2. A method for predicting the color of rapeseed oil Lovibond by rapeseed RGB color according to claim 1, characterized in that: In the step S1, the Lovibond L of rapeseed oil R , L Y , L B R through rapeseed oil R , R G , R B The conversion method of the measured value includes the following steps: Step S1.1 Select 84 Lovibond red and yellow filters, 0.1-0.9, 1-9, 10-70, blue filters, 0.1-0.9, 1-9, 10-40, and neutral gray filters, 0.1-0.9, 1-3, as the measurement samples. In each group of measurements, two variables are fixed and the third variable is changed. By measuring the R R , R G , R B Stimulus value, get sample data, that is, get the R R , R G , R B With L R , L Y , L B The corresponding relationship between the sample data, where R R , R G , R B are the percentages of the measured brightness values ​​of red, green, and blue, respectively; Step S1.2: Obtaining the R of rapeseed oil by measuring R , R G , R B , the R of rapeseed oil R , R G , R B Corresponding to the sample data of step S1.1, calculate its corresponding L R , L Y , L B ; The specific calculation method is: Step S1.2.1 Using the principle of equal area, assume that the color brightness value of the collected sample is R R0 , R G0 , R B0 , its corresponding coordinates are K(r0,g0), point K will be one of the large set of sample data, first find a quadrilateral area that includes K, assuming that the coordinates of the four vertices of the quadrilateral are A(r1,g1), B(r2,g2), C(r3,g3), D(r4,g4), this quadrilateral is called the minimum quadrilateral composed of four points ABCD; the specific method is: use the area method to calculate the areas of triangles KAB, KBC, KCD, and KAD respectively, and calculate whether they exist: If they are equal, the point is inside the quadrilateral ABCD, otherwise, it is outside. This method is used to gradually search within the entire sample data points until the minimum quadrilateral is found. Step S1.2.2 The minimum quadrilateral containing point K (r0, g0) has been found by the area method, and the four vertices of this minimum quadrilateral are: A (r1, g1), B (r2, g2), C (r3, g3), D (r4, g4). Draw a straight line through point K with a slope equal to the average of straight lines AB and CD, intersecting quadrilateral ABCD at points G and F respectively. The coordinate value of point G in the Lovibond color space is (L YG , L RG ), the Lovibond yellow value corresponding to point F is L YF , the red value is L RF According to the interpolation principle, if there are two known straight lines, the horizontal or vertical coordinates of any point on the straight line formed by these two points can be obtained; therefore, the Lovibond yellow value L corresponding to point K can be calculated YK : L YK =L YG +GK / GF﹡(L YF -L YG ) Similarly, the Lovibond red value corresponding to point K can be obtained: L RK =L RE +EK / EH﹡(L RH -L RE ) Therefore, the Lovibond yellow value L of the sample to be tested can be calculated YK and red value L RK; To calculate the blue value of point K, we need to use the interpolation algorithm again; first find the smallest quadrilateral containing point K, and use the interpolation algorithm to calculate the blue value of point K. According to the principle of minimum blue value, if the point we need to interpolate falls in the area included by blue 0 and in the area included by blue 1, then take the Lovibond value of point K in the blue 0 area.

3. A method for predicting the color of rapeseed oil Lovibond by rapeseed RGB color according to claim 1, characterized in that: The number of neurons in the hidden layer of the BP neural network model in step S1 satisfies: l<n-1 l = log2n Where n is the number of input layer nodes; m is the number of output layer nodes; a is a constant between 0 and 10; n-1 is the upper limit of the number of neurons in the hidden layer; the trial and error method is used to obtain the optimal value by experimenting point by point within the range of the number of hidden layer nodes specified by formula (1).

4. A method for predicting the color of rapeseed oil Lovibond by rapeseed RGB color according to claim 1, characterized in that: In the step S1, the hidden layer of the BP neural network model adopts a logarithmic S-type transfer function and a tangent S-type transfer function, and the output layer adopts a linear function as a transfer function.