Apple taste map information visualization method
Technical Field
The invention relates to the field of apple taste analysis, in particular to an apple taste map information visualization method.
Background
China is a big apple producing country, and the yield of China accounts for 65% of the total apple yield. The apple fruit is rich in minerals and vitamins, has high solubility and is easy to be absorbed by human bodies, so that the apple fruit is called as 'running water', and is one of the fruits which are often eaten by people. As one of the important factors for reflecting the quality of the apples, the taste information of the apples influences the selection of most consumers whether to buy, and has practical guiding significance for breeding, planting, storing and the like of the apples by accurately and efficiently detecting and representing the taste information. The traditional physical and chemical detection method cannot reflect the taste and sense information of the apples, and the most common artificial sense evaluation result is not objective due to the influences of factors such as the psychology of an evaluator, the surrounding environment and the like. Based on this, the SA-402B type electronic tongue as a single-taste intelligent bionic detection system gradually replaces the application of the traditional detection method in the aspect of taste information by the advantages of objectivity, accuracy and the like. Sampling detection and batch processing are carried out on the apple samples, so that the detection of the whole taste information of the samples is realized, and the distribution condition of various taste information on the sample space cannot be reflected.
Disclosure of Invention
In order to solve the problems, the invention provides an apple taste sensation map information visualization method.
In order to achieve the purpose, the invention adopts the technical scheme that:
an apple taste map information visualization method comprises the following steps:
s1 obtaining taste data based on electronic tongue apple sample
S11, selecting apples with regular shape, uniform size and no defects or pollutants, which are picked in the same batch and same place, and selecting 90 superior fruits according to the national standard GB/T10651-2008;
s12, numbering the samples, placing the samples at the normal temperature of 20 +/-2 ℃, storing the samples for 24 hours at the relative humidity of 55 +/-5%, and keeping the temperature and the humidity unchanged;
s13, cleaning, peeling, juicing and filtering each apple sample to obtain 40mL of supernatant, respectively placing the supernatant into 2 pure measuring cups, and sequentially detecting by an electronic tongue according to the numbering sequence to obtain three taste data of 90 multiplied by 3 sugar degree, sour taste and salty taste at 30 seconds; before the test starts, the sensor is firstly cleaned in positive and negative cleaning solution for 90s, cleaned in reference solution for 120s after the test is finished, cleaned in another reference solution for 120s continuously, and the balance of the sensor returns to zero for 30 s; after the balance is achieved, starting to detect, wherein the test time is 30s, and automatically entering a cleaning step after each measurement is finished;
s2, obtaining and preprocessing apple sample data based on hyperspectral technology
S21, correcting the hyperspectral image by adopting a black and white calibration method according to the following formula so as to eliminate the influence of noise:
in the formula, RdDark image, RwDiffuse reflection image of whiteboard, Rs-original diffuse reflectance spectral image of apple sample, R-corrected diffuse reflectance spectral image.
S22, carrying out vectorization processing on the image after black and white calibration to obtain an image description curve, after a target image is defined, generating a specific interested mask image, and controlling a sample image processing area;
and S23, performing image cutting on the image after the mask processing, wherein the spectral values of the masked spectral regions except the interested part are all 0.
S24, obtaining the preprocessed 90 apple spectral images, wherein an apple sample is divided into 4 faces when the sample is irradiated by a hyperspectral classifier because the apple is a spheroidal fruit, 5 interesting regions with the numbers of 1-5 are respectively obtained on each face, the size of each interesting region is 300 pixel points, the integral spectral mean value of 5 surfaces of each sample is obtained, and finally 90 x 256 dimensional apple data is obtained;
s3 selection of characteristic wave band
Respectively selecting 3 kinds of sensitive wave bands corresponding to sweet, sour and salty basic tastes, determining the number of the optimal sensitive wave bands by using a variation coefficient, and then determining the correlation degree between taste information and a spectral image of an apple sample by using a gray correlation scale (GRA) method;
s4 construction of apple taste visual model
Adopting SVM to predict the concentration value of each discrete point of taste information, wherein the hyperplane function, RBF kernel function and regression function formulas (2), (3) and (4) are respectively as follows:
K(x,x′)=exp(g Px-x′P2) (2)
f(x)=wφ(x)+b (3)
in the formula, w is a normal vector of a hyperplane, phi (x) is a nonlinear mapping function, b is an offset, and g is a width coefficient;
s5, taste visual presentation
After the GS-SVM model is established, predicted spectrum values under 10 wave bands are input point by point, taste prediction output values under all point spectrum values are calculated and recorded as K (i, j), the taste values are converted into corresponding actual color values, and the apple taste information is visually presented.
Preferably, the gray correlation method specifically includes the following steps: firstly, converting multi-dimension data into a uniform dimensionless form, defining a reference number sequence as a taste information number sequence, and comparing the number sequences to spectral information number sequences under each wave band of 380-; then, the grey correlation coefficient of each single taste information array and the spectrum information array under the full wave band is obtained; and finally, solving the grey correlation degree of each wave band.
Preferably, the step S4 is to optimize the parameters c and g based on a Genetic Algorithm (GA) in which the maximum genetic algebra is 100, the initial population number is 20, the search range of the parameter c is 0 to 100, and g is 0 to 100, and a Grid Search (GS) method; in the grid search method, parameter optimization is performed at intervals of 0.5, and the search range of the parameters c and g is 2-10To 210。
Preferably, in the step S4, in the process of building the model, when mapping the spectral data and the taste information, the model is built after calculating the mean value of the spectral values in each band; wherein 2/3 spectral data samples are selected as a training set and 1/3 spectral data samples are selected as a prediction set by using a Kennard-Stone method, and visual analysis of spectral-taste information is realized based on GS-SVM and GA-SVM.
The invention combines the advantages of apple sample on hyperspectral single-point difference with the electronic tongue taste integral information detection technology, thereby realizing the visualization of apple taste map information and providing a more accurate analysis method for the analysis of apple taste.
Drawings
Fig. 1 is a spectral image description curve in the embodiment of the present invention.
FIG. 2 is a vector mask image in an embodiment of the present invention.
Fig. 3 is a region-of-interest spectral plot in an embodiment of the present invention.
FIG. 4 is a graph illustrating variation of coefficient of variation according to an embodiment of the present invention
FIG. 5 is a diagram illustrating a parameter optimization process according to an embodiment of the present invention;
wherein, (a) is a genetic algorithm parameter optimization process; (b) the optimization process for the grid search parameters.
Fig. 6 is a graph of the GS-SVM-based taste visualization results in an embodiment of the present invention.
Detailed Description
In order that the objects and advantages of the invention will be more clearly understood, the invention is further described in detail below with reference to examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Examples
In the embodiment, 90 superior fruits are selected according to the national standard GB/T10651-2008 by selecting the Akxose heart apples which are picked in the same batch and in the same place and have regular shape, uniform size and no defects or pollutants as research objects; the method comprises the following steps:
s1 obtaining taste data based on electronic tongue apple sample
After numbering the samples, the samples are placed at the normal temperature of 20 ℃ (± 2 ℃), and stored for 24 hours with the relative humidity of 55% (± 5%), and the temperature and the humidity are kept basically unchanged. Sequentially measuring 90 samples according to the serial number sequence, cleaning, peeling, juicing and filtering each apple sample to obtain 40mL of supernatant, and respectively placing the supernatant in 2 pure measuring cups to be measured. Before the test is started, the sensor is firstly cleaned in positive and negative cleaning solution for 90s, cleaned in reference solution for 120s after the test is finished, cleaned in another reference solution for 120s continuously, and the balance of the sensor is reset to zero for 30 s. And after the balance is achieved, starting detection, wherein the test time is 30s, and automatically entering a cleaning step after each measurement is finished. The electronic tongue detection is carried out to obtain 90X 3 dimensional data of three tastes (sugar degree, sour taste and salty taste) at 30 seconds.
S2, obtaining and preprocessing apple sample data based on hyperspectral technology
In the hyperspectral image acquisition process, part of noise information is mixed due to the difference of the intensity distribution of the light source under each wave band and the influence of the dark current noise of the camera. The noise information can affect the quality of the hyperspectral image, and further affect the precision and stability of a hyperspectral image qualitative or quantitative analysis model. Therefore, the hyperspectral image is corrected by adopting a black and white calibration method to eliminate the influence of noise, and the formula (1) shows.
In the formula, RdDark image, RwDiffuse reflection image of whiteboard, Rs-original diffuse reflectance spectral image of apple sample, R-corrected diffuse reflectance spectral image.
Vectorizing the image after the black and white calibration to obtain an image description curve as shown in fig. 1, after the target image is defined, generating a specific interested mask image as shown in fig. 2, and controlling a sample image processing area. Because the acquired image edge contains more spectral noise, the difficulty of post-processing data is increased, the image after mask processing is subjected to image cutting, and other spectral values of the masked spectral region except the interested part are all 0.
And acquiring the preprocessed 90 apple spectral images. Wherein, because the apple is the quasi-spherical fruit, so divide into 4 faces with an apple sample when using the hyperspectral sorter to shine the sample to respectively take 5 region of interest (every region of interest size is about 300 pixel points) of serial number 1-5 on each face. The average spectral values of the 5 interesting regions on each cross section are shown in fig. 3, and the spectral average of the 5 surface integrals of each sample is obtained, so that 90 × 256 dimensional apple data is finally obtained. S3 selection of characteristic wave band
The spectral image reflects the difference of internal quality of the apple, and the electronic tongue obtains taste information through the free functional groups in the apple sample. Therefore, the grey correlation degree (GRA) method is adopted to determine the correlation degree between the two, and 3 sensitive wave bands corresponding to the sweet, sour and salty basic tastes are respectively selected. Before grey correlation analysis is carried out, the number of the optimal sensitive wave bands is determined by using the coefficient of variation. As the overall coefficient of variation is larger, the correlation between the variables is lower, and the influence of the number of characteristic bands spaced at 2 intervals on the coefficient of variation is examined, and as can be seen from fig. 4, the number of characteristic bands has the highest coefficient of variation at 10 points. In the grey correlation method, firstly, the multi-dimensional data is converted into a uniform dimensionless form, the reference number sequence is defined as a taste information number sequence, and the number sequence is compared with the spectral information number sequence under each wave band of 380-. Then, a gray correlation coefficient between each single taste information sequence and the spectrum information sequence in the full-band is obtained. And finally, solving the grey correlation degree of each wave band. The results are shown in Table 1, where the top 10 characteristic bands with higher relevance values are found for each single taste message.
TABLE 1 characteristic bands of the respective Pretaste 10
S4 construction of apple taste visual model
The spectrum and taste information data have discreteness, and local linear and nonlinear relations are presented between the spectrum and the taste information data, the SVM main idea is to establish a regression hyperplane as a decision surface, and utilize a kernel function to map multi-dimensional data to a high-dimensional space to make the multi-dimensional data linear as much as possible so as to solve the local nonlinearity of original data and finally make the distance from all data in a set to the hyperplane nearest. On the basis of the method, SVM is adopted to predict the concentration value of each discrete point of taste information, wherein the hyperplane function, RBF kernel function and regression function formulas (2), (3) and (4) are respectively as follows. The SVR modeling process result depends on parameters c and g, and correct and effective parameter selection has good regression performance on the support vector machine. Thus, the parameters c and g are optimized herein based on the methods of Genetic Algorithm (GA) and Grid Search (GS), as shown in fig. 5. In the genetic algorithm, the maximum genetic algebra is 100, the initial population number is 20, the search range of the parameter c is 0 to 100, and g is 0 to 100. In the grid search method, parameter optimization is performed at intervals of 0.5, and the search range of the parameters c and g is 2-10To 210. In the process of establishing the model, the taste of the whole sample is detected by the experimentAnd (4) obtaining the mean value of the spectral values under each wave band and then establishing a model when mapping the spectral data and the taste information. Wherein 2/3 spectral data samples are selected as a training set and 1/3 spectral data samples are selected as a prediction set by using a Kennard-Stone method, and visual analysis of spectral-taste information is realized based on GS-SVM and GA-SVM. The result shows that in the parameter optimization process of the GA-SVM, the genetic algorithm rapidly screens out the optimal modeling parameter c of 6.3859, g of 83.0159 and the parameter optimization process of the GS-SVM under the condition that the optimal fitness Mse is 0.01667, and the grid type search screens out the optimal modeling parameter c of 22.6274 and g of 0.0019531 under the condition that the optimal fitness Mse is 0.0037346, so that the GS-SVM is selected as the model for solving the apple taste value.
K(x,x′)=exp(g Px-x′P2) (2)
f(x)=wφ(x)+b (3)
Wherein w is the normal vector of the hyperplane, phi (x) -nonlinear mapping function, b-offset, and g-width coefficient
TABLE 2 c and g results of the optimization procedure
S5, taste visual presentation
After the GS-SVM model is established, predicted spectral values under 10 wave bands are input point by point, taste prediction output values under all point spectral values are calculated and recorded as K (i, j), taste values are converted into corresponding actual color values, apple taste information is displayed visually, a sweet taste, sour taste and salty taste single-point taste distribution diagram is shown in figure 6, and the legend gradually thickens from dark blue to brick red taste. As can be seen from the figure, the akxose apple is mainly sweet and sour, has very light salty taste, and has the most intense and wide distribution of sweet taste. Sweet taste is mainly distributed on two sides of an equator, and the central axis part is sweet; the distribution position of the sour taste is similar to the sweet taste; the salty taste is more uniformly distributed on the equatorial section.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be construed as the protection scope of the present invention.