Edible fungi quality detection method based on spectral characteristics
By analyzing the light intensity sequence of the light source, selecting the light intensity sequence of the reference light source, and constructing a Raman light intensity prediction model, the baseline drift problem caused by environmental temperature was solved, and the accuracy of edible fungi quality detection was improved.
Patent Information
- Application Number
- PCT/CN2025/087744
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-26
- Filing Date
- 2025-04-08
- Publication Date
- 2026-01-29
AI Technical Summary
In existing technologies, the accuracy of edible fungi quality testing results is affected by ambient temperature, which causes fluctuations in the light intensity of the Raman spectroscopy instrument's light source, resulting in baseline drift and affecting the accuracy of the test results.
By analyzing the light intensity sequences of light sources under different ambient temperatures, selecting a reference light source light intensity sequence, determining the light source fluctuation intensity, constructing a Raman light intensity prediction model, calculating the prediction weight of the original Raman light intensity, correcting the baseline drift effect, and obtaining standard Raman spectral data.
This improves the accuracy of edible fungi quality testing, reduces the interference of baseline drift on spectral analysis, and ensures the reliability and accuracy of test results.
Smart Images

Figure CN2025087744_29012026_PF_FP_ABST
Abstract
Description
Edible fungi quality detection method based on spectral characteristics Technical Field
[0001] This invention relates to the technical field of material analysis using optical methods, and specifically to a method for quality detection of edible fungi based on spectral characteristics. Background Technology
[0002] Edible fungi, as a highly nutritious and low-calorie food, have a wide consumer base in the market. Near-infrared spectroscopy analysis can quickly determine the content of key components in edible fungi, such as protein, carbohydrates, fats, and trace elements, to assess their nutritional value and quality level. This helps producers and consumers understand the true quality of the product more quickly.
[0003] Currently, Raman intensity data of various characteristic bands in the Raman spectrum of edible fungi samples are typically read directly to determine the content of each component in the sample. However, during the spectral analysis of edible fungi samples, the ambient temperature affects the internal electrical parameters of the Raman spectrometer, causing fluctuations in the light intensity emitted by the instrument's light source. These fluctuations in light intensity lead to baseline shifts in the generated spectral data, a phenomenon known as baseline drift. This results in inaccuracies in the spectral data used to analyze the content of key components, ultimately leading to low accuracy in the edible fungi quality testing results determined by Raman spectroscopy data. Summary of the Invention
[0004] To address the aforementioned technical problem of low accuracy in edible fungi quality testing results, the present invention aims to provide a method for edible fungi quality testing based on spectral characteristics. The specific technical solution adopted is as follows:
[0005] One embodiment of the present invention provides a method for quality detection of edible fungi based on spectral characteristics, the method comprising the following steps:
[0006] The raw Raman spectral data of edible fungi samples at different ambient temperatures and the light intensity sequences of several light sources at different ambient temperatures were obtained; wherein, the horizontal axis of the raw Raman spectral data is the Raman shift and the vertical axis is the raw Raman light intensity.
[0007] Based on the analysis of the similarity between the light intensity sequences of each light source at each ambient temperature, the reference light intensity sequence of each light source at each ambient temperature is determined.
[0008] The fluctuation of the reference light source light intensity sequence is analyzed based on the reference light source light intensity sequence at each ambient temperature, and the light source fluctuation intensity corresponding to each reference light source light intensity sequence is determined.
[0009] For any Raman shift within the spectral detection range, the original Raman intensity at that Raman shift corresponding to the ambient temperature for each reference light source light intensity sequence is obtained; the prediction weights of each original Raman intensity at that Raman shift are determined based on the fluctuation intensity of each light source and each original Raman intensity.
[0010] Based on the original Raman intensity and its prediction weight at each Raman shift, the standard spectral Raman intensity at each Raman shift is determined, and then the standard Raman spectral data is determined.
[0011] Quality testing of edible fungi samples was conducted based on standard Raman spectroscopy data.
[0012] Further, the step of analyzing the similarity between the light intensity sequences of each light source at each ambient temperature to determine the reference light intensity sequence at each ambient temperature includes:
[0013] Based on the light intensity sequence of the target light source and the light intensity of each non-target light source at each moment under the same ambient temperature, the differences in light intensity at the same moment are analyzed to determine the preferred index of the target light source light intensity sequence under each ambient temperature; wherein, the target light source light intensity sequence is any light source light intensity sequence under the ambient temperature.
[0014] The optimal index of each light source light intensity sequence at each ambient temperature is obtained, and then the light source light intensity sequence corresponding to the maximum optimal index at each ambient temperature is determined and used as the reference light source light intensity sequence.
[0015] Furthermore, the step of analyzing the differences in light intensity at the same time based on the light intensity sequence of the target light source and the light intensity sequences of various non-target light sources under the same ambient temperature, and determining the preferred index of the target light source light intensity sequence under each ambient temperature, includes:
[0016] First, calculate the difference between the light intensity of the target light source at each moment in the light intensity sequence under the same ambient temperature and the light intensity of the light source at the corresponding moment in each non-target light source light intensity sequence, and record it as the light intensity difference value.
[0017] Then, the average value of the light intensity difference of all light sources under the same ambient temperature is calculated, and the average value of the light intensity difference of the light sources is negatively correlated to obtain the preferred index of the light intensity sequence of the target light source under each ambient temperature.
[0018] Further, the step of analyzing the fluctuation of the reference light source intensity sequence based on the reference light source intensity sequence at each ambient temperature, and determining the light source fluctuation intensity corresponding to each reference light source intensity sequence, includes:
[0019] For any reference light source light intensity sequence, determine each local extreme point corresponding to the reference light source light intensity sequence, and determine the light source light intensity mean corresponding to the reference light source light intensity sequence;
[0020] Based on the differences between each local extreme point and the mean light intensity of the light source, the light source fluctuation intensity corresponding to the light intensity sequence of the reference light source is determined.
[0021] Further, determining the light source fluctuation intensity corresponding to the reference light source intensity sequence based on the differences between each local extreme point and the mean light intensity of the light source includes:
[0022] Calculate the absolute value of the difference between each local extreme point and the mean light intensity of the light source, and take the average of all the absolute values of the difference as the initial light source fluctuation intensity;
[0023] The initial light source fluctuation intensity is normalized, and the normalized result is used as the light source fluctuation intensity corresponding to the reference light source intensity sequence.
[0024] Further, determining the prediction weights of each original Raman intensity at the Raman shift based on the fluctuation intensity of each light source and each original Raman light intensity includes:
[0025] A Raman intensity prediction model at the Raman shift is constructed by combining the fluctuation intensity of each light source and the original Raman light intensity.
[0026] Based on the clustering of all data points in the Raman intensity prediction model and the light source fluctuation intensity of each data point, the prediction weights of each original Raman intensity at the Raman shift are determined.
[0027] Furthermore, the step of constructing a Raman intensity prediction model at the Raman shift by combining the fluctuation intensity of each light source and each original Raman light intensity includes:
[0028] A coordinate system is established with the fluctuation intensity of each light source as the abscissa and the intensity of each original Raman light as the ordinate;
[0029] Interpolation is performed on each data point in the coordinate system, and the interpolated coordinate system is used as the Raman intensity prediction model at the Raman displacement.
[0030] Further, determining the prediction weights of each original Raman intensity at the Raman shift based on the clustering of all data points in the Raman intensity prediction model and the light source fluctuation intensity of each data point includes:
[0031] Clustering is performed on all data points in the Raman intensity prediction model to obtain each cluster, and then the negative correlation value of the number of data points in each cluster is determined; the negative correlation value is used as the confidence factor for each data point in its respective cluster.
[0032] Calculate the product of the confidence factor for each data point and the light source fluctuation intensity of the corresponding data point, and denote it as the first product; perform negative correlation normalization on the first product, and use the normalized result as the prediction weight of the original Raman light intensity of the corresponding data point.
[0033] Further, determining the standard spectral Raman intensity of each Raman shift based on the original Raman intensity and its prediction weight at each Raman shift includes:
[0034] The original Raman intensities at any Raman shift are weighted and averaged using the predicted weights. The result of the weighted averaging is then used as the standard spectral Raman intensity for that Raman shift.
[0035] Furthermore, the quality testing of edible fungi samples based on standard Raman spectroscopy data includes:
[0036] Characteristic analysis was performed on standard Raman spectral data to determine the content of each type of element in the edible fungi sample;
[0037] The quality test results of edible fungi samples are determined based on the content of each type of element in the samples.
[0038] The present invention has the following beneficial effects:
[0039] This invention provides a method for quality detection of edible fungi based on spectral characteristics. This method predicts the standard Raman intensity value without baseline drift based on the Raman intensity characteristics under varying light source intensity, thus correcting the baseline drift effect in the spectral data and improving the accuracy of edible fungi quality detection results. First, by analyzing the similarity between light intensity sequences of various light sources under the same ambient temperature, a light intensity sequence affected only by ambient temperature, i.e., a reference light source intensity sequence, is selected. This helps improve the numerical accuracy and reliability of the analyzed data, further enhancing the reference value of the light source fluctuation intensity determined based on the reference light source intensity sequence. Second, by combining the light source fluctuation intensity and the original Raman intensity corresponding to each reference light source intensity sequence, the prediction weight of each original Raman intensity at each Raman shift is determined. By analyzing the influence of light source fluctuation intensity on the original Raman intensity, the weight of a single original Raman intensity in quantifying the standard Raman intensity is predicted, and the standard spectral Raman intensity is determined. This reduces the interference of baseline drift on spectral analysis, thereby improving the detection accuracy of edible fungi quality detection based on spectral characteristics. Attached Figure Description
[0040] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 is a schematic flowchart of a method for detecting the quality of edible fungi based on spectral features according to an embodiment of the present invention;
[0042] Figure 2 is a flowchart illustrating step S2 in an embodiment of the present invention;
[0043] Figure 3 is a flowchart illustrating step S3 in an embodiment of the present invention;
[0044] Figure 4 is a flowchart illustrating step S4 in an embodiment of the present invention. Detailed Implementation
[0045] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the specific implementation methods, structures, features, and effects of the technical solution proposed according to the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0046] Unless otherwise defined, 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 pertains.
[0047] The application scenarios targeted by this invention can be:
[0048] When detecting the quality of edible fungi using Raman spectroscopy, ambient temperature may cause baseline drift in the spectral data, thus affecting the accuracy of the spectral technology in detecting the quality of edible fungi. Therefore, this invention combines data characteristics to correct the baseline drift effect in the spectral data and obtain standard spectral data results.
[0049] This embodiment provides a method for quality detection of edible fungi based on spectral characteristics, as shown in Figure 1, including the following steps:
[0050] S1: Obtain Raman spectral data of edible fungi samples at different ambient temperatures, as well as light intensity sequences of several light sources at different ambient temperatures.
[0051] Step S1 above can be achieved through the following steps:
[0052] The first step is to obtain samples of edible fungi.
[0053] Specifically, during the testing, the flesh of mushrooms with caps exhibiting a strong umami flavor was hand-sliced. The deionized water used to prepare the water-based slides was replaced with silver glue, and silver glue slides were prepared for later use. The silver glue was prepared using a microwave method.
[0054] The second step is to obtain the raw Raman spectral data of edible fungi samples at different ambient temperatures, as well as the light intensity sequences of several light sources at different ambient temperatures.
[0055] It should be noted that it is necessary to predict the standard Raman intensity of the standard Raman spectrum data based on the changes in light intensity of different light sources. However, the main factor causing the change in light intensity of the light source is the change in ambient temperature. Therefore, the ambient temperature during the measurement is set as the dependent variable, and Raman spectrum data and light intensity data of edible fungi samples under different ambient temperature conditions are collected.
[0056] Specifically, Raman spectral data were collected from 15 edible fungi samples at different ambient temperatures. To facilitate differentiation between the Raman spectral data before and after correction, these were recorded as the original Raman spectral data. The horizontal axis of the original Raman spectral data represents the Raman shift, and the vertical axis represents the original Raman intensity. A DXR laser confocal micro Raman spectrometer was used to measure the spectral data. The excitation wavelength was 532 nm, the measurement power was 1 mW, the exposure time for sample 1 was 3 s, and the sample was exposed twice consecutively. The microscope objective was 10x magnification during the Raman spectral measurements.
[0057] Since analysis requires considering changes in light intensity, a light intensity sensor is used to collect light intensity data from the light source emission port of the Raman spectrometer under different ambient temperature conditions, simultaneously collecting spectral data at these conditions. This means acquiring light intensity data from the light source emission port of the Raman spectrometer for each ambient temperature. Because light intensity is also slightly affected by impurities in the air, multiple sets of data are acquired for the light intensity at the light source emission port of the Raman spectrometer under each ambient temperature condition. This results in multiple light intensity sequences corresponding to one ambient temperature, with an empirical value of six. The collected data is uploaded to a computer for subsequent analysis. The specific number and types of ambient temperature and light intensity sequences can be set by the implementer based on actual conditions and are not limited.
[0058] Thus, this embodiment obtained the original Raman spectral data of edible fungi samples at different ambient temperatures, as well as several light intensity sequences of light sources at different ambient temperatures.
[0059] S2, based on the light intensity sequence of each light source at each ambient temperature, analyze the similarity between the light intensity sequences of the light sources and determine the reference light intensity sequence at each ambient temperature.
[0060] First, it should be noted that during the spectral acquisition of edible fungi samples by Raman spectrometers, unsuitable ambient temperatures can affect the internal electrical performance of the Raman spectrometer, which in turn causes changes in the light intensity of the light source. These changes in light intensity result in errors in the Raman light intensity in the spectrum, leading to baseline drift and consequently, low accuracy in the quality results of edible fungi detected by Raman spectroscopy.
[0061] To correct for the impact of baseline drift on Raman spectral data, it is necessary to analyze the spectral characteristics corresponding to changes in light intensity. Specifically, firstly, by analyzing the similarity characteristics between light intensity data from multiple measurements of Raman spectrometers at different ambient temperatures, a light intensity sequence that is only affected by the ambient temperature is selected for each ambient temperature. That is, compared to other light intensity sequences at the same ambient temperature, the selected light intensity sequence is least affected by impurities in the air. These impurities affect the homogeneity of the medium along the light source's propagation path, thus subtly influencing changes in light intensity.
[0062] Step S2 above can be achieved through the steps shown in Figure 2:
[0063] S21. Based on the light intensity sequence of the target light source under the same ambient temperature and the light intensity of each non-target light source at each moment, analyze the differences in light intensity at the same moment and determine the preferred index of the light intensity sequence of the target light source under each ambient temperature.
[0064] In this embodiment, the target light source intensity sequence refers to any light source intensity sequence under the ambient temperature, while the non-target light source intensity sequence refers to other light source intensity sequences under the same ambient temperature besides the target light source intensity sequence. Each light source intensity sequence under an ambient temperature must be analyzed for similarity with the remaining light source intensity sequences excluding itself. To facilitate understanding of the scheme and reduce unnecessary descriptions, this embodiment takes the target light source intensity sequence as an example to determine the preferred index of the target light source intensity sequence. The preferred index is used to evaluate the possibility of the light source intensity sequence being selected as the reference light source intensity sequence.
[0065] As an example, step S21 above can be achieved through the following steps:
[0066] The first step is to calculate the difference between the light intensity of the target light source at each moment in the light intensity sequence under the same ambient temperature and the light intensity of the light source at the corresponding moment in the light intensity sequences of each non-target light source, and record it as the light intensity difference value.
[0067] The second step is to calculate the average value of the light intensity difference of all light sources under the same ambient temperature, and then perform negative correlation processing on the average value of the light intensity difference of the light sources to obtain the preferred index of the light intensity sequence of the target light source under each ambient temperature.
[0068] The formula for calculating the optimal index of the light intensity sequence of the j-th light source at the i-th ambient temperature can be:
[0069] In the formula, α i,j Let represent the preferred index for the light intensity sequence of the j-th light source at the i-th ambient temperature, exp represent an exponential function with the natural constant as the base, M represent the number of light intensity sequences corresponding to each ambient temperature, T represent the number of moments in the light intensity sequence, i.e., the acquisition duration of each light intensity group, x represent the sequence number of the light intensity sequence corresponding to each ambient temperature, t represent the moment number in the light intensity sequence, and ΔP represent the optimal index for the j-th light source intensity sequence at the i-th ambient temperature. i,j,x,t This represents the absolute value of the difference between the light intensity of the light source at time t in the light intensity sequence of the j-th light source under the i-th ambient temperature and the light intensity of the light source at time t in the light intensity sequence of the x-th light source (excluding the j-th light source under the i-th ambient temperature), i.e., the light intensity difference value.
[0070] In the formula for calculating the optimal index, ΔP i,j,x,t The smaller the value, the better the similarity between the light intensity sequence of the j-th light source under the i-th ambient temperature and the light intensity sequences of other light sources under the same ambient temperature. The larger the optimization index, the greater the probability that the light intensity sequence of the j-th light source under the i-th ambient temperature will be selected as the reference light source light intensity sequence under the i-th ambient temperature.
[0071] Another example is that step S21 above can also be achieved through the following steps:
[0072] Specifically, the DTW (Dynamic Time Warping) distance between the light intensity sequence of the target light source and the light intensity sequences of each non-target light source under the same ambient temperature is calculated. Then, the average value of all DTW distances corresponding to the light intensity sequence of the target light source is calculated. The average value of all DTW distances is negatively correlated, and the result after negative correlation is used as the preferred index of the light intensity sequence of the target light source.
[0073] The formula for calculating the optimal index of the light intensity sequence of the j-th light source at the i-th ambient temperature can also be:
[0074] In the formula, DTW represents the function for calculating the distance between two sequences, h i,j h represents the light intensity sequence of the j-th light source at the i-th ambient temperature.i,x Let represent the light intensity sequence of the x-th light source at the i-th ambient temperature, where j ≠ x.
[0075] S22, obtain the preferred index of each light source light intensity sequence at each ambient temperature, and then determine the light source light intensity sequence corresponding to the maximum preferred index at each ambient temperature, and use it as the reference light source light intensity sequence.
[0076] In this embodiment, the larger the preferred index, the greater the influence of ambient temperature on the light intensity sequence of the corresponding light source, and the greater the possibility that it will be selected as the reference light source light intensity sequence.
[0077] Specifically, by referring to the calculation process of the preferred index of the light intensity sequence of the target light source, the preferred index of each light source light intensity sequence at each ambient temperature can be obtained, the maximum preferred index corresponding to each ambient temperature can be determined, and the light intensity sequence of the light source corresponding to the maximum preferred index can be used as the reference light source light intensity sequence at the corresponding ambient temperature.
[0078] Thus, this embodiment has obtained the reference light source light intensity sequence for each ambient temperature.
[0079] S3. Analyze the fluctuation of the reference light source light intensity sequence based on the reference light source light intensity sequence at each ambient temperature, and determine the light source fluctuation intensity corresponding to each reference light source light intensity sequence.
[0080] First, it should be noted that the light source fluctuation intensity represents the degree of fluctuation in the light intensity of the light source in the reference light source intensity sequence. It can reflect the reliability of the original Raman spectral data at the corresponding ambient temperature of the reference light source intensity sequence. It is used to determine the prediction weights in the subsequent process, thereby overcoming the baseline offset of the Raman spectral data. The greater the light source fluctuation intensity, the more the internal electrical performance of the Raman spectrometer is affected during operation, which further indicates that the light intensity data of the light source of the Raman spectrometer fluctuates more during operation.
[0081] Step S3 above can be achieved through the steps shown in Figure 3:
[0082] S31. For any reference light source intensity sequence, determine each local extreme point corresponding to the reference light source intensity sequence, and determine the average light source intensity corresponding to the reference light source intensity sequence.
[0083] In this embodiment, to reduce unnecessary descriptions and facilitate understanding of the scheme, a reference light source intensity sequence at an arbitrary ambient temperature is selected, and its fluctuation is analyzed. To determine the local extrema corresponding to the reference light source intensity sequence, the least squares method is first used to perform curve fitting on the sequence, and the extrema points on the fitted curve are then identified as local extrema points.
[0084] The implementation process of the least squares method is existing technology and is not within the scope of protection of this invention, so it will not be described in detail here. Of course, implementers can also use other methods to determine local extreme points, and no specific limitations are made here.
[0085] S32, based on the differences between each local extreme point and the mean light intensity of the light source, determine the light source fluctuation intensity corresponding to the reference light source intensity sequence.
[0086] Step S32 above can be achieved through the following steps:
[0087] The first step is to calculate the absolute value of the difference between each local extreme point and the mean light intensity of the light source, and then take the average of all the absolute values of the differences as the initial light source fluctuation intensity.
[0088] The second step is to normalize the initial light source fluctuation intensity and use the normalized result as the light source fluctuation intensity corresponding to the reference light source intensity sequence.
[0089] As an example, the formula for calculating the light source fluctuation intensity corresponding to the light source intensity sequence at the i-th ambient temperature can be:
[0090] In the formula, β i N represents the light source fluctuation intensity corresponding to the light intensity sequence of the reference light source at the i-th ambient temperature, where norm represents the linear normalization function. i P represents the number of local extrema in the light intensity sequence of the reference source at the i-th ambient temperature, y represents the index of the local extrema in the light intensity sequence of the reference source at the i-th ambient temperature, and P represents the number of local extrema in the light intensity sequence of the reference source at the i-th ambient temperature. i,y This represents the light intensity of the y-th local extremum point in the light intensity sequence of the reference light source at the i-th ambient temperature. Let || denote the mean light intensity of the reference light source corresponding to the light intensity sequence at the i-th ambient temperature, and || denote the absolute value function. This represents the initial intensity of the light source fluctuation.
[0091] In the formula for calculating the intensity of light source fluctuations, The larger the value, the greater the light intensity fluctuation of the reference light source light intensity sequence at the i-th ambient temperature, which in turn indicates a lower reliability of the original Raman spectral data at the i-th ambient temperature. In order to facilitate the participation of the light source fluctuation intensity in the subsequent calculation of the prediction weight, it is necessary to ensure the standardization of the light source fluctuation intensity, that is, to limit the value range of the light source fluctuation intensity to between 0 and 1.
[0092] It is worth noting that, compared to calculating the degree of sequence fluctuation by calculating variance or standard deviation, the above formula for calculating the intensity of light source fluctuation can better reflect non-normally distributed data, is more sensitive to outliers, and is applicable to fluctuation analysis at different scales. The numerical accuracy of the light source fluctuation intensity determined in this way is higher, which helps to further improve the data quality of standard Raman spectroscopy data.
[0093] Thus, this embodiment obtains the light source fluctuation intensity corresponding to each reference light source light intensity sequence, that is, the light source fluctuation intensity corresponding to each reference light source light intensity sequence at each ambient temperature.
[0094] S4, relative to any Raman shift within the spectral detection range, determines the prediction weights of each original Raman intensity at that Raman shift based on the fluctuation intensity of each light source and each original Raman intensity.
[0095] First, it should be noted that the spectral detection range refers to the spectral detection range of the edible fungi sample. In the raw Raman spectral data under different temperature environments, the Raman shift on the horizontal axis is the same, but the Raman intensity differs. To determine the standard Raman intensity for each Raman shift, it is necessary to analyze the influence of light source fluctuation intensity at different ambient temperatures on the raw Raman intensity, i.e., to quantify the prediction weight of each raw Raman intensity. The prediction weight refers to the weight assigned to the raw Raman intensity at the same Raman shift at different ambient temperatures when quantifying the standard Raman intensity. The standard Raman intensity is the Raman intensity when the light source fluctuation intensity is zero, unaffected by ambient temperature.
[0096] Step S4 above can be achieved through the steps shown in Figure 4:
[0097] S41, relative to any Raman shift within the spectral detection range, obtain the original Raman intensity at that Raman shift at the corresponding ambient temperature for each reference light source light intensity sequence.
[0098] In this embodiment, each reference light source intensity sequence is the reference light source intensity sequence at each ambient temperature. The original Raman light intensity in the original Raman spectral data of the same Raman shift at different ambient temperatures is obtained. In order to ensure that the light source fluctuation intensity corresponds to the original Raman light intensity, each reference light source intensity sequence is used as the main body to determine the original Raman light intensity at the Raman shift in the original Raman spectral data at the corresponding ambient temperature, and the original Raman light intensities corresponding to the Raman shift are obtained.
[0099] S42, combine the fluctuation intensity of each light source and the original Raman light intensity to construct a Raman light intensity prediction model at the Raman shift.
[0100] In this embodiment, each Raman shift has its corresponding Raman intensity prediction model. The Raman intensity prediction model is used to predict the standard Raman intensity of the corresponding Raman shift. The Raman intensity prediction model consists of two parts: the light source fluctuation intensity corresponding to each reference light source light intensity sequence and the original Raman intensity at the Raman shift at the ambient temperature corresponding to each reference light source light intensity sequence.
[0101] Step S42 above can be achieved through the following steps:
[0102] The first step is to establish a coordinate system with the fluctuation intensity of each light source as the horizontal axis and the intensity of each original Raman light as the vertical axis.
[0103] Specifically, a two-dimensional coordinate system is established, with the horizontal axis representing the light source fluctuation intensity and the vertical axis representing the original Raman light intensity. The position of the data point on the two-dimensional coordinate system is determined by the light source fluctuation intensity and the original Raman light intensity corresponding to each reference light source light intensity sequence.
[0104] The second step is to perform interpolation on each data point in the coordinate system, and use the interpolated coordinate system as the Raman intensity prediction model at that Raman displacement.
[0105] It should be noted that the intensity fluctuations of the light source on the abscissa of each data point are not necessarily an arithmetic sequence; that is, the difference in the abscissa between two adjacent data points is not necessarily equal. To ensure that the prediction results of the Raman light intensity prediction model are more accurate, interpolation processing is required for each data point in the coordinate system. That is, interpolation techniques are used to ensure that the distance between adjacent points after interpolation is equal. The implementation process of the interpolation technique is existing technology and is not within the scope of protection of this invention, and will not be described in detail here.
[0106] Specifically, select an appropriate spacing to ensure that the distance between adjacent points is equal after interpolation, while minimizing the number of interpolation points. At the same time, the ordinate of the interpolation is obtained from the nearest data points on the left and right sides according to the corresponding proportional relationship, that is, the interpolation point and the nearest data points on the left and right sides satisfy the condition that the three points are collinear.
[0107] S43. Based on the clustering of all data points in the Raman intensity prediction model and the light source fluctuation intensity of each data point, determine the prediction weight of each original Raman intensity at the Raman displacement.
[0108] In this embodiment, the clustering degree of all data points in the Raman intensity prediction model is further analyzed. The better the clustering of a certain data point in the model, the higher the probability that the change in the original Raman intensity in the Raman spectrum data caused by the change in the light intensity of the source at that data point is small. The higher the reference value of that data point in determining the standard Raman intensity, the greater the prediction weight of that data point. Based on the above analysis logic of prediction weights, the prediction weight of each original Raman intensity at the Raman shift is determined by the Raman intensity prediction model.
[0109] Step S43 above can be achieved through the following steps:
[0110] The first step is to perform clustering on all data points in the Raman light intensity prediction model to obtain each cluster, and then determine the negative correlation value of the number of data points in each cluster; the negative correlation value is used as the confidence factor for each data point in its respective cluster.
[0111] Specifically, all data points in the Raman intensity prediction model for the Raman shift are subjected to DBSCAN (Density-based spatial clustering of applications with noise) density clustering to obtain each cluster; the number of data points in each cluster is counted, and the number of data points in each cluster is negatively correlated. The resulting negative correlation value is used as the confidence factor for each data point in the corresponding cluster, and the confidence factors of all data points in the same cluster are the same.
[0112] In the DBSCAN density clustering algorithm, the ε(eps) parameter can be set to 5, and the MinPts parameter can also be set to 5. The implementer can set the size of the two parameters in the clustering algorithm according to the specific actual situation. The DBSCAN density clustering algorithm is existing technology and is not within the scope of protection of this invention, so it will not be described in detail here.
[0113] For example, when performing negative correlation processing on the number of data points in a cluster, the reciprocal of the number can be used as the negative correlation value, i.e., to determine the confidence factor. The smaller the confidence factor, the less likely the change in the light intensity of the light source of the corresponding data point in the Raman light intensity prediction model corresponding to the Raman shift will cause a change in the Raman spectral data.
[0114] The second step is to calculate the product of the confidence factor of each data point and the light source fluctuation intensity of the corresponding data point, which is denoted as the first product; the first product is subjected to negative correlation normalization, and the normalized result is used as the prediction weight of the original Raman light intensity of the corresponding data point.
[0115] As an example, the formula for calculating the prediction weight of the original Raman intensity of the r-th data point in the Raman intensity prediction model when the Raman shift is k can be:
[0116] In the formula, W k,r Let G represent the prediction weight of the original Raman intensity at the r-th data point in the Raman intensity prediction model when the Raman shift is k, and let exp represent the exponential function with the natural constant as the base. k,r This represents the number of data points in the cluster to which the r-th data point belongs in the Raman intensity prediction model when the Raman shift is k. β represents the confidence factor for the r-th data point in the Raman intensity prediction model when the Raman shift is k. k,r This represents the light source fluctuation intensity at the r-th data point in the Raman intensity prediction model when the Raman shift is k. This represents the first product of the r-th data point in the Raman intensity prediction model when the Raman shift is k.
[0117] In the formula for calculating the prediction weights, β k,r To predict the base value of the weights, β k,r The larger the value, the greater the influence of the light intensity fluctuation of the source light source on the original Raman light intensity of the data point r in the Raman light intensity prediction model when the Raman shift is k, and the smaller the weight of the data point r in the prediction of the standard Raman light intensity. The smaller the value, the better the reliability of the original Raman intensity of the r-th data point in the Raman intensity prediction model when the Raman shift is k, and the larger the prediction weight of the original Raman intensity of the r-th data point; exp(-) represents the negative correlation normalization process. In a Raman intensity prediction model with a Raman shift, there are original Raman spectral intensities with different degrees of influence. In order to facilitate the subsequent implementation of standard Raman intensity prediction, the value range of the prediction weight needs to be limited to between 0 and 1.
[0118] Thus, by referring to the calculation process of the prediction weights of each original Raman intensity at a Raman shift of k in this embodiment, the prediction weights of each original Raman intensity at each Raman shift can be obtained.
[0119] S5. Based on the original Raman light intensity and its prediction weight at each Raman shift, determine the standard spectral Raman light intensity at each Raman shift, and then determine the standard Raman spectral data.
[0120] First, it should be noted that after obtaining the original Raman intensity and its prediction weight at each Raman shift, the standard spectral Raman intensity at each Raman shift is quantified by combining the original Raman intensity and its prediction weight. The standard spectral Raman intensity is the Raman intensity when the light source fluctuation intensity is zero in the Raman intensity prediction model, which is the spectral Raman intensity at Raman shift k after reducing the influence of the baseline drift effect.
[0121] Specifically, the original Raman intensities at any Raman shift are weighted and averaged using the predicted weights, and the result of the weighted averaging is used as the standard spectral Raman intensity of that Raman shift.
[0122] As an example, the formula for calculating the standard spectral Raman intensity at a Raman shift of k can be:
[0123] In the formula, C k H represents the standard Raman intensity at a Raman shift of k. k W represents the number of data points in the Raman intensity prediction model when the Raman shift is k, r represents the index of the data points in the Raman intensity prediction model, and W represents the number of data points in the Raman intensity prediction model. k,r C represents the prediction weight of the original Raman intensity at the r-th data point in the Raman intensity prediction model when the Raman shift is k. k,r This represents the original Raman intensity of the r-th data point in the Raman intensity prediction model when the Raman shift is k.
[0124] Finally, by referring to the calculation process of the standard Raman intensity at a Raman shift of k, the standard Raman intensity at each Raman shift can be obtained; the Raman spectral data composed of each Raman shift and its standard Raman intensity is used as the standard Raman spectral data.
[0125] Thus, this embodiment obtained standard Raman spectral data of edible fungi samples.
[0126] S6. Quality testing of edible fungi samples based on standard Raman spectroscopy data.
[0127] Specifically, characteristic analysis is performed on standard Raman spectral data to determine the content of each type of element in the edible fungus sample; based on the content of each type of element in the edible fungus sample, the quality test results of the edible fungus sample are determined.
[0128] In this embodiment, the standard Raman spectral data is the Raman spectral data after correcting for baseline drift. First, the standard Raman light intensity of each band of the edible fungus sample is characterized according to actual needs, thereby reflecting the content of protein, carbohydrates, fats, and trace elements in the edible fungus sample. Second, the quality level of the edible fungus is detected based on the degree of deviation between the actual content and the standard content of each component in the edible fungus sample, thereby realizing a more accurate edible fungus quality detection method based on spectral feature analysis.
[0129] For example, the standard for protein content in king oyster mushrooms is 14% to 18% of the dry weight of the fruiting body. The greater the deviation between the protein content in a king oyster mushroom sample and the standard level, the worse the quality of the protein content in the sample. The same principle applies to the quality testing of other components in king oyster mushrooms, as well as other varieties of edible fungi.
[0130] This invention provides a method for detecting the quality of edible fungi based on spectral characteristics. This method predicts the standard Raman intensity value without baseline drift effect based on the Raman intensity characteristics under changes in light intensity. It corrects the baseline drift effect in the original Raman spectral data of edible fungi samples, and the accuracy of the edible fungi quality detection results determined based on standard Raman spectral data is higher.
[0131] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for detecting quality of edible fungi based on spectral characteristics, characterized in that, The method comprises the following steps: Obtaining original Raman spectrum data of edible fungus samples under different environmental temperatures and a plurality of light source intensity sequences under different environmental temperatures; wherein the horizontal axis of the original Raman spectrum data is Raman shift, and the vertical axis is original Raman light intensity; Analyzing the similarity between the light source intensity sequences under each environmental temperature to determine the reference light source intensity sequence under each environmental temperature; Analyzing the fluctuation of the reference light source intensity sequence under each environmental temperature to determine the light source fluctuation intensity corresponding to each reference light source intensity sequence; For any Raman shift in the spectral detection range, obtaining the original Raman light intensity at the Raman shift under the environmental temperature corresponding to each reference light source intensity sequence; and determining the prediction weight of each original Raman light intensity at the Raman shift according to each light source fluctuation intensity and each original Raman light intensity; Determining the standard spectrum Raman light intensity of each Raman shift according to each original Raman light intensity at the Raman shift and the prediction weight thereof, and further determining standard Raman spectrum data; Performing quality detection of the edible fungus samples according to the standard Raman spectrum data; The step of analyzing the similarity between the light source intensity sequences under each environmental temperature to determine the reference light source intensity sequence under each environmental temperature comprises: Analyzing the light source intensity difference at the same time according to the light source intensity at each time in the target light source intensity sequence and each non-target light source intensity sequence under the same environmental temperature to determine the optimization index of the target light source intensity sequence under each environmental temperature; wherein the target light source intensity sequence is any light source intensity sequence under the environmental temperature; Obtaining the optimization index of each light source intensity sequence under each environmental temperature, and further determining the light source intensity sequence corresponding to the maximum optimization index under each environmental temperature as the reference light source intensity sequence; The step of analyzing the fluctuation of the reference light source intensity sequence under each environmental temperature to determine the light source fluctuation intensity corresponding to each reference light source intensity sequence comprises: For any reference light source intensity sequence, determining each local extreme point corresponding to the reference light source intensity sequence, and determining the light source intensity mean value corresponding to the reference light source intensity sequence; Determining the light source fluctuation intensity corresponding to the reference light source intensity sequence according to the difference between each local extreme point and the light source intensity mean value; The step of determining the prediction weight of each original Raman light intensity at the Raman shift according to each light source fluctuation intensity and each original Raman light intensity comprises: Constructing a Raman light intensity prediction model at the Raman shift by combining each light source fluctuation intensity and each original Raman light intensity; Determining the prediction weight of each original Raman light intensity at the Raman shift according to the clustering of all data points in the Raman light intensity prediction model and the light source fluctuation intensity of each data point; The step of constructing the Raman light intensity prediction model at the Raman shift by combining each light source fluctuation intensity and each original Raman light intensity comprises: Taking the intensity of fluctuation of each light source as the abscissa and taking the original Raman light intensity of each as the ordinate, a coordinate system is established; Interpolation is performed on each data point in the coordinate system, and the coordinate system after interpolation is taken as a Raman light intensity prediction model at the Raman shift; The method for determining the prediction weight of each original Raman light intensity at the Raman shift according to the clustering of all data points in the Raman light intensity prediction model and the intensity of fluctuation of each data point includes: Clustering is performed on all data points in the Raman light intensity prediction model to obtain each cluster, and then the negative correlation value of the number of data points in each cluster is determined; the negative correlation value is taken as the confidence factor of each data point in the cluster to which the data point belongs; The product of the confidence factor of each data point and the intensity of fluctuation of the corresponding data point is calculated, denoted as a first product; the first product is normalized in a negative correlation manner, and the normalized result value is taken as the prediction weight of the original Raman light intensity of the corresponding data point.
2. The method for detecting quality of edible fungi based on spectral characteristics according to claim 1, characterized in that, The method for determining the optimal index of the target light source intensity sequence at each environmental temperature according to the light source intensity at each time in the target light source intensity sequence and the light source intensity at each time in each non-target light source intensity sequence under the same environmental temperature includes: First, the difference between the light source intensity at each time in the target light source intensity sequence and the light source intensity at the corresponding time in each non-target light source intensity sequence under the same environmental temperature is calculated, denoted as a light source intensity difference value; Then, the average value of all light source intensity difference values under the same environmental temperature is calculated, and the average value of the light source intensity difference values is processed in a negative correlation manner to obtain the optimal index of the target light source intensity sequence at each environmental temperature.
3. The method for detecting quality of edible fungi based on spectral characteristics according to claim 1, characterized in that, The method for determining the light source fluctuation intensity corresponding to the reference light source intensity sequence according to the difference between each local extreme point and the mean value of the light source intensity includes: The absolute value of the difference between each local extreme point and the mean value of the light source intensity is calculated, and the average value of all absolute values is taken as the initial light source fluctuation intensity; The initial light source fluctuation intensity is normalized, and the normalized result value is taken as the light source fluctuation intensity corresponding to the reference light source intensity sequence.
4. The method for detecting quality of edible fungi based on spectral characteristics according to claim 1, characterized in that, The method for determining the standard spectral Raman light intensity of each Raman shift according to each original Raman light intensity at each Raman shift and the prediction weight thereof includes: The original Raman light intensity at any Raman shift is weighted and averaged using the prediction weight, and the result value after the weighted and averaged processing is taken as the standard spectral Raman light intensity of the Raman shift.
5. The method for detecting quality of edible fungi based on spectral characteristics according to claim 1, characterized in that, The method for detecting the quality of the edible fungus sample according to the standard Raman spectral data includes: Characteristic analysis is performed on the standard Raman spectral data to determine the content of each type of element in the edible fungus sample; The quality detection result of the edible fungus sample is determined according to the content of each type of element in the edible fungus sample.
Citation Information
Patent Citations
Raman signal position correction using relative integration parameters
CN111077128A
Intelligent pollutant toxicity detection system
CN117007577A
Edible mushroom quality detection method based on spectral characteristics
CN118533816A
Techniques for scoring food specimens, and related methods and apparatus
US20210311011A1
Cited By
Chest tumor exosome detection method based on Raman spectrum
CN122030895A