Method for detecting milk fat adulteration and electronic device
Patent Information
- Application Number
- CN202610861732.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-08-28
AI Technical Summary
[0003]目前,通过掺假乳脂产品的拉曼光谱中的特征峰强度进行掺假类型和掺假浓度的分析确定,然而该分析结果容易受到温度等环境因素的干扰
[0018] The method for detecting adulteration of milk fat provided in this invention involves taking multiple samples from a milk fat product to be tested, constructing a three-dimensional data cube of the milk fat product based on the Raman spectral data of each sample under multiple preset temperature conditions, determining the three-dimensional synchronous correlation spectrum of the milk fat product based on the three-dimensional synchronous correlation spectrum of the milk fat product, and obtaining the adulteration type and adulteration concentration of the milk fat product based on the three-dimensional synchronous correlation spectrum of the milk fat product and a pre-trained three-dimensional milk fat adulteration detection network. The three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations. This invention introduces multiple preset temperature conditions as external perturbations to effectively decouple the temperature perturbation signal from the adulterant component characteristic signal in the relevant spectral domain, eliminating the interference of temperature changes on the detection results and avoiding misjudgments caused by temperature fluctuations in conventional Raman spectroscopy. Simultaneously, through correlation analysis under temperature perturbations, the spectral response differences between adulterant components and milk fat components are amplified, enhancing the extraction of weak characteristic signals from low-concentration adulterants and improving detection sensitivity. Furthermore, the pre-trained three-dimensional milk fat adulteration detection network effectively extracts deep features related to adulteration type and concentration, avoiding the loss of spatial structure information caused by dimensionality reduction and flattening in traditional regression models, thus improving the accuracy of adulteration detection.
Smart Images

Figure CN122651674A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of food testing technology, and in particular to a method and electronic equipment for detecting adulteration of milk fat. Background Technology
[0002] Milk fat, as the core functional component of animal butter, is widely used in dairy processing and high-end baked goods decorating due to its naturally rich milky flavor, excellent emulsification stability and rheological properties, and nutritional advantages such as being rich in essential fatty acids, calcium, iron, and other trace elements and free of trans fatty acids. It possesses irreplaceable value. However, the high production cost of milk fat has led to industry malpractices such as the substitution or adulteration with cheaper vegetable fats like palm oil and hydrogenated vegetable oil. Such adulteration not only seriously infringes on consumers' right to know but also increases health risks such as cardiovascular disease due to the intake of trans fatty acids from hydrogenated vegetable oil, while simultaneously violating food safety regulations.
[0003] Currently, the type and concentration of adulteration are determined by analyzing the characteristic peak intensities in the Raman spectra of adulterated milk fat products. However, this analysis is easily affected by environmental factors such as temperature. Milk fat is highly sensitive to temperature; temperature changes can lead to alterations in crystal conformation, causing fluctuations in the intensity of characteristic peaks. These fluctuations are difficult to distinguish from the spectral changes caused by low-concentration adulteration, resulting in a high misjudgment rate.
[0004] Therefore, how to achieve accurate qualitative and quantitative detection of dairy fat products is a technical problem that urgently needs to be solved in the field of food quality testing. Summary of the Invention
[0005] This invention provides a method and electronic device for detecting adulteration of milk fat, thereby improving the accuracy of milk fat adulteration detection.
[0006] In a first aspect, embodiments of the present invention provide a method for detecting adulteration of milk fat, comprising: For multiple samples taken from the milk fat product to be tested, Raman spectral data of each sample were obtained under multiple preset temperature conditions. Based on the Raman spectral data of multiple samples to be tested, a three-dimensional data cube of the milk fat product to be tested was constructed. Based on the three-dimensional data cube of the milk fat product to be tested, determine the three-dimensional synchronous correlation spectrum of the milk fat product to be tested; Based on the three-dimensional synchronous correlation spectrum of the milk fat product to be tested and the pre-trained three-dimensional milk fat adulteration detection network, the adulteration type and adulteration concentration of the milk fat product to be tested are obtained; wherein, the three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations.
[0007] In one feasible implementation, the training method for the three-dimensional milk fat adulteration detection network includes: Raman spectral data of each of a number of pre-prepared milk fat samples were obtained under multiple preset temperature conditions; wherein, the multiple milk fat samples covered a variety of adulteration types, and each adulteration type contained multiple different preset adulteration concentrations; For each adulteration type, a three-dimensional training data cube is constructed based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under that adulteration type. For each 3D training data cube, determine the 3D training synchronization correlation spectrum based on the 3D training data cube; For each 3D training synchronous correlation spectrum, a sliding window is used to cut the 3D training synchronous correlation spectrum along the adulteration concentration dimension to generate multiple 3D training sub-cube samples. Each 3D training sub-cube sample is associated with an adulteration type label and an adulteration concentration label. Using 3D training sub-cube samples as input and adulteration type and adulteration concentration labels as output, a 3D convolutional neural network is trained to obtain a 3D milk fat adulteration detection network.
[0008] One feasible implementation involves acquiring Raman spectral data of each of a plurality of pre-prepared milk fat samples under multiple preset temperature conditions, including: For each milk fat sample, the Raman spectrum of the milk fat sample is collected under each preset temperature condition to obtain multiple Raman spectra corresponding to multiple preset temperature conditions; For each Raman spectrum, the target characteristic spectrum within a preset wavenumber range is extracted, and the target characteristic spectrum is sequentially processed by baseline correction, smoothing filtering, and spectral intensity normalization to obtain the Raman spectral data corresponding to that Raman spectrum.
[0009] In one feasible implementation, a three-dimensional training data cube corresponding to the adulteration type is constructed based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under the adulteration type, including: Construct a blank three-dimensional data cube containing wavenumber, adulteration concentration, and temperature dimensions; wherein the blank three-dimensional data cube contains a first number of wavenumber points in the wavenumber dimension, a second number of adulteration concentration points in the adulteration concentration dimension, and a third number of temperature points in the temperature dimension. The Raman spectral intensity values of the Raman spectral data corresponding to multiple milk fat samples with different preset adulteration concentrations under this adulteration type are filled into a blank three-dimensional data cube according to the corresponding wave value, concentration value and temperature value to obtain a three-dimensional training data cube.
[0010] In one feasible implementation, the three-dimensional training synchronization correlation spectrum is determined based on the three-dimensional training data cube, including: For each wavenumber point and each adulteration concentration in the three-dimensional training data cube, calculate the average Raman spectral intensity of that wavenumber point at all temperature points under that adulteration concentration, and use the average Raman spectral intensity as the reference benchmark for that wavenumber point at that adulteration concentration. For each wavenumber point, each doping concentration, and each preset temperature condition in the three-dimensional data cube, the Raman spectral intensity value of the wavenumber point under the doping concentration and temperature condition is subtracted from the reference value of the wavenumber point under the doping concentration to obtain the dynamic spectral value of the wavenumber point under the doping concentration and temperature condition. For any two wavenumber points forming a wavenumber pair, calculate the product of the dynamic spectral values of the two wavenumber points at each temperature point under the same doping concentration, sum the product results corresponding to all temperature points, and then divide by the difference between the number of temperature points and one to obtain the synchronous correlation strength of the two wavenumber points under the doping concentration. For each adulteration concentration, iterate through all wavenumber pair combinations, calculate the synchronization correlation strength between each pair of wavenumber points, and fill it into a blank three-dimensional synchronization correlation spectrum containing the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension to obtain the three-dimensional training synchronization correlation spectrum.
[0011] In one feasible implementation, a sliding window is used to cut the three-dimensional training synchronous correlation spectrum along the doping concentration dimension to generate multiple three-dimensional training sub-cube samples, including: A first virtual concentration point is added before the starting concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the first virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the starting concentration point; and a second virtual concentration point is added after the ending concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the second virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the ending concentration point. For the new three-dimensional training synchronous correlation spectrum formed by adding a first virtual concentration point and a second virtual concentration point, a sliding window with a preset depth is used to slide and traverse the new three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension with a preset step size. Each slide extracts the synchronous correlation spectrum data corresponding to the concentration point covered by the sliding window to obtain the corresponding three-dimensional training sub-cube sample. Among them, the three-dimensional training sub-cube sample obtained by each slide is associated with the adulteration concentration label according to the center concentration of the concentration point covered by the sliding window.
[0012] In one feasible implementation, a three-dimensional training sub-cube sample is used as input, and adulteration type label and adulteration concentration label are used as output to train a three-dimensional convolutional neural network to obtain a three-dimensional milk fat adulteration detection network, including: Inputting 3D training sub-cube samples into a 3D convolutional neural network yields prediction results for adulteration type and adulteration concentration. The first difference between the adulteration type prediction result and the associated adulteration type label is calculated using the cross-entropy loss function, and the second difference between the adulteration concentration prediction result and the associated adulteration concentration label is calculated using the mean squared error loss function. Based on the first and second differences, determine whether a preset stopping condition is met. If the preset stopping condition is met, stop the iterative training of the three-dimensional convolutional neural network and use the currently trained three-dimensional convolutional neural network as the three-dimensional milk fat adulteration detection network. Otherwise, based on the first and second differences, update the parameters of the three-dimensional convolutional neural network using the backpropagation algorithm, and input the three-dimensional training sub-cube samples into the three-dimensional convolutional neural network after updating the parameters. Repeat the steps of calculating the first and second differences and updating the parameters until the preset stopping condition is met.
[0013] In one feasible implementation, the three-dimensional convolutional neural network includes a first three-dimensional convolutional block, a second three-dimensional convolutional block, and a third three-dimensional convolutional block; The output of the first 3D convolutional block is connected to the input of the second 3D convolutional block, and the output of the second 3D convolutional block is connected to the input of the third 3D convolutional block; each 3D convolutional block includes a 3D convolutional layer, a batch normalization layer, an activation layer, and a pooling layer connected in sequence. The output of the third 3D convolutional block is connected to the input of the global pooling layer, the output of the global pooling layer is connected to the input of the first fully connected layer, the output of the first fully connected layer is connected to the input of the random deactivation layer, and the output of the random deactivation layer is connected to the input of the second fully connected layer. The output of the second fully connected layer is connected to the output layer, which includes a flexible maximum layer for outputting the adulteration type and a single-neuron linear layer for outputting the adulteration concentration.
[0014] In one feasible implementation, the adulteration types of the milk fat sample include palm oil adulteration and / or hydrogenated vegetable oil adulteration; the multiple adulteration concentrations of the milk fat sample include 0%, 5%, 10%, 15%, 20%, and 25%; and the multiple preset temperature conditions include 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃.
[0015] Secondly, embodiments of the present invention provide a device for detecting adulteration of milk fat, comprising: The acquisition module is used to acquire Raman spectral data of each sample taken from the milk fat product to be tested under multiple preset temperature conditions. The processing module is used to construct a three-dimensional data cube of the milk fat product to be tested based on the Raman spectral data of multiple samples to be tested. The processing module is also used to determine the three-dimensional synchronous correlation spectrum of the milk fat product to be tested based on the three-dimensional data cube of the milk fat product to be tested; The processing module is also used to obtain the adulteration type and adulteration concentration of the milk fat product to be tested based on the three-dimensional synchronous correlation spectrum of the milk fat product to be tested and the pre-trained three-dimensional milk fat adulteration detection network; wherein, the three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations.
[0016] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect or any possible implementation thereof.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect or any possible implementation thereof.
[0018] The method for detecting adulteration of milk fat provided in this invention involves taking multiple samples from a milk fat product to be tested, constructing a three-dimensional data cube of the milk fat product based on the Raman spectral data of each sample under multiple preset temperature conditions, determining the three-dimensional synchronous correlation spectrum of the milk fat product based on the three-dimensional synchronous correlation spectrum of the milk fat product, and obtaining the adulteration type and adulteration concentration of the milk fat product based on the three-dimensional synchronous correlation spectrum of the milk fat product and a pre-trained three-dimensional milk fat adulteration detection network. The three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations. This invention introduces multiple preset temperature conditions as external perturbations to effectively decouple the temperature perturbation signal from the adulterant component characteristic signal in the relevant spectral domain, eliminating the interference of temperature changes on the detection results and avoiding misjudgments caused by temperature fluctuations in conventional Raman spectroscopy. Simultaneously, through correlation analysis under temperature perturbations, the spectral response differences between adulterant components and milk fat components are amplified, enhancing the extraction of weak characteristic signals from low-concentration adulterants and improving detection sensitivity. Furthermore, the pre-trained three-dimensional milk fat adulteration detection network effectively extracts deep features related to adulteration type and concentration, avoiding the loss of spatial structure information caused by dimensionality reduction and flattening in traditional regression models, thus improving the accuracy of adulteration detection. Attached Figure Description
[0019] Figure 1 This is an application scenario diagram of the milk fat adulteration detection method provided in the embodiments of the present invention; Figure 2 This is a flowchart illustrating the implementation of the milk fat adulteration detection method provided in this embodiment of the invention; Figure 3 This is a schematic diagram of the structure of a three-dimensional convolutional neural network provided in an embodiment of the present invention; Figure 4A This is a schematic diagram of the Raman spectra of pure milk fat under different temperature perturbations provided in the embodiments of the present invention; Figure 4B This is a schematic diagram of the Raman spectra of different concentrations of adulterated palm oil at 25 degrees Celsius, provided in an embodiment of the present invention. Figure 4C This is a slice of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum of the first batch of pure milk fat under temperature perturbation provided in the embodiments of the present invention; Figure 4D This is a slice of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum of the second batch of pure milk fat under temperature perturbation provided in the embodiments of the present invention; Figure 5A Three-dimensional synchronous correlation spectrum of a palm oil adulterated milk fat sample provided in an embodiment of the present invention; Figure 5B for Figure 5A A slice plot of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum; Figure 5C A bar chart showing the correlation intensity changes of different characteristic peaks in a milk fat sample of palm oil adulteration type provided in an embodiment of the present invention; Figure 6A Three-dimensional synchronous correlation spectrum of a milk fat sample adulterated with hydrogenated vegetable oil provided in an embodiment of the present invention; Figure 6B for Figure 6A A slice plot of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum; Figure 6C A bar chart showing the correlation intensity changes of different characteristic peaks in a milk fat sample adulterated with hydrogenated vegetable oil, provided in an embodiment of the present invention. Figure 7 This is the result of multivariate analysis of the three-dimensional training synchronization correlation spectrum using the method provided in this embodiment of the invention; Figure 8 This is the qualitative detection confusion matrix of the three-dimensional milk fat adulteration detection network provided in this embodiment of the invention; Figure 9 This is a schematic diagram of the structure of the milk fat adulteration detection device provided in an embodiment of the present invention. Detailed Implementation
[0020] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0021] Milk fat, as the core functional component of animal butter, possesses irreplaceable value due to its naturally rich milky flavor, excellent emulsification stability and rheological properties, and nutritional advantages such as being rich in essential fatty acids, calcium, iron, and other trace elements while being free of trans fatty acids. It is widely used in dairy processing and high-end baked goods decorating. However, the high production cost of milk fat has led to industry malpractices such as the substitution or adulteration with cheaper vegetable fats like palm oil and hydrogenated vegetable oil. This adulteration not only seriously infringes on consumers' right to know but also increases health risks such as cardiovascular disease due to the intake of trans fatty acids from hydrogenated vegetable oil, while simultaneously violating food safety regulations. Therefore, how to achieve accurate qualitative and quantitative detection of milk fat products is a pressing technical problem in the field of food quality testing.
[0022] With the continuous development of detection technologies, various adulteration detection methods have emerged, including gas chromatography-mass spectrometry (GC-MS), high performance liquid chromatography (HPLC), near-infrared spectroscopy (NIRS), conventional Raman spectroscopy (RS), surface-enhanced Raman spectroscopy (SERS), and electrochemical sensors. However, these technologies all have inherent limitations in practical applications. While GC-MS and HPLC offer high quantitative detection performance, their complex sample pretreatment processes, requiring fat extraction and derivatization, and time-consuming detection (2-4 hours per sample), coupled with high instrument maintenance costs, make them unsuitable for rapid on-site detection. NIRS exhibits weak anti-interference capabilities, easily affected by matrix components such as moisture and protein in the sample, leading to insufficient sensitivity in detecting low-concentration adulteration. Conventional Raman spectroscopy enables non-destructive detection, but its reliance on single characteristic peak intensity for interpretation is limited, and it is susceptible to temperature disturbances. Fluctuations in characteristic peaks due to temperature variations in the orderliness of milk fat crystals often result in misjudgments of low-concentration adulteration, and it struggles to capture subtle differences in low-concentration adulteration. SERS can achieve extreme Raman signal enhancement by adsorbing analyte molecules onto the surface of noble metal nanostructures, utilizing their localized surface plasmon resonance effect. However, it is more suitable for trace substance detection and has limited applicability to constant-proportion analysis such as milk fat adulteration. Electrochemical sensors suffer from poor specificity and long detection cycles, failing to meet the need for simultaneous detection of multiple types of adulteration.
[0023] Raman spectroscopy, with its high specificity for molecular structures, can accurately characterize the vibrational features of dairy triglycerides, providing a basis for the molecular-level identification of adulterants. To overcome the limitations of conventional Raman spectroscopy, which relies on the interpretation of a single characteristic peak intensity, spectroscopic techniques are gradually developing towards high-dimensional correlation analysis. Two-Dimensional Correlation Spectroscopy (2D-COS) is an analytical method that extends the spectral signal to a second dimension. By introducing perturbation factors such as concentration, temperature, and pH, it achieves the extraction of correlation features between wavenumbers. Among related techniques, 2D-COS, combined with machine learning algorithms such as Partial Least Squares Regression (PLSR) and Support Vector Regression (SVR), as well as deep learning models such as Convolutional Neural Networks (CNN), has accumulated rich experience in the qualitative identification and quantitative prediction of food components.
[0024] Based on this, considering that 2D-COS can only cover two-dimensional information related to wavenumbers, this application proposes to construct a cubic structure of wavenumber space and perturbation factors such as concentration, i.e., a three-dimensional correlation spectrum, which can be simply referred to as 3D-COS, to provide a more promising carrier for high-dimensional feature mining of adulteration concentration. Furthermore, considering that traditional machine learning algorithms are limited by the inherent limitations of manual feature selection and cannot fully mine three-dimensional information, resulting in detection accuracy and anti-interference capabilities that cannot meet the needs of practical applications, this application proposes to systematically combine deep learning algorithms with 3D-COS for the detection of milk fat adulteration.
[0025] Figure 1 This diagram illustrates an application scenario of the milk fat adulteration detection method provided in this embodiment of the invention. Figure 1 As shown, the milk fat adulteration detection device is equipped with a data processing unit and a trained three-dimensional milk fat adulteration detection network.
[0026] It should be noted that before using a milk fat adulteration detection device to detect milk fat adulteration, it is necessary to use relevant equipment with Raman spectroscopy acquisition function to acquire Raman data of the milk fat product to be tested.
[0027] For example, parallel sampling of the milk fat product to be tested is performed to obtain multiple test samples. Each test sample is further subdivided into multiple sub-samples, the same number as the number of preset temperature conditions. The multiple sub-samples are then placed one-to-one under the preset temperature conditions for temperature pretreatment. Further, using equipment with Raman spectroscopy acquisition capabilities, the original Raman spectra of each pretreated sub-sample are acquired.
[0028] Understandably, a set of original Raman spectra was obtained from one sample to be tested through multiple sub-samples to be tested, while multiple sets of original Raman spectra were obtained from multiple samples to be tested for the milk fat product.
[0029] In some embodiments, the raw Raman spectrum can be provided to the data processing unit, which then performs preprocessing such as spectral truncation, baseline correction, smoothing, and normalization on the raw Raman spectrum to obtain Raman spectral data corresponding to the raw Raman spectrum. It should be noted that "corresponding Raman spectral data" refers to the information of the entire Raman spectrum, including wavenumber points and their corresponding Raman spectral intensity values.
[0030] The data processing unit constructs a three-dimensional data cube of the milk fat product to be tested based on the Raman spectral data of multiple samples. The three dimensions of this three-dimensional data cube are wavenumber, temperature, and number of samples. Furthermore, the data processing unit calculates the three-dimensional synchronous correlation spectrum of the milk fat product to be tested based on this three-dimensional data cube.
[0031] The three-dimensional synchronous correlation spectrum of the milk fat product to be tested is provided to the three-dimensional milk fat adulteration detection network to obtain the adulteration type and concentration of the milk fat product output by the three-dimensional milk fat adulteration detection network. The three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and concentrations.
[0032] Specifically, multiple milk fat samples are artificially prepared, which can cover different adulteration types, and each adulteration type can contain multiple different preset adulteration concentrations. Raman spectral data of each milk fat sample are acquired under multiple preset temperature conditions. To enable the three-dimensional milk fat adulteration detection network to learn the evolution of the synchronization correlation spectrum with changes in adulteration concentration, and the mapping relationship between this evolution and adulteration type and concentration, a three-dimensional training data cube with dimensions of wavenumber, temperature, and adulteration concentration is constructed based on the Raman spectral data of multiple milk fat samples. Further, a three-dimensional training synchronization correlation spectrum is calculated based on this three-dimensional training data cube, and this spectrum is used as training data to obtain the three-dimensional milk fat adulteration detection network.
[0033] Figure 2This is a flowchart illustrating the implementation of the milk fat adulteration detection method provided in this embodiment of the invention. (See attached diagram.) Figure 2 The method for detecting adulterated milk fat provided in this embodiment includes the following steps 201 to 204.
[0034] 201. For multiple samples taken from the milk fat product to be tested, the Raman spectral data of each sample under multiple preset temperature conditions are obtained.
[0035] Optionally, multiple samples of the same mass or volume are taken from the milk fat product to be tested. Each sample is divided into multiple sub-samples, the same number as the preset temperature conditions. Each sub-sample is thinly coated onto an independent silicon wafer to form a uniform thin layer. The silicon wafers containing the multiple sub-samples are placed in a constant temperature chamber at the corresponding preset temperature conditions for static pretreatment. The static pretreatment time for each preset temperature condition is the same (e.g., 2 hours). Through this temperature pretreatment, each sub-sample reaches a stable molecular conformation, preparing it for subsequent acquisition of Raman spectral data reflecting the spectral response under temperature perturbations.
[0036] In this step, multiple preset temperature conditions can cover the refrigeration temperature range, room temperature range, and melting transition zone, such as 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃, a total of 8 temperature points.
[0037] Furthermore, the acquisition process for the Raman spectral data of each test sample is as follows: After pretreatment at a preset temperature, the silicon wafer carrying the test sample is quickly transferred to the stage of the Raman spectrometer, and the raw Raman spectrum under the same acquisition parameters is acquired using the Raman spectrometer. For example, the acquisition parameters can be set to a laser wavelength of 532 nm, a power of 25 mW, an objective lens of 50×, an integration time of 10 seconds, and a cumulative count of 3.
[0038] The raw Raman spectrum output by a Raman spectrometer can be represented as a set of discrete data points. The horizontal axis of each Raman spectrum represents the Raman shift, in cm. -1 The vertical axis represents different wavenumber positions; the vertical axis of the Raman spectrum is the spectral intensity, in au, representing the intensity of scattered light at that wavenumber position.
[0039] The raw Raman spectra acquired by each Raman spectrometer are preprocessed as follows: the target characteristic spectrum is extracted within a preset wavenumber range, which is the 800 cm⁻¹ range where the Raman spectrum is most sensitive to the characteristic response of milk fat adulterants. -1 Up to 1800cm -1 The target characteristic spectrum is subjected to baseline correction, smoothing filtering, and spectral intensity normalization in sequence to obtain Raman spectral data corresponding to the original Raman spectrum.
[0040] Optionally, the number of samples to be tested can be the same as the depth required by the input layer specifications of the three-dimensional milk fat adulteration detection network in subsequent step 204, so that data preprocessing is not required again before inputting the network.
[0041] Step 202: Construct a three-dimensional data cube of the milk fat product to be tested based on the Raman spectral data of multiple samples to be tested.
[0042] As shown in step 201, each sample to be tested yielded a set of Raman spectral data under different preset temperature conditions through multiple sub-samples. Since the milk fat product to be tested corresponds to multiple samples, there are therefore multiple sets of Raman spectral data under different preset temperature conditions.
[0043] In some embodiments, the three-dimensional data cube of the milk fat product to be tested is constructed as follows: the three dimensions of the three-dimensional data cube are determined to be wavenumber dimension, temperature dimension, and sample quantity dimension; the Raman spectral intensity values from multiple sets of Raman spectral data are filled into the three-dimensional data cube according to the wavenumber index, temperature index, and sample quantity index. It should be noted here that Raman spectral data correspondence refers to the information of the entire Raman spectrum, including the wavenumber point and its corresponding Raman spectral intensity value; Raman spectral intensity value refers to the spectral intensity value at a specific wavenumber point.
[0044] For example, if the wavenumber dimension is 398, the temperature dimension is 8, and the quantity dimension is 3, then the data structure of the constructed three-dimensional data cube is 398×8×3.
[0045] Step 203: Determine the three-dimensional synchronous correlation spectrum of the milk fat product to be tested based on the three-dimensional data cube of the milk fat product to be tested.
[0046] As shown in step 202, the three-dimensional data cube of the milk fat product to be tested includes wavenumber, temperature, and quantity dimensions. Based on this three-dimensional data cube, this step calculates the three-dimensional synchronous correlation spectrum using the Noda rule. The calculation steps are as follows: (1.1) For each wavenumber point and each part number dimension index in the three-dimensional data cube, extract the Raman spectral intensity values of all preset temperature points under the part number dimension index for the wavenumber point, calculate the average Raman spectral intensity, and use the average Raman spectral intensity as the reference benchmark for the wavenumber point under the part number dimension index.
[0047] (1.2) For each wavenumber point, each component dimension index, and each preset temperature condition in the three-dimensional data cube, the Raman spectral intensity value of the wavenumber point under that component dimension index and temperature condition is subtracted from the reference benchmark of the wavenumber point under that component dimension index to obtain the dynamic spectral value of the wavenumber point under that component dimension index and temperature point. This dynamic spectral value reflects the amount of fluctuation of the spectral intensity with temperature perturbation relative to the average level.
[0048] (1.3) For any two wavenumber points forming a wavenumber pair, under the same number of dimensions index, calculate the product of the dynamic spectral values of the two wavenumber points under each preset temperature condition, add up the product results under all preset temperature conditions, and then divide by the difference between the number of preset temperature conditions and one to obtain the synchronous correlation strength of the two wavenumber points under the same number of dimensions index.
[0049] (1.4) For each part number dimension index, traverse all wavenumber pair combinations, calculate the synchronization correlation strength between each pair of wavenumber points, and construct a three-dimensional synchronization correlation spectrum containing part number dimension, first wavenumber dimension and second wavenumber dimension.
[0050] The expression for calculating the three-dimensional synchronous correlation spectrum is:
[0051] in, Indicates a specific adulteration concentration The strength of synchronous correlation under the following conditions; and Represents any two wavenumber points; T is the preset temperature condition set; t is the temperature dimension index; and These represent specific adulteration concentrations. Down and Dynamic spectral values at wavenumber points.
[0052] It should be noted that, in order to maintain the consistency of the underlying mathematical logic of the algorithm between the training and application phases, the formula here uses the physical depth variable from the deep learning model training. A unified expression should be used. When testing a single milk fat product, this specific adulteration concentration... The variable is equivalently replaced with the "number of copies dimension index" from the previous steps.
[0053] In the three-dimensional synchronous correlation spectrum, when and When they are equal, the corresponding synchronous correlation strength represents the autocorrelation strength at the same wavenumber point, reflecting the overall change in the spectral intensity at that wavenumber point under temperature perturbation; when... and The synchronous correlation strength corresponding to the unequal values represents the cross-correlation strength between different wavenumber points, reflecting the degree of coordinated change of vibrational modes of different molecular functional groups under temperature perturbation.
[0054] The aforementioned three-dimensional synchronous correlation spectrum, by introducing multiple preset temperature conditions as external perturbations, effectively decouples the temperature perturbation signal from the adulterant component characteristic signal in the correlation spectral domain, eliminating the interference of temperature changes on the detection results and avoiding misjudgments caused by temperature fluctuations in conventional Raman spectroscopy. Simultaneously, through correlation analysis under temperature perturbations, it amplifies the spectral response differences between adulterant components and milk fat components, achieving enhanced extraction of weak characteristic signals from low-concentration adulterants and improving detection sensitivity. Furthermore, the three-dimensional synchronous correlation spectrum has a three-dimensional coupled correlation structure, naturally adapting to the input layer specifications of the three-dimensional milk fat adulteration detection network, avoiding the loss of spatial structure information caused by dimensionality reduction and flattening in traditional regression models.
[0055] Step 204: Based on the three-dimensional synchronous correlation spectrum of the milk fat product to be tested and the pre-trained three-dimensional milk fat adulteration detection network, the adulteration type and adulteration concentration of the milk fat product to be tested are obtained; wherein, the three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations.
[0056] Here, considering that the input layer of the three-dimensional milk fat adulteration detection network has fixed data structure requirements, when the dimensions of the three-dimensional synchronous correlation spectrum of the milk fat product to be tested do not match, the three-dimensional synchronous correlation spectrum needs to be preprocessed before being input into the network.
[0057] For example, suppose the three-dimensional milk fat adulteration detection network requires input data with dimensions of 398×398×3, meaning both wavenumber dimensions are 398 and the depth dimension is 3. If the dimension of the three-dimensional synchronous correlation spectrum of the milk fat product to be tested is exactly 398×398×3, then no processing is needed, and it can be directly used as input data. If the dimension of the three-dimensional synchronous correlation spectrum of the milk fat product to be tested is 398×398×N, where N is not equal to 3, then it needs to be adjusted to the dimension of 398×398×3 through methods such as truncation or padding.
[0058] Optionally, the preprocessed three-dimensional synchronous correlation spectrum is input into a pre-trained three-dimensional milk fat adulteration detection network. After forward computation, the three-dimensional milk fat adulteration detection network outputs two results: one is the adulteration type, which indicates the adulterant component in the milk fat product to be tested, and the other is the adulteration concentration, which indicates the percentage of adulterant component in the milk fat product.
[0059] It should be noted that the three-dimensional milk fat adulteration detection network learns the spectral evolution characteristics along the adulteration concentration gradient direction during the training phase. Due to the good feature generalization ability of this three-dimensional milk fat adulteration detection network, its three-dimensional convolution kernel extracts the common pattern of the two-dimensional slices of the three-dimensional correlated spectral synchronous spectrum changing along the third dimension. Therefore, in the application process, the third dimension is replaced by "adulteration concentration gradient" with "sample number order", and the three-dimensional milk fat adulteration detection network can still effectively extract features and make correct judgments.
[0060] This application's embodiments introduce multiple preset temperature conditions as external perturbations to effectively decouple the temperature perturbation signal from the adulterant component's characteristic signal in the relevant spectral domain, eliminating the interference of temperature changes on the detection results and avoiding misjudgments caused by temperature fluctuations in conventional Raman spectroscopy. Simultaneously, through correlation analysis under temperature perturbations, the spectral response differences between adulterant components and milk fat components are amplified, enhancing the extraction of weak characteristic signals from low-concentration adulterants and improving detection sensitivity. Furthermore, the three-dimensional synchronous correlation spectrum has a three-dimensional coupled correlation structure, naturally matching the input layer specifications of the three-dimensional milk fat adulteration detection network. The three-dimensional milk fat adulteration detection network extracts the high-dimensional coupling features of the three-dimensional synchronous correlation spectrum in parallel, avoiding the loss of spatial structure information caused by dimensionality reduction and flattening in traditional regression models.
[0061] The training process of the three-dimensional milk fat adulteration detection network is described below.
[0062] In one feasible implementation, the training method for the three-dimensional milk fat adulteration detection network includes steps (2.1) to (2.5).
[0063] (2.1) Obtain Raman spectral data of each of the multiple pre-prepared milk fat samples under multiple preset temperature conditions; wherein, the multiple milk fat samples cover multiple adulteration types, and each adulteration type contains multiple different preset adulteration concentrations; (2.2) For each adulteration type, a three-dimensional training data cube corresponding to the adulteration type is constructed based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under that adulteration type. (2.3) For each three-dimensional training data cube, determine the three-dimensional training synchronization correlation spectrum based on the three-dimensional training data cube; wherein, the dimensions of the three-dimensional training synchronization correlation spectrum include the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension; (2.4) For each three-dimensional training synchronous correlation spectrum, a sliding window is used to cut the three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension to generate multiple three-dimensional training sub-cube samples. Each three-dimensional training sub-cube sample is associated with an adulteration type label and an adulteration concentration label. (2.5) The three-dimensional training sub-cube samples are used as input, and the adulteration type label and adulteration concentration label are used as output to train the three-dimensional convolutional neural network to obtain the three-dimensional milk fat adulteration detection network.
[0064] It should be noted that each adulteration type corresponds to a three-dimensional training data cube, and each three-dimensional training data cube corresponds to a three-dimensional training synchronization correlation spectrum. Each three-dimensional training synchronization correlation spectrum is divided into multiple three-dimensional training sub-cube samples by a sliding window along the adulteration concentration dimension. Therefore, each three-dimensional training sub-cube sample is associated with two labels: an adulteration type label and an adulteration concentration label.
[0065] The multiple milk fat samples prepared in step (2.1) serve as the basic data source for the training set. These multiple milk fat samples need to cover various adulteration types, and each adulteration type contains multiple different preset adulteration concentrations.
[0066] For example, two adulteration types are selected: palm oil adulteration and hydrogenated vegetable oil adulteration. For each adulteration type, the preset adulteration concentration gradient is set to 0%, 5%, 10%, 15%, 20%, and 25%, for a total of six concentration points. The sample with a 0% adulteration concentration is a pure milk fat sample. The training process maintains consistent preset temperature conditions with the application process, selecting 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃, for a total of eight temperature points.
[0067] A feasible method for preparing a milk fat sample involves using animal butter, vegetable butter, and palm oil as raw materials. The raw materials are separated into fat layers: animal butter and vegetable butter are heated to 40°C and completely melted, then separated using a high-speed centrifuge, collecting the upper layer of milk fat and hydrogenated vegetable oil separately. The milk fat is mixed with palm oil and hydrogenated vegetable oil (two different adulterants) at adulteration ratios of 0%, 5%, 10%, 15%, 20%, and 25%, respectively, and placed in glass bottles. The mixture is heated to 50°C, thoroughly stirred with a magnetic stirrer, and then homogenized using a high-speed homogenizer to ensure uniform mixing. The prepared adulterated sample is then sealed and refrigerated at 4°C in the dark for 24 hours to simulate the crystallization state of butter. After solidification, it is thinly coated onto a silicon wafer.
[0068] To obtain Raman spectral data of each milk fat sample under multiple preset temperature conditions, subsamples of the same number as the preset temperature conditions can be extracted from the milk fat sample. The silicon wafers of each subsample are statically pretreated for 2 hours at each temperature point of 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃.
[0069] For each subsample, after pretreatment at the corresponding preset temperature conditions, the silicon wafer carrying the subsample was quickly transferred to the stage of the Raman spectrometer. A confocal Raman spectrometer was used to acquire the Raman spectrum under the same acquisition parameters. The laser wavelength was set to 532 nm, power to 25 mW, objective lens to 50×, integration time to 10 seconds, and the spectrum was accumulated three times. Wavenumber was calibrated using the silicon wafer before each daily test to ensure peak position error was less than 1 cm. -1 .
[0070] In one feasible implementation, step (2.1) involves acquiring Raman spectral data of each of the pre-prepared multiple milk fat samples under multiple preset temperature conditions, including: for each milk fat sample, acquiring the Raman spectrum of the milk fat sample under each preset temperature condition to obtain multiple Raman spectra corresponding to the multiple preset temperature conditions; for each Raman spectrum, extracting the target feature spectrum within a preset wavenumber range, and sequentially performing baseline correction processing, smoothing filtering processing, and spectral intensity value normalization processing on the target feature spectrum to obtain the Raman spectral data corresponding to the Raman spectrum.
[0071] In some embodiments, to increase the amount of training data and obtain statistically representative spectral data, each milk fat sample with a specific adulteration concentration and type is prepared three times. After pretreatment at a specific temperature, 26 locations are randomly selected from each subsample. Three raw Raman spectra are obtained from each location and averaged. After screening, 20 valid raw Raman spectra are retained. Each subsample is sampled three times, with 20 valid raw Raman spectra obtained each time. Since each milk fat sample is prepared three times, ultimately, for each milk fat sample with a specific adulteration type and concentration, 3 × 3 × 20 = 180 raw Raman spectra are obtained under each preset temperature condition. Each adulteration type corresponds to 8640 (180 × 6 × 8) raw Raman spectra.
[0072] Further preprocessing of the acquired raw Raman spectra is performed, with the following specific steps: ① Spectral interception: Focusing on the 800-1800 cm⁻¹ range, where the characteristic responses of milk fat and adulterants are most sensitive. -1 The preprocessing steps are as follows: ① Baseline correction: Baseline correction is performed using the adaptive iterative reweighted penalized least squares method (airPLS); ② SG smoothing: The smoothing window size is set to 11 points and the polynomial order is 2; ③ Max-min normalization: The smoothed spectral intensity values are normalized to the [0,1] interval; After preprocessing, the correlation between the characteristic peak intensity changes and the adulteration type and adulteration concentration is analyzed, providing a high-quality data foundation for the subsequent construction of a three-dimensional training data cube.
[0073] In one feasible implementation, for each adulteration concentration, step (2.2) constructs a three-dimensional training data cube corresponding to the adulteration type based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under the adulteration type. This includes: constructing a blank three-dimensional data cube containing wavenumber, adulteration concentration, and temperature dimensions; wherein the blank three-dimensional data cube contains a first number of wavenumber points in the wavenumber dimension, a second number of adulteration concentration points in the adulteration concentration dimension, and a third number of temperature points in the temperature dimension; and filling the blank three-dimensional data cube with the Raman spectral intensity values of the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under the adulteration type according to the corresponding wavenumber, concentration, and temperature values to obtain the three-dimensional training data cube.
[0074] Optionally, the core parameters of the three-dimensional dimensions of the blank three-dimensional data cube are determined. For example, the first quantity is 398, the second quantity is 6, and the third quantity is 8, thus constructing a blank three-dimensional data cube with dimensions of 398×8×6. Specifically, the wavenumber dimension includes 800-1800 cm⁻¹. -1 The system includes 398 pre-set wavenumber points in the range; 8 pre-set temperature points in the temperature dimension, namely 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃; and 6 adulteration concentration gradients in the adulteration concentration dimension, namely 0%, 5%, 10%, 15%, 20%, and 25%.
[0075] Furthermore, it can be understood that the Raman spectral intensity value of each milk fat sample corresponds to the adulteration concentration of that milk fat sample, the preprocessing temperature of the milk fat subsample when acquiring the Raman spectral data, and the wave value corresponding to that Raman spectral intensity value. Therefore, according to the corresponding adulteration concentration value, preprocessing temperature value, and wave value, the Raman spectral intensity value is filled into the aforementioned constructed blank three-dimensional data cube, thereby obtaining a standardized three-dimensional training data cube with dimensions of 398×8×6.
[0076] In one feasible implementation, for each three-dimensional training data cube, step (2.3) determines the three-dimensional training synchronization correlation spectrum based on the three-dimensional training data cube, including: (3.1) For each wavenumber point and each adulterant concentration in the three-dimensional training data cube, calculate the average Raman spectral intensity of the wavenumber point at all temperature points under the adulterant concentration, and use the average Raman spectral intensity as the reference benchmark for the wavenumber point under the adulterant concentration; (3.2) For each wavenumber point, each adulterant concentration, and each preset temperature condition in the three-dimensional data cube, subtract the reference value of the wavenumber point at the adulterant concentration from the Raman spectral intensity value of the wavenumber point at the adulterant concentration and the temperature condition to obtain the dynamic spectral value of the wavenumber point at the adulterant concentration and the temperature condition. (3.3) For any two wavenumber points forming a wavenumber pair, calculate the product of the dynamic spectral values of the two wavenumber points at each temperature point under the same doping concentration, sum the product results corresponding to all temperature points, and then divide by the difference between the number of temperature points and one to obtain the synchronous correlation strength of the two wavenumber points under the doping concentration. (3.4) For each adulteration concentration, iterate through all wavenumber pair combinations, calculate the synchronization correlation strength between each pair of wavenumber points, and fill it into the blank three-dimensional synchronization correlation spectrum containing the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension to obtain the three-dimensional training synchronization correlation spectrum.
[0077] For example, based on the aforementioned three-dimensional training data cube with dimensions of 398×8×6, the three-dimensional synchronization correlation spectrum is calculated using the Noda rule. The expression for calculating the three-dimensional synchronization correlation spectrum is:
[0078] In the formula, Indicates a specific adulteration concentration The strength of synchronous correlation under the following conditions; and Represents any two wavenumber points; T is the preset temperature condition set; t is the temperature dimension index; and These represent specific adulteration concentrations. Down and Dynamic spectral values at wavenumber points.
[0079] In this embodiment, the three-dimensional synchronous correlation spectrum aims to capture the nonlinear cooperative response of the wavenumber axis under combined temperature and concentration perturbations. Compared to the superposition of two-dimensional correlation spectra under single perturbation, this three-dimensional synchronous correlation spectrum structure can distinguish between temperature-induced crystal conformational changes and compositional ratio changes caused by doping in a multi-dimensional coordinate system, achieving spatial decoupling of temperature interference signals and concentration characteristic signals.
[0080] The following example illustrates steps (3.1) to (3.4) using a three-dimensional training data cube with dimensions of 398×8×6 and the above calculation expression.
[0081] For step (3.1), taking a 5% doping concentration and the first wavenumber point as an example, at a 5% doping concentration, extract the eight Raman spectral intensities corresponding to the eight temperature points at the first wavenumber point. Sum these eight Raman spectral intensities and take the average to obtain the average Raman spectral intensity at the first wavenumber point at a 5% doping concentration, which serves as a reference. For step (3.2), subtract the average Raman spectral intensity obtained in step (3.1) from the Raman spectral intensity at each temperature point corresponding to the 5% doping concentration and the first wavenumber point to obtain eight dynamic spectral values. The dynamic spectral values at a 5% doping concentration, the first wavenumber point, and 5℃ can be expressed as follows: Based on steps (3.1) and (3.2), 398×8×6 dynamic spectral values can be obtained, each of which corresponds to an adulteration concentration index, a wavenumber point index, and a temperature index.
[0082] For step (3.3), taking the calculation of the synchronization correlation strength between the first and third wavenumber points at a 5% adulteration concentration as an example, there are 8 dynamic spectral values at the first wavenumber point and 8 dynamic spectral values at the third wavenumber point. Multiplying the two dynamic spectral values at the same temperature yields 8 product results. Adding these 8 product results and dividing by 7 gives the synchronization correlation strength between the first and third wavenumber points at a 5% adulteration concentration, which is characterized as follows: Based on step (3.3), it can be seen that each adulteration concentration corresponds to 398×398 synchronous correlation intensities.
[0083] For step (3.4), the 398×398 synchronization correlation intensities corresponding to each adulteration concentration are filled into a pre-constructed blank three-dimensional synchronization correlation spectrum containing the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension, according to the adulteration concentration index and the two wavenumber point indices. This yields a three-dimensional training synchronization correlation spectrum with a structure of 398×398×6. Here, 398 corresponds to the number of wavenumber points in the two wavenumber dimensions, and 6 corresponds to the number of concentration points in the adulteration concentration dimension.
[0084] In one feasible implementation, for each three-dimensional training synchronous correlation spectrum, step (2.4) uses a sliding window to cut the three-dimensional training synchronous correlation spectrum along the doping concentration dimension to generate multiple three-dimensional training sub-cube samples, including: A first virtual concentration point is added before the starting concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the first virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the starting concentration point; and a second virtual concentration point is added after the ending concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the second virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the ending concentration point. For the new three-dimensional training synchronous correlation spectrum formed by adding a first virtual concentration point and a second virtual concentration point, a sliding window with a preset depth is used to slide and traverse the new three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension with a preset step size. Each slide extracts the synchronous correlation spectrum data corresponding to the concentration point covered by the sliding window to obtain the corresponding three-dimensional training sub-cube sample. Among them, the three-dimensional training sub-cube sample obtained by each slide is associated with the adulteration concentration label according to the center concentration of the concentration point covered by the sliding window.
[0085] In this embodiment, taking a three-dimensional training synchronous correlation spectrum with a structure of 398×398×6 as an example, the concentration sequence includes 6 concentration points: 0%, 5%, 10%, 15%, 20%, and 25%, with the starting concentration point being 0% and the ending concentration point being 25%.
[0086] Based on the 3D input requirements of the 3D convolutional neural network model, the sliding window size is designed to be 398×398×3, where the depth of 3 corresponds to the local evolution window of the concentration perturbation axis. This ensures that the obtained 3D subcube samples retain local wavenumber correlation while possessing dynamic trend characteristics on the concentration gradient, providing spatially continuous feature input for subsequent 3D convolution operations.
[0087] Without adding virtual concentrations, using a sliding window of size 398×398×3 with a sliding step size of 1, the 3D training synchronization correlation spectrum of dimension 398×398×6 can be segmented into four 3D training sub-cube samples of dimension 398×398×3. The first 3D training sub-cube sample corresponds to the 3D training synchronization correlation spectrum with adulteration concentrations of 0%, 5%, and 10%. Based on the principle of central concentration dominance, the first 3D training sub-cube sample is associated with the 5% adulteration concentration label.
[0088] Similarly, the second 3D sub-cube sample corresponds to the 3D training synchronization correlation spectrum with adulteration concentrations of 5%, 10%, and 15%, and is associated with the 10% adulteration concentration label. The third 3D sub-cube sample corresponds to the 3D training synchronization correlation spectrum with adulteration concentrations of 10%, 15%, and 20%, and is associated with the 15% adulteration concentration label. The fourth 3D sub-cube sample corresponds to the 3D training synchronization correlation spectrum with adulteration concentrations of 15%, 20%, and 25%, and is associated with the 20% adulteration concentration label.
[0089] To associate the adulteration concentrations of 0% and 25%, a first virtual concentration point is added before the initial concentration point of 0%. The synchronization correlation spectrum corresponding to this first virtual concentration point is determined based on the synchronization correlation spectrum data corresponding to the initial concentration point of 0%. For example, it is filled using the mean of all synchronization correlation intensities within the synchronization correlation spectrum corresponding to the adulteration concentration of 0%. Thus, a three-dimensional training sub-cube sample can be obtained, consisting of the first virtual concentration point and the three-dimensional training synchronization correlation spectra corresponding to 0% and 5%, which is associated with the adulteration concentration label of 0%.
[0090] Similarly, for the 25% termination concentration point, a second virtual concentration point is added after it. The synchronization correlation spectrum corresponding to this second virtual concentration point is determined based on the synchronization correlation spectrum data corresponding to the 25% termination concentration point. For example, the average value of all synchronization correlation intensities within the synchronization correlation spectrum corresponding to the 25% adulteration concentration is used for filling. Thus, a three-dimensional training sub-cube sample can be obtained, consisting of the three-dimensional training synchronization correlation spectra corresponding to the 20%, 25%, and second virtual concentration points, which is associated with the 25% adulteration concentration label.
[0091] In one feasible implementation, step (2.5) takes the three-dimensional training sub-cube samples as input, and the adulteration type label and adulteration concentration label as output, and trains the three-dimensional convolutional neural network to obtain the three-dimensional milk fat adulteration detection network, including steps (4.1) to (4.3).
[0092] (4.1) Input three-dimensional training sub-cube samples into the three-dimensional convolutional neural network to obtain the adulteration type prediction results and adulteration concentration prediction results; (4.2) The first difference between the adulteration type prediction result and the associated adulteration type label is calculated using the cross-entropy loss function, and the second difference between the adulteration concentration prediction result and the associated adulteration concentration label is calculated using the mean squared error loss function; (4.3) Based on the first difference and the second difference, determine whether the preset stopping condition is met. If the preset stopping condition is met, stop the iterative training of the three-dimensional convolutional neural network and use the currently trained three-dimensional convolutional neural network as the three-dimensional milk fat adulteration detection network. Otherwise, based on the first difference and the second difference, update the parameters of the three-dimensional convolutional neural network using the backpropagation algorithm, and input the three-dimensional training sub-cube samples into the three-dimensional convolutional neural network after updating the parameters. Repeat the steps of calculating the first difference and the second difference and updating the parameters until the preset stopping condition is met.
[0093] In this embodiment, a three-dimensional convolutional neural network is trained to obtain a three-dimensional milk fat adulteration detection network. The convolutional kernels of the three-dimensional convolutional neural network slide synchronously in three dimensions: wavenumber space, concentration evolution axis, and so on, enabling parallel extraction of high-dimensional coupling features from the three-dimensional training synchronous correlation spectrum tensor. This network architecture maintains isomorphism with the data topology of the three-dimensional training synchronous correlation spectrum, avoiding the loss of spatial structure information caused by dimensionality reduction and flattening in traditional regression models.
[0094] Figure 3 This is a schematic diagram of the structure of a three-dimensional convolutional neural network provided in an embodiment of the present invention. Optionally, the three-dimensional convolutional neural network includes three three-dimensional convolutional blocks, namely a first three-dimensional convolutional block, a second three-dimensional convolutional block, and a third three-dimensional convolutional block. Each three-dimensional convolutional block includes a three-dimensional convolutional layer (Conv3D), a batch normalization layer (BatchNormalization), an activation layer (ReLU), and a pooling layer (MaxPooling3D) connected in sequence. The output of the first three-dimensional convolutional block is connected to the input of the second three-dimensional convolutional block, and the output of the second three-dimensional convolutional block is connected to the input of the third three-dimensional convolutional block. Here, the number of convolutional kernels in the three three-dimensional convolutional blocks can be set to 16, 32, and 64 respectively, and the size of each is 3×3×3. The first three-dimensional convolutional block can accurately capture local synchronization spectrum details near the feature wavenumber, the second three-dimensional convolutional block can effectively mine the interaction relationship between concentration and synchronization spectrum features, and the third three-dimensional convolutional block realizes the fusion of multi-dimensional coupled features.
[0095] The output of the third 3D convolutional block is connected to the input of the global pooling layer. The output of the global pooling layer is connected to the input of the first fully connected layer. The output of the first fully connected layer is connected to the input of the random deactivation layer. The output of the random deactivation layer is connected to the input of the second fully connected layer. The output of the second fully connected layer is connected to the output layer, which includes a flexible maximum layer for outputting the adulteration type and a single-neuron linear layer for outputting the adulteration concentration.
[0096] like Figure 3 As shown, the third 3D convolutional block is followed by a global pooling layer (GlobalAveragePooling3D) to compress the feature map into a 64-dimensional feature vector. This is then followed by a first fully connected layer with 64 neurons (Dense 64) and a second fully connected layer with 32 neurons (Dense 32). A dropout layer is embedded between the first and second fully connected layers to suppress overfitting. The output layer is configured differently depending on the task: a softmax layer is used for qualitative tasks to output the predicted adulteration type probability, while a single-neuron linear layer is used for quantitative tasks to output the concentration prediction value.
[0097] The mathematical expression for 3D convolution is:
[0098] in It is the input data. It is a convolution kernel with dimension 1. , It is the position index in the output feature map.
[0099] The input layer receives 3D sub-cube samples with dimensions of 398×398×3, and uses channel-wise normalization preprocessing. The normalization formula is: ,in To obtain the global mean of the training set, The global standard deviation of the training set.
[0100] In the training parameters, the Adam optimizer was selected, and the initial learning rate was set to 5×10. -4 Quantitative analysis was performed using the mean squared error (MSE) loss function, and qualitative analysis was performed using the cross-entropy loss function. L2 regularization and Dropout layers were enabled. An early stopping strategy was introduced, with a patience value set to 20 and a minimum improvement threshold (min_delta) set to 1×10. -4 Training is terminated when the validation set loss function no longer improves after 20 consecutive training epochs; a reduction in validation set loss less than this threshold is considered as no improvement. A learning rate decay strategy (ReduceLROnPlateau) is introduced, with a patience value of 15, a decay coefficient of 0.7, and a minimum learning rate of 1×10⁻⁶. -7 That is, when the validation set loss function no longer improves after 15 consecutive training epochs, the current learning rate is multiplied by a decay factor of 0.7, and the lower limit of the learning rate is set to 1×10. -7 During training, the batch size is set to 8, meaning that 8 samples are processed simultaneously in each iteration before updating the network parameters; the maximum number of training epochs is set to 200, meaning that all training data is traversed a maximum of 200 times, and a graphics processing unit (GPU) is used to accelerate training and shorten training time.
[0101] For example, in this embodiment, a total of 2160 three-dimensional training sub-cube samples are generated, of which 1296 (60%) are used as the training set, 432 (20%) as the validation set, and 432 (20%) as the test set. The training set is used to train the three-dimensional milk fat adulteration detection network, i.e., to iteratively optimize the network parameters to make the model fit the training data; the validation set is used to evaluate the model's generalization ability during training, and to adjust hyperparameters or decide whether to stop training early based on the performance on the validation set; the test set is used to evaluate the model's final performance after training is completed, and to verify the model's detection effect on unknown data.
[0102] Tests have verified that the aforementioned 3D-CNN-based 3D milk fat adulteration detection network significantly outperforms 1D-CNN (which extracts linear features), 2D-CNN (which extracts only 2D planar features), and traditional machine learning models such as PLSR, SVR, and extreme gradient boosting (XGBoost) in extracting the 3D coupled features of the 3D synchronous correlation spectrum. Furthermore, the quantitative detection determination coefficient R0 is significantly higher. 2 A value consistently above 0.99 indicates excellent quantitative detection capability.
[0103] In summary, the milk fat adulteration detection method based on Raman spectroscopy and three-dimensional synchronous correlation spectroscopy combined with a three-dimensional convolutional neural network provided by this invention constructs an integrated detection framework encompassing multi-temperature preprocessing, Raman spectral acquisition, high-dimensional analysis of the three-dimensional synchronous correlation spectrum, and three-dimensional convolutional neural network modeling. This framework enables accurate qualitative and quantitative detection of palm oil and hydrogenated vegetable oil adulteration in milk fat. This invention solves the technical problems of weak anti-interference and insufficient feature extraction in conventional Raman spectroscopy detection. By constructing a three-dimensional synchronous correlation spectrum based on a wavenumber-temperature-concentration three-dimensional training data cube and a three-dimensional convolutional neural network adapted to the high-dimensional features of the three-dimensional synchronous correlation spectrum, it collaboratively achieves in-depth mining and accurate identification of milk fat adulteration features, exhibiting high detection accuracy and high stability.
[0104] This invention is not a simple superposition of single detection technologies and algorithms, but rather constructs a dual perturbation model of "temperature-concentration," utilizing the sensitivity of three-dimensional synchronous correlation spectrum to composite perturbations to achieve spatial decoupling between environmental interference factors and concentration target factors. Furthermore, it leverages the topological isomorphism between the three-dimensional convolutional architecture of a three-dimensional convolutional neural network and the three-dimensional synchronous correlation spectrum tensor data to solve the problem of spatial structure information loss in high-dimensional feature extraction by traditional flattening algorithms. By constructing a linkage mechanism between temperature, concentration, and spectrum, and a deep adaptation analysis framework centered on a three-dimensional convolutional neural network, it achieves accurate qualitative identification of adulteration in palm oil and hydrogenated vegetable oil, and high-precision quantitative prediction of adulteration concentrations from 0% to 25%, providing a feasible high-dimensional spectral detection technology for dairy fat adulteration, meeting the needs of dairy product quality control.
[0105] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0106] The following are experimental data related to the milk fat adulteration detection method provided in the embodiments of the present invention, which are used to verify the effectiveness of milk fat adulteration detection based on three-dimensional synchronous correlation spectrum.
[0107] First, the three-dimensional asynchronous correlation spectrum involved in the subsequent verification analysis is introduced. The three-dimensional synchronous correlation spectrum reflects the degree of coordinated change in Raman spectral intensities at different wavenumbers, while the three-dimensional asynchronous correlation spectrum reflects the sequential change of Raman spectral intensities at different wavenumbers under external perturbations. In other words, by analyzing the three-dimensional asynchronous correlation spectrum, the response time sequence of different molecular functional group vibrational modes to external perturbations can be determined. Comprehensive analysis of the three-dimensional synchronous and asynchronous correlation spectra allows for the differentiation of the contributions of temperature perturbations and doping concentration perturbations to the spectral characteristics.
[0108] Specifically, the calculation expression for the three-dimensional asynchronous correlation spectrum is as follows:
[0109] in, Indicates a specific adulteration concentration The strength of asynchronous correlation; Represents the Hilbert transform operator; and Represents any two wavenumber points; T is the preset temperature condition set; t is the temperature dimension index; and These represent specific adulteration concentrations. Down and Dynamic spectral values at wavenumber points.
[0110] Figure 4A This is a schematic diagram of the Raman spectra of pure milk fat under different temperature perturbations provided in the embodiments of the present invention; Figure 4B This is a schematic diagram of the Raman spectra of different concentrations of adulterated palm oil at 25 degrees Celsius, provided in an embodiment of the present invention. Figure 4A As shown, pure milk fat is between 800-1800 cm³. -1 The Raman spectral characteristic peaks within the range correspond to well-defined molecular vibrational modes, with the 960 cm⁻¹ peak being the most prominent. -1 Characteristic peaks, serving as specific probes of the orderliness of pure milk fat crystals, originate from the C / C backbone stretching vibrations of long fat molecular chains and are highly sensitive to the molecular chain conformation and their packing density. 25℃ is the optimal crystallization temperature for pure milk fat; under other temperature conditions, the ordered packing of pure milk fat molecular chains is disrupted, leading to peaks at 960 cm⁻¹. -1The intensity of the characteristic peaks decreased by nearly 50% compared to the optimal crystallization state, and even peak broadening or peak splitting occurred; meanwhile, the intensity of the peaks at 1443 cm⁻¹ decreased. -1 The characteristic peak intensity fluctuation is less than 10%, indicating that temperature mainly affects the orderliness of the crystal, but has no significant effect on the total amount of fat.
[0111] like Figure 4B As shown, at 25 degrees Celsius, pure milk fat has a density of 960 cm⁻¹. -1 A distinct peak is observed at this point. As the adulterant concentration increases, the uniformity of the pure milk fat crystal network is disrupted, and crystal defects increase, leading to a peak at 960 cm⁻¹. -1 The peak intensity decreased significantly; when the adulterant concentration increased to 25%, the intensity of this characteristic peak decreased by more than 70%, and peak splitting occurred. Although both temperature and adulterant concentration affect the 960 cm⁻¹ peak intensity... -1 The mechanism of action of the characteristic peak is to reduce the orderliness of aliphatic crystals, but the response characteristics of the two are significantly different: when the adulterant concentration reaches 25%, the peak is 960 cm⁻¹. -1 The peak intensity decreased by over 70%, while the decrease was only close to 50% when the optimal crystallization state was disrupted by temperature changes. This indicates that the characteristic peak is significantly more sensitive to adulteration concentration disturbances than to temperature. Furthermore, temperature changes primarily affect peak intensity and shape, with some temperature conditions leading to the addition or shift of the characteristic peak; while adulteration concentration disturbances not only cause peak splitting but also affect the peak shape through the 1156 cm⁻¹ peak. -1 1519cm -1 1655cm -1 The difference in the rise and fall of characteristic peaks effectively distinguishes the adulteration of palm oil from that of hydrogenated vegetable oil, demonstrating a higher value in adulteration identification.
[0112] Calculation results show that the three-dimensional asynchronous correlation spectrum can accurately determine the order of characteristic peak changes, and the 960 cm⁻¹ peak in pure milk fat samples... -1 The peak change (triglyceride molecular chain vibration) precedes the change at 1655 cm⁻¹. -1 The peak (C=C stretching vibration) is present, but this order differs in adulterated samples, effectively avoiding misjudgments caused by temperature interference in conventional Raman spectroscopy. Simultaneously, the 960 cm⁻¹ peak in the three-dimensional synchronous spectrum... -1 1655cm -1 The change in the autocorrelation peak intensity (i.e., the synchronous correlation intensity corresponding to two identical wavenumber points) with increasing adulteration concentration provides a reliable characteristic basis for qualitative identification and quantitative prediction.
[0113] To visually illustrate the perturbation mechanism of temperature on the spectral response of pure milk fat, concentration slices were extracted and displayed under the condition of 0% adulteration (pure milk fat). Figure 4C This is a slice of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum of the first batch of pure milk fat under temperature perturbation provided in the embodiments of the present invention; Figure 4DThis is a slice of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum of the second batch of pure milk fat under temperature perturbation, provided in an embodiment of the present invention. Figure 4C and 4D As shown, the horizontal and vertical axes represent Raman shifts, and the color intensity represents the correlation coefficient, with red indicating a positive correlation and blue indicating a negative correlation. At 960cm... -1 The red core region and strong positive correlation confirm that this peak serves as the core response target for temperature perturbations; at (960cm) -1 1443cm -1 The blue matching region shows a clear negative correlation, reflecting that when temperature disrupts the crystal's order, the ordered vibrations of the CC skeleton weaken, while the proportion of disordered vibrations of the CH2 group increases. This coupling change reflects the dynamic adjustment of the milk fat molecule conformation under temperature changes. At 1655 cm⁻¹ -1 Only weak correlation signals were observed in the relevant regions, indicating that the vibrations of unsaturated fatty acids are far less sensitive to temperature perturbations than the vibrations of the fatty acid chain skeleton. Analysis of the impact mechanism of temperature perturbations on milk fat molecules using three-dimensional synchronous correlation spectral slices provides multidimensional evidence for subsequent differentiation between temperature perturbations and adulteration concentration perturbations.
[0114] Figure 5A Three-dimensional synchronous correlation spectrum of a palm oil adulterated milk fat sample provided in an embodiment of the present invention; Figure 5B for Figure 5A A slice plot of the adulteration concentration dimension of the three-dimensional synchronous correlation spectrum. Figure 5C The bar chart shows the correlation intensity changes of different characteristic peaks in a milk fat sample of palm oil adulteration type provided in an embodiment of the present invention.
[0115] The compositional differences between palm oil and hydrogenated vegetable oil result in unique response patterns in their corresponding three-dimensional synchronous correlation spectra. For example... Figure 5A , Figure 5B and Figure 5C As shown, the correlation characteristics of the three-dimensional synchronous correlation spectrum evolved in three stages as the adulteration concentration of palm oil increased: in the low-concentration (0%–5%) adulteration stage, the characteristic correlation region of pure palm oil (960 cm⁻¹) evolved. -1 1519cm -1 The correlation intensity gradually weakens, while new weak correlation signals begin to appear, indicating that the introduction of palm oil components begins to dilute the intrinsic spectral response of pure milk fat, and the system enters the initial mixing stage of milk fat and palm oil. In the medium concentration (10%-15%) adulteration stage, the correlation intensity significantly increases, reaching 960 cm⁻¹. -1 1120cm -1 1443cm -1The presence of a deep red, strongly correlated region indicates the most significant interaction between milk fat and palm oil, with the dynamic correlation of the spectral signal reaching its peak. During the high-concentration (20%-25%) adulteration stage, the original strongly correlated red region weakens, while the blue negatively correlated region increases, corresponding to the increased proportion of palm oil in the system. Since palm oil is mainly composed of saturated fatty acids and no new functional groups are introduced, it only affects the intrinsic vibrational mode of milk fat, 1655 cm⁻¹. -1 The intensity of the wavenumber correlation spectrum first decreases, then increases, and then gradually decreases again as the concentration increases.
[0116] Figure 6A Three-dimensional synchronous correlation spectrum of a milk fat sample adulterated with hydrogenated vegetable oil provided in an embodiment of the present invention; Figure 6B for Figure 6A Doping concentration dimension slice of three-dimensional synchronous correlation spectrum. Figure 6C A bar chart showing the correlation intensity changes of different characteristic peaks in a milk fat sample adulterated with hydrogenated vegetable oil, provided in an embodiment of the present invention.
[0117] like Figure 6A , Figure 6B and Figure 6C As shown, the hydrogenated vegetable oil in vegetable shortening contains unsaturated fatty acids and hydrogenated fats, 960cm - ¹The intensity of the regional correlation spectrum exhibits a slope-like change with increasing concentration. This is due to the introduction of heterounsaturated fats in hydrogenated vegetable oils, at 1655 cm⁻¹. - ¹The correlation spectral intensity in the wavenumber region exhibits a fluctuation of first increasing and then decreasing: in the 10%–15% concentration slice, at 1655 cm⁻¹ - ¹ A light red to dark red signal appears in the region, indicating a new vibrational correlation between the unsaturated components of milk fat and hydrogenated vegetable oil; when the concentration further increases to 20%–25%, the intensity of the correlation spectrum in this region gradually decreases.
[0118] The joint representation of wavenumber space and concentration in three-dimensional synchronous correlation spectroscopy overcomes the limitations of single Raman spectroscopy. Its wavenumber space dimension locks in the characteristic wavenumber pairs of milk fat or adulterants, while the adulteration concentration dimension explains the gradient variation of correlation spectrum intensity. The correlation spectrum intensity-concentration mapping relationship formed by the coupling of these two dimensions not only provides a strong distinguishing feature for the qualitative classification of adulterated palm oil and hydrogenated vegetable oil, but also lays the core feature foundation for subsequent 3D-CNN models to capture the quantitative correspondence between correlation spectrum intensity and adulteration concentration, achieving accurate prediction of adulteration concentrations from 0% to 25%. In this invention, the temporal information provided by three-dimensional asynchronous correlation spectroscopy has limited effect on adulteration identification and quantitative prediction; therefore, the analysis is centered on three-dimensional synchronous correlation spectroscopy.
[0119] The following section compares the performance of several different models using the three-dimensional training synchronization correlation spectrum constructed in this invention. This includes the 3D-CNN (three-dimensional convolutional neural network) used in the embodiments of this invention, as well as 1D-CNN (one-dimensional convolutional neural network), 2D-CNN (two-dimensional convolutional neural network), PLSR (partial least squares regression), SVR (support vector regression), and XGBoost (extreme gradient boosting) as comparisons.
[0120] The training data for each model is as follows: PLSR, SVR, and XGBoost models: Preprocessing was performed on each model (cropping 800-1800cm). -1 The Raman spectral data obtained by (interval correction, baseline correction, SG smoothing, and maximum-minimum normalization) and the three-dimensional training synchronous correlation spectrum constructed in the embodiments of the present invention are used for training.
[0121] 1D-CNN model: The input is a one-dimensional feature sequence after the three-dimensional training synchronous correlation spectrum constructed in the embodiment of the present invention is expanded along the concentration dimension.
[0122] 2D-CNN model: The three-dimensional training synchronous correlation spectrum constructed in this embodiment of the invention is used as input for two-dimensional synchronous correlation spectrum slices at various concentrations.
[0123] 3D-CNN model: The 3D training sub-cube samples, which are obtained by cutting the 3D training synchronous correlation spectrum through a sliding window as constructed in the embodiments of the present invention, are used as input.
[0124] In terms of qualitative detection, traditional multivariate analysis methods were used to perform preliminary classification of the three-dimensional training synchronous correlation spectrum. Figure 7 The results of multivariate analysis of the three-dimensional training synchronous correlation spectrum are provided by the method in the embodiments of the present invention.
[0125] Specifically, principal component analysis (PCA), partial least squares discriminant analysis (PLS-DA), and orthogonal partial least squares discriminant analysis (OPLS-DA) models were constructed using SIMCA software, and their score graphs are shown below. Figure 7 Subgraphs A to C are shown in the figure. Among them, the green dots concentrated on the left side of each subgraph from A to C represent samples adulterated with palm oil, and the blue dots concentrated on the right side of each subgraph from A to C represent samples adulterated with hydrogenated vegetable oil.
[0126] PCA score chart ( Figure 7 Subplot A shows that there is some overlap between the palm oil adulterated sample and the hydrogenated vegetable oil adulterated sample; PLS-DA score plot ( Figure 7 In subplot B), the separation of the two classes of samples is improved compared to PCA; OPLS-DA score plot ( Figure 7In subgraph C), the two classes of samples were completely separated. These results demonstrate that the three-dimensional synchronous correlation spectrum data constructed in this embodiment of the invention possesses good classification potential.
[0127] Furthermore, the three-dimensional convolutional neural network model proposed in this embodiment of the invention is used for accurate classification, and its confusion matrix is as follows: Figure 8 As shown, the horizontal axis, from left to right, represents the types of adulteration with palm oil and hydrogenated vegetable oil, respectively; the vertical axis, from bottom to top, also represents the types of adulteration with palm oil and hydrogenated vegetable oil, respectively. According to this confusion matrix, the model achieves 100% accuracy in distinguishing between both types of adulteration with palm oil and hydrogenated vegetable oil on the test set.
[0128] In terms of quantitative testing, each model was trained, validated, and tested according to the input data types of the aforementioned models. The evaluation metrics for each trained model are shown in the table below:
[0129] The table uses the following three indicators for evaluation: Coefficient of determination (R) 2 ): Measures the degree of fit between the model's predicted value and the actual value. The value ranges from [0,1]. The closer the value is to 1, the higher the accuracy of the model's prediction.
[0130] Root Mean Square Error (RMSE): Measures the average deviation between the model's predicted value and the actual value, expressed as a percentage. The smaller the value, the smaller the model's prediction error.
[0131] Relative Analysis Error (RPD): The ratio of sample standard deviation to root mean square error. Generally, an RPD greater than 3.0 indicates that the model has good predictive ability, and an RPD greater than 5.0 indicates that the model has excellent predictive ability.
[0132] In the table, R is one of the evaluation indicators. 2 The subscript letter 'c' indicates qualitative detection, and the subscript letter 'p' indicates quantitative detection; in the evaluation index RMSE, the suffix letter 'c' indicates qualitative detection, and the suffix letter 'p' indicates quantitative detection.
[0133] Comparing PLSR models using two different training data: As shown in the table, the PLSR model using preprocessed Raman spectroscopy data as training data achieves higher quantitative detection rates for palm oil adulteration. =0.829, RMSEp=3.460%, RPD=2.418; Quantitative detection of adulteration in hydrogenated vegetable oil. =0.823, RMSEp=3.516%, RPD=2.379. The PLSR model, constructed using the three-dimensional training synchronous correlation spectrum as training data in this embodiment of the invention, is used for the quantitative detection of palm oil adulteration. =0.915, RMSEp=2.482%, RPD=3.440; Quantitative detection of adulteration in hydrogenated vegetable oil. =0.933, RMSEp=2.208%, RPD=3.867. The PLSR model constructed using the three-dimensional training synchronous correlation spectrum constructed in this embodiment of the invention as training data has relatively high detection accuracy, which is inferred to be due to temperature interference and insufficient feature extraction.
[0134] The 3D-CNN model used in this embodiment of the invention is for the quantitative detection of palm oil adulteration. =0.997, RMSEp=0.468%, RPD=18.254; Quantitative detection of adulteration in hydrogenated vegetable oil. =0.998, RMSEp=0.396%, RPD=21.572. The SVR model, constructed using the three-dimensional training synchronous correlation spectrum constructed in this embodiment of the invention as training data, was used to quantitatively detect adulteration in palm oil. =0.927, RMSEp=2.300%, RPD=3.713, quantitative detection of adulteration in hydrogenated vegetable oil =0.941, RMSEp=2.081%, RPD=4.103. It can be seen that the detection performance of the SVR model is lower than that of the 3D-CNN model, presumably because traditional machine learning algorithms struggle to fully extract 3D features.
[0135] The comparisons are not listed here, but the table above shows that the 3D-CNN model trained based on the three-dimensional training synchronous correlation spectrum in the embodiments of the present invention has good quantitative and qualitative detection capabilities that are superior to other models.
[0136] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0137] Figure 9 A schematic diagram of the structure of the milk fat adulteration detection device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below: like Figure 9 As shown, the milk fat adulteration detection device includes: The acquisition module 901 is used to acquire Raman spectral data of each sample taken from the milk fat product to be tested under multiple preset temperature conditions. The processing module 902 is used to construct a three-dimensional data cube of the milk fat product to be tested based on the Raman spectral data of multiple samples to be tested. The processing module 902 is also used to determine the three-dimensional synchronous correlation spectrum of the milk fat product to be tested based on the three-dimensional data cube of the milk fat product to be tested; The processing module 902 is also used to obtain the adulteration type and adulteration concentration of the milk fat product to be tested based on the three-dimensional synchronous correlation spectrum of the milk fat product to be tested and the pre-trained three-dimensional milk fat adulteration detection network; wherein, the three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations.
[0138] In one feasible implementation, the acquisition module 901 is further configured to acquire Raman spectral data of each of the multiple pre-prepared milk fat samples under multiple preset temperature conditions; wherein, the multiple milk fat samples cover multiple adulteration types, and each adulteration type contains multiple different preset adulteration concentrations; The processing module 902 is also used to construct a three-dimensional training data cube corresponding to each adulteration type based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under that adulteration type. The processing module 902 is also used to determine the three-dimensional training synchronization correlation spectrum based on each three-dimensional training data cube. The processing module 902 is also used to cut the three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension using a sliding window for each three-dimensional training synchronous correlation spectrum, generating multiple three-dimensional training sub-cube samples, each of which is associated with an adulteration type label and an adulteration concentration label. The processing module 902 is also used to train a three-dimensional convolutional neural network by taking three-dimensional training sub-cube samples as input and adulteration type labels and adulteration concentration labels as output, so as to obtain a three-dimensional milk fat adulteration detection network.
[0139] In one feasible implementation, the acquisition module 901 is specifically used to acquire the Raman spectrum of each milk fat sample under each preset temperature condition, so as to obtain multiple Raman spectra corresponding to multiple preset temperature conditions. The acquisition module 901 is further used to extract the target feature spectrum within a preset wavenumber range for each Raman spectrum, and to perform baseline correction processing, smoothing filtering processing, and spectral intensity value normalization processing on the target feature spectrum in sequence to obtain the Raman spectral data corresponding to the Raman spectrum.
[0140] In one feasible implementation, the processing module 902 is specifically used to construct a blank three-dimensional data cube containing wavenumber dimension, adulteration concentration dimension and temperature dimension; wherein, the blank three-dimensional data cube contains a first number of wavenumber points in the wavenumber dimension, a second number of adulteration concentration points in the adulteration concentration dimension, and a third number of temperature points in the temperature dimension. The processing module 902 is further used to fill the Raman spectral intensity values of the Raman spectral data corresponding to multiple milk fat samples with different preset adulteration concentrations under the adulteration type into a blank three-dimensional data cube according to the corresponding wave value, concentration value and temperature value, so as to obtain a three-dimensional training data cube.
[0141] In one feasible implementation, the processing module 902 is specifically used to calculate the average Raman spectral intensity of each wavenumber point and each adulterant concentration at all temperature points of the wavenumber point at the adulterant concentration, and to use the average Raman spectral intensity as a reference benchmark for the wavenumber point at the adulterant concentration for each wavenumber point and each adulterant concentration in the three-dimensional training data cube. The processing module 902 is further used to subtract the reference value of the wavenumber point at the adulteration concentration and the temperature condition from the Raman spectral intensity value of the wavenumber point at the adulteration concentration and the temperature condition for each wavenumber point, each adulteration concentration and each preset temperature condition in the three-dimensional data cube, so as to obtain the dynamic spectral value of the wavenumber point at the adulteration concentration and the temperature condition. The processing module 902 is further used to calculate the product of the dynamic spectral values of the two wavenumber points at each temperature point for any two wavenumber points under the same doping concentration, sum the product results corresponding to all temperature points, and then divide by the difference between the number of temperature points and one to obtain the synchronous correlation intensity of the two wavenumber points under the doping concentration. The processing module 902 is further used to, for each adulteration concentration, traverse all wavenumber pair combinations, calculate the synchronization correlation strength between each pair of wavenumber points, and fill it into a blank three-dimensional synchronization correlation spectrum containing the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension to obtain a three-dimensional training synchronization correlation spectrum.
[0142] In one feasible implementation, the processing module 902 is specifically used to add a first virtual concentration point before the starting concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, wherein the synchronous correlation spectrum data corresponding to the first virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the starting concentration point; and to add a second virtual concentration point after the ending concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, wherein the synchronous correlation spectrum data corresponding to the second virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the ending concentration point. The processing module 902 is further configured to use a sliding window of preset depth to traverse the new three-dimensional training synchronous correlation spectrum formed by adding a first virtual concentration point and a second virtual concentration point along the adulteration concentration dimension. Each time the sliding window is used, the synchronous correlation spectrum data corresponding to the concentration point covered by the sliding window is extracted to obtain the corresponding three-dimensional training sub-cube sample. The three-dimensional training sub-cube sample obtained in each sliding is associated with the adulteration concentration label according to the center concentration of the concentration point covered by the sliding window.
[0143] In one possible implementation, the processing module 902 is specifically used to input three-dimensional training sub-cube samples into a three-dimensional convolutional neural network to obtain adulteration type prediction results and adulteration concentration prediction results. The processing module 902 is further configured to calculate the first difference between the adulteration type prediction result and the associated adulteration type label using the cross-entropy loss function, and to calculate the second difference between the adulteration concentration prediction result and the associated adulteration concentration label using the mean square error loss function. The processing module 902 is further configured to determine whether a preset stopping condition is met based on the first difference and the second difference. If the preset stopping condition is met, the iterative training of the three-dimensional convolutional neural network is stopped, and the currently trained three-dimensional convolutional neural network is used as a three-dimensional milk fat adulteration detection network. Otherwise, based on the first difference and the second difference, the parameters of the three-dimensional convolutional neural network are updated using the backpropagation algorithm, and the three-dimensional training sub-cube samples are input into the three-dimensional convolutional neural network after the parameters are updated. The steps of calculating the first difference and the second difference and updating the parameters are repeated until the preset stopping condition is met.
[0144] In one possible implementation, the three-dimensional convolutional neural network includes a first three-dimensional convolutional block, a second three-dimensional convolutional block, and a third three-dimensional convolutional block; The output of the first 3D convolutional block is connected to the input of the second 3D convolutional block, and the output of the second 3D convolutional block is connected to the input of the third 3D convolutional block; each 3D convolutional block includes a 3D convolutional layer, a batch normalization layer, an activation layer, and a pooling layer connected in sequence. The output of the third 3D convolutional block is connected to the input of the global pooling layer, the output of the global pooling layer is connected to the input of the first fully connected layer, the output of the first fully connected layer is connected to the input of the random deactivation layer, and the output of the random deactivation layer is connected to the input of the second fully connected layer. The output of the second fully connected layer is connected to the output layer, which includes a flexible maximum layer for outputting the adulteration type and a single-neuron linear layer for outputting the adulteration concentration.
[0145] In one possible implementation, the adulteration type of the milk fat sample includes palm oil adulteration and / or hydrogenated vegetable oil adulteration; the multiple adulteration concentrations of the milk fat sample include 0%, 5%, 10%, 15%, 20%, and 25%; and the multiple preset temperature conditions include 5°C, 10°C, 15°C, 20°C, 25°C, 30°C, 35°C, and 40°C.
[0146] This invention also provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the above method embodiments.
[0147] This invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect above or any possible implementation thereof.
[0148] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not detailed or described in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Unless otherwise specified or in conflict with logic, the terminology and / or descriptions between different embodiments are consistent and can be referenced interchangeably. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0149] 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 spirit and 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 adulteration of milk fat, characterized in that, include: For multiple samples taken from the milk fat product to be tested, Raman spectral data of each sample were obtained under multiple preset temperature conditions. Based on the Raman spectral data of the multiple samples to be tested, a three-dimensional data cube of the milk fat product to be tested is constructed. Based on the three-dimensional data cube of the milk fat product to be tested, determine the three-dimensional synchronous correlation spectrum of the milk fat product to be tested; Based on the three-dimensional synchronous correlation spectrum of the milk fat product to be tested and the pre-trained three-dimensional milk fat adulteration detection network, the adulteration type and adulteration concentration of the milk fat product to be tested are obtained; wherein, the three-dimensional milk fat adulteration detection network is pre-trained based on multiple milk fat samples with known adulteration types and known adulteration concentrations.
2. The method for detecting adulteration of milk fat according to claim 1, characterized in that, The training method for the three-dimensional milk fat adulteration detection network includes: Raman spectral data of each of a plurality of pre-prepared milk fat samples under a plurality of preset temperature conditions are obtained; wherein the plurality of milk fat samples cover a variety of adulteration types, and each adulteration type contains a plurality of different preset adulteration concentrations; For each adulteration type, a three-dimensional training data cube is constructed based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under that adulteration type. For each 3D training data cube, determine the 3D training synchronization correlation spectrum based on the 3D training data cube; For each three-dimensional training synchronous correlation spectrum, a sliding window is used to cut the three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension to generate multiple three-dimensional training sub-cube samples. Each three-dimensional training sub-cube sample is associated with an adulteration type label and an adulteration concentration label. Using the three-dimensional training sub-cube samples as input and the adulteration type label and adulteration concentration label as output, a three-dimensional convolutional neural network is trained to obtain the three-dimensional milk fat adulteration detection network.
3. The method for detecting adulteration of milk fat according to claim 2, characterized in that, The acquisition of Raman spectral data for each of the multiple pre-prepared milk fat samples under the multiple preset temperature conditions includes: For each milk fat sample, the Raman spectrum of the milk fat sample is collected under each preset temperature condition to obtain multiple Raman spectra that correspond one-to-one with the multiple preset temperature conditions; For each Raman spectrum, the target characteristic spectrum within a preset wavenumber range is extracted, and the target characteristic spectrum is sequentially subjected to baseline correction, smoothing filtering, and spectral intensity normalization to obtain the Raman spectral data corresponding to that Raman spectrum.
4. The method for detecting adulteration of milk fat according to claim 2, characterized in that, The step of constructing a three-dimensional training data cube corresponding to this adulteration type based on the Raman spectral data of multiple milk fat samples with different preset adulteration concentrations under this adulteration type includes: Construct a blank three-dimensional data cube containing wavenumber, adulteration concentration, and temperature dimensions; wherein the blank three-dimensional data cube contains a first number of wavenumber points in the wavenumber dimension, a second number of adulteration concentration points in the adulteration concentration dimension, and a third number of temperature points in the temperature dimension. The Raman spectral intensity values of the Raman spectral data corresponding to multiple milk fat samples with different preset adulteration concentrations under the adulteration type are filled into the blank three-dimensional data cube according to the corresponding wave value, concentration value and temperature value to obtain the three-dimensional training data cube.
5. The method for detecting adulteration of milk fat according to claim 2, characterized in that, The step of determining the three-dimensional training synchronization correlation spectrum based on the three-dimensional training data cube includes: For each wavenumber point and each adulteration concentration in the three-dimensional training data cube, calculate the average Raman spectral intensity of that wavenumber point at all temperature points under that adulteration concentration, and use the average Raman spectral intensity as the reference benchmark for that wavenumber point under that adulteration concentration; For each wavenumber point, each adulteration concentration, and each preset temperature condition in the three-dimensional data cube, the Raman spectral intensity value of the wavenumber point under the adulteration concentration and temperature condition is subtracted from the reference value of the wavenumber point under the adulteration concentration to obtain the dynamic spectral value of the wavenumber point under the adulteration concentration and temperature condition. For any two wavenumber points forming a wavenumber pair, calculate the product of the dynamic spectral values of the two wavenumber points at each temperature point under the same doping concentration, sum the product results corresponding to all temperature points, and then divide by the difference between the number of temperature points and one to obtain the synchronous correlation strength of the two wavenumber points under the doping concentration. For each adulteration concentration, all wavenumber pair combinations are traversed, the synchronization correlation strength between each pair of wavenumber points is calculated, and the result is filled into a blank three-dimensional synchronization correlation spectrum containing the adulteration concentration dimension, the first wavenumber dimension, and the second wavenumber dimension to obtain the three-dimensional training synchronization correlation spectrum.
6. The method for detecting adulteration of milk fat according to claim 2, characterized in that, The method involves using a sliding window to cut the three-dimensional training synchronous correlation spectrum along the doping concentration dimension, generating multiple three-dimensional training sub-cube samples, including: A first virtual concentration point is added before the starting concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the first virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the starting concentration point; and a second virtual concentration point is added after the ending concentration point of the concentration sequence of the three-dimensional training synchronous correlation spectrum, and the synchronous correlation spectrum data corresponding to the second virtual concentration point is determined based on the synchronous correlation spectrum data corresponding to the ending concentration point. For the new three-dimensional training synchronous correlation spectrum formed by adding the first virtual concentration point and the second virtual concentration point, a sliding window of preset depth is used to slide and traverse the new three-dimensional training synchronous correlation spectrum along the adulteration concentration dimension with a preset step size. Each slide extracts the synchronous correlation spectrum data corresponding to the concentration point covered by the sliding window to obtain the corresponding three-dimensional training sub-cube sample. The three-dimensional training sub-cube sample obtained by each slide is associated with the adulteration concentration label according to the center concentration of the concentration point covered by the sliding window.
7. The method for detecting adulteration of milk fat according to claim 2, characterized in that, The step of using the three-dimensional training sub-cube samples as input and the adulteration type label and adulteration concentration label as output to train a three-dimensional convolutional neural network to obtain the three-dimensional milk fat adulteration detection network includes: By inputting the three-dimensional training sub-cube samples into the three-dimensional convolutional neural network, the prediction results of adulteration type and adulteration concentration are obtained. The first difference between the adulteration type prediction result and the associated adulteration type label is calculated using the cross-entropy loss function, and the second difference between the adulteration concentration prediction result and the associated adulteration concentration label is calculated using the mean squared error loss function. Based on the first difference and the second difference, determine whether a preset stopping condition is met. If the preset stopping condition is met, stop the iterative training of the three-dimensional convolutional neural network and use the currently trained three-dimensional convolutional neural network as the three-dimensional milk fat adulteration detection network. Otherwise, based on the first difference and the second difference, update the parameters of the three-dimensional convolutional neural network using the backpropagation algorithm, and input the three-dimensional training sub-cube samples into the three-dimensional convolutional neural network after updating the parameters. Repeat the steps of calculating the first difference and the second difference and updating the parameters until the preset stopping condition is met.
8. The method for detecting adulteration of milk fat according to claim 7, characterized in that, The three-dimensional convolutional neural network includes a first three-dimensional convolutional block, a second three-dimensional convolutional block, and a third three-dimensional convolutional block; The output of the first 3D convolutional block is connected to the input of the second 3D convolutional block, and the output of the second 3D convolutional block is connected to the input of the third 3D convolutional block; each 3D convolutional block includes a 3D convolutional layer, a batch normalization layer, an activation layer, and a pooling layer connected in sequence. The output of the third 3D convolutional block is connected to the input of the global pooling layer, the output of the global pooling layer is connected to the input of the first fully connected layer, the output of the first fully connected layer is connected to the input of the random deactivation layer, and the output of the random deactivation layer is connected to the input of the second fully connected layer. The output of the second fully connected layer is connected to the output layer, which includes a flexible maximum layer for outputting the adulteration type and a single-neuron linear layer for outputting the adulteration concentration.
9. The method for detecting adulteration of milk fat according to claim 1, characterized in that, The adulteration types of the milk fat samples include palm oil adulteration and / or hydrogenated vegetable oil adulteration; the multiple adulteration concentrations of the milk fat samples include 0%, 5%, 10%, 15%, 20%, and 25%; the multiple preset temperature conditions include 5℃, 10℃, 15℃, 20℃, 25℃, 30℃, 35℃, and 40℃.
10. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 9.