Food detection method based on spectrum detection

By establishing a multi-index coupling model through spectral detection methods, the problem of rapid, non-destructive, and simultaneous detection of multiple indicators in salad dressings and other similar products was solved. This enabled accurate prediction of acidity, salt content, and viscosity, thereby improving the detection efficiency and consistency of food production lines.

CN121453715AInactive Publication Date: 2026-02-03BEIJING QIUBI FOOD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511636581.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies are insufficient for rapid, non-destructive, and simultaneous detection of multiple indicators such as acidity, salt content, and viscosity in salad dressings and sauces. Furthermore, the models have poor adaptability and cannot meet the requirements for real-time detection and batch consistency control on food production lines.

Method used

A multi-index coupled model is established using a spectral detection-based method. Through near-infrared spectral acquisition and preprocessing, combined with feature extraction and multi-objective regression modeling, the simultaneous prediction of acidity, salinity, and viscosity is achieved. A model validation and recalibration mechanism is introduced to ensure the accuracy and stability of the detection.

Benefits of technology

It enables rapid, non-destructive, and simultaneous multi-indicator testing of salad dressings and similar products, significantly improving testing efficiency and intelligence. It can adapt to different flavors and formula systems, ensuring the accuracy and stability of the testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121453715A_ABST
    Figure CN121453715A_ABST
Patent Text Reader

Abstract

The invention discloses a food detection method based on spectrum detection, and relates to the technical field of food detection, and the method comprises the following steps: S1, original sample database establishment and reference index confirmation; s2, spectrum acquisition standardization and pretreatment process solidification; s3, engineering design from a spectrum to an available model is carried out; s4, model verification and performance evaluation; s5, unknown sample detection and model application; and S6, performing model maintenance and a recalibration mechanism. According to the invention, rapid, non-destructive and multi-index synchronous detection of acidity, salt content and viscosity of salad juice and salad sauce products is realized, and the efficiency and intelligent level of food quality detection are significantly improved. By modeling and analyzing the spectral information of the sample, multiple key physical and chemical indexes can be obtained at one time without chemical titration or physical measurement, the detection time is shortened to be within one minute from half an hour or more of a traditional method, and the detection flux and the real-time performance are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of food testing technology, specifically to a food testing method based on spectral detection. Background Technology

[0002] Currently, salad dressings and sauces require strict control over three key indicators during production due to their complex emulsification systems and diverse components (oil phase, water phase, emulsifiers, sugars, salts, acidulants, and spices, etc.). Acidity directly affects the product's flavor and preservative effect, salt content determines the taste and nutritional balance, while viscosity affects emulsion stability and consumers' perception of texture. Traditional detection methods mainly rely on chemical titration, conductivity methods, and rotational viscometers. Although these methods are highly accurate, they have long testing cycles, consume large amounts of samples, and require destructive sampling, making it difficult to meet the requirements of real-time detection and batch consistency control on food production lines.

[0003] In recent years, spectroscopic detection technologies (especially near-infrared spectroscopy, NIR) have gained widespread attention in the field of food analysis due to their rapid, non-destructive, and multi-indicator prediction capabilities. Near-infrared spectroscopy can reflect the vibrational absorption characteristics of O–H, C–H, and N–H groups in a sample, and these chemical bonds are closely related to changes in the acidity, salinity, and viscosity of food. However, differences in formulation, emulsification state, and water-oil ratio among different salad products can lead to strong nonlinear relationships in spectral characteristics.

[0004] In existing technologies, most methods only establish regression models for a single indicator (such as moisture or oil content), lack a unified modeling method for the coupling relationship of multiple indicators, and the models have poor adaptability and insufficient predictive stability across different flavors or batches. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a food detection method based on spectral detection, thereby resolving the problems mentioned in the background section.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] In a first aspect, the present invention provides a food detection method based on spectral detection, comprising the following steps:

[0008] S1. Original sample library construction and benchmark indicator verification;

[0009] A sample library was established for target food categories, including salad dressings and salad dressings. For each sample, corresponding data of two types were collected in the same batch, including near-infrared spectroscopy and benchmark indicators.

[0010] S2. Standardization and solidification of spectral acquisition and preprocessing procedures;

[0011] Once the sample library is established, the standardized processing for spectral acquisition should be defined, and the preprocessing procedure should be solidified.

[0012] S3. Perform engineering design of the spectrum into a usable model;

[0013] Establish a multi-index coupled model for predicting acidity, salinity, and viscosity to achieve a quantitative expression "from spectrum to index";

[0014] S4. Model Validation and Performance Evaluation;

[0015] The sample library is divided into three parts: training set, validation set and test set. The validation set is used for optimizing model parameters and evaluating generalization performance, and the test set is used for verifying the final effect.

[0016] S5. Detection of Unknown Samples and Application of Models;

[0017] The validated model was used for rapid detection of unknown samples;

[0018] S6. Model maintenance and recalibration mechanism;

[0019] Representative samples are periodically selected, and benchmark indicators are retested using traditional chemical methods. The results are then compared with model predictions to assess the trend of deviation.

[0020] To further optimize this technical solution, in step S1, the near-infrared spectrum is acquired in the 900–2500 nm band, with a fixed spectral interval of 2 nm, under a fixed geometric structure of integrating sphere reflection or transmission reflection.

[0021] Benchmark parameters include acidity, salt content, and viscosity;

[0022] Each sample generates a unique ID, and the metadata of "raw spectral data + benchmark indicators + formula / process / batch number / temperature and humidity / instrument serial number" is bound and archived.

[0023] To further optimize this technical solution, the standardization processing of spectral acquisition in step S2 includes:

[0024] Fixed optical path and integration time, defined "number of repeated scans - averaging strategy - anomaly rejection threshold" for each sample, and wrote whiteboard calibration cycle, dark current correction method and stray light inspection method into SOP.

[0025] To further optimize this technical solution, in step S2, the preprocessing is solidified in the order of "denoising—correction—screening—alignment—scaling", including:

[0026] First, a sliding window is used to smooth and suppress high-frequency noise; then scattering and baseline correction are performed to reduce the multiplicative / additive effects caused by differences in particle size and filling density.

[0027] Secondly, shield the bands that are susceptible to absorption saturation by the water bandwidth or instrument saturation, and retain the bands that are sensitive to acidity, salt content and viscosity; if there is a slight shift in peak position between different batches, perform slight wavelength alignment.

[0028] Finally, feature scaling is performed, and the scaling parameter is frozen so that future samples can use the same parameter.

[0029] To further optimize this technical solution, step S3, the process of establishing the multi-index coupling model, includes three stages: feature extraction, multi-objective regression modeling, and parameter calibration.

[0030] Feature extraction involves establishing a mapping relationship between the standardized spectral matrix and the target index matrix.

[0031] Multi-objective regression modeling establishes a linear predictive relationship between the latent variable matrix and the measured target indicator matrix of the sample.

[0032] Parameter calibration involves determining the number of latent variables and the strength of regularization through cross-validation to obtain the optimal balance point for different food categories.

[0033] To further optimize this technical solution, in the feature extraction stage,

[0034] Spectral matrix is ,in For the sample size, Number of wavelength points;

[0035] The target indicator matrix is The three columns represent acidity, salt content, and viscosity, respectively.

[0036] To reduce collinearity and noise interference between spectral bands, principal component analysis or partial least squares methods are used to extract the latent variable matrix. :

[0037]

[0038] in, This is a wavelength weighting matrix, representing the degree of contribution of each wavelength to the change of the index;

[0039] By using latent spatial transformation, the spectral features most relevant to changes in the target index are extracted.

[0040] To further optimize this technical solution, in the multi-objective regression modeling stage,

[0041] Latent variable matrix Target index matrix compared with actual sample measurements The linear prediction relationship is as follows:

[0042]

[0043] in, To predict the output matrix; This is the regression coefficient matrix, representing the linear weight of each latent variable in predicting acidity, salinity, and viscosity; For bias terms;

[0044] Parameter optimization is achieved by minimizing the sum of squared prediction errors.

[0045] To further optimize this technical solution, during the parameter calibration stage,

[0046] For different food categories, including various salad dressings and sauces, if significant differences in spectral distribution are found, a segmented modeling strategy is adopted. That is, under the same algorithm framework, regression coefficients are fitted separately for different categories to calibrate the parameters, and then the model is automatically invoked through flavor classification labels.

[0047] To further optimize this technical solution, in step S5, during rapid detection, the unknown sample is scanned under the same spectral acquisition conditions as in the modeling stage to obtain its spectral curve.

[0048] Subsequently, the system automatically calls the model that matches the product category, inputs the spectrum into it, and outputs the corresponding predicted values ​​of acidity, salt content and viscosity;

[0049] The detection system automatically compares the similarity between the current sample spectrum and the modeled sample spectrum. When the similarity is lower than the preset threshold, the system prompts "manual verification required" or "sample is not within the applicable range of the model". The prediction results are displayed in real time on the detection terminal and are automatically archived, including spectral files, prediction data, detection time, operator and instrument number information.

[0050] To further optimize this technical solution, in step S6, when the deviation exceeds a set threshold or the distribution of the detection data is significantly off, a recalibration mechanism is triggered.

[0051] Recalibration mechanisms include rapid compensation for small samples and full-sample remodeling;

[0052] Rapid compensation for small samples, incremental correction based on the original model parameters, enables the model to adaptively adjust to the spectral characteristics of new batches;

[0053] Full sample remodeling involves re-selecting features and retraining the model when long-term accumulated data increases significantly or the product system undergoes major changes.

[0054] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein the computer program instructions, when executed by the processor, implement the steps of a food detection method based on spectral detection as described in the first aspect of the present invention.

[0055] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of a food detection method based on spectral detection as described in the first aspect of the present invention.

[0056] Compared with existing technologies, the present invention provides a food detection method based on spectral detection, which has the following beneficial effects:

[0057] This spectral-based food testing method significantly improves the efficiency and intelligence of food quality testing by enabling rapid, non-destructive, and simultaneous detection of acidity, salinity, and viscosity in salad dressings and sauces. By modeling and analyzing the spectral information of samples, multiple key physicochemical indicators can be obtained simultaneously without chemical titration or physical measurements. The detection time has been reduced from over half an hour using traditional methods to less than one minute, greatly improving throughput and real-time performance. This method incorporates multi-objective coupling analysis and latent variable feature extraction strategies in spectral modeling, allowing indicators such as acidity, salinity, and viscosity to be synergistically predicted within the same model system. This enables unified detection of different flavors and formulations (such as sesame, mixed salad, egg yolk, and Thousand Island flavors), ensuring the accuracy and stability of the model in cross-category applications. Attached Figure Description

[0058] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0059] Figure 1 This is a schematic flowchart of a food detection method based on spectral detection proposed in this invention;

[0060] Figure 2 This is a schematic diagram illustrating the modeling and calibration of spectral data and salinity indicators in this invention. Detailed Implementation

[0061] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0062] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0063] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places throughout this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.

[0064] Example 1:

[0065] Reference Figure 1 and Figure 2 This is the first embodiment of the present invention, which provides a food detection method based on spectral detection, including the following steps:

[0066] S1. Original sample library construction and benchmark indicator verification;

[0067] A sample library is established for the target food category (such as sesame salad dressing, mixed salad dressing, egg yolk salad dressing, Thousand Island dressing, etc.). For each sample, corresponding data of two types are collected in the same batch, including near-infrared spectroscopy and benchmark indicators.

[0068] Near-infrared spectroscopy is performed in the 900–2500 nm band with a fixed spectral interval of 2 nm, under a fixed geometry of integrating sphere reflection or transmission reflection; the sample cup diameter, sample layer thickness and stirring consistency are uniform; the instrument must be preheated, white plate / dark current calibration, drift check, and the ambient temperature and humidity must be recorded.

[0069] The benchmark indicators include acidity (expressed as a mass fraction; the main acidic components in the product are acetic acid and citric acid, and the total acid content is obtained by neutralization after reaction with alkaline standard solution. During testing, the acid equivalent is first determined by titration and then converted through stoichiometry, serving as an acidity characterization indicator), salt content (mass fraction, calculated based on the stoichiometry of the reaction of chloride ions in the product with silver nitrate solution to form silver chloride precipitate. During testing, the volume of silver nitrate consumed is determined by titration and converted into the equivalent sodium chloride content, serving as a characterization indicator), and viscosity (mPa·s, using rotational rheology or viscometer with rotor and speed indicated).

[0070] In practical applications, for the four products—sesame salad dressing, mixed salad dressing, egg yolk salad dressing, and Thousand Island dressing—only acidity, salt content, and viscosity need to be measured to achieve the desired testing effect; pH measurement is not required. However, considering the subsequent application of this food testing method to other products, the pH value of the product can also be measured, i.e., measured using a calibrated pH meter according to national standards.

[0071] Each sample is assigned a unique ID, and metadata including "raw spectral data + benchmark indicators + formulation / process / batch number / temperature and humidity / instrument serial number" is bound and archived. To ensure the generalizability of subsequent models, the sample design covers formulation differences (oil-to-water ratio, type and amount of emulsifier, spice content, etc.), process fluctuations (shear strength, aging time), and storage and transportation changes (temperature, settling time), and maintains a balance according to flavor and category. Initial screening and labeling are performed based on spectral signal-to-noise ratio, saturation range, and outliers. Samples are not deleted but labeled with availability levels for weighting or removal in subsequent decisions.

[0072] S2. Standardization and solidification of spectral acquisition and preprocessing procedures;

[0073] Once the sample library is established, the standardized processing of spectral acquisition is defined, and the preprocessing workflow is solidified. That is, a "reproducible pipeline" is established for spectral acquisition and preprocessing to ensure that the processing of unknown samples entering the system is completely consistent with that in the modeling stage.

[0074] Standardized processing of spectral acquisition includes:

[0075] Fixed optical path and integration time, defined "number of repeated scans - averaging strategy - anomaly rejection threshold" for each sample, and wrote whiteboard calibration cycle, dark current correction method and stray light inspection method into SOP.

[0076] Preprocessing is solidified in the order of "noise reduction—correction—screening—alignment—scaling", including:

[0077] First, a sliding window is used to smooth and suppress high-frequency noise; then scattering and baseline correction (such as SNV or MSC combined with polynomial baseline subtraction) are performed to reduce the multiplicative / additive effects caused by the difference in particle size and filling density.

[0078] Secondly, shield the bands that are susceptible to absorption saturation by the water bandwidth or instrument saturation, and retain the bands that are sensitive to acidity, salt content and viscosity; if there is a slight shift in peak position between different batches, perform slight wavelength alignment.

[0079] Finally, perform feature scaling (such as zero-mean unit variance scaling based on training set statistics) and freeze the scaling parameter so that future samples can use the same parameter.

[0080] S3. Perform engineering design of the spectrum into a usable model;

[0081] Establish a multi-index coupled model for predicting acidity, salinity, and viscosity to achieve quantitative expression "from spectrum to index".

[0082] The process of establishing a multi-indicator coupled model includes three stages: feature extraction, multi-objective regression modeling, and parameter calibration.

[0083] Feature extraction involves establishing a mapping relationship between the standardized spectral matrix and the target index matrix.

[0084] Multi-objective regression modeling establishes a linear predictive relationship between the latent variable matrix and the measured target indicator matrix of the sample.

[0085] Parameter calibration involves determining the number of latent variables and the strength of regularization through cross-validation to obtain the optimal balance point for different food categories.

[0086] In the feature extraction stage,

[0087] Spectral matrix is ,in For the sample size, The number of wavelength points; each row corresponds to a food sample (e.g., a salad dressing or salad dressing sample); each column corresponds to a specific wavelength (e.g., a wavelength point in the range of 900 nm to 2500 nm).

[0088] The target indicator matrix is The three columns represent acidity, salt content, and viscosity, respectively.

[0089] To reduce collinearity and noise interference between spectral bands, principal component analysis or partial least squares methods are used to extract the latent variable matrix. :

[0090]

[0091] in, This is a wavelength weighting matrix, representing the degree of contribution of each wavelength to the change of the index;

[0092] By using latent spatial transformation, the spectral features most relevant to changes in the target index are extracted.

[0093] In the multi-objective regression modeling stage,

[0094] Latent variable matrix Target index matrix compared with actual sample measurements The linear prediction relationship is as follows:

[0095]

[0096] in, To predict the output matrix; This is the regression coefficient matrix, representing the linear weight of each latent variable in predicting acidity, salinity, and viscosity; For bias terms;

[0097] and All of these are achieved by adjusting the spectral matrix during the calibration phase. With target indicator matrix The minimized error solution is obtained when performing regression training (such as partial least squares regression PLS) and is used to extract spectral feature weights and establish the mapping relationship between features and indicators.

[0098] The parameters are optimized by minimizing the sum of squared prediction errors. This process is equivalent to mapping changes in the high-dimensional spectral space to changes in the physicochemical indicators of food through low-dimensional latent variables, thus achieving a functional expression of the "spectrum-indicator" relationship.

[0099] During the parameter calibration phase,

[0100] For different food categories, including various salad dressings and sauces, if significant differences in spectral distribution are found, a segmented modeling strategy is adopted. That is, under the same algorithm framework, regression coefficients are fitted separately for different categories to calibrate the parameters, and then the model is automatically invoked through flavor classification labels.

[0101] The final multi-index coupled model not only outputs predicted values ​​for acidity, salinity, and viscosity, but also performs real-time parameter tuning to improve the model's reliability, thereby ensuring the model's accuracy and stability in long-term applications.

[0102] Through the steps described above, from spectral data extraction and modeling to parameter calibration, a quantitative expression process "from spectrum to index" is achieved, making the method scalable, traceable, and adaptive, providing a reliable modeling foundation for online food detection and intelligent quality control.

[0103] S4. Model Validation and Performance Evaluation;

[0104] After the model is built, its accuracy and stability need to be systematically validated. First, the sample library is divided into three parts: a training set, a validation set, and a test set to ensure the representativeness and balance of the data distribution. The validation set is used for optimizing model parameters and evaluating generalization performance, while the test set is used for final effect verification. During validation, the deviation between the model's predicted values ​​and those measured by traditional chemical methods is mainly examined, using statistical indicators such as the coefficient of determination (R²), root mean square error (RMSE), and residual prediction deviation ratio (RPD) for evaluation. Simultaneously, by plotting scatter plots comparing predicted and measured values ​​and residual distribution plots, the model's fit and outlier distribution are visually assessed. For different food categories (such as salad dressing and salad dressing), the adaptability of single-category models and the generalization ability of cross-category models can be evaluated separately to determine whether stratified modeling is necessary. Through repeated validation and cross-testing, it is confirmed that the model maintains stable predictive performance under different batches, different temperatures and humidity levels, and different instrument conditions.

[0105] S5. Detection of Unknown Samples and Application of Models;

[0106] The validated model was used for rapid detection of unknown samples.

[0107] During rapid detection, the unknown sample is scanned under the same spectral acquisition conditions as in the modeling stage to obtain its spectral curve.

[0108] Subsequently, the system automatically calls the model that matches the product category, inputs the spectrum into it, and outputs the corresponding predicted values ​​of acidity, salt content and viscosity;

[0109] The detection system automatically compares the similarity between the current sample spectrum and the modeled sample spectrum. When the similarity is lower than the preset threshold, the system prompts "manual verification required" or "sample is not within the applicable range of the model". The prediction results are displayed in real time on the detection terminal and are automatically archived, including spectral files, prediction data, detection time, operator and instrument number information.

[0110] If there is a continuous testing requirement on the enterprise's production line, an automatic update module can be embedded in the testing system to perform semi-supervised learning or incremental updates on the data of recently manually reviewed samples in order to maintain the dynamic optimal state of the model and realize real-time monitoring of key indicators such as acidity, salinity and viscosity during the production process.

[0111] S6. Model maintenance and recalibration mechanism;

[0112] As the source of raw materials, formulation ratios, or equipment conditions change, model performance may gradually decline. Therefore, it is crucial to establish a sound recalibration and maintenance mechanism.

[0113] Representative samples are periodically selected, and benchmark indicators are retested using traditional chemical methods. The results are then compared with model predictions to assess the trend of deviation.

[0114] When the deviation exceeds the set threshold or the distribution of the detection data deviates significantly, the recalibration mechanism is triggered.

[0115] Recalibration mechanisms include rapid compensation for small samples and full-sample remodeling;

[0116] Rapid compensation for small samples, incremental correction based on the original model parameters, enables the model to adaptively adjust to the spectral characteristics of new batches;

[0117] Full sample remodeling involves re-selecting features and retraining the model when long-term accumulated data increases significantly or the product system undergoes major changes.

[0118] All calibration versions retain version number, calibration time, sample source, and performance indicators, enabling model version tracking and auditability. Through continuous model maintenance and periodic verification, this spectral detection-based food testing method maintains stable and reliable detection capabilities across different product categories, batches, and long-term operation, providing scientific support for food companies to achieve online quality control and intelligent production.

[0119] Example 2:

[0120] The method described in Example 1 was applied in practice to four typical salad products:

[0121] (1) Application of sesame-flavored salad dressing

[0122] Sesame-flavored salad dressing contains a high proportion of vegetable oil, sesame paste, and sugar and salt components. The system exhibits a high degree of emulsification, and its spectral signal is significantly affected by oil phase absorption. This method, by modeling the characteristic bands of the O–H and C–H stretching vibration regions (approximately 1400–2400 nm) in such products, can sensitively capture subtle spectral differences corresponding to changes in oil-water ratio and acidity. Acidity prediction mainly depends on the influence of acetic acid or citric acid content on the absorption band; salt content is related to the shift of water molecule absorption peaks caused by ionic strength; and viscosity is reflected in changes in long-wavelength scattering intensity. This method allows for direct detection at the production tank or end of the filling line without damaging the sample, enabling online monitoring of ingredient uniformity and emulsion stability. This helps process engineers adjust stirring intensity or acidulant dosage in a timely manner to ensure flavor stability.

[0123] (2) Application of salad dressing for mixed vegetables

[0124] The mixed salad dressing has a high water-to-water ratio and contains various vegetable extracts, acetic acid, and spices. The system exhibits good transparency and is sensitive to changes in spectral signals. This method allows for rapid detection of acidity and salt content during the mixing and preparation stage, ensuring consistent flavor in the finished product. Simultaneously, model analysis can assess liquid viscosity changes in real time to determine emulsification stability. When the test results show high acidity or low salt content, the system automatically prompts for formula adjustment or feed ratio correction. Compared to traditional chemical testing, this spectroscopic method enables rapid online scanning every 10 minutes in mass production, avoiding the accumulation of ingredient deviations caused by delayed detection, thereby improving the stability and quality consistency of the production line.

[0125] (3) Application of egg yolk flavored salad dressing

[0126] Egg yolk flavored salad dressing emulsions have high viscosity and a high oil phase content. This method utilizes near-infrared spectral signals in diffuse reflectance mode to jointly analyze the multidimensional characteristics of acidity, salinity, and viscosity through a model. In samples with a high oil phase, the intensity and shape changes of the C–H absorption peaks are closely related to the oil distribution, and the model can identify the viscosity decrease trend caused by incomplete emulsification. Rapid detection can be achieved before product filling, promptly identifying batch-to-batch consistency inconsistencies and reducing rework and waste.

[0127] (4) Application scenarios of Thousand Island dressing

[0128] Thousand Island dressing contains tomato extract, fructose, spices, and various emulsified oils, resulting in a complex composition with significant overlap in spectral absorption peaks. This method separates the absorption contributions of different chemical groups in the spectrum, accurately extracting feature vectors related to changes in acidity and salinity. In application, during production batch transitions or formula fine-tuning, only a small number of samples need to be collected for model self-calibration to maintain high-accuracy predictions. The system can also intelligently assess product consistency trends based on real-time spectral detection results, allowing for dynamic adjustment of stirring speed or thickener dosage.

[0129] In summary, this spectral detection-based food testing method is widely applicable to salad dressings and sauces with different flavors and formulations. It enables rapid, non-destructive, and traceable detection of acidity, salt content, and viscosity in production lines, quality inspections, and formulation control, providing stable technical support for the intelligent and standardized production of the food industry.

[0130] Example 3:

[0131] This embodiment also provides a computer device applicable to a food detection method based on spectral detection, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to realize the food detection method based on spectral detection as proposed in the above embodiment.

[0132] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a food detection method based on spectral detection as proposed in the above embodiments.

[0133] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0134] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0135] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0136] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0137] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0138] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A food detection method based on spectral detection, characterized in that, Includes the following steps: S1. Original sample library construction and benchmark indicator verification; A sample library was established for target food categories, including salad dressings and salad dressings. For each sample, corresponding data of two types were collected in the same batch, including near-infrared spectroscopy and benchmark indicators. S2. Standardization and solidification of spectral acquisition and preprocessing procedures; Once the sample library is established, the standardized processing for spectral acquisition should be defined, and the preprocessing procedure should be solidified. S3. Perform engineering design of the spectrum into a usable model; Establish a multi-index coupled model for predicting acidity, salinity, and viscosity to achieve a quantitative expression "from spectrum to index"; S4. Model Validation and Performance Evaluation; The sample library is divided into three parts: training set, validation set and test set. The validation set is used for optimizing model parameters and evaluating generalization performance, and the test set is used for verifying the final effect. S5. Detection of Unknown Samples and Application of Models; The validated model was used for rapid detection of unknown samples; S6. Model maintenance and recalibration mechanism; Representative samples are periodically selected, and benchmark indicators are retested using traditional chemical methods. The results are then compared with model predictions to assess the trend of deviation.

2. The food detection method based on spectral detection according to claim 1, characterized in that, In step S1, the near-infrared spectrum is acquired in the 900–2500 nm band, with a fixed spectral interval of 2 nm, under a fixed geometric structure of integrating sphere reflection or transmission reflection. Benchmark parameters include acidity, salt content, and viscosity; Each sample generates a unique ID, and the metadata of "raw spectral data + benchmark indicators + formula / process / batch number / temperature and humidity / instrument serial number" is bound and archived.

3. The food detection method based on spectral detection according to claim 1, characterized in that, In step S2, the standardization processing of spectral acquisition includes: Fixed optical path and integration time, defined "number of repeated scans - averaging strategy - anomaly rejection threshold" for each sample, and wrote whiteboard calibration cycle, dark current correction method and stray light inspection method into SOP.

4. The food detection method based on spectral detection according to claim 1, characterized in that, In step S2, the preprocessing is solidified in the order of "denoising—correction—screening—alignment—scaling", including: First, a sliding window is used to smooth and suppress high-frequency noise; then scattering and baseline correction are performed to reduce the multiplicative / additive effects caused by differences in particle size and filling density. Secondly, shield the bands that are susceptible to absorption saturation by the water bandwidth or instrument saturation, and retain the bands that are sensitive to acidity, salt content and viscosity; if there is a slight shift in peak position between different batches, perform slight wavelength alignment. Finally, feature scaling is performed, and the scaling parameter is frozen so that future samples can use the same parameter.

5. The food detection method based on spectral detection according to claim 1, characterized in that, In step S3, the process of establishing the multi-index coupling model includes three stages: feature extraction, multi-objective regression modeling, and parameter calibration. Feature extraction involves establishing a mapping relationship between the standardized spectral matrix and the target index matrix. Multi-objective regression modeling establishes a linear predictive relationship between the latent variable matrix and the measured target indicator matrix of the sample. Parameter calibration involves determining the number of latent variables and the strength of regularization through cross-validation to obtain the optimal balance point for different food categories.

6. The food detection method based on spectral detection according to claim 5, characterized in that, In the feature extraction stage Spectral matrix is ,in For the sample size, Number of wavelength points; The target indicator matrix is The three columns represent acidity, salt content, and viscosity, respectively. To reduce collinearity and noise interference between spectral bands, principal component analysis or partial least squares methods are used to extract the latent variable matrix. : in, This is a wavelength weighting matrix, representing the degree of contribution of each wavelength to the change of the index; By using latent spatial transformation, the spectral features most relevant to changes in the target index are extracted.

7. The food detection method based on spectral detection according to claim 5, characterized in that, In the multi-objective regression modeling stage Latent variable matrix Target index matrix compared with actual sample measurements The linear prediction relationship is as follows: in, To predict the output matrix; This is the regression coefficient matrix, representing the linear weight of each latent variable in predicting acidity, salinity, and viscosity; For bias terms; Parameter optimization is achieved by minimizing the sum of squared prediction errors.

8. The food detection method based on spectral detection according to claim 5, characterized in that, During the parameter calibration phase For different food categories, including various salad dressings and sauces, if significant differences in spectral distribution are found, a segmented modeling strategy is adopted. That is, under the same algorithm framework, regression coefficients are fitted separately for different categories to calibrate the parameters, and then the model is automatically invoked through flavor classification labels.

9. The food detection method based on spectral detection according to claim 1, characterized in that, In step S5, during rapid detection, the unknown sample is scanned under the same spectral acquisition conditions as in the modeling stage to obtain its spectral curve. Subsequently, the system automatically calls the model that matches the product category, inputs the spectrum into it, and outputs the corresponding predicted values ​​of acidity, salt content and viscosity; The detection system automatically compares the similarity between the current sample spectrum and the modeled sample spectrum. When the similarity is lower than the preset threshold, the system prompts "manual verification required" or "sample is not within the applicable range of the model". The prediction results are displayed in real time on the detection terminal and are automatically archived, including spectral files, prediction data, detection time, operator and instrument number information.

10. The food detection method based on spectral detection according to claim 1, characterized in that, In step S6, when the deviation exceeds the set threshold or the distribution of the detection data is significantly off, the recalibration mechanism is triggered. Recalibration mechanisms include rapid compensation for small samples and full-sample remodeling; Rapid compensation for small samples, incremental correction based on the original model parameters, enables the model to adaptively adjust to the spectral characteristics of new batches; Full sample remodeling involves re-selecting features and retraining the model when long-term accumulated data increases significantly or the product system undergoes major changes.