A food oil rapid detection and traceability method based on a spectral feature library
By establishing a spectral feature library and using ridge regression algorithm for inter-device calibration, the problem of measurement inconsistency between portable spectrometers has been solved, enabling rapid detection and traceability of edible oils, improving regulatory efficiency and protecting consumers' right to know.
Patent Information
- Application Number
- CN202511443633.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-10-10
AI Technical Summary
The inconsistency in spectral data measurement among existing portable spectrometers makes it impossible to establish a large-scale, shareable database of spectral characteristics of food oils, thus hindering rapid detection and traceability.
By establishing a spectral feature library of edible oils and waste cooking oils, and employing inter-device calibration technology based on standard oil sample groups and ridge regression algorithms, we can ensure seamless comparison between the spectral data collected by portable devices and the cloud-based spectral feature library, thus solving the problem of consistency of measurement data between devices.
It has achieved data standardization and universality of portable spectrometers, provided a method for rapid detection and traceability of edible oils, improved regulatory coverage and timeliness, and empowered consumers with the right to know.
Smart Images

Figure CN120908122B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of edible oil safety detection, and particularly relates to a food oil rapid detection and traceability method based on a spectral feature library. BACKGROUND
[0002] Food oil safety is an important part of food safety, and food oil safety is guaranteed by full-chain quality control and traceability of raw materials, production processes and circulation links. However, from the long chain from the production end to the consumption end, the regulatory departments, production enterprises, sales businesses and final consumers all lack a kind of on-site rapid detection and verification method which can take into account high efficiency, accuracy, low cost and easy operation.
[0003] At present, the determination of food oil quality mainly depends on the following two ways: (1) Laboratory detection method: This is the current mainstream authoritative detection method, which usually detects the physicochemical indexes, health and safety indexes, nutritional component indexes and metal pollutants of oil products according to national mandatory standards. Although the laboratory detection method has high accuracy, it has high cost and needs to rely on large and precise instruments such as gas chromatography, mass spectrometry and atomic absorption spectrometry. In addition, the sample pretreatment is complex, and it seriously lacks timeliness. Moreover, this method must be operated by professional personnel in a laboratory environment, and cannot be used for real-time judgment in production sites, warehouses, supermarkets and other scenes. Most importantly, the sample after laboratory detection is usually destroyed and cannot be rechecked or stored as is. (2) Appearance, label and sensory identification: For consumers and businesses, this is the most commonly used simple method, which mainly makes preliminary judgments by checking the color, transparency, product label information (production date, manufacturer, ingredient list) and smell of the oil. This method is simple, but it is extremely subjective and unreliable, and cannot scientifically and effectively identify safety risks such as kitchen waste oil, inferior oil and adulterated oil.
[0004] Especially for the identification of "kitchen waste oil", its composition is complex and variable, and is greatly affected by factors such as raw material source, processing technology, season and region. Traditional laboratory methods also need to make comprehensive judgments on multiple indexes, and on-site rapid identification has become a problem in the industry, which leads to a blind spot in supervision and seriously threatens public health.
[0005] As a kind of "fingerprint" identification technology, hyperspectral analysis technology has shown great potential in the field of material identification in recent years. Different substances have different absorption and reflection characteristics of light, forming unique spectral characteristics. Hyperspectral technology is like a pair of "glasses" that helps to see these "fingerprints". In theory, the spectral characteristics of edible oil are bound by correlating the spectral characteristics of edible oil with its composition, indexes and spectral characteristics. By analyzing the spectral characteristics of edible oil, its composition information can be obtained, so as to realize rapid identification and traceability. However, the practical application of hyperspectral technology in food oil daily supervision still faces the following core technical bottlenecks:
[0006] Device consistency problem: different hyperspectral detection devices will measure systematic deviation of spectral data on the same sample due to factors such as light source aging, optical device difference, and environmental temperature change; this "device dependence" makes the spectral model established on one device cannot be directly applied to another device, and the data cannot be shared and compared, which fundamentally hinders the establishment of large-scale and universal spectral feature database; without reliable database, it is impossible to trace and quickly detect;
[0007] Cost and portability contradiction: laboratory-level hyperspectral instruments have high precision, but are expensive, bulky and complex to operate, and are difficult to popularize, while the existing portable spectrometers on the market often have deficiencies in precision, stability or professional modeling for oil detection, and cannot meet the reliable requirements of food safety detection. SUMMARY
[0008] Therefore, the present application provides a food oil rapid detection and traceability method based on a spectral feature library, which effectively solves the problem of differences in sampling between existing portable spectral devices, realizes the standardization and universalization of food oil spectral data, and provides a method for food oil rapid detection and traceability.
[0009] To achieve the above purpose, the present application provides a food oil rapid detection and traceability method based on a spectral feature library, comprising the following steps:
[0010] S1, establishing a spectral feature library of food oil and kitchen waste oil;
[0011] Collecting spectral feature data of a plurality of known categories of food oil and kitchen waste oil samples by a portable hyperspectral oil detection device, and establishing a correlated spectral feature database according to the categories, components and indicators of the food oil and kitchen waste oil samples;
[0012] The spectral feature data of the food oil and kitchen waste oil includes: hyperspectral device UID, DN value, blackboard intensity, whiteboard intensity and reflectivity;
[0013] S2, consistency correction between portable hyperspectral oil detection devices;
[0014] S201, using a standard oil sample with known components as a reference system, randomly selecting one hyperspectral oil detection device as a master device and at least one hyperspectral oil detection device as a slave device, and the master device and the slave device sequentially detect the standard oil sample;
[0015] S202, establishing a consistency deviation correction matrix between the master device and the slave device;
[0016] S203, correcting the slave device, uploading the DN value correction value of the slave device to the device spectral feature database, the expression of the DN value correction is:
[0017] ;
[0018] Wherein, DN value array obtained by the slave device from the standard oil sample, DN value array after correction, deviation correction matrix The average value of the DN value array generated on the slave device using the reference system is Waveband, deviation correction matrix The average value of the DN value array generated on the master device using the reference system is Waveband;
[0019] S3, consistency correction of the portable hyperspectral oil detection device itself;
[0020] S301, record the whiteboard intensity and blackboard intensity adopted by the portable hyperspectral oil detection device when initializing the random fixed standard light plate, compare the actual whiteboard intensity and blackboard intensity generated by the standard light plate and each time the portable hyperspectral oil detection device is turned on for correction operation, and record the daily updated correction coefficient, that is, the corrected whiteboard intensity and blackboard intensity spectral array;
[0021] S302, calculate the oil sample reflectivity according to the DN value obtained from each oil sample detection; ;
[0022] S4, detect the oil sample to be tested;
[0023] Use any corrected slave device to detect the oil sample to be tested, and obtain the original spectral data of the oil sample to be tested;
[0024] S5, correct and trace the original spectral data of the oil sample to be tested, and output the tracing result of the oil sample to be tested.
[0025] Preferably, the spectral features of food oil are based on food oil manufacturers, brands and factory batches, and the spectral feature library of kitchen waste oil is based on region, eating habits and season.
[0026] Preferably, the Direct Standardization method is used to use ridge regression to The matrix of dimension The matrix of dimension, i.e. obtaining the bias correction matrix wherein denotes the number of samples, denotes the number of spectral bands generated by the hyperspectral oil detection device for each food oil sample, comprising the following steps:
[0027] determining the bias correction matrix , the slave device according to the spectral band matrix generated by the slave device for the number of samples after conversion, close to the spectral band matrix generated by the master device for the same number of samples , the expression is:
[0028] ;
[0029] using the ridge regression with the added parameter regularization term to process each spectral band, the expression is:
[0030] ;
[0031] wherein denotes the column of the master device data, denotes the column of the bias correction matrix , denotes the regularization parameter;
[0032] the expression of the solution of each column ridge regression is:
[0033] ;
[0034] wherein denotes the identity matrix of ;
[0035] combining the columns , i.e. obtaining the complete bias correction matrix , the expression is:
[0036] ;
[0037] wherein and have a dimension of , has a dimension of , has a dimension of So the dimension of ; the complexity of the control model.
[0038] Preferably, the correction coefficient expression is:
[0039] ;
[0040] ;
[0041] the expression of the reflectivity is:
[0042] ;
[0043] wherein, denotes the wavelength, denotes the number of wave bands, , respectively denote the whiteboard intensity and the blackboard intensity generated when the portable hyperspectral oil detection device is initialized, , respectively denote the whiteboard intensity and the blackboard intensity generated when the portable hyperspectral oil detection device is started up and preheated every day, , respectively denote the correction coefficients of the whiteboard and the blackboard.
[0044] Preferably, the oil sample to be measured is traced, comprising the following steps:
[0045] S501, correcting and normalizing the original spectral data of the oil sample to be measured through the deviation correction matrix to obtain corrected and normalized spectral features;
[0046] S502, comparing and analyzing the corrected and normalized spectral data with the spectral data in the spectral feature library of food oil and kitchen waste oil, identifying the oil sample type, composition, index and traceability result of the oil sample to be measured by using a spectral feature vector clustering algorithm and outputting.
[0047] Compared with the prior art, the present application has the following advantages:
[0048] The method provided by this invention transforms hyperspectral analysis technology from a sophisticated laboratory tool into a practical tool widely applicable to on-site food oil safety supervision. By establishing a spectral feature library of food oils and waste cooking oils, and employing inter-device calibration technology based on standard oil sample groups and ridge regression algorithms, it ensures that spectral data collected by any calibrated portable device can be seamlessly compared and universally used with benchmark data in a cloud-based spectral feature library, independent of the device itself. This solves the problem of consistency of measurement data between different testing devices, making it possible to establish a large-scale, shareable, and traceable "spectral fingerprint" database of food oils, thereby completely changing the traditional laboratory testing model that relied on high costs, long cycles, and professional personnel.
[0049] The method provided by this invention allows refineries to easily establish unique spectral identification files for their finished oil products and store them in the warehouse at the production end. At the distribution and consumption end, regulators, merchants, and even consumers can use portable devices to perform a quick scan in a few seconds to determine the authenticity of the oil products, identify potential risks of adulteration with waste cooking oil, and trace their origin. This not only greatly improves the coverage and timeliness of supervision, but also gives consumers an unprecedented right to know, resulting in significant social benefits and commercial value. Attached Figure Description
[0050] Figure 1 is a flowchart of the process of establishing the spectral feature model library according to the present invention;
[0051] Figure 2 This is a comparison image of the spectral characteristics of the same oil sample collected by the host device and the slave device in this embodiment;
[0052] Figure 3 This is a comparison chart of the spectral characteristics obtained by the host device and the slave device for the same oil sample in this embodiment, and the spectral characteristics obtained by the slave device after correction.
[0053] Figure 4 A spectral feature library was established for the 16 oil samples numbered D01-D16 in this embodiment. Detailed Implementation
[0054] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0055] Example 1
[0056] Portable hyperspectral oil rapid detection equipment (detection equipment), such as Figure 1 As shown in ①-③, when leaving the refinery, as Figure 1 In step ④, unique spectral characteristics are obtained from each batch of edible oil samples, such as...Figure 1 In the middle ⑤, the spectral characteristics of the oil product are established and stored in the database; the end customer uses the same hyperspectral oil liquid rapid detection equipment to detect the obtained food oil sample in real time; if Figure 1 In the middle ⑥, the obtained spectral characteristics are identified in real time by algorithm and the spectral characteristics of food oil in the spectral characteristics database, and the data are classified and regressed to achieve clustering and tracing, thereby realizing the quality supervision function;
[0057] Different elements and their compounds have their own unique spectral characteristics, and the spectrum is regarded as the "fingerprint" of distinguishing substances, and hyperspectrum is the "glasses" that help to see these "fingerprint", so establishing the spectral characteristics database of food oil should be the best method to save the characteristics of oil samples; however, at present, except for the hyperspectral oil liquid rapid detection equipment adopted in the present patent, there is no similar product on the market that can provide the spectral characteristics of food oil, and the present embodiment solves the consistency problem between devices by establishing a correction matrix through the structure and the oil sample group of the host and the slave; the difference between the devices is represented by a correction matrix, which is accompanied by the spectral characteristics data of the device uploaded into the database; when applied, the spectral data is independent of the acquisition device during calculation, thereby solving the consistency problem; and the spectral characteristics database of food oil has the ability of tracing and detection analysis.
[0058] The present embodiment provides a food oil rapid detection and tracing method based on a spectral characteristics database, comprising the following steps:
[0059] S1, establishing a spectral characteristics database of food oil and kitchen waste oil;
[0060] The spectral characteristics data of a plurality of known types of food oil and kitchen waste oil samples are collected by a portable hyperspectral oil liquid detection device, and a correlation spectral characteristics database is established according to the types, components and indexes of the food oil and kitchen waste oil samples;
[0061] The spectral characteristics data of food oil and kitchen waste oil include: hyperspectral device UID, DN value, blackboard intensity, whiteboard intensity and reflectivity;
[0062] The main physical and chemical components of food oil include temperature-dependent concentration (physical component), triglyceride (95%) and other components (5%); triglyceride is formed by esterification of one molecule of glycerol (glycerol) and three molecules of fatty acid, which can be further divided into saturated fatty acid (SFA) and unsaturated fatty acid (UFA); unsaturated fatty acid can be further divided into monounsaturated fatty acid and polyunsaturated fatty acid; unsaturated fatty acid can effectively distinguish the types of edible oil, such as peanut oil (monounsaturated fatty acid) or corn oil (polyunsaturated fatty acid); other components are composed of vitamins (E), antioxidants, free fatty acids and other impurities;
[0063] The physicochemical indicators and metal components of kitchen waste oil are based on food oil; the main components of kitchen waste oil are triglycerides, toxic metal elements, harmful microorganisms, harmful chemicals, rancid decomposition products, and sewage and garbage impurities; these components together constitute the complex composition of kitchen waste oil, except for triglycerides, other components come from kitchen waste raw materials and processing process, even in the refining process, it is completely difficult to exclude these components, which are affected by factors such as region, diet environment, season, etc.
[0064] Therefore, the food oil spectral feature library takes food oil manufacturers, brands, and factory batches as the basic unit, and the kitchen waste oil spectral feature library takes region, eating habits, and season as the basic unit; the spectral feature spectrum needs to establish a relational database according to the food oil category, and Table 1 lists the structure and relationship of the spectral feature library generated by the corresponding components of food oil and kitchen waste oil category indicators;
[0065] Table 1 Composition structure and components of food oil and kitchen waste oil
[0066]
[0067] Taking tea seed oil as an example, in order to ensure compliance with food safety standards (such as GB / T 11765-2018 “Oil Tea Seed Oil”), multiple tests need to be performed, as shown in Table 2; safety standards include tea seed oil physicochemical indicators, health and safety related indicators, and nutritional component indicators; Even if it is sent to the laboratory for testing, different test equipment and testing processes need to be completed, which undoubtedly increases the difficulty, cost, and effectiveness of tea seed oil quality and safety testing and verification for regulatory units and end customers; If necessary, oil sample quality and safety indicators are sent to the laboratory for testing at the production link, at the same time, a set of spectral features of the oil sample sample is generated on-site by the hyperspectral oil liquid rapid detection equipment (not at the same time); According to physical principles, different elements and their compounds have their own unique spectral characteristics; Spectra can be used to identify the “fingerprint” of a substance; Therefore, if the consistency of the hyperspectral oil liquid rapid detection equipment can be guaranteed, the deviation of the spectral features obtained from the same oil sample sample at different occasions can be compensated by the algorithm model; Therefore, by building a food oil spectral feature library, the on-site rapid detection and verification of food oil on the market can be achieved using the hyperspectral oil liquid rapid detection equipment, and the effect of detection and verification can be achieved through oil spectral feature traceability;
[0068] Table 2 Tea seed oil food safety content detection standard
[0069]
[0070] S2, consistency correction between portable hyperspectral oil liquid detection equipment;
[0071] The results obtained from testing the same oil sample by different devices reflect the consistency between the devices. The consistency of the devices is the basis for the accuracy of the devices. Factors affecting the consistency of the devices include the stability of the light source, the stability of the grating separation and photoelectric conversion, the stability of the power supply, the consistency of the structural design and related operations, and the influence of the environment (temperature, humidity) on the optical path and grating circuit.
[0072] The consistency of equipment components includes the light source and grating separation, as well as the photoelectric conversion circuit. Equipment components can be uniformly classified as optical modules. The controllable parameters are exposure time (integral value) and gain. The cuvette darkroom structure includes the cuvette insertion and removal structure and the standard calibration plate, as well as the power supply system. The final result is expressed according to the wavelength through DN value and reflectivity. The above three aspects are the differences between equipment caused by the structural design and installation of the equipment.
[0073] The spectral characteristic spectrum includes the hyperspectral device UID (generated spectral characteristic spectrum), DN value, black panel (dark current) intensity, white panel intensity, and consistency (between devices) deviation correction matrix. Among them, DN value, blackboard (dark current), and whiteboard are one-dimensional arrays and two-dimensional correction matrices with the number of bands as the unit. In this embodiment, 300 bands are assumed (based on the reflection spectrum of 400nm-1000nm and the accuracy of 2nm band).
[0074] Since the spectral model and algorithm are both based on reflectance, the spectral feature spectrum includes reflectance; the reflectance and DN value arrays are on the same dimension; reflectance is obtained by the probe of the acquisition device in a given wavelength band. According to the standard whiteboard Strength and blackboard The intensity (dark current) affects the reflected brightness value after projection from the halogen light source in the spectral module of the acquisition device and the true reflected brightness value of the detected object (cooking oil and kitchen waste oil). The ratio is calculated and expressed as:
[0075]
[0076] Among them, the strength of the whiteboard and the strength of the blackboard It involves collecting the strength of the whiteboard and blackboard generated daily during the device's power-on preheating process, which serves as a consistency calibration for the device itself.
[0077] In this embodiment, the consistency correction between devices specifically includes the following steps:
[0078] S201, Use A standard oil sample of a known component is taken as a reference system, a hyperspectral oil detection device is randomly selected as a master device, and at least one hyperspectral oil detection device is selected as a slave device, and the master device and the slave device detect the standard oil sample in turn ;
[0079] S202、Establishing a deviation correction matrix between the master device and the slave device ;
[0080] The Direct Standardization (DS) algorithm is a method for converting spectral data models, aiming to standardize and convert the spectral data collected by different hyperspectral oil rapid detection devices, so that the slave data can match the master data; the spectral feature data obtained by the slave can be directly applied to the master data in the spectral feature library, greatly improving the universality of the hyperspectral analysis model; the DS algorithm establishes a conversion matrix, so that the slave data can be consistent with the master data in statistical characteristics after conversion, and this conversion is crucial for establishing a spectral feature database using a hyperspectral oil rapid detection device, because different optical instruments or measurement conditions may cause systematic differences in spectral features (response), so that the data collected by the spectral feature library is affected by the collection device, and loses its universality.
[0081] The DS method uses ridge regression to convert a matrix of dimensions to a matrix of dimensions, that is, to obtain the deviation correction matrix , where represents the number of standard oil sample samples, represents the number of spectral bands, and essentially solves a multivariate linear regression problem; in this embodiment, the spectral feature spectrum of each standard oil sample is composed of 300 wave bands of 400nm-1000nm spectrum (2nm per wave band), , and specifically includes the following steps:
[0082] determining the deviation correction matrix , so that the spectral band matrix generated by the slave device according to the number of samples is close to the spectral band matrix generated by the master device according to the same number of samples, and the expression is:
[0083] ;
[0084] The ridge regression method with a parameter of is used The regularization term ridge regression processes each spectral band, and the expression is as follows:
[0085]
[0086] wherein, represents the i-th column of the host device data, represents the i-th column of the bias correction matrix, represents a regularization parameter;
[0087] The expression of the solution of each column ridge regression is as follows:
[0088]
[0089] wherein, represents an identity matrix of, is added to ensure that is invertible, even if exists collinearity;
[0090] The 300 columns are combined, and the complete bias correction matrix is obtained, and the expression is as follows:
[0091]
[0092] wherein, and have a dimension of , has a dimension of , has a dimension of , so that has a dimension of ; The complexity of the control model is controlled, the larger is, the more the coefficients of tend to be smooth (to prevent overfitting), in the embodiment,
[0093] the default value is 0.01, which is used for most cases, and can be optimized by cross-validation;
[0094] S203, the slave device is corrected, and the DN value correction value of the slave device is uploaded to the device spectral feature database, and the expression of the DN value correction is as follows:
[0095] wherein, DN value array obtained from the standard oil sample, corrected DN value array, deviation correction matrix DN value array generated on the slave device using the reference system average value of the waveband, deviation correction matrix DN value array generated on the master device using the reference system average value of the waveband;
[0096] the difference between the devices is corrected by the deviation correction matrix deviation correction matrix With the device spectral feature data uploaded to the database, when applied, the DN value array uploaded by the acquisition device is preferentially corrected, so that the spectral data is independent of the acquisition device when calculating (reflectivity), thereby solving the consistency problem between devices.
[0097] S3, as shown in ③ of the application, the consistency of the portable hyperspectral oil detection device itself is corrected; Figure 1
[0098] S301, record the whiteboard intensity and blackboard intensity collected by the portable hyperspectral oil detection device when it is initialized and blackboard intensity , compare the actual whiteboard intensity and blackboard intensity generated by the standard light plate and each time the portable hyperspectral oil detection device is turned on for correction operation and blackboard intensity , and record the daily updated correction coefficient, that is, the corrected whiteboard intensity and blackboard intensity spectral array;
[0099] The correction coefficient expression is:
[0100] ;
[0101] ;
[0102] The expression of the reflectivity is:
[0103] ;
[0104] wherein, denotes the wavelength, denotes the number of wavebands, , denote the whiteboard intensity and blackboard intensity generated when the portable hyperspectral oil detection device is initialized, , respectively represent the whiteboard intensity and the blackboard intensity generated when the portable hyperspectral oil liquid detection equipment is started up and preheated every day, 、 respectively represent the correction coefficients of the whiteboard and the blackboard;
[0105] S302, as shown in (4) in the specification, the DN value is calculated according to the oil sample detection every day every time Figure 1 .
[0106] S4, as shown in (5) in the specification, the oil sample to be detected is detected; Figure 1
[0107] The slave device is used to detect the oil sample to be detected, and the original spectral data of the oil sample to be detected is obtained.
[0108] S5, as shown in (6) in the specification, the original spectral data of the oil sample to be detected is corrected and traced, and the tracing result of the oil sample to be detected is output, which specifically includes the following steps: Figure 1
[0109] S501, the original spectral data of the oil sample to be detected is corrected and standardized by using the deviation correction matrix , to obtain the corrected and standardized spectral features;
[0110] S502, the corrected and standardized spectral data is compared and analyzed with the data in the spectral feature library of food oil and kitchen waste oil, and the oil sample type, composition and tracing result of the oil sample to be detected are identified and output by using a clustering algorithm.
[0111] Example 2
[0112] A set of standard oils is used to establish the deviation correction conversion matrix between the master device and the slave device (because there is an error in the 2nm precision of the spectrometer in the hyperspectral solution rapid detection device, the actual waveband generated by 400-1000nm is 303);
[0113] The standard oil group used as the reference data label group of the deviation correction conversion matrix between the master device and the slave device is independent of the application scene, and has implementability and expandability; the standard oil group has known detection components, such as iron element (Fe) and aluminum element (Al), and a total of 16 oil samples, as shown in Table 3;
[0114] Table 3 A set of standard oils for establishing the conversion matrix of the master device and the slave device
[0115]
[0116] The oil sample group used 150-075-002 CONOSTAN 75cSt Blank Oil (blank oil) and 150-021-598 CONOSTAN S-21 standard oil to establish 16 oil sample groups with different content distributions through dilution, so that the oil sample groups have the same basic spectral characteristics. The spectral differences only reflect the content of their metal components. These 16 oil samples have unique spectral characteristics in terms of metal components.
[0117] Considering the inherent arbitrariness of equipment operation, for each oil sample, both the host and slave devices perform 5 consecutive tests. Therefore, the original data matrices `host_data` and `slave_data` have a dimension of 80×303, where 5×16=80, 5: number of repetitions, and 16: number of samples. The calibration matrix obtained by implementing the Ridge Regression algorithm using Python is shown below:
[0118]
[0119] Deviation correction matrix in the program Equivalent to the deviation correction matrix described above .
[0120] Example 3: Differences in spectral characteristics obtained from the same oil sample measured by the host equipment and the slave equipment, and the results after applying a correction matrix.
[0121] A random oil sample (D09 oil sample is used in this embodiment) is selected and tested separately using the host and slave devices to obtain spectral characteristics (DN values), such as... Figure 2 As shown, the differences between the host and slave devices are clearly reflected in the collected spectral characteristics.
[0122] The deviation correction matrix generated according to Example 2 and generating the deviation correction matrix. The reference system used (such as a standard oil sample set) generates an array of DN values in bands on the host and slave. Using the average value as a baseline, a set of corrected slave DN values can be obtained. ;
[0123] ;
[0124] in, This represents the array of DN values generated by the slave device when detecting oil sample D09, such as... Figure 2 As shown by the black curve Figure 2 The blue curve represents the array of DN values generated by the host equipment when detecting oil sample D09;
[0125] Figure 3It is shown that Bias correction matrix The generated corrected slave detection D09 oil sample DN value array As Figure 3 The bias correction matrix is shown by the green line The DN value array generated by the slave detection D09 oil sample can be matched to the DN value array generated by the master detection D09 oil sample. Thus, the consistency between devices is solved.
[0126] Example 4: Establishing a spectral feature library using 16 known different component oil samples, simulating traceability
[0127] A hyperspectral oil liquid rapid detection device 1 (master) and 16 different metal component content of finished oil samples are used to establish a spectral feature library of finished oil. One of the 16 oil samples is randomly selected, and a hyperspectral oil liquid rapid detection device 2 (slave) is used to simulate traceability testing. The results given by the spectral feature model library and the actual test oil sample (through numbering) are matched.
[0128] Under the premise of completing examples 2 and 3, the bias correction matrix between the master device and the slave device .
[0129] The 16 oil samples are defined as D01-D16 and inserted into the master. Under different environments, times and different cuvette containers, each oil sample is repeatedly tested 5 times as machine learning, training model and establishing model library, as shown in Figure 4 Among the 16 oil samples, one oil sample is randomly selected and inserted into the slave. The spectral feature library algorithm software will accurately feedback the measured oil sample number, achieving the purpose of rapid and equivalent traceability.
[0130] The above is only a preferred embodiment of the present application, and does not limit the present application in any form. Although the present application has been disclosed as above, it is not intended to limit the present application. Any person skilled in the art can make some changes or modifications to the above disclosed technical content without departing from the scope of the present application, and any equivalent embodiments with equivalent changes are equivalent. Any modification, change and modification of the above embodiments according to the technical essence of the present application are still within the scope of the present application.
Claims
1. A method for rapid detection and traceability of food oil based on spectral feature library, characterized in that, The method comprises the following steps: S1, establishing a spectral feature library of food oil and kitchen waste oil; Spectrum feature data of food oil and kitchen waste oil samples of multiple known categories are collected by a portable hyperspectral oil liquid detection device, and a correlated spectrum feature database is established according to the categories, components and indexes of the food oil and kitchen waste oil samples; The spectral feature data of the food oil and kitchen waste oil include UID, DN value, blackboard intensity, whiteboard intensity and reflectivity of the hyperspectral device; S2, consistency correction between portable hyperspectral oil liquid detection devices; S201、using A standard oil sample of a known component is used as a reference system, a hyperspectral oil detection device is randomly selected as a master device, at least one hyperspectral oil detection device is selected as a slave device, and the master device and the slave device detect the standard oil sample in turn. A standard oil sample of a known component is used as a reference system, a hyperspectral oil detection device is randomly selected as a master device, at least one hyperspectral oil detection device is selected as a slave device, and the master device and the slave device detect the standard oil sample in turn. S202, establishing a consistency deviation correction matrix between the host device and the slave device ; S203, correction processing is performed on the slave device, and the DN value correction value of the slave device is uploaded to the device spectrum feature database, and the expression of the DN value correction is: wherein, DN value array obtained from the standard oil sample, corrected DN value array, bias correction matrix DN value array generated on the slave device using the reference system in average of the number of wave bands, bias correction matrix DN value array generated on the master device using the reference system in average of the number of wave bands; S3, consistency correction of the portable hyperspectral oil liquid detection device itself; S301. Record the white plate intensity acquired using a randomly fixed standard optical plate during the initialization of the portable hyperspectral oil detection equipment. and blackboard strength The actual white plate strength is determined by comparing the standard white plate with the actual white plate strength generated during each power-on calibration operation of the portable hyperspectral oil detection equipment. and blackboard strength The comparison is performed, and the daily updated correction coefficients are recorded, which are the corrected whiteboard intensity and blackboard intensity spectral arrays. S302、According to the DN value calculation of daily oil sample detection, the reflectivity of oil sample is obtained ; S4, detection of the oil sample to be tested; The oil sample to be tested is detected by using any corrected slave device, and original spectrum data of the oil sample to be tested are obtained; S5, correction and tracing of the original spectrum data of the oil sample to be tested, and output of the tracing result of the oil sample to be tested.
2. The method according to claim 1, characterized in that, The spectral feature of the food oil is based on the manufacturer, brand and factory batch, and the spectral feature library of the kitchen waste oil is based on the region, eating habits and season.
3. The method according to claim 1, characterized in that, The matrix of the deviation correction matrix is obtained by using the Direct Standardization method with Ridge Regression The matrix of the deviation correction matrix is obtained by using the Direct Standardization method with Ridge Regression The matrix of the deviation correction matrix is obtained by using the Direct Standardization method with Ridge Regression wherein, denotes the number of samples, The method for detecting food oil sample by using hyperspectral oil liquid detection equipment, specifically comprises the following steps: Determining a bias correction matrix The slave device generates a spectral band matrix from the number of samples The spectral band matrix generated by the slave device from the number of samples The spectral band matrix generated by the slave device from the number of samples The expression is: The parameter added is The ridge regression with a regularization term is used to process each spectral band, and the expression is as follows: wherein, represents the first column of the host device data matrix represents the first column of the bias correction matrix , represents the first column of the bias correction matrix represents the first column of the bias correction matrix represents the first column of the bias correction matrix represents the first column of the bias correction matrix represents the regularization parameter; The solution expression of each column ridge regression is: wherein denotes the identity matrix; The column combination, i.e. the complete bias correction matrix is obtained, which is expressed as: wherein and has a dimension of , has a dimension of , has a dimension of so that has a dimension of ; controls the complexity of the model.
4. The method according to claim 1, characterized in that, The tracing of the oil sample to be tested comprises the following steps: S501、through the bias correction matrix The original spectrum data of the oil sample to be tested is corrected and normalized to obtain corrected and normalized spectral features. S502, comparison and analysis of the corrected standardized spectrum data and the spectrum data in the spectral feature library of the food oil and kitchen waste oil, identification of the oil sample type, components, indexes and tracing result of the oil sample to be tested by using a spectrum feature vector clustering algorithm, and output.
Citation Information
Patent Citations
Near-infrared model transfer method based on spectral regression
CN105842190A
Method for identifying Candidatus Liberibacter spp. of different varieties of citrus by adopting model transfer
CN110363125A