Rapid detection method for fatty acid content of Beijing duck based on near infrared spectrum technology
By applying near-infrared spectroscopy technology and extreme learning machine model in Beijing duck fatty acid detection, the problem of traditional detection methods taking time and using dangerous solvents is solved, and a fast, lossless, safe and environmentally friendly detection effect is achieved.
Patent Information
- Application Number
- CN202411831165.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-12
AI Technical Summary
Traditional meat fatty acid detection methods are cumbersome, time-consuming, and require the use of dangerous solvents. They cannot achieve fast, non-destructive and online testing, and it is difficult to meet the needs of modern agriculture and food industries.
The rapid detection method of fatty acid content in Beijing duck based on near-infrared spectroscopy is adopted. By collecting and preparing samples of Beijing duck chest muscles, using a portable near-infrared spectrometer for spectral data acquisition, and combining with the ultimate learning machine (ELM) model for data processing and analysis, it realizes fast and lossless detection of fatty acid content.
It realizes rapid, non-destructive, safe and environmentally friendly testing of Beijing duck fatty acid content, avoids sample damage and time-consuming problems in traditional methods, has the application potential of real-time online detection, and improves the accuracy and repeatability of the detection.
Smart Images

Figure CN119643501A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of agricultural food detection, and particularly relates to a method for quickly detecting the fatty acid content of Peking duck based on near-infrared spectroscopy technology. Background Art
[0002] At present, traditional meat fatty acid detection methods mainly rely on chemical and instrumental analysis methods, usually including: Gas Chromatography (GC) and High-Performance Liquid Chromatography (HPLC). Although these methods are highly accurate, they have disadvantages such as cumbersome operation, time-consuming and labor-intensive, delayed test results, sample destruction, the need to use hazardous solvents, and environmental pollution. They are not suitable for large-scale, rapid, and online quality testing of Beijing ducks.
[0003] Near-infrared spectroscopy (NIRS) is a non-invasive analytical method that uses the light absorption characteristics of a substance in the near-infrared band (approximately 780 to 2500 nanometers) to explore its chemical composition. The theoretical basis of this technology is based on molecular vibration spectroscopy. In the near-infrared region, functional groups in molecules, such as carbon-hydrogen (CH), nitrogen-hydrogen (NH), and oxygen-hydrogen (OH) bonds, vibrate due to the absorption of light. These vibration modes correspond to specific wavelengths, forming a unique spectral fingerprint of the substance.
[0004] With the emergence of new generation information technologies such as cloud computing, big data, and artificial intelligence, the deep integration of agricultural technology and information technology has promoted the continuous development of digital agriculture and smart agriculture. As an advanced analytical technology, near-infrared spectroscopy has been widely used in agriculture, food, medicine and other fields, but its application in quality testing of Beijing ducks is still relatively rare, especially in the field of fatty acid testing.
[0005] Therefore, there is an urgent need for a rapid detection method for the fatty acid content of Peking ducks based on near-infrared spectroscopy technology. By combining near-infrared spectroscopy technology with a machine learning model, a rapid and non-destructive detection of the fatty acid content of Peking ducks can be achieved, thereby solving the problems of traditional methods in the detection of fatty acid content in Peking ducks, such as long time consumption, delayed test results, and the need to use hazardous solvents, so as to meet the needs of modern agriculture and the food industry. Summary of the invention
[0006] The object of the present invention is to provide a method for rapid detection of fatty acid content in Peking duck based on near infrared spectroscopy technology, characterized in that the method comprises the following steps:
[0007] Step S1: Selecting a sample and performing sample pretreatment; the sample pretreatment is freezing the sample to preserve the natural tissue structure of the internal muscle of the sample;
[0008] Step S2: Collecting sample data using a standardized collection method; the sample data includes: spectral data and physical and chemical index data;
[0009] Step S3: Eliminate abnormal samples; the abnormal samples include: using the Mahalanobis distance method to eliminate abnormal samples in the spectral data and using the 3σ principle method to screen out abnormal samples in the physical and chemical index data;
[0010] Step S4: performing spectral data correction, including: using Savitzky-Golay smoothing algorithm to perform smoothing and denoising; using standard normal variable transformation to eliminate baseline drift and random errors in the spectral data;
[0011] Step S5: using a sample set partitioning method based on joint XY distance to divide the data set into a training set and a test set in a ratio of 7:3;
[0012] Step S6: construct an optimized extreme learning machine model, and train the optimized extreme learning machine model based on the training set; construct an evaluation model, and verify the detection effect of the optimized extreme learning machine model based on the test set; and realize rapid detection of fatty acid content in Beijing duck.
[0013] The beneficial effects of the present invention are:
[0014] In order to solve the problems of long time consumption, delayed test results, and the need to use hazardous solvents in the detection of fatty acid content in Peking ducks by traditional methods, the present invention proposes a Peking duck fatty acid rapid detection method based on near-infrared spectroscopy technology. The method collects and prepares Peking duck breast muscle samples, uses traditional physical and chemical experimental methods to determine the true value data of fatty acids, and then uses a portable near-infrared spectrometer to collect spectral data. Based on the Mahalanobis distance and the 3σ principle, the spectral data and the physical and chemical true values are respectively subjected to abnormal sample elimination, and the data preprocessing technology is used for spectral correction. In addition, a quantitative analysis model is constructed in combination with an extreme learning machine (ELM), so as to achieve efficient, non-destructive and rapid detection of the fatty acid content of Peking ducks.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] Fast and non-destructive: A portable near-infrared spectrometer was used to collect spectral data of duck meat samples, and combined with a machine learning model, the fatty acid content of Beijing ducks was quickly and non-destructively detected, avoiding the sample destruction and time-consuming problems of traditional detection methods.
[0017] Safety and environmental protection: This invention avoids the reliance on hazardous solvents in traditional detection methods, reduces solvent consumption, and lowers operating requirements. Near infrared spectroscopy technology does not require the use of any chemical reagents, does not produce hazardous waste, and has high safety and environmental protection.
[0018] Real-time online detection: Traditional detection methods cannot achieve real-time online detection, but the detection method of the near-infrared spectroscopy technology combined with the machine learning model of the present invention can be deployed in the system at a later stage, and has the application potential of real-time online detection.
[0019] High-precision model: The present invention uses the extreme learning machine (ELM) model after optimizing the activation function to perform feature phenotype association analysis on the optimized high-quality sample data. By adjusting different preprocessing methods and model parameters, the best technology and matching combination are selected to ensure the prediction effect and stability of the model. This method improves the accuracy and repeatability of the test and reduces the manual measurement errors in the physical and chemical test methods.
[0020] Reference value: This invention innovates on the basis of traditional detection methods, adopts advanced spectral analysis and machine learning technology to realize a new detection method for the fatty acid content of Beijing duck, and also provides a reference and reference for the quality detection of other agricultural products and foods, with significant economic and social benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram of a process for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy technology of the present invention;
[0022] Figure 2 A detailed schematic diagram of a method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy technology according to the present invention;
[0023] Figure 3 Schematic diagram of a miniature near-infrared spectrometer according to an embodiment of the present invention, wherein (a) is a schematic diagram of a JDSU instrument, and (b) is a physical diagram of a JDSU instrument;
[0024] Figure 4 This is a schematic diagram of a near infrared spectrum acquisition experimental platform according to an embodiment of the present invention;
[0025] Figure 5 This is a schematic diagram of eliminating abnormal spectrum samples using the Mahalanobis distance according to an embodiment of the present invention;
[0026] Figure 6 This is a density distribution comparison diagram before and after the 3σ principle is used to eliminate abnormal true values in an embodiment of the present invention;
[0027] Figure 7 Schematic diagram of spectral band correction according to an embodiment of the present invention, wherein: (a) is a schematic diagram of spectral SG smoothing, and (b) is a schematic diagram of spectral SNV correction;
[0028] Figure 8 Schematic diagram of the density distribution of physical and chemical truth values of the training set and the test set of the embodiment of the present invention, wherein (a) is a schematic diagram of the density distribution of the training set, and (b) is a schematic diagram of the density distribution of the test set;
[0029] Fig. 9 This is a schematic diagram of the ELM model structure of an embodiment of the present invention;
[0030] Fig.10 Schematic diagram of the ELM model training results of an embodiment of the present invention, wherein (a) is a scatter plot of the training set fitting, and (b) is a scatter plot of the test set fitting;
[0031] Fig.11 A schematic diagram showing a comparison of the difference between the actual sample value and the model predicted value according to an embodiment of the present invention;
[0032] Fig.12 The figures are the actual pictures of the minced meat tablets of the embodiments of the present invention, wherein (a) is the actual picture of the minced meat tablets containing a large number of voids and bubbles, and (b) is the actual picture of the minced meat tablets without obvious bubbles;
[0033] Fig.13 A schematic diagram of a sample spectrum collection area according to an embodiment of the present invention;
[0034] Fig.14 These are the near-infrared spectrum collection diagrams of duck meat according to an embodiment of the present invention, wherein (a) is an abnormal operation collection diagram, and (b) is a normal operation collection diagram. DETAILED DESCRIPTION
[0035] The present invention provides a method for rapid detection of fatty acid content of Beijing duck based on near-infrared spectroscopy technology, by collecting and preparing Beijing duck breast muscle samples, using traditional physical and chemical experimental methods to determine fatty acid true value data, and then using a portable near-infrared spectrometer to collect spectral data, and based on Mahalanobis distance and 3σ principle, respectively, the spectral data and the physical and chemical true value are subjected to abnormal sample elimination, and data preprocessing technology is used to perform spectral correction, and a quantitative analysis model is constructed in combination with an extreme learning machine (ELM), so as to achieve efficient, non-destructive and rapid detection of fatty acid content of Beijing duck. The present invention is further described in detail below in conjunction with the accompanying drawings.
[0036] like Figure 1 The embodiment of the present invention shown discloses a method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy technology, comprising the following steps:
[0037] Step S1: Selecting a sample and performing sample pretreatment; the sample pretreatment is freezing the sample to preserve the natural tissue structure of the internal muscle of the sample;
[0038] Step S2: Collecting sample data using a standardized collection method; the sample data includes: spectral data and physical and chemical index data;
[0039] Step S3: Eliminate abnormal samples; the abnormal samples include: using the Mahalanobis distance method to eliminate abnormal samples in the spectral data and using the 3σ principle method to screen out abnormal samples in the physical and chemical index data;
[0040] Step S4: performing spectral data correction, including: using Savitzky-Golay smoothing algorithm to perform smoothing and denoising; using standard normal variable transformation to eliminate baseline drift and random errors in the spectral data;
[0041] Step S5: using a sample set partitioning method based on joint XY distance to divide the data set into a training set and a test set in a ratio of 7:3;
[0042] Step S6: construct an optimized extreme learning machine model, and train the optimized extreme learning machine model based on the training set; construct an evaluation model, and verify the detection effect of the optimized extreme learning machine model based on the test set; and realize rapid detection of fatty acid content in Beijing duck.
[0043] In this embodiment, the specific process is as follows Figure 2 As shown, the present invention provides a method for rapid detection of fatty acid content in Beijing ducks based on near infrared spectroscopy technology and extreme learning machine (ELM). The specific implementation scheme includes the following: (taking the fitting of PUFA fatty acid index as an example): 1. Experimental preparation: In this embodiment, the left pectoral muscle of Beijing ducks aged 42 days was selected and placed in a freezer at minus 80°C to obtain experimental samples.
[0044] 2. Sample data collection:
[0045] Spectral data collection: MicroNIR-1700 near-infrared spectrometer was used to collect spectral data of duck meat samples without interference from strong external light sources and under constant temperature conditions. The processed meat samples were prepared into uniform thin slices, and the fixed central area of each sample was rotated and sampled at three angles. Each angle was scanned three times, and the three additional edge areas were collected three times each. Finally, the average spectrum of 18 times was taken as the effective spectrum.
[0046] Physical and chemical index data collection: The fatty acid content of the sample was determined according to GB 5009.168-2016 standard, and analyzed by gas chromatography to obtain physical and chemical true value data.
[0047] 3. Data processing and outlier removal:
[0048] The Mahalanobis distance method is used to remove abnormal samples from spectral data.
[0049] · Apply the 3σ principle to screen out abnormal values in physical and chemical index data to ensure the accuracy and consistency of data.
[0050] Finally, 372 high-quality sample data were obtained.
[0051] 4. Spectral data correction: Smoothing and denoising (using Savitzky-Golay smoothing algorithm) and standard normal variable transformation (SNV) are performed to eliminate baseline drift and random errors in spectral data and improve data consistency.
[0052] 5. Dataset partitioning: Use the sample set partitioning method based on joint XY distance (SPXY) to divide the dataset into training set and test set in a 7:3 ratio to ensure that the density distribution of the training set and the test set is close, thereby improving the representativeness and generalization ability of the model.
[0053] 6. Model construction and evaluation: Construct an extreme learning machine model, add neurons with different activation functions (80 Sigmoid activation functions, 50 Tanh activation functions, and 50 linear activation functions), and train the model. Use the coefficient of determination (R 2 ), root mean square error (RMSE) and relative analytical deviation (RPD) were used to evaluate the model performance.
[0054] In this embodiment, through the combination of extreme learning machine model and spectral technology, rapid non-destructive detection is achieved, the detection efficiency and accuracy are improved, and a scientific basis is provided for duck meat quality control.
[0055] The following is a detailed description of each step by taking the fitting of PUFA fatty acid index as an example in conjunction with the accompanying drawings:
[0056] 1. Experimental Preparation
[0057] Step S1: Selecting a sample and performing sample pretreatment; the sample pretreatment is freezing the sample to preserve the natural tissue structure of the internal muscle of the sample;
[0058] The sample in step S1 is the left pectoral muscle of a 42-day-old Beijing duck; the sample includes: a roasted type and a split type; and freezing and preserving the sample includes: sealing and freezing the sample in an environment of minus 80°C.
[0059] In this embodiment, the duck meat sample material used in the experiment is roasted duck (IV fat type), 42-day-old individuals, and the left duck breast muscle is taken. The samples are packed in self-sealing bags, numbered respectively, and stored in a freezer at minus 80°C to ensure the natural tissue structure of the internal muscles. In the spectral detection laboratory, near-infrared spectral data and duck meat quality indicators such as various fatty acid contents are collected.
[0060] The equipment used for spectral acquisition is the MicroNIR-1700 micro near-infrared spectrometer launched by JDSU Corporation of the United States (JDSU niphase [JDSU] Corporation, Milpitas, No. S1-00492). Figure 3 As shown, Figure 3 (a) is a schematic diagram of the JDSU instrument. Figure 3 (b) is a picture of the JDSU instrument. This model of spectrometer is a portable USB-driven device used for non-destructive analysis of various samples on site, such as pharmaceuticals, food and agricultural products, chemicals, etc. The detailed parameters of the equipment are shown in Table 1.
[0061] Table 1 Main parameters of MicroNIR-1700 spectrometer
[0062]
[0063] 2. Sample Data Collection
[0064] Step S2: Collecting sample data using a standardized collection method; the sample data includes: spectral data and physical and chemical index data;
[0065] The standardized collection method in step S2 includes:
[0066] Step S21: Building an experimental platform, including: disinfecting the surface of the experimental equipment, building a spectrum collection experimental platform with an iron frame and a spectrum equipment fixing clamp, fixing a near-infrared collection lens, and connecting a computer device;
[0067] Step S22: thawing the sample, including: placing the sample in a room temperature environment for thawing, and using experimental absorbent paper to absorb blood water flowing out during the thawing process;
[0068] Step S23: cutting the sample, including: using a large serrated knife to cut the sample, and using a small scalpel to remove interfering tissue on the surface of the sample, including the external epidermal fascia and obvious fat particles and impurities, to ensure that the samples used are all pink meat pieces;
[0069] Step S24: grinding the sample, including: grinding the sample for 15 seconds, taking a 5-second break, and grinding the sample again for 15 seconds to obtain pink minced meat;
[0070] Step S25: preheating the spectrum acquisition device, including: starting the spectrum acquisition device, preheating for 20 minutes, and ensuring that the probe of the spectrum acquisition device reaches a preset temperature;
[0071] Step S26: using the same barium sulfate standard white plate with a reflectivity of 100% to perform a black and white reference calibration on the spectrum acquisition device;
[0072] Step S27: Setting the spectrum acquisition equipment parameters, including: setting the integration time to 15.6ms; setting the sampling integration times to 75 times; setting the detection distance between the probe and the sample surface to 3mm; setting the spectrum scanning range to 900-1700nm; setting the total number of characteristic bands to 125;
[0073] Step S28: making sample tablets, including: taking the pink minced meat, putting it into a sample testing cup, and slowly pressing it into a uniform thin slice state using a device stopcock, so that the pink minced meat covers the entire surface of the sample cup, ensuring that the overall meat quality of the tablet product is uniform and there are no obvious bubbles;
[0074] Step S29: collecting spectrum to obtain spectrum data;
[0075] Step S2A: Collect physical and chemical true value data to obtain physical and chemical index data.
[0076] (1) NIR spectral data collection:
[0077] The spectrum acquisition in step S29 includes:
[0078] Step S291: Collect spectral data of the middle area A of the sample cup surface, rotate the sample cup surface three times, each time by 120 degrees, collect data at each angle three times, and obtain a total of 9 spectral data of the middle area A; around the middle area A, select the first surrounding area B, the second surrounding area C and the third surrounding area D at intervals of 120 degrees at the midpoint of the radial direction of the sample cup surface, collect data for each surrounding area three times, and obtain a total of 9 spectral data of the surrounding areas;
[0079] Step S292: Use the 18 spectral data collected in step S291 to draw the final target spectral image, and determine whether the final target spectral image meets the preset judgment conditions. If it meets the judgment conditions, the average value of the 18 spectral data is used as the spectral data of the sample; if it does not meet the judgment conditions, re-execute step S28; the judgment condition is: the 18 spectral collection images overlap and the overall curve is smooth without jagged edges;
[0080] Step S293: determine whether the acquisition time is less than a predefined threshold, and if the acquisition time exceeds the threshold, re-execute step S21; the threshold is 3 hours;
[0081] In this embodiment, the spectrum acquisition process needs to be carried out in a spectral laboratory without interference from strong external light sources and at a room temperature of 24°C. First, the duck meat is taken out of the freezer and thawed at room temperature for 10 minutes. Then, 15g of meat is cut with a serrated knife to remove interfering tissues, including external epidermal fascia and obvious fat particles. The meat is minced with a meat mincer for 30 seconds to remove the loss in the process, and pink minced meat is obtained. 8g of meat sample is taken for subsequent spectrum acquisition.
[0082] Use the iron frame and spectral equipment fixing clamp to build a spectrum collection experimental table, such as Figure 4 As shown. The acquisition equipment needs to be preheated for 20 minutes in advance so that the probe temperature reaches 50 degrees Celsius (45-50 degrees Celsius is the manufacturer's recommended temperature for the equipment), and then obtain the black and white reference of the spectral equipment, and each time the same side of the standard white plate (reflectivity 100%) must be used as the white reference. According to previous research, the spectrometer is set with an integration time of 15.6ms, a sampling integration number of 75 times, a detection distance between the probe and the sample surface of 3mm, and a spectral scanning range of 900-1700nm.
[0083] During the spectral scanning, 8g of minced meat prepared previously was placed in a sample test cup with a diameter of 5.1cm, and pressed into a uniform thin slice using the equipment stopcock. Three fixed sampling angles were used for each sample, and each angle was scanned 3 times. The average spectrum of 9 times was taken as the final effective spectrum. The number of samples collected in the experiment must be limited so that the entire operation can be completed within 3 hours.
[0084] (2) Physical and chemical true value data collection (fatty acids):
[0085] The physical and chemical true value data collection in step S2A includes:
[0086] The duck breast was pre-cooled and transferred to a freeze dryer for freeze drying at -40°C for more than 72 hours; 50 mg (±1 mg) was weighed into a 4 ml reaction bottle, 1000 μl of acetyl chloride methanol solution was added, nitrogen was filled in and shaken; the duck breast was placed in an 80°C water bath for 2 hours, and the mixture was taken out and shaken every 20 minutes. After the water bath, the duck breast was taken out and cooled to room temperature, 1 ml of n-hexane was added and shaken; 1.5 ml of 6% potassium carbonate solution was added and shaken; the mixture was centrifuged at 4000 rpm for 5 minutes, 500 μl of the supernatant was taken into a 2 ml injection bottle, and the mixture was directly injected into a gas chromatograph to analyze the experimental results and obtain the physical and chemical true value data.
[0087] In this embodiment, reference is made to GB 5009.168-2016 "Determination of Fatty Acids in Food" standard. The specific collection method is: pre-cool the duck breast and transfer it to a freeze dryer for freeze drying, the freeze drying temperature is -40 ° C, and the freeze drying is more than 72 hours. Accurately weigh 50mg (± 1mg) into a 4ml reaction bottle, add 1000μl acetyl chloride methanol solution, fill with nitrogen and shake; place in an 80 ° C water bath for 2h, take out and shake every 20min, take out after the water bath and cool to room temperature, add 1ml n-hexane, shake; add 1.5ml 6% potassium carbonate solution, shake and vortex; centrifuge at 4000rpm for 5min, take 500μl of the supernatant into a 2ml injection bottle, directly inject it into the gas chromatograph, and analyze the experimental results using Agilent MassHunter.
[0088] 3. Data processing and outlier removal:
[0089] Step S3: Eliminate abnormal samples; the abnormal samples include: using the Mahalanobis distance method to eliminate abnormal samples in the spectral data and using the 3σ principle method to screen out abnormal samples in the physical and chemical index data;
[0090] (1) Abnormal spectral data screening:
[0091] The spectra used in the experiment need to be removed in advance by using the Mahalanobis distance method to remove samples with abnormal spectra. The Mahalanobis distance method can remove abnormal spectral samples such as Figure 5 As shown, the samples between the red and blue dotted lines are finally retained.
[0092] The step S3 of using the Mahalanobis distance method to eliminate abnormal samples in the spectral data includes:
[0093] Perform mean normalization, including: calculating the mean of all features, and then letting x j =x j -μ j ; If the features are on different orders of magnitude, divide the features by the standard deviation σ 2 , where x j represents the original value of the jth feature, μ j represents the mean of the jth feature, x j -μ j Indicates that the jth feature is mean normalized, that is, the feature value is subtracted from its mean and used to replace the original x j The value of x j Participate in subsequent operations;
[0094] Calculate the covariance matrix Σ, which is:
[0095]
[0096] In the formula, m represents the number of samples, that is, the total number of samples in the data set; n represents the number of features, that is, the number of features contained in each sample; T represents the transposition operation, x (i) Represents the eigenvector of the i-th sample, containing all the eigenvalues of the sample;
[0097] Based on the eigenvector of the covariance matrix Σ, calculate the Mahalanobis distance D of the i-th sample in the validation set i :
[0098]
[0099] Where t i is the principal component score of sample i in the validation set; is the average score matrix of the validation set samples; m is the number of samples; M is the covariance matrix of the principal component score matrix of the validation set spectra;
[0100] Calculate the Mahalanobis distance threshold D of abnormal samples th :
[0101] D th =D m +e·σ d
[0102] Where e is the threshold weight coefficient, D m is the average value of the sample Mahalanobis distance, σ d is the standard deviation;
[0103] The prediction model of spectral data and physical and chemical indicators was established by combining partial least squares method, so as to select the appropriate Mahalanobis distance threshold;
[0104] When D i ≥D th When , the i-th sample in the validation set is determined to be an abnormal sample; if D i <D th , then it is judged that the spectral characteristics of the sample are within a reasonable range.
[0105] In this embodiment, the specific processing steps are as follows:
[0106] I. Mean normalization. You need to calculate the mean of all features, and then let x j =x j -μ j If the features are on different orders of magnitude, they also need to be divided by the standard deviation σ 2 . Where x j represents the original value of the jth feature, μ j represents the mean of the jth feature, x j -μ j Indicates that the jth feature is mean normalized, that is, the feature value is subtracted from its mean and used to replace the original x j The value of x j Participate in subsequent operations;
[0107] II. Calculate the covariance matrix
[0108] III. Calculate the eigenvectors of the covariance matrix Σ:
[0109] The Mahalanobis distance method is used to eliminate samples whose spectral curves are obviously abnormal from the normal range. By calculating the Mahalanobis distance of the samples, the samples exceeding the outlier Mahalanobis distance threshold are identified, thereby eliminating abnormal sample points that have a greater impact on modeling.
[0110] Based on the eigenvector of the covariance matrix Σ, calculate the Mahalanobis distance D of the i-th sample in the validation set i :
[0111] The partial least squares method was used to establish a prediction model for spectral data and physical and chemical indicators, so as to select the appropriate Mahalanobis distance threshold.
[0112] In this embodiment, the prediction model of the Mahalanobis distance threshold is selected as the classic regression model Partial Least Squares Regression (PLSR) of spectral analysis, and the selection steps are: manually setting the threshold weight coefficient e to adjust the sample retention percentage after the Mahalanobis distance is screened, such as retaining 95% or 90% of the samples (to ensure the representativeness of the data sample, the retention range is between 80%-100%), and then using the screened data to perform additional regression fitting modeling through the PLSR model, observe the improvement effect of its fitting performance, and thus obtain the optimal threshold. In this embodiment, the sample retention percentage after the Mahalanobis distance is screened is 90%.
[0113] (2) Screening out abnormal physical and chemical true value data (fatty acids):
[0114] The step S3 of using the 3σ principle method to screen out abnormal samples in the physical and chemical index data includes:
[0115] Calculate the mean μ:
[0116]
[0117] Where N is the number of data points, x i is the i-th data point;
[0118] Calculate the standard deviation σ:
[0119]
[0120] Calculate the upper and lower thresholds to determine the range of normal data;
[0121] Upper threshold = μ + 3σ
[0122] Threshold lower limit = μ-3σ
[0123] Identify and remove outliers. When the i-th data point x i Satisfy: (x i<μ-3σ) or (x i >μ+3σ), x i are considered outliers.
[0124] In this embodiment, the 3σ principle is applied to screen abnormal samples of physical and chemical true values. The specific steps are as follows:
[0125] I. Calculate the mean (μ):
[0126] II. Calculate the standard deviation (σ):
[0127] III. Determine the threshold range: Calculate the upper and lower thresholds to determine the range of normal data:
[0128] IIII. Identify and remove outliers: Identify and remove data points that are outside the above range:
[0129] In this embodiment, x i is considered an outlier if and only if (x i <μ-3σ) or (x i >μ+3σ)
[0130] The density distribution comparison results before and after the 3σ principle is used to eliminate abnormal true values are as follows: Figure 6 As shown in Figure 1, it is the data density distribution before and after removing the abnormal values of fatty acids (taking the PUFA fatty acid index as an example). It can be seen that by using the 3σ principle, abnormal outlier sample points can be eliminated.
[0131] After the above-mentioned anomaly elimination processing of the spectrum and the true value, 372 high-quality sample data were finally obtained.
[0132] 4. Spectral data correction
[0133] Step S4: performing spectral data correction, including: using Savitzky-Golay smoothing algorithm to perform smoothing and denoising; using standard normal variable transformation to eliminate baseline drift and random errors in the spectral data;
[0134] In order to eliminate the influence of baseline drift or random errors in spectral data, spectral correction operation (i.e. characteristic band correction) is required to make the spectral data more consistent in order to improve the accuracy of modeling. The specific steps are to first perform smoothing and denoising, and then perform SNV transformation correction. The relevant details are as follows:
[0135] (1) Smoothing and denoising
[0136] The step S4 of using the Savitzky-Golay smoothing algorithm to perform smoothing and denoising includes: calculating the smoothed average value x at wavelength k k,smooth :
[0137]
[0138] In the formula, h i is the smoothing coefficient, h i Based on the least squares principle, it is obtained by polynomial fitting, and H is the normalization factor;
[0139] w is the half width of the window, that is, the number of left and right data points considered in the smoothing process. The total width of the window is 2w+1, and the value of w is 13;
[0140] Savitzky-Golay convolution smoothing (SG smoothing) reduces the impact of random errors or noise by smoothing the spectral data. Here, the average value after smoothing at wavelength k is used. Each measurement value is multiplied by the smoothing coefficient h i The purpose is to minimize the impact of smoothing on useful information. i Based on the least squares principle, it is obtained by polynomial fitting. w is the half width of the window width, that is, the number of left and right data points considered in the smoothing process. The total width of the window is 2w+1. In the experiment, w takes the value of 13.
[0141] (2) Standard normal variable transformation
[0142] Standard Normal Variate Transformation (SNV) is mainly used to eliminate the effects of solid particle size, surface scattering and optical path change on NIR diffuse reflectance spectra.
[0143] The standard normal variable transformation in step S4 includes:
[0144] Calculate the spectral data X after standard normal variable transformation SNV :
[0145]
[0146] In the formula, X raw is the original spectral data, and std(X raw ) are the mean and standard deviation of the original spectrum, respectively.
[0147] The sample spectral image after using the above correction method is as follows Figure 7 As shown, where: Figure 7 (a) is a schematic diagram of spectral SG smoothing. Figure 7 (b) is a schematic diagram of spectral SNV correction;
[0148] 5. Dataset Division
[0149] Step S5: using a sample set partitioning method based on joint XY distance to divide the data set into a training set and a test set in a ratio of 7:3;
[0150] The sample set division method based on the joint XY distance in step S5 includes:
[0151] Step S51: for all samples in the known sample set, calculate the joint XY distance matrix between each sample; select two samples with the farthest distance from all samples as the initial correction sample set;
[0152] Step S52: Calculate the distances between all unselected samples and all samples in the selected sample set, and select a sample with the largest average distance to the selected sample set to add to the correction sample set;
[0153] Step S53: repeating step S52 until the size of the calibration sample set reaches a preset number n;
[0154] Step S54: the remaining unselected samples are classified as test samples;
[0155] The joint XY distance matrix is:
[0156]
[0157] Where, d x (i, j) is the distance between samples calculated using the spectrum as the characteristic parameter; d y (i, j) is the distance between samples calculated with concentration as the characteristic parameter; i, j∈[1,z], z is the total number of samples, that is, assuming there are z samples, and then the set is divided; α is the weighting factor, 0≤α≤1.
[0158] In this embodiment, in order to assist the subsequent model training, the existing data set needs to be divided into a training set and a test set in a 7:3 ratio, and the division method used is "Sample set Partitioning Based on Joint XY Distances" (SPXY).
[0159] The SPXY method aims to select and divide training samples and test samples by jointly considering the distance of spectral features and concentration features. The principle is to sort the "JointX-Y Distance" of the samples while keeping the number of samples unchanged, select the samples with the longest distance as the initial samples, and then add the samples with the largest average distance to the currently selected samples in turn until the number of selected samples reaches the required number. The specific selection process is as follows:
[0160] (1) For all samples in the known sample set, calculate the "joint XY distance" matrix between them. Select the two samples with the farthest distance from all samples as the initial correction sample set.
[0161] (2) Calculate the distance between all unselected samples and all samples in the selected sample set. Select the sample with the largest average distance to the selected sample set and add it to the correction sample set.
[0162] (3) Repeat step 2 until the size of the calibration sample set reaches the preset number n.
[0163] (4) The remaining unselected samples are classified as test samples.
[0164] The "joint XY distance" between samples, i.e. d xy (i,j)
[0165] In order to make the samples have the same weight in the spectral space and concentration space, they are divided by their respective maximum values for standardization. In order to highlight the role of the spectral space or concentration space, a weighted method is used to select samples:
[0166]
[0167] Where α is the weighting factor, 0≤α≤1.
[0168] The final result of SPXY division is obtained. The density distribution of physical and chemical truth values of the training set and the test set is as follows: Figure 8 As shown, (a) is a schematic diagram of the density distribution of the training set, and (b) is a schematic diagram of the density distribution of the test set; (taking the PUFA fatty acid index as an example), it can be seen that the label density distribution of the training set and the test set is similar, and the model trained using this data will be representative.
[0169] 6. Model Construction and Evaluation
[0170] Step S6: construct an optimized extreme learning machine model, and train the optimized extreme learning machine model based on the training set; construct an evaluation model, and verify the detection effect of the optimized extreme learning machine model based on the test set; and realize rapid detection of fatty acid content in Beijing duck.
[0171] The step S6 of constructing an optimized extreme learning machine model includes:
[0172] Based on the classic extreme learning machine model structure, optimized activation functions are designed; the optimized activation functions include: 80 Sigmoid activation functions, 50 Tanh activation functions and 50 linear activation functions.
[0173] The evaluation model constructed in step S6 includes: 2, root mean square error RMSE and relative analysis error RPD.
[0174] (1) Extreme Learning Machine Model:
[0175] The model used for regression is the Extreme Learning Machine (ELM), which is a type of feedforward neural network known for its fast learning speed and relatively simple implementation process. Unlike traditional multi-layer perceptrons or deep learning models that use backpropagation algorithms to iteratively adjust all weights in the network, the main features of ELM include:
[0176] ● Randomly initialize hidden layer weights: The core innovation of ELM is that the input weights and bias values of its hidden layer nodes are random or artificial.
[0177] is set and remains unchanged throughout the learning process. This is significantly different from conventional neural network algorithms that require continuous optimization of weights through iteration.
[0178] Optimizing only the output layer weights: The learning process focuses on calculating the weights of the output layer, which is usually done in one go by solving a system of linear equations or using methods such as least squares, rather than repeatedly iterating, which greatly speeds up learning.
[0179] I. Basic structure: The ELM model structure is as follows Fig. 9 As shown in Figure 1, the basic architecture of ELM includes input layer, hidden layer and output layer. Suppose we have a training set with (N) samples
[0180]
[0181] where x i ∈R d is the input vector, t i ∈R c is the corresponding output vector (for classification tasks, ti is a one-hot encoded vector; for regression tasks, it is directly a real value).
[0182] II. Hidden layer activation: For each input sample x i , the activation value h of the L neurons in the hidden layer i =[h i1 ,h i2 ,...,h iL ] T It is expressed as:
[0183]
[0184] Here, g(·) is the activation function (such as sigmoid, Tanh, etc.), a l is the input weight vector of the lth hidden layer neuron, b l are bias terms, which are all randomly initialized and remain unchanged during the learning process.
[0185] Using different activation functions (Sigmoid, Tanh and Lin) in the ELM structure helps the model capture different features and patterns of the data. Each activation function has different nonlinear characteristics, which can help the model better adapt to complex data structures.
[0186] Sigmoid activation function: The output range is between (0,1), but it is prone to the gradient disappearance problem.
[0187] Tanh activation function: The output range is between (-1,1), which can alleviate the gradient disappearance problem better than Sigmoid.
[0188] lin linear activation function: no nonlinear transformation, suitable for feature extraction of linear relationships.
[0189] The ELM model used in the experiment adds 80 Sigmoid activation functions, 50 Tanh activation functions, and 50 linear activation functions to the classic structure.
[0190] III. Output weight calculation: The main calculation step of ELM is to determine the weights β from the hidden layer to the output layer = [β1,β2,...,β L ] T Assuming that the output layer uses linear combinations, the output Expressed as
[0191]
[0192] In order to minimize the overall prediction error of all samples, the output weight β is generally found by the least squares method. Specifically, consider minimizing the mean square error and solve the following normal equation to obtain β:
[0193] β=(H T H) -1 H T T
[0194] Here, H = [h1,h2,...,h N ] T is the hidden layer activation value matrix, T = [t1, t2, ..., t N ] T is the target output matrix.
[0195] (2) Evaluation indicators
[0196] The model training and verification process requires reference to evaluation indicators. These indicators help evaluate and compare the performance of the model and provide a basis for subsequent model tuning. The specific indicators are as follows:
[0197] I. Determination coefficient (R 2 ): Also known as the coefficient of determination or goodness of fit, it is an important indicator for measuring the prediction effect of the regression model. It reflects the degree of explanation of the independent variable on the dependent variable, that is, the proportion of the dependent variable variation that the regression model can explain.
[0198]
[0199] In the formula, y i,actual is the true measured value of the i-th sample; y i,predicted is the spectral method prediction value of the i-th sample in the test set prediction process; is the average value of the reference method determination of all samples in the test set; n is the number of samples in the test set. Under the premise of the same concentration range, the closer R2 is to 1, the better the prediction result.
[0200] II. Root Mean Square Error (RMSE): This indicator is a common indicator for measuring the error of the prediction model. It is used to quantify the difference between the predicted value and the true value, reflecting the accuracy of the model prediction results.
[0201]
[0202] In the formula, y i,actual is the true measured value of the i-th sample; y i,predicted is the predicted value of the i-th sample in the calibration set / validation set using the constructed model, and n is the number of samples in the calibration set / validation set.
[0203] III. Ratio of Prediction to Deviation (RPD): This indicator measures the relative error of the model by comparing the standard deviation of the prediction error with the actual value of the sample. The larger the value, the stronger the predictive ability of the model.
[0204]
[0205] Where SD is the standard deviation of the calibration set samples used to build the model, and RMSEP is the root mean square error of the test set.
[0206] Model Results:
[0207] The ELM model training results of the embodiment of the present invention are as follows: Fig.10As shown, (a) is the training set fitting scatter plot, (b) is the test set fitting scatter plot; is the training result of the ELM model for PUFA fatty acid indicators: its training set R 2 is 0.914, the test set R 2 The training set RMSE is 0.009, and the test set RMSE is 0.012, which means that the average error between the model prediction value and the actual value is small, and the prediction accuracy is high. The training set RPD is 3.409, and the test set RPD is 3.041, indicating that the model has high predictive ability and is suitable for quantitative analysis. The difference between the sample true value and the model prediction value is compared. Fig.11 As shown in the figure, overall, the model has good generalization ability and can maintain high prediction accuracy on the data.
[0208] In order to verify the effectiveness of the method for rapid detection of fatty acid content of Peking duck based on near-infrared spectroscopy technology disclosed in the present invention, the following verification experiment was carried out.
[0209] Experimental environment: This experiment needs to be carried out in a spectral laboratory with an ambient temperature of 24°C and without interference from strong external light sources to avoid the influence of ambient light during spectral acquisition.
[0210] (1) Laboratory bench construction: Use ethanol to disinfect the operating table and the surface of the experimental equipment, and use an iron frame and spectral equipment fixing clamps to build a spectrum collection laboratory bench, fix the near-infrared collection lens, and connect the computer equipment, such as Figure 4 shown.
[0211] (2) Sample thawing: Take the duck meat out of the -80°C freezer and thaw it at room temperature for 10 minutes. Use experimental absorbent paper to absorb the excess blood that flows out during the thawing process.
[0212] (3) Sample cutting and processing: Use a large serrated knife to cut 15 g of meat, and use a small scalpel to remove interfering tissue on the surface of the meat, including the external epidermal fascia and obvious fat particles and impurities, to ensure that all samples used are pink meat.
[0213] (4) Sample grinding: Use Royalstar meat grinder (100ml) to grind the meat for 30 seconds. To avoid overheating and stalling of the machine, which will result in uneven grinding and uneven particle size, the grinding process is divided into two times, 15 seconds each time, with a 5-second cooling time in between. After removing the loss during the process, pink minced meat is finally obtained, and 8g of meat sample is taken for subsequent spectrum collection.
[0214] (5) Equipment preheating: Start the spectrum acquisition equipment (MicroNIR-1700) in advance and preheat it for 20 minutes to ensure that the probe temperature reaches the manufacturer's recommended range of 45-50°C, with 50°C recommended.
[0215] (6) Black and white reference calibration: Use a barium sulfate standard white plate with a reflectivity of 100% for black and white reference calibration, and use the same white plate surface as a white reference for each experiment to ensure calibration consistency.
[0216] (7) Spectrometer parameter settings: According to previous research, the spectrometer was set with an integration time of 15.6 ms, a sampling integration number of 75 times, a detection distance of 3 mm between the probe and the sample surface, a spectral scanning range of 900 to 1700 nm, and a total of 125 characteristic bands.
[0217] (8) Sample tableting: Minced meat tablets such as Fig.12 As shown, (a) is a picture of a minced meat tablet containing a large number of voids and bubbles, and (b) is a picture of a minced meat tablet without obvious bubbles. During the spectral scan, take 8g of the previously prepared minced meat and put it into a sample test cup with a diameter of 5.1cm. Use the equipment stopcock to slowly press it into a uniform thin sheet state so that it covers the entire surface of the sample cup. The final tablet product should have uniform meat texture and no obvious bubbles. Fig.12 (b) As shown. Fig.12 As shown in (a), there are a lot of void bubbles, which will disturb the subsequent spectrum collection and the tableting operation should be repeated.
[0218] (9) Spectral acquisition process: When acquiring spectra, if the acquisition area is a special case (such as a place with more meat fat or water), it will affect the accuracy of the subsequent overall spectral modeling. Therefore, in actual acquisition, multiple areas and angles need to be selected and multiple samplings are performed. Specifically, the sample spectrum acquisition area is Fig.13 As shown, first of all Fig.13 Area A in the middle of the sample cup is the main area for spectrum acquisition. The acquisition method is to rotate and sample at three angles. Each time the sample cup is rotated 120 degrees, and each angle is scanned 3 times, and a total of 9 data are obtained. In order to avoid uneven thickness of minced meat in the sample cup caused by uneven tableting, three small areas around the main sampling area are required ( Fig.13 B, C, D), each area is repeatedly collected at a fixed angle for 3 times, and a total of 9 data are obtained. After the collection is completed, the total number of data for one sample is 18.
[0219] (10) Spectral data image: The final target spectral image, i.e., duck meat near-infrared spectrum collection image, is shown in Figure 1. Fig.14 The normal operation acquisition diagram is shown as follows Fig.14As shown in (b), the 18 spectral acquisition images are almost completely overlapped, and the overall curve is smooth without jagged edges. The spectral data of the duck meat sample is the average of these 18 spectra. Fig.14 (a) shows the situation where the spectral data collected multiple times have obvious bifurcations at the peaks and troughs of the curve. In this case, the severity of the bifurcation should determine whether to re-perform the compression collection experiment. Ideally, the 18 spectral collection images should be almost overlapping, and the overall curve should be smooth without jagged edges. Those skilled in the art should know whether to re-perform the compression collection experiment based on the severity of the bifurcation according to the experimental requirements; in this embodiment, if the multiple spectral images collected are shown on the collection software to be separated by more than 2 small cells, the compression sampling operation should be performed again. (11) Experimental time control: In order to avoid the deterioration of samples due to long-term exposure to air and excessive loss of meat moisture, the number of samples processed in each round of experiments should be controlled to be completed within 3 hours. Multiple experimental verifications have shown that under single-person operation, high-quality spectral data collection for 8 samples can be completed every 3 hours.
[0220] Table 2 Experimental data comparison table
[0221]
[0222] As shown in Table 2, the R2 coefficient, RMSE, and RPD fitting index are used as references to compare the impact of different methods on the regression performance of the ELM model. The different steps and comparative analysis are as follows:
[0223] 1. Control experiment (unstandardized acquisition): Under non-standardized experimental conditions, near-infrared spectra of 100 duck breast samples of the same type were collected. The ELM model was then directly used for fitting, and the results showed extremely low fitting performance (R 2 C is 0.11, R 2 P = 0.07). Compared with the subsequent standardized experiments, this result reflects the necessity of strictly controlling experimental variables and operation steps to improve model performance.
[0224] 2. Strictly standardize the collection process: Under the above standardized collection conditions, the variables were strictly controlled to ensure the consistency of the collection process, but no further data processing was performed. ELM was directly used for regression fitting. Compared with the unstandardized case, the model performance was greatly improved (R 2 C is 0.55, R 2 P was 0.52).
[0225] 3. Standardized experiments and outlier screening: Under standardized acquisition conditions, the spectral data and physical and chemical indicators are screened for outliers using the Mahalanobis distance and 3σ principle to eliminate sample data that do not meet the standards. This process significantly improves the accuracy of the model (R2 C is 0.73, R 2 P is 0.70), indicating that high-quality data has a significant effect on improving the regression performance of the model.
[0226] 4. Standardization experiment and SG-SNV correction: Based on standardized acquisition, SG-SNV correction was performed on the spectral data to eliminate the effects of baseline drift and random errors. After correction, regression fitting was performed. The fitting effect was improved compared with the original data, but not significantly (R 2 C is 0.60, R 2 P = 0.57).
[0227] 5. Standardized experiment and SPXY set partitioning: Under standardized acquisition conditions, SPXY partitioning was performed to ensure that the label density distribution of the training set and the test set was similar. The results showed that this processing method greatly improved the model prediction accuracy (R 2 C is 0.71, R 2 P was 0.69).
[0228] 6. Standardized experiment and comprehensive application of the above processing methods: Finally, the above processing methods were applied, including standardized collection, abnormal screening, SG-SNV correction and SPXY division, and then ELM model regression fitting was used. The results showed that the combined processing scheme significantly improved the model performance and achieved the optimal fitting effect for PUFA indicators (R 2 C is 0.91, R 2 P was 0.89, RPD was 3.04).
[0229] 7. Unstandardized experiment and comprehensive application of the above processing methods: As a control, to determine whether the above processing methods are effective, this experiment used a combination of abnormal screening, SG-SNV correction and SPXY partitioning to fit under unstandardized collection conditions. The results show that the above comprehensive method can indeed improve the model performance (R 2 C is 0.41, R 2 P is 0.22, RPD is 1.12), but because the initial collection process itself was not strictly controlled, the overall data quality and feature representativeness were extremely low, so the model fitting performance was still poor, which once again verified the importance of standardized collection process to model performance.
[0230] ELM model analysis:
[0231] The model used for regression is the Extreme Learning Machine (ELM), which is a type of feedforward neural network known for its fast learning speed and relatively simple implementation process. Unlike traditional multi-layer perceptrons or deep learning models that use backpropagation algorithms to iteratively adjust all weights in the network, the main features of ELM include:
[0232] Randomly initialize hidden layer weights: The core innovation of ELM is that the input weights and bias values of its hidden layer nodes are randomly or manually set and remain unchanged throughout the learning process. This is significantly different from conventional neural network algorithms that require continuous optimization of weights through iteration.
[0233] Optimizing only the output layer weights: The learning process focuses on calculating the weights of the output layer, which is usually done in one go by solving a system of linear equations or using methods such as least squares, rather than repeatedly iterating, which greatly speeds up learning.
[0234] I. Basic structure: Fig. 9 As shown in Figure 1, the basic architecture of ELM includes input layer, hidden layer and output layer. Suppose we have a training set with (N) samples
[0235]
[0236] where x i ∈R d is the input vector, t i ∈R c is the corresponding output vector (for classification tasks, ti is a one-hot encoded vector; for regression tasks, it is directly a real value).
[0237] II. Hidden layer activation: For each input sample x i , the activation value h of the L neurons in the hidden layer i =[h i1 ,h i2 ,...,h iL ] T It is expressed as:
[0238]
[0239] Here, g(·) is the activation function (such as sigmoid, Tanh, etc.), a l is the input weight vector of the lth hidden layer neuron, b l are bias terms, which are all randomly initialized and remain unchanged during the learning process.
[0240] Using different activation functions (Sigmoid, Tanh, and Lin) in the ELM structure helps the model capture different features and patterns of the data. Each activation function has different nonlinear characteristics, which helps the model better adapt to complex data structures. Specifically:
[0241] When activation functions are used in combination, it is not just a simple addition. The intuitive result of the combination is the improvement of data fitting performance indicators, such as R 2 The improvement of these indicators is not only due to the role of the three activation functions, but also due to the new nonlinear transformations and interaction effects brought about by their combination, as well as the different mapping methods of the model in the feature space, which enhances the expressiveness of the model and brings it a more complex and multi-dimensional feature extraction capability.
[0242] The specific effects are described as follows:
[0243] 1. Enhance the nonlinear expression ability of the model: By combining the two nonlinear activation functions, Sigmoid and Tanh, the model can more comprehensively capture the complex nonlinear patterns in the data. Sigmoid is suitable for capturing relatively smooth nonlinear changes, while Tanh can effectively adapt to nonlinear features with symmetrical distribution. Through this combination, the model can more flexibly adapt to various different features and patterns, thereby improving the ability to fit nonlinear data.
[0244] 2. Increase the richness of feature space: Different activation functions provide a variety of feature mapping methods, allowing the hidden layer to generate a richer feature space. This diversity of feature space helps the model to more accurately separate and capture the complex features of data in high-dimensional space. Different nonlinear mappings of different activation functions to data enable the model to explore the potential laws of data in multiple dimensions, further enhancing the model's expressive power.
[0245] 3. Improve generalization ability: The combination of multiple activation functions enables the model to better handle the diverse distribution in the data, avoiding the adaptability limitations brought by a single activation function. Specifically, Sigmoid and Tanh can handle small-scale and symmetrically distributed data, while the linear lin activation function ensures the ability to model linear relationships. Through this diverse selection of activation functions, the model can work more robustly on different data sets, improve model generalization, and reduce the risk of overfitting.
[0246] During the experiment, the type and number of activation functions were manually adjusted and optimized based on actual application requirements and fitting effects. For the true value regression problem of spectrum-fatty acids, the experimental design combined the classic ELM model structure with the actual data characteristics. After experimental adjustment, a combination of 80 Sigmoid activation functions, 50 Tanh activation functions, and 50 linear activation functions was selected. This selection not only optimizes the model, but also maintains the advantages of the classic ELM structure, ensuring a balance between computational efficiency and effect.
[0247] The following is a description of each activation function:
[0248] Sigmoid activation function: It is a commonly used S-shaped activation function with an output range of (0,1)
[0249]
[0250] Operational characteristics: When the input value x is large or small, the derivative of the Sigmoid function is close to zero, and the gradient disappearance problem is prone to occur. Because the output value is limited to (0,1), it is often used for binary classification tasks.
[0251] Role in ELM: The Sigmoid function is suitable for data with small amplitude or biased towards positive values. It can help the model capture some simple nonlinear relationships in the data through nonlinear mapping. In this experiment, 80
[0252] Hidden layer neurons with Sigmoid activation function are used to capture smoothly changing patterns in the data.
[0253] Tanh activation function: It is another S-shaped activation function with an output range between (-1,1) and is more efficient than Sigmoid.
[0254] Alleviate the vanishing gradient problem.
[0255]
[0256] Operational characteristics: Compared with Sigmoid, the output of the Tanh function is between (-1, 1) and centered at 0, so it is suitable for symmetrically distributed data. The gradient of Tanh is large, which can alleviate the gradient vanishing problem to a certain extent.
[0257] Role in ELM: Tanh activation function is suitable for the situation where data is balanced in the positive and negative intervals. It can output close to 1 when the input is large and close to -1 when the input is small. In this experiment, 50 hidden layer neurons using Tanh activation function are set to help the model extract more symmetrical nonlinear features.
[0258] 1in linear activation function: There is no nonlinear transformation, the output is the same as the input, and there are no specific restrictions.
[0259] f(x)=x
[0260] Operational characteristics: Linear activation functions directly output input values without changing the shape and distribution of the input data. They are suitable for extracting linear relationships in data without introducing any nonlinearity.
[0261] Role in ELM: The linear activation function is suitable for linear patterns in the data and is used in the model to directly extract linear information from the data. This experiment sets up 50 hidden layer neurons using linear activation functions to adapt to the linear features that may exist in the data.
[0262] In summary, the ELM model used in this experiment adds a variety of activation functions based on the classic structure, including 80 Sigmoid activation functions, 50 Tanh activation functions, and 50 linear activation functions. This diverse distribution of activation functions provides the model with rich feature extraction capabilities, enabling it to better adapt to complex data structures.
[0263] III. Output weight calculation: The main calculation step of ELM is to determine the weights β from the hidden layer to the output layer = [β1, β2, ..., β L ] T Assuming that the output layer uses linear combinations, the output Expressed as
[0264]
[0265] In order to minimize the overall prediction error of all samples, the output weight β is generally found by the least squares method. Specifically, consider minimizing the mean square error and solve the following normal equation to obtain β:
[0266] β=(H T H) -1 H T T
[0267] Where H = [h1, h2, ..., h N ] T is the hidden layer activation value matrix, T = [t1, t2, ..., t N ] T is the target output matrix.
Claims
1. A method for rapid detection of fatty acid content in Peking duck based on near infrared spectroscopy, characterized in that: The steps include: Step S1: Selecting a sample and performing sample pretreatment; the sample pretreatment is freezing the sample to preserve the natural tissue structure of the internal muscle of the sample; Step S2: Collect sample data using a standardized collection method; The sample data includes: spectral data and physical and chemical index data; Step S3: Eliminate abnormal samples; the abnormal samples include: using the Mahalanobis distance method to eliminate abnormal samples in the spectral data and using the 3σ principle method to screen out abnormal samples in the physical and chemical index data; Step S4: performing spectral data correction, including: using Savitzky-Golay smoothing algorithm to perform smoothing and denoising; using standard normal variable transformation to eliminate baseline drift and random errors in the spectral data; Step S5: using a sample set partitioning method based on joint XY distance to divide the data set into a training set and a test set in a ratio of 7:3; Step S6: construct an optimized extreme learning machine model, and train the optimized extreme learning machine model based on the training set; construct an evaluation model, and verify the detection effect of the optimized extreme learning machine model based on the test set; and realize rapid detection of fatty acid content in Beijing duck.
2. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The sample in step S1 is the left breast muscle of a 42-day-old Beijing duck; The samples include: baked type and split type; the freezing and preservation of the samples includes: placing the samples in an environment of minus 80° C. for sealed freezing and preservation.
3. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The standardized collection method in step S2 includes: Step S21: Building an experimental platform, including: disinfecting the surface of the experimental equipment, building a spectrum collection experimental platform with an iron frame and a spectrum equipment fixing clamp, fixing a near-infrared collection lens, and connecting a computer device; Step S22: thawing the sample, including: placing the sample in a room temperature environment for thawing, and using experimental absorbent paper to absorb blood water flowing out during the thawing process; Step S23: cutting the sample, including: using a large serrated knife to cut the sample, and using a small scalpel to remove interfering tissue on the surface of the sample, including the external epidermal fascia and obvious fat particles and impurities, to ensure that the samples used are all pink meat pieces; Step S24: grinding the sample, including: grinding the sample for 15 seconds, taking a 5-second break, and grinding the sample again for 15 seconds to obtain pink minced meat; Step S25: preheating the spectrum acquisition device, including: starting the spectrum acquisition device, preheating for 20 minutes, and ensuring that the probe of the spectrum acquisition device reaches a preset temperature; Step S26: using the same barium sulfate standard white plate with a reflectivity of 100% to perform a black and white reference calibration on the spectrum acquisition device; Step S27: Setting the spectrum acquisition equipment parameters, including: setting the integration time to 15.6ms; setting the sampling integration times to 75 times; setting the detection distance between the probe and the sample surface to 3mm; setting the spectrum scanning range to 900-1700nm; setting the total number of characteristic bands to 125; Step S28: making sample tablets, including: taking the pink minced meat, putting it into a sample testing cup, and slowly pressing it into a uniform thin slice state using a device stopcock, so that the pink minced meat covers the entire surface of the sample cup, ensuring that the overall meat quality of the tablet product is uniform and there are no obvious bubbles; Step S29: collecting spectrum to obtain spectrum data; Step S2A: Collect physical and chemical true value data to obtain physical and chemical index data.
4. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 3, characterized in that: The spectrum acquisition in step S29 includes: Step S291: Collect spectral data of the middle area A of the sample cup surface, rotate the sample cup surface three times, each time by 120 degrees, collect data at each angle three times, and obtain a total of 9 spectral data of the middle area A; around the middle area A, select the first surrounding area B, the second surrounding area C and the third surrounding area D at intervals of 120 degrees at the midpoint of the radial direction of the sample cup surface, collect data for each surrounding area three times, and obtain a total of 9 spectral data of the surrounding areas; Step S292: Use the 18 spectral data collected in step S291 to draw the final target spectral image, and determine whether the final target spectral image meets the preset judgment conditions. If it meets the judgment conditions, the average value of the 18 spectral data is used as the spectral data of the sample; if it does not meet the judgment conditions, re-execute step S28; the judgment condition is: the 18 spectral collection images overlap and the overall curve is smooth without jagged edges; Step S293: determine whether the acquisition time is less than a predefined threshold, and if the acquisition time exceeds the threshold, re-execute step S21; the threshold is 3 hours; The physical and chemical true value data collection in step S2A includes: The duck breast was pre-cooled and transferred to a freeze dryer for freeze drying at -40°C for more than 72 hours; 50 mg (±1 mg) was weighed into a 4 ml reaction bottle, 1000 μl of acetyl chloride methanol solution was added, nitrogen was filled in and shaken; the duck breast was placed in an 80°C water bath for 2 hours, and the mixture was taken out and shaken every 20 minutes. After the water bath, the duck breast was taken out and cooled to room temperature, 1 ml of n-hexane was added and shaken; 1.5 ml of 6% potassium carbonate solution was added and shaken; the mixture was centrifuged at 4000 rpm for 5 minutes, 500 μl of the supernatant was taken into a 2 ml injection bottle, and the mixture was directly injected into a gas chromatograph to analyze the experimental results and obtain the physical and chemical true value data.
5. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The step S3 of using the Mahalanobis distance method to eliminate abnormal samples in the spectral data includes: Perform mean normalization, including: calculating the mean of all features, and then let x j =x j -μ j ; If the features are on different orders of magnitude, divide the features by the standard deviation σ 2 , where x j represents the original value of the jth feature, μ j represents the mean of the jth feature, x j -μ j Indicates that the jth feature is mean normalized, that is, the feature value is subtracted from its mean and used to replace the original x j The value of x j Participate in subsequent operations; Calculate the covariance matrix Σ, which is: In the formula, m represents the number of samples, that is, the total number of samples in the data set; n represents the number of features, that is, the number of features contained in each sample; T represents the transposition operation, x (i) Represents the eigenvector of the i-th sample, containing all the eigenvalues of the sample; Based on the eigenvector of the covariance matrix Σ, calculate the Mahalanobis distance D of the i-th sample in the validation set i : Where t i is the principal component score of sample i in the validation set; is the average score matrix of the validation set samples; m is the number of samples; M is the covariance matrix of the principal component score matrix of the validation set spectra; Calculate the Mahalanobis distance threshold D of abnormal samples th : D th =D m +e·σ d Where e is the threshold weight coefficient, D m is the average value of the sample Mahalanobis distance, σ d is the standard deviation; The prediction model of spectral data and physical and chemical indicators was established by combining partial least squares method, so as to select the appropriate Mahalanobis distance threshold; When D i ≥D th When , the i-th sample in the validation set is determined to be an abnormal sample; if D i <D th , then it is judged that the spectral characteristics of the sample are within a reasonable range.
6. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The step S3 of using the 3σ principle method to screen out abnormal samples in the physical and chemical index data includes: Calculate the mean μ: Where N is the number of data points, x i is the i-th data point; Calculate the standard deviation σ: Calculate the upper and lower thresholds to determine the range of normal data; Upper threshold = μ + 3σ Threshold lower limit = μ-3σ Identify and remove outliers. When the i-th data point x i Satisfy: (x i <μ-3σ) or (x i >μ+3σ), x i are considered outliers.
7. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The step S4 of using the Savitzky-Golay smoothing algorithm to perform smoothing and denoising includes: calculating the smoothed average value x at wavelength k k,smooth : In the formula, h i is the smoothing coefficient, h i Based on the least squares principle, it is obtained by polynomial fitting, and H is the normalization factor; w is the half width of the window, that is, the number of left and right data points considered in the smoothing process. The total width of the window is 2w+1, and the value of w is 13; The standard normal variable transformation in step S4 includes: Calculate the spectral data X after standard normal variable transformation SNV : Where, X raw is the original spectral data, and std(X raw ) are the mean and standard deviation of the original spectrum, respectively.
8. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The sample set division method based on the joint XY distance in step S5 includes: Step S51: for all samples in the known sample set, calculate the joint XY distance matrix between each sample; select two samples with the farthest distance from all samples as the initial correction sample set; Step S52: Calculate the distances between all unselected samples and all samples in the selected sample set, and select a sample with the largest average distance to the selected sample set to add to the correction sample set; Step S53: repeating step S52 until the size of the calibration sample set reaches a preset number n; Step S54: the remaining unselected samples are classified as test samples; The joint XY distance matrix is: Where, d x (i, j) is the distance between samples calculated using the spectrum as the characteristic parameter; d y (i, j) is the distance between samples calculated with concentration as the characteristic parameter; i, j∈[1,z], z is the total number of samples, that is, assuming there are z samples, and then the set is divided; α is the weighting factor, 0≤α≤1.
9. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The step S6 of constructing an optimized extreme learning machine model includes: Based on the classic extreme learning machine model structure, optimized activation functions are designed; the optimized activation functions include: 80 Sigmoid activation functions, 50 Tanh activation functions and 50 linear activation functions.
10. The method for rapid detection of fatty acid content of Peking duck based on near infrared spectroscopy according to claim 1, characterized in that: The evaluation model constructed in step S6 includes: 2 , root mean square error RMSE and relative analysis error RPD.
Citation Information
Patent Citations
An establishing method of a breast milk fatty acid spectrum database
CN104165955A
Sample component measurement method based on PCR-ELM algorithm
CN105092509A
Near infrared detection method for fatty acid content of vegetable oil
CN108645815A
Near infrared spectroscopy based quantitative detection method for detecting talcum powder mixed to radix angelicae
CN109799207A
Rapid semi-supervised classification method based on graph volume positive limit learning machine
CN111626332A
Cited By
Pet food spectrum detection device and detection method
CN120668594A
A spectral detection device and method for pet food
CN120668594B