Method and system for rapid detection of cereal food ingredients based on spectral imaging technology
Through hyperspectral imaging technology and chemometric processing, rapid and accurate detection of cereal food ingredients is achieved, solving the problems of low efficiency and poor accuracy of traditional methods, providing detailed test reports and safety recommendations, and improving food safety.
Patent Information
- Application Number
- CN202411854903.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-12-16
AI Technical Summary
Traditional grain food testing methods are inefficient and inaccurate, and cannot meet the needs of rapid and precise testing.
Hyperspectral imaging technology is combined with chemometric processing to obtain the sample's detection spectral data, extract characteristic wavelengths, and use quantitative models for analysis to generate component detection reports and safety recommendations. Zoning detection is performed by combining three-dimensional models and region of interest extraction algorithms.
It improves the accuracy and efficiency of testing, reduces costs, enhances food safety, provides detailed internal information of samples, reduces manual operations, and the generated test reports provide scientific decision-making support for producers.
Smart Images

Figure CN119643466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food detection, and in particular to a method and system for rapid detection of cereal food ingredients based on spectral imaging technology. Background Art
[0002] Traditional methods for testing grain foods rely primarily on manual sensory evaluation, Kjeldahl nitrogen determination, oven drying, spectrophotometry, DNA labeling, and protein electrophoresis. These methods have numerous limitations, including high workload, subjectivity, low efficiency, cumbersome operation, poor timeliness, high cost, and potential health risks. For example, manual testing, due to its reliance on sensory evaluation, is subject to significant errors and has been gradually phased out. Furthermore, while near-infrared spectroscopy (NIRS) is widely used, its complex spectral bands can easily lead to errors in data compilation, affecting the final results.
[0003] The above-mentioned existing technologies have the following technical problems: traditional methods are inefficient and have poor accuracy, and cannot meet the needs of rapid and accurate detection, so they need to be improved. Summary of the Invention
[0004] In order to improve the efficiency of cereal food ingredient detection, the present application provides a method and system for rapid cereal food ingredient detection based on spectral imaging technology.
[0005] In the first aspect, the above-mentioned invention object of the present application is achieved through the following technical solutions:
[0006] A method for rapid detection of cereal food ingredients based on spectral imaging technology, the method comprising the steps of:
[0007] Obtain the model of the cereal food to be tested and enter it into the pre-set product library to match the corresponding production ingredient table;
[0008] Generate a corresponding ingredient table prediction spectrum according to the production ingredient table, wherein the ingredient table prediction spectrum is used as a detection reference;
[0009] Use hyperspectral imaging technology to scan samples of cereal foods to be tested and obtain test spectral data of the samples;
[0010] Processing the detected spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0011] Analyze the characteristic wavelengths according to a preset quantitative model to quantitatively analyze the chemical components in the cereal food, thereby generating chemical component detection results based on the quantitative analysis results;
[0012] Comparing the chemical composition test results with the production composition table to generate initial composition deviation data;
[0013] Comparing the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and generating corresponding composition difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual composition differences;
[0014] comparing the composition difference correction data with the initial composition deviation data to generate corrected composition deviation data;
[0015] A food ingredient detection report is generated based on the corrected ingredient deviation data, and a food safety recommendation is generated based on the food ingredient detection report.
[0016] By adopting the above-mentioned technical solution and combining hyperspectral imaging technology with chemometric processing, this method can accurately extract characteristic wavelengths related to cereal food ingredients and use quantitative models to perform accurate ingredient analysis. This method not only improves the accuracy and efficiency of detection and reduces costs, but also enhances food safety assurance. The automated detection process reduces manual operations, making the detection process faster and more reliable. In addition, this solution includes ingredient difference correction data and corrected ingredient deviation data to further correct the test results, making the test results of this solution more realistic and accurate, and easier to discover ingredient differences and make adjustments. At the same time, the data-driven test reports and food safety recommendations generated by this solution provide producers with scientific decision-making support based on actual data, further improving food safety.
[0017] In a preferred example, the present application may be further configured as follows: in the step of scanning a sample of a cereal food to be tested using hyperspectral imaging technology to obtain test spectral data of the sample, the steps include:
[0018] Acquiring image data of different dimensions of the sample, and preprocessing the image data to obtain processed image data;
[0019] constructing a three-dimensional model of the sample based on the pre-processed image data;
[0020] The preset partition model partitions the three-dimensional model through a region of interest extraction algorithm to determine the detection partition of the sample;
[0021] The different detection partitions are spectrally scanned by using a hyperspectral imaging technique to obtain detection spectrum data of each partition.
[0022] By adopting the above technical solution, this solution realizes the precise partitioning detection of cereal food samples. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety assurance. Compared with traditional detection methods, this solution can provide more detailed internal information of the sample. Through the construction of three-dimensional models and the extraction of regions of interest, different parts of the sample can be located more accurately, thereby performing targeted spectral analysis. This method reduces manual operations and makes the detection process faster and more reliable. In addition, the partitioning detection of this solution can more accurately detect differences in ingredients and make adjustments.
[0023] In a preferred example, the present application may be further configured as follows: after the step of performing spectral scanning on the different detection partitions to obtain detection spectral data of each partition using hyperspectral imaging technology, the following steps are included:
[0024] Determine the detection weight ratio of the i-th detection area based on the area size and area importance of the detection partition;
[0025] The overall detection result is calculated by the overall detection calculation formula and the detection spectrum data of each partition, where the overall detection calculation formula is: ;
[0026] Specifically, is the test result of the jth component, represents the detection result of the jth component corresponding to the i-th region, Represents the weight ratio of the i-th region.
[0027] By adopting the above technical solution, this formula can calculate the whole according to the partition detection results, thereby improving the accuracy of detection.
[0028] In a preferred example, the present application may be further configured as follows: after obtaining image data of different dimensions of a sample and preprocessing the image data to obtain processed image data, the following steps are included:
[0029] Acquiring image data of different dimensions, wherein the image data includes image clarity, image abnormal point data, and image noise detection data;
[0030] Acquire pre-processing history data corresponding to the image data, wherein the pre-processing history data includes luminosity compensation data and pixel compensation data;
[0031] The preset image compensation analysis model analyzes the image data and pre-processed historical data based on a machine self-learning algorithm to generate an image credibility weight;
[0032] The preset regional credibility analysis model performs analysis based on the detection partitions and the corresponding image credibility weights to generate regional confidences, which are used to represent the confidence level of each regional detection result based on the image analysis result.
[0033] By adopting the above technical solution, combined with hyperspectral imaging technology and machine self-learning algorithms, accurate zoning detection of cereal food samples and in-depth analysis of image data are achieved. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety assurance. Compared with traditional detection methods, this solution can provide more detailed internal information of the sample. Through the construction of three-dimensional models and the extraction of regions of interest, different parts of the sample can be more accurately located, thereby performing targeted spectral analysis. This method reduces manual operations and makes the detection process faster and more reliable.
[0034] In a preferred example, the present application may be further configured as follows: after the preset regional credibility analysis model performs analysis based on the detection partition and the corresponding image credibility weight to generate the regional credibility weight, the overall detection calculation formula is: ,in Indicates the confidence level of the detection result of the i-th region.
[0035] By adopting the above technical solution, a "confidence" value is assigned to each area, which reflects the reliability of the detection result of the area. Then, this value is multiplied by the detection result and weight of the area to obtain a weighted detection result. Finally, the weighted detection results of all areas are added together and divided by the sum of the products of the weights and confidence values of all areas to obtain the overall detection result, thereby improving the accuracy of the detection results.
[0036] In a preferred example, the present application may be further configured as follows: after the step of comparing the composition difference correction data with the initial composition deviation data to generate the corrected composition deviation data, the following steps are included:
[0037] Associating the historical correction component deviation data with the corresponding historical image data based on the detection batch to construct a deviation-image dataset;
[0038] The preset deviation analysis model analyzes the deviation-image dataset based on a machine self-learning algorithm to generate an image influence factor, wherein the image influence factor is used to predict the detection component deviation corresponding to different image data;
[0039] The preset deviation prediction model analyzes the detected image data and the image influencing factors based on a machine self-learning algorithm to generate predicted component deviation data, and the predicted component deviation data is used to compensate for the initial component deviation data.
[0040] By adopting the above technical solution, through combining hyperspectral imaging technology and machine self-learning algorithm, accurate prediction and compensation of composition deviation of cereal food samples can be achieved. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety assurance.
[0041] In a preferred example, the present application can be further configured as follows: the preset quantitative model includes a continuous projection algorithm and a multi-weight optimized soft shrinkage algorithm.
[0042] Secondly, the above-mentioned invention objectives of this application are achieved through the following technical solutions:
[0043] A method and device for rapidly detecting cereal food ingredients based on spectral imaging technology, the device comprising: a production ingredient table matching unit for obtaining the model of the cereal food to be detected and inputting it into a pre-set product library to match the corresponding production ingredient table;
[0044] A component table prediction spectrum generating unit, configured to generate a corresponding component table prediction spectrum according to the production component table, wherein the component table prediction spectrum is used as a detection reference;
[0045] A detection spectrum data acquisition unit is used to scan a sample of the cereal food to be tested using a hyperspectral imaging technology to obtain detection spectrum data of the sample;
[0046] a characteristic wavelength extraction unit, configured to process the detection spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0047] a chemical composition detection result generating unit, configured to be pre-set with a quantitative model to analyze characteristic wavelengths to perform quantitative analysis on the chemical components in the cereal food, thereby generating a chemical composition detection result based on the quantitative analysis result;
[0048] an initial composition deviation data generating unit, configured to compare the chemical composition test result with the production composition table to generate initial composition deviation data;
[0049] an actual component difference analysis unit, configured to compare the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and to generate corresponding component difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual component differences;
[0050] a corrected component deviation data generating unit, configured to compare the component difference correction data with the initial component deviation data to generate corrected component deviation data;
[0051] A food ingredient detection report generating unit is used to generate a food ingredient detection report based on the corrected ingredient deviation data, and to generate food safety recommendations based on the food ingredient detection report.
[0052] Thirdly, the above-mentioned purpose of this application is achieved through the following technical solutions:
[0053] An electronic device includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the steps of the above-mentioned method for rapid detection of cereal food ingredients based on spectral imaging technology are implemented.
[0054] Fourthly, the above-mentioned purpose of the present application is achieved through the following technical solutions:
[0055] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for rapid detection of cereal food ingredients based on spectral imaging technology.
[0056] In summary, this application includes at least one of the following beneficial technical effects:
[0057] 1. Using hyperspectral imaging technology combined with chemometric processing, this method can accurately extract characteristic wavelengths related to cereal food ingredients and use quantitative models to accurately analyze ingredients. This method not only improves detection accuracy and efficiency, reduces costs, but also enhances food safety assurance. The automated detection process reduces manual operations, making the detection process faster and more reliable. In addition, this solution includes ingredient difference correction data and ingredient deviation correction data to further correct the test results, making the test results of this solution more realistic and easier to detect ingredient differences and make adjustments. At the same time, the data-driven test reports and food safety recommendations generated by this solution provide producers with scientific decision-making support based on actual data, further improving food safety.
[0058] 2. This solution enables precise zoning testing of cereal food samples. This method not only improves detection accuracy and efficiency, reduces costs, but also enhances food safety. Compared with traditional detection methods, this solution can provide more detailed internal information of the sample. By constructing a three-dimensional model and extracting regions of interest, it can more accurately locate different parts of the sample, allowing for targeted spectral analysis. This method reduces manual operation, making the detection process faster and more reliable. In addition, this solution's zoning detection can more accurately detect differences in composition and make adjustments.
[0059] 3. Based on the 3D model of the wheat flour sample, different detection areas are divided, such as the central area and the edge area. Then, the regional credibility analysis model is applied, combined with the image credibility weight of each area, to calculate the confidence of each area. This confidence will be used to evaluate the reliability of the detection results of each area. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 This is a flow chart of a method for rapid detection of cereal food ingredients based on spectral imaging technology in one embodiment of the present application;
[0061] Figure 2 This is a principle block diagram of a device for rapid detection of cereal food ingredients based on spectral imaging technology in one embodiment of the present application;
[0062] Figure 3 It is a schematic diagram of an electronic device in an embodiment of the present application.
[0063] Figure Number:
[0064] 1. Production ingredient table matching unit; 2. Ingredient table prediction spectrum generation unit; 3. Detection spectrum data acquisition unit; 4. Characteristic wavelength extraction unit; 5. Chemical ingredient detection result generation unit; 6. Initial ingredient deviation data generation unit; 7. Actual ingredient difference analysis unit; 8. Corrected ingredient deviation data generation unit; 9. Food ingredient detection report generation unit. DETAILED DESCRIPTION
[0065] The present application is further described in detail below with reference to the accompanying drawings.
[0066] In one embodiment, if Figure 1 As shown, the present application discloses a method for rapid detection of cereal food ingredients based on spectral imaging technology, which specifically includes the following steps:
[0067] S10: Obtain the model of the cereal food to be tested and input it into a pre-set product library to match the corresponding production ingredient table;
[0068] S20: generating a corresponding ingredient table prediction spectrum according to the production ingredient table, wherein the ingredient table prediction spectrum is used as a detection reference;
[0069] S30: Scan the sample of the cereal food to be tested using hyperspectral imaging technology to obtain test spectrum data of the sample;
[0070] S40: Processing the detected spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0071] S50: Analyzing the characteristic wavelength according to a preset quantitative model to quantitatively analyze the chemical components in the cereal food, thereby generating a chemical component detection result according to the quantitative analysis result;
[0072] S60: Comparing the chemical composition test result with the production composition table to generate initial composition deviation data;
[0073] S70: Comparing the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and generating corresponding composition difference correction data based on the spectrum difference data;
[0074] Wherein, the spectral difference data is used to analyze the actual composition difference;
[0075] S80: Comparing the composition difference correction data with the initial composition deviation data to generate corrected composition deviation data;
[0076] S90: Generate a food ingredient detection report based on the corrected ingredient deviation data, and generate food safety recommendations based on the food ingredient detection report.
[0077] Specifically, with respect to steps S10-S90, in the embodiment of the present application:
[0078] Step S10: The inspector inputs the wheat flour model "WF-2024" into the product library, and the system automatically matches the production ingredient table corresponding to the model, showing that the main components of wheat flour are protein, carbohydrates and fat.
[0079] Step S20: The system generates a predicted spectrum of the ingredient list based on the production ingredient list of "WF-2024" by using the standard spectral data of proteins, carbohydrates and fats in the database through a chemometric method.
[0080] Step S30: Scan the wheat flour sample using a hyperspectral imager to obtain detection spectrum data of the sample. During the scanning process, the hyperspectral imager collects data within a wavelength range of 400-1000 nm.
[0081] Step S40: extracting characteristic wavelengths related to proteins, carbohydrates, and fats from the detected spectral data through chemometric processing. In the embodiment of the present application, chemometrics includes partial least squares regression (PLSR) and successive projections algorithm (SPA).
[0082] Step S50: Using a preset quantitative model, in the embodiment of the present application, the preset quantitative model includes a continuous projection algorithm, a multi-weight optimized soft shrinkage algorithm and a support vector machine (SVM) model to analyze the extracted characteristic wavelengths, quantitatively analyze the chemical components in the wheat flour, and generate chemical component detection results.
[0083] Step S60: Compare the chemical composition test results with the production composition table to generate initial composition deviation data, for example, the protein content deviation is 2%, and the carbohydrate deviation is 1.5%.
[0084] Step S70: Compare the detected spectrum data with the spectrum predicted by the ingredient table to generate spectrum difference data, and generate ingredient difference correction data based on the data to correct the deviation of protein and carbohydrates.
[0085] Step S80: Compare the component difference correction data with the initial component deviation data to generate corrected component deviation data. The final protein content correction deviation is 1.8%, and the carbohydrate correction deviation is 1.2%.
[0086] Step S90: Generate a food composition test report based on the corrected composition deviation data. The report indicates that the protein and carbohydrate content of the wheat flour are both within acceptable ranges. Based on the test report, a food safety recommendation is generated, suggesting that the proportion of wheat flour used in bread making be adjusted to optimize the taste.
[0087] In summary, compared to existing technologies, this solution uses hyperspectral imaging technology combined with chemometric processing. This method can accurately extract characteristic wavelengths related to cereal food ingredients and use quantitative models to perform accurate component analysis. This method not only improves the accuracy and efficiency of detection and reduces costs, but also enhances food safety. The automated detection process reduces manual operations, making the detection process faster and more reliable. In addition, this solution includes component difference correction data and component deviation correction data to further correct the test results, making the test results of this solution more realistic and easier to detect component differences and make adjustments. At the same time, the data-driven test reports and food safety recommendations generated by this solution provide producers with scientific decision-making support based on actual data, further improving food safety.
[0088] In step S30: using hyperspectral imaging technology to scan the sample of the cereal food to be tested and obtaining the test spectrum data of the sample, the following steps are included:
[0089] S31: Acquire image data of different dimensions of the sample, and preprocess the image data to obtain processed image data;
[0090] Specifically, in the present embodiment, a hyperspectral imaging system is used to scan wheat samples to obtain image data at different wavelengths. Image processing software, such as OpenCV, is used to perform preprocessing operations such as denoising and contrast enhancement on the original images to improve the accuracy of subsequent analysis.
[0091] S32: constructing a three-dimensional model of the sample based on the pre-processed image data;
[0092] Specifically, the preprocessed image data is used to construct a three-dimensional model of the wheat sample through three-dimensional reconstruction technology, such as structured light scanning or stereo vision. This three-dimensional model can provide geometric and spectral information of the sample, providing a basis for subsequent partition detection.
[0093] S33: partitioning the three-dimensional model using a region of interest extraction algorithm using a preset partitioning model to determine a detection partition of the sample;
[0094] Specifically, a region of interest (RoI) extraction algorithm, such as RoI Align, is applied to partition the 3D model. The algorithm divides the model into multiple regions, each corresponding to a specific feature or potential anomaly in the sample. For example, different grain parts in a wheat sample, such as the germ and endosperm, can be identified.
[0095] S34: performing spectral scanning on the different detection partitions using a hyperspectral imaging technology to obtain detection spectral data of each partition;
[0096] Specifically, hyperspectral imaging is performed on each partition to obtain detailed spectral data. For example, for a wheat sample, the spectral characteristics of components such as protein, moisture, and starch in different regions can be obtained. This data will be used for subsequent chemical composition analysis.
[0097] In summary, this scheme achieves precise zoning detection of cereal food samples. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety. Compared with traditional detection methods, this scheme can provide more detailed internal information of the sample. Through the construction of three-dimensional models and the extraction of regions of interest, different parts of the sample can be located more accurately, thereby performing targeted spectral analysis. This method reduces manual operations and makes the detection process faster and more reliable. In addition, the zoning detection of this scheme can more accurately detect differences in ingredients and make adjustments.
[0098] After the step of performing spectral scanning on the different detection partitions by using the hyperspectral imaging technology to obtain detection spectrum data of each partition, the following steps are included:
[0099] Determine the detection weight ratio of the i-th detection area based on the area size and area importance of the detection partition;
[0100] The overall detection result is calculated by the overall detection calculation formula and the detection spectrum data of each partition, where the overall detection calculation formula is: ;
[0101] Specifically, is the test result of the jth component, represents the detection result of the jth component corresponding to the i-th region, This formula calculates the overall detection result by multiplying the detection result of each region by its corresponding weight, summing the results, and finally dividing by the sum of all weights. This ensures that the detection result of each region contributes to the overall result, with the size of the contribution determined by its weight.
[0102] For example, For moisture as an example, suppose we have three regions with test results of 80%, 85%, and 90%, and their weights are 2, 3, and 1 respectively. Then the overall test result is calculated as follows:
[0103] ={(80%×2)+(85%×3)+(90%×1)} / (2+3+1)=(160%+255%+90%) / 6=505% / 6=84.17%,
[0104] Therefore, the overall test results corresponding to moisture It is 84.17%.
[0105] This formula can be used to calculate the whole according to the partition detection results to improve the accuracy of the detection.
[0106] After the step of S31: acquiring image data of different dimensions of the sample and preprocessing the image data to obtain processed image data, the following steps are included:
[0107] S311: Acquire image data of different dimensions, wherein the image data includes image clarity, image abnormal point data, and image noise detection data;
[0108] Specifically, a hyperspectral imaging system is used to scan wheat flour samples, acquiring image data at different wavelengths. This data includes image clarity information, used to identify particle size and distribution within the flour; image anomaly data, used to identify possible foreign matter or impurities; and image noise detection data, used for subsequent noise filtering.
[0109] S312: Acquire pre-processing history data corresponding to the image data, wherein the pre-processing history data includes luminosity compensation data and pixel compensation data;
[0110] Specifically, based on previous wheat flour sample testing data, we collected luminance compensation data and pixel compensation data to correct image deviations caused by uneven lighting or sensor characteristics.
[0111] S313: Analyzing the image data and pre-processed historical data using a preset image compensation analysis model based on a machine self-learning algorithm to generate an image credibility weight;
[0112] Specifically, machine learning algorithms, such as random forests or neural networks, are used to train models based on image data and pre-processed historical data to identify key features in images and assign a confidence weight to each feature. This weight reflects the degree of influence of the feature on the final analysis result.
[0113] S313: A preset regional credibility analysis model performs analysis based on the detection partitions and the corresponding image credibility weights to generate regional confidences, where the regional confidences are used to represent the confidence level of the detection results of each region based on the image analysis results.
[0114] Specifically, based on the three-dimensional model of the wheat flour sample, different detection areas are divided, such as the central area, edge area, etc. Then, the regional credibility analysis model is applied, combined with the image credibility weight of each area, to calculate the confidence of each area. This confidence will be used to evaluate the reliability of the detection results of each area.
[0115] In summary, by combining hyperspectral imaging technology and machine self-learning algorithms, precise zoning detection of cereal food samples and in-depth analysis of image data are achieved. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety assurance. Compared with traditional detection methods, this scheme can provide more detailed internal information of the sample. Through the construction of three-dimensional models and the extraction of regions of interest, different parts of the sample can be more accurately located, thereby performing targeted spectral analysis. This method reduces manual operations and makes the detection process faster and more reliable.
[0116] Furthermore, after the preset regional credibility analysis model performs analysis based on the detection partition and the corresponding image credibility weight to generate the regional credibility weight, the overall detection calculation formula is: ,in Indicates the confidence level of the detection result of the i-th region.
[0117] By adopting the above technical solution, a "confidence" value is assigned to each area, which reflects the reliability of the detection result of the area. Then, this value is multiplied by the detection result and weight of the area to obtain a weighted detection result. Finally, the weighted detection results of all areas are added together and divided by the sum of the products of the weights and confidence values of all areas to obtain the overall detection result, thereby improving the accuracy of the detection results.
[0118] After the step S80 of comparing the composition difference correction data with the initial composition deviation data to generate the modified composition deviation data, the following steps are included:
[0119] S81: Associating the historical correction component deviation data with the corresponding historical image data based on the detection batch to construct a deviation-image dataset;
[0120] Specifically, we collected corrected compositional deviation data for all wheat flour batches tested over the past year, including deviation values for protein, moisture, and starch content. We also collected image data for each batch, such as particle size distribution and color intensity. We then correlated this data to construct a deviation-image dataset for subsequent analysis.
[0121] S82: Analyzing the deviation-image dataset using a preset deviation analysis model based on a machine self-learning algorithm to generate image influencing factors, wherein the image influencing factors are used to predict detection component deviations corresponding to different image data;
[0122] Using machine learning algorithms, such as random forests or neural networks, the model is trained on the deviation-image dataset to identify the relationship between image features and composition deviation. The model outputs a set of image influencing factors that can predict how image features affect compositional testing results. For example, the uniformity of particle size distribution may be correlated with protein content deviation.
[0123] S83: Analyzing the detected image data and the image influencing factors using a preset deviation prediction model based on a machine self-learning algorithm to generate predicted component deviation data, wherein the predicted component deviation data is used to compensate for the initial component deviation data;
[0124] Specifically, when testing a new wheat flour sample, the sample's image data is first acquired. Then, using the image influence factors trained in step S82, the deviation prediction model is used to predict the composition deviation of the new sample. This prediction result is used to adjust the initial composition deviation data to improve detection accuracy.
[0125] In summary, by combining hyperspectral imaging technology and machine self-learning algorithms, accurate prediction and compensation of composition deviations of cereal food samples can be achieved. This method not only improves the accuracy and efficiency of detection, reduces costs, but also enhances food safety assurance.
[0126] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0127] In one embodiment, a method and device for rapid detection of cereal food ingredients based on spectral imaging technology is provided, which corresponds to the method for rapid detection of cereal food ingredients based on spectral imaging technology in the above embodiment. Figure 2 As shown, the method and device for rapid detection of cereal food ingredients based on spectral imaging technology includes a production ingredient table matching unit for obtaining the model of the cereal food to be detected and inputting it into a pre-set product library to match the corresponding production ingredient table;
[0128] A component table prediction spectrum generating unit, configured to generate a corresponding component table prediction spectrum according to the production component table, wherein the component table prediction spectrum is used as a detection reference;
[0129] A detection spectrum data acquisition unit is used to scan a sample of the cereal food to be tested using a hyperspectral imaging technology to obtain detection spectrum data of the sample;
[0130] a characteristic wavelength extraction unit, configured to process the detection spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0131] a chemical composition detection result generating unit, configured to be pre-set with a quantitative model to analyze characteristic wavelengths to perform quantitative analysis on the chemical components in the cereal food, thereby generating a chemical composition detection result based on the quantitative analysis result;
[0132] an initial composition deviation data generating unit, configured to compare the chemical composition test result with the production composition table to generate initial composition deviation data;
[0133] an actual component difference analysis unit, configured to compare the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and to generate corresponding component difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual component differences;
[0134] a corrected component deviation data generating unit, configured to compare the component difference correction data with the initial component deviation data to generate corrected component deviation data;
[0135] A food ingredient detection report generating unit is used to generate a food ingredient detection report based on the corrected ingredient deviation data, and to generate food safety recommendations based on the food ingredient detection report.
[0136] Regarding the specific limitations of the method and device for rapid detection of cereal food ingredients based on spectral imaging technology, please refer to the limitations of the method for rapid detection of cereal food ingredients based on spectral imaging technology mentioned above, which will not be repeated here. Each module in the above-mentioned method and device for rapid detection of cereal food ingredients based on spectral imaging technology can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory in the electronic device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0137] In one embodiment, an electronic device is provided. The electronic device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store a database. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for rapid detection of cereal food ingredients based on spectral imaging technology is implemented.
[0138] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0139] Obtain the model of the cereal food to be tested and enter it into the pre-set product library to match the corresponding production ingredient table;
[0140] Generate a corresponding ingredient table prediction spectrum according to the production ingredient table, wherein the ingredient table prediction spectrum is used as a detection reference;
[0141] Use hyperspectral imaging technology to scan samples of cereal foods to be tested and obtain test spectral data of the samples;
[0142] Processing the detected spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0143] Analyze the characteristic wavelengths according to a preset quantitative model to quantitatively analyze the chemical components in the cereal food, thereby generating chemical component detection results based on the quantitative analysis results;
[0144] Comparing the chemical composition test results with the production composition table to generate initial composition deviation data;
[0145] Comparing the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and generating corresponding composition difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual composition differences;
[0146] comparing the composition difference correction data with the initial composition deviation data to generate corrected composition deviation data;
[0147] A food ingredient detection report is generated based on the corrected ingredient deviation data, and a food safety recommendation is generated based on the food ingredient detection report.
[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0149] Obtain the model of the cereal food to be tested and enter it into the pre-set product library to match the corresponding production ingredient table;
[0150] Generate a corresponding ingredient table prediction spectrum according to the production ingredient table, wherein the ingredient table prediction spectrum is used as a detection reference;
[0151] Use hyperspectral imaging technology to scan samples of cereal foods to be tested and obtain test spectral data of the samples;
[0152] Processing the detected spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components;
[0153] Analyze the characteristic wavelengths according to a preset quantitative model to quantitatively analyze the chemical components in the cereal food, thereby generating chemical component detection results based on the quantitative analysis results;
[0154] Comparing the chemical composition test results with the production composition table to generate initial composition deviation data;
[0155] Comparing the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and generating corresponding composition difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual composition differences;
[0156] comparing the composition difference correction data with the initial composition deviation data to generate corrected composition deviation data;
[0157] A food ingredient detection report is generated based on the corrected ingredient deviation data, and a food safety recommendation is generated based on the food ingredient detection report.
[0158] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0159] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0160] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for rapid detection of cereal food ingredients based on spectral imaging technology, characterized in that: The detection method comprises the following steps: obtaining the model of the cereal food to be detected and inputting it into a pre-set product library to match the corresponding production ingredient table; Generate a corresponding ingredient table prediction spectrum according to the production ingredient table, wherein the ingredient table prediction spectrum is used as a detection reference; Use hyperspectral imaging technology to scan samples of cereal foods to be tested and obtain test spectral data of the samples; Processing the detected spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components; Analyze the characteristic wavelengths according to a preset quantitative model to quantitatively analyze the chemical components in the cereal food, thereby generating chemical component detection results based on the quantitative analysis results; Comparing the chemical composition test results with the production composition table to generate initial composition deviation data; Comparing the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and generating corresponding composition difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual composition differences; comparing the composition difference correction data with the initial composition deviation data to generate corrected composition deviation data; generating a food composition test report based on the corrected composition deviation data, and generating food safety recommendations based on the food composition test report; The step of using hyperspectral imaging technology to scan a sample of a cereal food to be tested and obtaining test spectrum data of the sample includes the following steps: Acquiring image data of different dimensions of the sample, and preprocessing the image data to obtain processed image data; constructing a three-dimensional model of the sample based on the pre-processed image data; The preset partition model partitions the three-dimensional model through a region of interest extraction algorithm to determine the detection partition of the sample; Performing spectral scanning on the different detection partitions by using hyperspectral imaging technology to obtain detection spectral data of each partition; Determine the detection weight ratio of the i-th detection area based on the area size and area importance of the detection partition; The overall detection result is calculated by the overall detection calculation formula and the detection spectrum data of each partition, where the overall detection calculation formula is: ; Specifically, is the test result of the jth component, represents the detection result of the jth component corresponding to the i-th region, represents the weight ratio of the i-th region; Acquiring image data of different dimensions, wherein the image data includes image clarity, image abnormal point data, and image noise detection data; Acquire pre-processing history data corresponding to the image data, wherein the pre-processing history data includes luminosity compensation data and pixel compensation data; The preset image compensation analysis model analyzes the image data and pre-processed historical data based on a machine self-learning algorithm to generate an image credibility weight; The preset regional credibility analysis model performs analysis based on the detection partitions and the corresponding image credibility weights to generate regional confidence. The regional confidence is used to express the confidence level of the detection results of each region based on the image analysis results. The overall detection calculation formula is: ,in Indicates the confidence level of the detection result of the i-th region.
2. The method for rapid detection of cereal food ingredients based on spectral imaging technology according to claim 1, characterized in that: After the step of comparing the composition difference correction data with the initial composition deviation data to generate the modified composition deviation data, the following steps are included: Associating the historical correction component deviation data with corresponding historical image data based on the detection batch to construct a deviation-image dataset; The preset deviation analysis model analyzes the deviation-image dataset based on a machine self-learning algorithm to generate an image influence factor, wherein the image influence factor is used to predict the detection component deviation corresponding to different image data; The preset deviation prediction model analyzes the detected image data and the image influencing factors based on a machine self-learning algorithm to generate predicted component deviation data, and the predicted component deviation data is used to compensate for the initial component deviation data.
3. The method for rapid detection of cereal food ingredients based on spectral imaging technology according to claim 1, characterized in that: The preset quantitative model includes a continuous projection algorithm and a multi-weight optimized soft shrinkage algorithm.
4. A device for rapid detection of cereal food ingredients based on spectral imaging technology, applied to the method for rapid detection of cereal food ingredients based on spectral imaging technology according to any one of claims 1 to 3, characterized in that: The device includes a production ingredient table matching unit for obtaining the model of the cereal food to be tested and inputting it into a pre-set product library to match the corresponding production ingredient table; A component table prediction spectrum generating unit, configured to generate a corresponding component table prediction spectrum according to the production component table, wherein the component table prediction spectrum is used as a detection reference; A detection spectrum data acquisition unit is used to scan a sample of the cereal food to be tested using a hyperspectral imaging technology to obtain detection spectrum data of the sample; a characteristic wavelength extraction unit, configured to process the detection spectrum data by chemometrics to extract characteristic wavelengths related to cereal food components; a chemical composition detection result generating unit, configured to be pre-set with a quantitative model to analyze characteristic wavelengths to perform quantitative analysis on the chemical components in the cereal food, thereby generating a chemical composition detection result based on the quantitative analysis result; an initial composition deviation data generating unit, configured to compare the chemical composition test result with the production composition table to generate initial composition deviation data; an actual component difference analysis unit, configured to compare the detected spectrum data with the spectrum predicted by the composition table to generate spectrum difference data, and to generate corresponding component difference correction data based on the spectrum difference data, wherein the spectrum difference data is used to analyze actual component differences; a corrected component deviation data generating unit, configured to compare the component difference correction data with the initial component deviation data to generate corrected component deviation data; A food ingredient detection report generating unit is used to generate a food ingredient detection report based on the corrected ingredient deviation data, and to generate food safety recommendations based on the food ingredient detection report.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for rapid detection of cereal food ingredients based on spectral imaging technology as described in any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for rapid detection of cereal food ingredients based on spectral imaging technology as claimed in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Hyperspectrum-based method for determining starch content of whole potato flour noodles
CN113984683A
Wheat growth period nutrient information detection method
CN114252406A