A food component detection method and system based on spectral analysis

By analyzing the wavelength change trend in the spectrogram and screening the Gaussian central wavelength, quantifying the absorption peak characteristics of each wavelength, and adjusting the covariance matrix, the problem of poor dimensionality reduction effect of spectral data in the existing technology is solved, and more accurate feature retention and food ingredient detection are achieved.

CN119646491BActive Publication Date: 2025-04-18SHANXI YANGHE TESTING TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510179928.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-04-18
Estimated Expiration
2045-02-19

AI Technical Summary

Technical Problem

The existing spectral data processing technology fails to effectively consider the specific significance and contribution of each wavelength to the component characteristics, resulting in poor dimensionality reduction and loss of important feature information.

Method used

By obtaining the spectral map of food ingredients, analyzing the absorption change trend between each wavelength and adjacent wavelengths, screening out the suspected absorption peak wavelength, building a simulated mixed Gaussian model, screening out the Gaussian central wavelength, quantifying the single spectral absorption peak characteristics of each wavelength, and adjusting the covariance matrix through the overall spectral absorption peak characteristics, and performing PCA dimensionality reduction processing.

Benefits of technology

It effectively retains important feature information, improves the accuracy of dimensionality reduction results, and enhances the analysis accuracy of food ingredient detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646491B_ABST
    Figure CN119646491B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of spectral data processing technology, and in particular to a food ingredient detection method and system based on spectral analysis. The invention constructs a simulated mixed Gaussian model of all suspected absorption peak wavelengths, obtains the optimal estimation parameters of the simulated mixed Gaussian model, and screens out the Gaussian center wavelength; obtains the single spectrum absorption peak characteristics of each wavelength of each sample according to the relative distance between each wavelength and the Gaussian center wavelength; combines the correlation coefficient of the absorbance within the neighborhood range of each wavelength between each sample and other samples to obtain the overall spectral absorption peak characteristics of each wavelength; uses the absorbance of all samples at each wavelength to form a one-dimensional column vector of the absorbance matrix; and then performs dimensionality reduction processing on the absorbance matrix to obtain the reduced dimensionality data of the absorbance matrix. The present invention obtains accurate absorption peak performance characteristics of each wavelength, retains important features during dimensionality reduction, and improves the accuracy of dimensionality reduction results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of spectral data processing, and in particular to a food component detection method and system based on spectral analysis. Background Art

[0002] The identification of food ingredients helps to ensure the safety of the food industry, food safety and consumer health. Traditional chemical analysis, microbiological analysis and physical analysis often take a lot of time to prepare and analyze samples and cannot meet the needs of real-time monitoring. Therefore, spectral analysis technology is used to identify and detect food ingredients by analyzing the characteristic wavelengths of the interaction between light and matter.

[0003] In the prior art, the PCA dimensionality reduction technology can be used to convert the original high-dimensional spectral data into a smaller amount of data, but retain the main components of most of the information, thereby achieving dimensionality reduction processing of the spectral data and making the data easier to understand and interpret; however, when reducing the dimensionality of spectral data, the specific meaning and contribution of each wavelength in the spectral data to the component characteristics are different. Failure to consider this will lead to the loss of important feature information in the original data, and the dimensionality reduction effect is poor. Summary of the invention

[0004] In order to solve the technical problem that the specific significance and contribution of wavelength to the expression of component characteristics are different and the dimensionality reduction effect is poor, the purpose of the present invention is to provide a food component detection method and system based on spectral analysis. The technical scheme adopted is as follows:

[0005] The present invention proposes a food component detection method based on spectral analysis, the method comprising:

[0006] Obtaining a spectrum of each sample in the food component; the spectrum includes absorbance corresponding to different wavelengths;

[0007] For any sample, according to the variation trend of absorbance between each wavelength and the adjacent wavelength, the suspected absorption peak wavelength degree of each wavelength is obtained; according to the suspected absorption peak wavelength degree, the suspected absorption peak wavelength is screened out; a simulated mixed Gaussian model of all suspected absorption peak wavelengths is constructed, the optimal estimation parameters of the simulated mixed Gaussian model are obtained, and the Gaussian center wavelength is screened out; according to the relative distance between each wavelength and the Gaussian center wavelength, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained;

[0008] According to the correlation coefficient of absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics, the overall spectrum absorption peak characteristics of each wavelength are obtained;

[0009] The absorbance of all samples at each wavelength is used to form a one-dimensional column vector of the absorbance matrix; dimensionality reduction processing is performed based on the overall spectral absorption peak characteristics of each wavelength and the absorbance matrix to obtain reduced-dimensional data of the absorbance matrix.

[0010] Furthermore, the method for obtaining the suspected absorption peak wavelength degree includes:

[0011] For any sample, the degree of the suspected absorption peak wavelength is obtained according to the difference in absorbance between each wavelength and the adjacent wavelengths before and after, and the difference is positively correlated with the degree of the suspected absorption peak wavelength.

[0012] Furthermore, the method for obtaining the suspected absorption peak wavelength includes:

[0013] If the degree of the suspected absorption peak wavelength of each wavelength is greater than a preset degree threshold, the corresponding wavelength is used as the suspected absorption peak wavelength.

[0014] Furthermore, the method for obtaining the Gaussian center wavelength includes:

[0015] Based on simulating all the suspected absorption peak wavelengths as the center of the Gaussian distribution, a corresponding simulated mixed Gaussian model is obtained;

[0016] The simulated mixed Gaussian model is estimated by maximum likelihood to obtain the optimal estimated parameters; the suspected absorption peak wavelength corresponding to the non-preset parameter value in the optimal estimated parameters is used as the Gaussian central wavelength.

[0017] Furthermore, the method for obtaining the single spectrum absorption peak characteristics includes:

[0018] The difference between each wavelength of each sample and the central wavelength of each Gaussian is obtained as a relative distance;

[0019] According to the minimum value of the relative distance between each wavelength of each sample and all Gaussian center wavelengths, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained, and the minimum value of the relative distance is negatively correlated with the single spectrum absorption peak characteristics.

[0020] Furthermore, the method for obtaining the overall spectral absorption peak characteristics includes:

[0021] Obtaining a first cumulative value of a correlation coefficient of absorbance within a neighborhood range of each wavelength between each sample and all other samples;

[0022] Normalizing the first accumulated value to obtain an absorption factor of each wavelength of each sample;

[0023] For any wavelength, the corresponding single spectrum absorption peak characteristics are weightedly accumulated according to the absorption factor of each sample to obtain the overall spectrum absorption peak characteristics of each wavelength.

[0024] Furthermore, the method for obtaining the dimension reduction data includes:

[0025] In the PCA dimensionality reduction processing of the absorbance matrix, the corresponding covariance matrix is ​​obtained; the covariance matrix is ​​adjusted according to the overall spectral absorption peak characteristics of each wavelength to obtain a new covariance matrix; and the dimensionality reduction data of the absorbance matrix is ​​obtained based on the new covariance matrix.

[0026] Furthermore, the method for obtaining the new covariance matrix includes:

[0027] For each element in the covariance matrix, obtaining a first sum of the overall spectral absorption peak characteristics between corresponding wavelengths;

[0028] Merging the first sum value with each element in the covariance matrix to obtain a corresponding updated element;

[0029] Get the updated elements corresponding to all elements to form a new covariance matrix.

[0030] Furthermore, the correlation coefficient is a Pearson correlation coefficient.

[0031] The present invention also proposes a food component detection system based on spectral analysis, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the steps of the food component detection method based on spectral analysis.

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

[0033] The present invention takes into account that the absorbance at the absorption peak is significantly enhanced. For any sample, according to the variation trend of the absorbance between each wavelength and the adjacent wavelength, the suspected absorption peak wavelength degree of each wavelength is obtained, and it is evaluated at which wavelengths there may be significant absorption phenomena; the suspected absorption peak wavelength is screened out according to the suspected absorption peak wavelength degree, and the range is further narrowed to improve the accuracy of the analysis; a simulated mixed Gaussian model of all suspected absorption peak wavelengths is constructed, and the optimal estimation parameters of the simulated mixed Gaussian model are obtained, and the Gaussian center wavelength is screened out. The Gaussian center wavelength is directly related to the specific properties or components of the substance, which is conducive to subsequent component analysis; considering that the absorption peak is near the center of the Gaussian, according to the relationship between each wavelength and the Gaussian center wavelength The relative distance between the two wavelengths is used to obtain the single spectrum absorption peak characteristics of each wavelength of each sample, and the contribution of each wavelength in the absorption peak is quantified; because all sample spectra are similar under normal circumstances, the overall spectrum absorption peak characteristics of each wavelength are obtained according to the correlation coefficient of the absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics, so as to more comprehensively understand the spectral characteristics at each wavelength; the absorbance of all samples at each wavelength is used to form a one-dimensional column vector of the absorbance matrix; according to the overall spectrum absorption peak characteristics of each wavelength and the absorbance matrix, dimensionality reduction processing is performed to obtain the dimension reduction data of the absorbance matrix, remove redundant information, and retain the most important characteristic information. The present invention obtains the accurate absorption peak performance characteristics of each wavelength, takes into account the specific significance and contribution of different wavelengths to the performance of component characteristics, retains important features during dimensionality reduction, and improves the accuracy of dimensionality reduction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 A flow chart of a food component detection method based on spectral analysis provided by one embodiment of the present invention;

[0036] Figure 2 A schematic diagram of a spectrum diagram provided by an embodiment of the present invention;

[0037] Figure 3 A flow chart of a method for obtaining overall spectral absorption peak characteristics provided by one embodiment of the present invention;

[0038] Figure 4 A flow chart of a new method for obtaining a covariance matrix provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the food component detection method and system based on spectral analysis proposed by the present invention, its specific implementation, structure, characteristics and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0040] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0041] The following is a detailed description of a method and system for detecting food ingredients based on spectral analysis provided by the present invention in conjunction with the accompanying drawings.

[0042] See also Figure 1 , which shows a flow chart of a food component detection method based on spectral analysis provided by an embodiment of the present invention, and the specific method includes:

[0043] Step S1: Obtain a spectrum of each sample in the food component; the spectrum includes absorbance corresponding to different wavelengths.

[0044] In the embodiments of the present invention, in order to improve the detection efficiency, spectral analysis technology is used to identify food ingredients and detect quality by analyzing the characteristic wavelengths of the interaction between light and matter. Infrared spectroscopy involves the vibration and rotation of material molecules. Different molecular structures correspond to different vibration frequencies. By recording the absorption or scattered spectrum, the structural information of the sample can be obtained. It performs well in detecting ingredients, water content, fatty acids, etc. in food. First, grind the food and stir and mix it to divide it into multiple samples. Perform spectral detection with an infrared spectrometer to obtain a spectrum of each sample. The spectrum includes the absorbance corresponding to different wavelengths. Figure 2 As shown, a schematic diagram of a spectrum is given, where the horizontal axis represents wavelength and the vertical axis represents absorbance.

[0045] It should be noted that, in the embodiments of the present invention, in order to facilitate subsequent data processing, the acquired data is standardized and the dimensions of the data are eliminated so that indicators of different units or orders of magnitude can be comprehensively analyzed and compared to ensure the accuracy of subsequent analysis.

[0046] Step S2: For any sample, according to the variation trend of absorbance between each wavelength and the adjacent wavelength, the degree of suspected absorption peak wavelength of each wavelength is obtained; according to the degree of suspected absorption peak wavelength, the suspected absorption peak wavelength is screened out; a simulated mixed Gaussian model of all suspected absorption peak wavelengths is constructed, the optimal estimation parameters of the simulated mixed Gaussian model are obtained, and the Gaussian center wavelength is screened out; according to the relative distance between each wavelength and each Gaussian center wavelength, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained.

[0047] Since the two sides of the absorption peak are changing, it is usually manifested as a significant increase in absorbance at a certain wavelength and then a gradual decrease, such as Figure 2 As shown; therefore, by analyzing the change trend between each wavelength and the adjacent wavelengths, the degree of absorbance change corresponding to the wavelength is indicated. The greater the change, the more likely it is that the wavelength is at the absorption peak; so for any sample, according to the change trend of absorbance between each wavelength and the adjacent wavelengths, the degree of suspected absorption peak wavelength of each wavelength is obtained.

[0048] Preferably, in one embodiment of the present invention, the method for obtaining the suspected absorption peak wavelength level includes:

[0049] For any sample, the degree of the suspected absorption peak wavelength is obtained according to the difference in absorbance between each wavelength and the adjacent wavelengths before and after, and the difference is positively correlated with the degree of the suspected absorption peak wavelength.

[0050] Among them, the positive correlation means that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases, that is, the greater the difference in absorbance, the greater the degree of suspected absorption peak wavelength.

[0051] In one embodiment of the present invention, the formula for the suspected absorption peak wavelength degree is expressed as:

[0052] ;

[0053] in, Indicates The sample The degree of the suspected absorption peak wavelength at each wavelength; Indicates The sample The absorbance at each wavelength; Indicates The sample The absorbance at each wavelength; Indicates The sample The absorbance at each wavelength; Indicates the absolute value. Represents the normalization function.

[0054] In the formula for the suspected absorption peak wavelength, Indicates The sample The larger the mean value, the greater the difference in absorbance between adjacent wavelengths, the more likely it is to be at the absorption peak position, and the greater the degree of suspected absorption peak wavelength.

[0055] Screening out suspected absorption peak wavelengths can greatly narrow the scope of subsequent analysis, reduce the amount of calculation, and more specifically analyze wavelengths that may contain important information; therefore, the suspected absorption peak wavelengths are screened out based on the degree of the suspected absorption peak wavelengths of all wavelengths.

[0056] Preferably, in one embodiment of the present invention, the method for obtaining the suspected absorption peak wavelength includes:

[0057] If the suspected absorption peak wavelength level of each wavelength is greater than a preset level threshold, the corresponding wavelength is used as the suspected absorption peak wavelength.

[0058] It should be noted that, in one embodiment of the present invention, the preset degree threshold is 0.7; in other embodiments of the present invention, the size of the preset degree threshold can be set according to specific circumstances, and is not limited or elaborated herein.

[0059] Since food ingredients all show Gaussian or near-Gaussian distribution in the infrared spectrum, the sample spectrum can be regarded as the superposition of a series of Gaussian curves. The absorption peak is located at the symmetric center of the Gaussian curve. Therefore, the suspected absorption peak wavelength must include the center of the Gaussian curve. A simulated mixed Gaussian model of all suspected absorption peak wavelengths is constructed, the optimal estimated parameters of the simulated mixed Gaussian model are obtained, and the Gaussian center wavelength is screened out.

[0060] Preferably, in one embodiment of the present invention, the method for obtaining the Gaussian center wavelength includes:

[0061] Based on simulating all the suspected absorption peak wavelengths as the center of the Gaussian distribution, a corresponding simulated mixed Gaussian model is obtained;

[0062] The simulated mixed Gaussian model is estimated by maximum likelihood to obtain the optimal estimated parameters; the suspected absorption peak wavelength corresponding to the non-preset parameter value in the optimal estimated parameters is used as the Gaussian central wavelength.

[0063] In one embodiment of the present invention, the formula of the mixed Gaussian model is expressed as:

[0064] ;

[0065] in, Indicates Mixed Gaussian model of all suspected absorption peak wavelengths of samples; Indicates The sample The mixing coefficient of the Gaussian distribution with the suspected absorption peak wavelength as the Gaussian center; Indicates The sample A Gaussian distribution with the suspected absorption peak wavelength as the center; Indicates the number of suspected absorption peak wavelengths.

[0066] It should be noted that the Gaussian distribution can be obtained by analyzing the probability distribution of each wavelength obeying a normal distribution with the suspected absorption peak wavelength as the Gaussian center, that is, , ;in, represents each wavelength; It is The sample The mean of the random variables with normal distribution and Gaussian center at the wavelength of the suspected absorption peak; It is The sample The standard deviation of a random variable with a normal distribution centered at a Gaussian wavelength; Represents an exponential function with a natural constant as its base.

[0067] It should be noted that the maximum likelihood estimation is used to estimate the model parameters, namely the mean, standard deviation and mixing coefficient, so as to maximize the probability of the observed data. Since the Gaussian peak values ​​of all food components are greater than 300, the maximum value of the Gaussian distribution is obtained in the maximum likelihood estimation result. It also needs to be greater than 300 to meet the conditions; the specific Gaussian distribution and maximum likelihood estimation are technical means well known to those skilled in the art and will not be described in detail here.

[0068] It should be noted that, in one embodiment of the present invention, the size of the mixing coefficient reflects the contribution of each Gaussian distribution with the suspected absorption peak wavelength as the Gaussian center when generating a mixed Gaussian model. The preset parameter value indicates that the mixing coefficient is 0, that is, it does not contribute to the mixed Gaussian model. The non-preset parameter value indicates that the mixing coefficient is not 0. The suspected absorption peak wavelength corresponding to the mixing coefficient not being 0 in the optimal estimation parameter is used as the Gaussian center wavelength.

[0069] The absorption peak is usually manifested as an area with the maximum absorbance at a central wavelength. The central wavelength corresponds to the center point of the Gaussian distribution. Since many samples of food ingredients show Gaussian or near-Gaussian distribution on the infrared spectrum, the real absorption peak is close to the Gaussian center. By analyzing the relative distance between each wavelength and the Gaussian center wavelength, the absorbance at that wavelength can be evaluated, that is, the farther from the Gaussian center wavelength, the farther the wavelength is from the absorption peak, the smaller the absorbance, and the smaller the single spectrum absorption characteristics. Therefore, according to the relative distance between each wavelength and the Gaussian center wavelength, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained.

[0070] Preferably, in one embodiment of the present invention, the method for obtaining the single spectrum absorption peak characteristic comprises:

[0071] The difference between each wavelength of each sample and the central wavelength of each Gaussian is obtained as a relative distance;

[0072] According to the minimum value of the relative distance between each wavelength of each sample and all Gaussian center wavelengths, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained, and the minimum value of the relative distance is negatively correlated with the single spectrum absorption peak characteristics.

[0073] Among them, the negative correlation means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases, that is, the larger the minimum value of the relative distance between the wavelength and the Gaussian center wavelength, the closer it is to the Gaussian center wavelength, the less it corresponds to the absorption peak, and the smaller the single spectrum absorption peak characteristics.

[0074] In one embodiment of the present invention, the formula for the single spectrum absorption peak characteristic is expressed as:

[0075] , ;

[0076] in, Indicates The sample Single spectral absorption peak characteristics of wavelengths; Indicates The sample wavelength; Indicates The serial number of the Gaussian center wavelength of each sample; Indicates The number of Gaussian central wavelengths of a sample; Indicates The sample Gaussian central wavelength; represents the minimum value function; represents an exponential function with a natural constant as base; Indicates absolute value.

[0077] In the formula for the single spectral absorption peak characteristics, the exponential function with the natural constant as the base is Perform negative correlation mapping; Indicates the calculation The sample wavelength and The difference between the wavelengths of the Gaussian centers, that is, the relative distance, the greater the difference, the greater the wavelength difference, the greater the relative distance, the farther away from the Gaussian center, the less the absorption peak, and the smaller the single spectrum absorption peak characteristics; Indicates the selection The sample The minimum difference between the first wavelength and other Gaussian center wavelengths. The smaller the minimum value, the closer the wavelength is to the Gaussian center wavelength and the closer it is to the absorption peak. The higher the single spectrum absorption peak characteristics of each wavelength.

[0078] It should be noted that, in other embodiments of the present invention, by right The method for negative correlation mapping can also be used to find The reciprocal of is used to achieve a negative correlation in which the smaller the minimum difference value is, the closer it is to a Gaussian center, and the greater the single spectrum absorption peak characteristic is; wherein, if the reciprocal method is used to achieve the negative correlation, it is necessary to artificially add an adjustment parameter to the denominator, such as taking a value of 0.01 to avoid the situation where the denominator is 0 and the formula is meaningless. The specific means are technical means well known to those skilled in the art and will not be elaborated here.

[0079] Step S3: According to the correlation coefficient of absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics, the overall spectrum absorption peak characteristics of each wavelength are obtained.

[0080] Since samples contaminated with impurities during the detection process may have corresponding peak distributions at the same wavelength or similar wavelengths, the influence of overlapping will cause the curve to change and the center line of the changing Gaussian distribution to shift. Therefore, the food ingredients cannot be analyzed by only considering the single spectrum absorption peak characteristics of the wavelength; considering that multiple samples are obtained by grinding and pulverizing food, the spectra of all samples are similar. Therefore, the overall spectrum absorption peak characteristics of each wavelength are obtained based on the correlation coefficient of the absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics.

[0081] Preferably, in one embodiment of the present invention, the method for obtaining the overall spectral absorption peak characteristics can be found in Figure 3 , which shows a flow chart of a method for obtaining overall spectral absorption peak characteristics provided by an embodiment of the present invention, the method comprising:

[0082] Step S301: Obtain a first cumulative value of a correlation coefficient of absorbance within a neighborhood range of each wavelength between each sample and all other samples.

[0083] In order to quantify the spectral similarity or difference between each sample and other samples, by calculating the correlation coefficient of absorbance in the neighborhood range of each wavelength, we can capture whether the spectral characteristics between samples in the neighborhood range of the wavelength are similar or to what extent there is correlation; the accumulation reflects the overall correlation between each sample and other samples in the neighborhood range of the wavelength; the greater the overall correlation, the more likely it is that there are the same absorption characteristics, and the corresponding wavelength is more conducive to the analysis of the characteristics.

[0084] It should be noted that, in one embodiment of the present invention, the correlation coefficient is the Pearson correlation coefficient; the larger the Pearson correlation coefficient, the larger the correlation coefficient. In other embodiments of the present invention, the DTW distance of all absorbances within the wavelength range between samples can also be calculated and the inverse can be obtained to express the correlation coefficient between the data. The larger the distance, the smaller the correlation coefficient, and the smaller the distance, the larger the correlation coefficient; the specific Pearson correlation coefficient and DTW algorithm are technical means well known to those skilled in the art, and will not be described in detail here.

[0085] It should be noted that if the DTW distance is calculated and the inverse is taken, it is necessary to add an artificial threshold to the denominator of the fraction, such as a value of 0.01, to avoid the situation where the denominator of the fraction is 0.

[0086] It should be noted that, in one embodiment of the present invention, the neighborhood range of each wavelength is composed of a neighborhood range with each wavelength as the center and a preset number of adjacent wavelengths on the left and right, the preset number is 10, and there are 21 wavelengths in total; an embodiment is made, the first sample of the first The wavelength neighborhood range is ,in, The first sample The absorbance set of wavelengths; The first sample The absorbance at each wavelength; The first sample The absorbance at each wavelength; The first sample The absorbance at each wavelength; The first sample The absorbance at each wavelength; The first sample In other embodiments of the present invention, the size of the neighborhood range can be specifically set according to specific circumstances, and will not be limited or elaborated herein.

[0087] Step S302: normalizing the first accumulated value to obtain the absorption factor of each wavelength of each sample;

[0088] It should be noted that the sum of the first cumulative values ​​corresponding to all samples can be obtained, and the ratio of the first cumulative value corresponding to each sample to the sum of the first cumulative values ​​can be calculated, that is, the first cumulative value is normalized to obtain the absorption factor of each wavelength of each sample, which reflects the relative absorption intensity of the sample at this wavelength.

[0089] Step S303: For any wavelength, weighted accumulation of the corresponding single spectrum absorption peak characteristics is performed according to the absorption factor of each sample to obtain the overall spectrum absorption peak characteristics of each wavelength.

[0090] By weighted accumulation, the overall spectral absorption peak characteristics of each wavelength can be obtained, reflecting the comprehensive absorption effect of all samples at this wavelength.

[0091] In one embodiment of the present invention, the overall spectral absorption peak characteristic is expressed as:

[0092] ;

[0093] in, Indicates The overall spectral absorption peak characteristics of each wavelength; Indicates The sample The set of all absorbances in the neighborhood of a wavelength; Indicates The sample The set of all absorbances in the neighborhood of a wavelength; express and The correlation coefficient between Indicates The sample Single spectral absorption peak characteristics of wavelengths; Indicates the number of samples.

[0094] In the formula for the overall spectral absorption peak characteristics, It means that the corresponding correlation coefficients between each sample and all other samples are accumulated, that is, the first accumulated value; Indicates The ratio of the cumulative value of the correlation coefficient between the sample and all other samples and the cumulative value of the correlation coefficient between all samples and the corresponding other samples, that is, the ratio of the cumulative value of the correlation coefficient between the sample and all other samples, that is, The accumulated values ​​of correlation coefficients between each sample and all other samples are normalized to obtain the absorption factor of each wavelength of each sample. The larger the absorption factor, the more similar the absorbance between samples, indicating that the samples have more consistent absorption characteristics at the corresponding wavelength, and are more likely to have larger absorption peak characteristics at the corresponding wavelength; the larger the single spectrum absorption peak characteristics of each wavelength of each sample, the larger the absorption factor, and the larger the overall spectrum absorption peak characteristics of each wavelength.

[0095] Step S4: construct a one-dimensional column vector of the absorbance matrix with the absorbance of all samples at each wavelength; perform dimensionality reduction processing based on the overall spectral absorption peak characteristics of each wavelength and the absorbance matrix to obtain reduced dimensionality data of the absorbance matrix.

[0096] Different substances present unique wavelength characteristics in the spectrum. By taking the absorbance of different samples at the same wavelength as a column, the absorption characteristics at each wavelength can be intuitively compared. The absorbance of all samples at each wavelength constitutes a one-dimensional column vector of the absorbance matrix; the number of wavelengths corresponds to the column dimension of the absorbance matrix, and the number of samples corresponds to the row dimension of the absorbance matrix.

[0097] The spectral absorption peak is the manifestation of a substance's significantly enhanced light absorption at a specific wavelength, which reflects the substance's internal structure, chemical bonding state and other information; different substances or the same substance may have different spectral absorption peak characteristics at different wavelengths, which is an important basis for distinguishing and identifying substances. Therefore, wavelengths with larger overall spectral absorption peak characteristics show greater characteristic information; dimensionality reduction of the matrix can reduce the number of dimensions in the data set while retaining important information of the original data as much as possible, thereby increasing the efficiency of the food ingredient evaluation process and reducing the amount of analytical data while minimizing data loss; therefore, dimensionality reduction processing is performed based on the overall spectral absorption peak characteristics of each wavelength and the absorbance matrix to obtain dimensionality reduction data of the absorbance matrix.

[0098] Preferably, in one embodiment of the present invention, the method for obtaining dimension reduction data includes:

[0099] In the PCA dimensionality reduction processing of the absorbance matrix, the corresponding covariance matrix is ​​obtained; the covariance matrix is ​​adjusted according to the overall spectral absorption peak characteristics of each wavelength to obtain a new covariance matrix; and the dimensionality reduction data of the absorbance matrix is ​​obtained based on the new covariance matrix.

[0100] It should be noted that, in one embodiment of the present invention, the method for obtaining reduced dimension data is as follows: in the process of executing the PCA dimensionality reduction algorithm, the absorbance matrix is ​​de-meaned, that is, a standardized matrix of the absorbance matrix is ​​obtained, and the covariance matrix of the standardized matrix is ​​obtained; considering that the degree of contribution of each wavelength to the characteristic information is inconsistent, a new covariance matrix is ​​obtained based on the overall spectral absorption peak characteristics of each wavelength; the covariance matrix is ​​calculated according to the subsequent original calculation method of executing the PCA dimensionality reduction algorithm to obtain a projection matrix, and the product of the projection matrix and the absorbance matrix is ​​calculated to obtain the reduced dimension data of the absorbance matrix; that is, the eigenvalues ​​and eigenvectors of the covariance matrix are calculated; the eigenvectors are arranged into a matrix by row from large to small according to the corresponding eigenvalues, and the first k rows of principal components are taken to form the projection matrix; wherein the first k rows are determined by the cumulative variance explanation, and the cumulative variance explanation refers to the ratio of the sum of the first k eigenvalues ​​to the sum of all eigenvalues; in one embodiment of the present invention, the implementer can set the cumulative variance explanation threshold to 0.7 according to the empirical value, that is, the cumulative variance explanation is greater than or equal to the cumulative variance explanation threshold, and the first k rows of data are obtained. The specific PCA dimensionality reduction algorithm is a technical means well known to those skilled in the art and will not be described in detail here.

[0101] Since the spectra of all samples are similar, the larger the overall spectral absorption peak characteristics of each wavelength, the greater the absorption characteristics of the sample at the corresponding wavelength, the more characteristic manifestations, and more information can be retained for subsequent component analysis; therefore, the covariance matrix is ​​adjusted according to the overall spectral absorption peak characteristics of each wavelength to obtain a new covariance matrix.

[0102] Preferably, in one embodiment of the present invention, the method for obtaining the new covariance matrix can be found in Figure 4 , which shows a flow chart of a new method for obtaining a covariance matrix provided by an embodiment of the present invention, the method comprising:

[0103] Step S401: For each element in the covariance matrix, obtain a first sum value of the overall spectral absorption peak characteristics between corresponding wavelengths.

[0104] The overall spectral absorption peak characteristics can show the absorption characteristics of the sample at each wavelength. The larger it is, the more similar the absorption characteristics are and the more features they show. In this way, the elements in the covariance matrix are corrected so that the wavelengths with greater contributions are more significant.

[0105] Step S402: Fusing the first sum value with each element in the covariance matrix to obtain a corresponding updated element.

[0106] It should be noted that, in some embodiments of the present invention, the first sum value may be fused with each element in the covariance matrix by addition or multiplication to obtain a corresponding updated element.

[0107] Step S403: Obtain update elements corresponding to all elements to form a new covariance matrix.

[0108] In one embodiment of the present invention, the formula for updating the element is expressed as:

[0109] ;

[0110] in, represents the covariance matrix wavelength and The update element corresponding to the wavelength; Indicates The overall spectral absorption peak characteristics of each wavelength; Indicates The overall spectral absorption peak characteristics of each wavelength; represents the covariance matrix wavelength and The element corresponding to the wavelength.

[0111] In the formula for updating elements, It represents the first sum of the overall spectral absorption peak characteristics between corresponding wavelengths. The larger the overall spectral absorption peak characteristics, the more component characteristics can be expressed, which makes the influence on the covariance matrix elements greater and the update elements larger.

[0112] After obtaining the reduced-dimensional data, the compound components identified in the reduced-dimensional data can be confirmed by extracting the first k rows of principal component data and comparing them with the spectra of known chemical standards. The first k rows of data represent the main features in the spectral data. By comparing them with the spectra of known chemical standards, the correlation between the two can be evaluated by methods such as spectral similarity analysis. The load value distribution represents the contribution of each spectral wavelength to the principal component. By comparing the load value distribution of the principal component with the spectra of chemical standards, the correspondence between the principal component and the specific chemical component can be further verified. Through PCA dimensionality reduction and comparison with the spectra of chemical standards, specific ingredients in food can be quickly and accurately identified.

[0113] In summary, for any sample, the present invention obtains the suspected absorption peak wavelength degree of each wavelength according to the change trend of the absorbance between each wavelength and the adjacent wavelength; screens out the suspected absorption peak wavelength; constructs a simulated mixed Gaussian model of all suspected absorption peak wavelengths, obtains the optimal estimation parameters of the simulated mixed Gaussian model, and screens out the Gaussian center wavelength; obtains the single spectrum absorption peak characteristics of each wavelength of each sample according to the relative distance between each wavelength and the Gaussian center wavelength; obtains the overall spectrum absorption peak characteristics of each wavelength according to the correlation coefficient of the absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics; with the absorbance of all samples at each wavelength, a one-dimensional column vector of the absorbance matrix is ​​formed; according to the overall spectrum absorption peak characteristics of each wavelength and the absorbance matrix, dimensionality reduction processing is performed to obtain the reduced dimension data of the absorbance matrix. The present invention obtains the accurate absorption peak performance characteristics of each wavelength, retains important features during dimensionality reduction, and improves the accuracy of dimensionality reduction results.

[0114] The present invention also proposes a food component detection system based on spectral analysis, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any step of a food component detection method based on spectral analysis.

[0115] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0116] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A food ingredient detection method based on spectral analysis, characterized in that: The method comprises: Obtaining a spectrum of each sample in the food component; the spectrum includes absorbance corresponding to different wavelengths; For any sample, according to the variation trend of absorbance between each wavelength and the adjacent wavelength, the suspected absorption peak wavelength degree of each wavelength is obtained; according to the suspected absorption peak wavelength degree, the suspected absorption peak wavelength is screened out; a simulated mixed Gaussian model of all suspected absorption peak wavelengths is constructed, the optimal estimation parameters of the simulated mixed Gaussian model are obtained, and the Gaussian center wavelength is screened out; according to the relative distance between each wavelength and the Gaussian center wavelength, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained; According to the correlation coefficient of absorbance within the neighborhood range of each wavelength between each sample and other samples, and the corresponding single spectrum absorption peak characteristics, the overall spectrum absorption peak characteristics of each wavelength are obtained; The absorbance of all samples at each wavelength is used to form a one-dimensional column vector of the absorbance matrix; dimensionality reduction processing is performed according to the overall spectral absorption peak characteristics of each wavelength and the absorbance matrix to obtain reduced-dimensional data of the absorbance matrix; The method for obtaining the Gaussian center wavelength includes: Based on simulating all the suspected absorption peak wavelengths as the center of the Gaussian distribution, a corresponding simulated mixed Gaussian model is obtained; Performing maximum likelihood estimation on the simulated mixed Gaussian model to obtain optimal estimation parameters; taking the suspected absorption peak wavelength corresponding to the non-preset parameter value in the optimal estimation parameters as the Gaussian center wavelength; The method for obtaining the single spectrum absorption peak characteristics comprises: The difference between each wavelength of each sample and the central wavelength of each Gaussian is obtained as a relative distance; According to the minimum value of the relative distance between each wavelength of each sample and all Gaussian center wavelengths, the single spectrum absorption peak characteristics of each wavelength of each sample are obtained, and the minimum value of the relative distance is negatively correlated with the single spectrum absorption peak characteristics; The method for obtaining the overall spectral absorption peak characteristics includes: Obtaining a first cumulative value of a correlation coefficient of absorbance within a neighborhood range of each wavelength between each sample and all other samples; Normalizing the first accumulated value to obtain an absorption factor of each wavelength of each sample; For any wavelength, the corresponding single spectrum absorption peak characteristics are weightedly accumulated according to the absorption factor of each sample to obtain the overall spectrum absorption peak characteristics of each wavelength.

2. A method for detecting food ingredients based on spectral analysis according to claim 1, characterized in that: The method for obtaining the suspected absorption peak wavelength comprises: For any sample, the degree of the suspected absorption peak wavelength is obtained according to the difference in absorbance between each wavelength and the adjacent wavelengths before and after, and the difference is positively correlated with the degree of the suspected absorption peak wavelength.

3. The method for detecting food ingredients based on spectral analysis according to claim 1, characterized in that: The method for obtaining the suspected absorption peak wavelength comprises: If the degree of the suspected absorption peak wavelength of each wavelength is greater than a preset degree threshold, the corresponding wavelength is used as the suspected absorption peak wavelength.

4. The method for detecting food ingredients based on spectral analysis according to claim 1, characterized in that: The method for obtaining the dimension reduction data comprises: In the PCA dimensionality reduction processing of the absorbance matrix, the corresponding covariance matrix is ​​obtained; the covariance matrix is ​​adjusted according to the overall spectral absorption peak characteristics of each wavelength to obtain a new covariance matrix; and the dimensionality reduction data of the absorbance matrix is ​​obtained based on the new covariance matrix.

5. A method for detecting food ingredients based on spectral analysis according to claim 4, characterized in that: The method for obtaining the new covariance matrix includes: For each element in the covariance matrix, obtaining a first sum of the overall spectral absorption peak characteristics between corresponding wavelengths; Merging the first sum value with each element in the covariance matrix to obtain a corresponding updated element; Get the updated elements corresponding to all elements to form a new covariance matrix.

6. The method for detecting food ingredients based on spectral analysis according to claim 1, characterized in that: The correlation coefficient is the Pearson correlation coefficient.

7. A food component detection system based on spectral analysis, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of a food component detection method based on spectral analysis as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for determining number of split peaks of infrared characteristic absorption peak of SiO2 film

    CN104458641A

  • Gaussian multi-peak fitting-based spectrum analysis algorithm

    CN107462535A