Preformed dish quality detection device and safety traceability method

Through multimodal data acquisition and deep learning combined with blockchain technology, real-time detection and safe traceability of pre-made dishes are achieved, and the problem of inaccurate quality detection and low efficiency of traceability methods in the existing technology is solved, and the quality and safety of pre-made dishes are improved and consumer trust is improved.

CN120258609AActive Publication Date: 2025-07-04FANJIA FOOD (QINGDAO) CO LTD

Patent Information

Application Number
CN202510364721.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-07-04
Estimated Expiration
2045-03-26

AI Technical Summary

Technical Problem

The quality inspection of existing pre-made dishes is not real-time during production, storage and transportation, the traceability method is inefficient and error-prone, and the data sharing and security are insufficient, which affects consumer trust and market order.

Method used

The multi-modal data acquisition module, dynamic calibration module, multi-source data fusion module and deep learning quality evaluation model are adopted, and the traceability encoding is generated and implemented in combination with blockchain technology to achieve real-time quality detection and safe traceability.

Benefits of technology

It realizes accurate detection and safe traceability of the quality of pre-made dishes, enhances consumer trust, ensures the quality and safety of pre-made dishes, and improves the intelligence and operation efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258609A_ABST
    Figure CN120258609A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of prefabricated dish detection and traceablility, and discloses a prefabricated dish quality detection device and a safety traceablility method.According to the device, multi-aspect data of prefabricated dishes are collected in real time through a multi-modal data collection module, environmental interference is eliminated through a dynamic calibration module, and multi-dimensional quality indexes are generated through a multi-source data fusion module; the deep learning quality evaluation model outputs a quality level and an abnormal probability, and the traceability data generation module binds related information to generate a unique traceability code. The security traceability method comprises the steps of multi-dimensional data acquisition and binding, distributed encryption storage, dynamic consensus verification, lightweight traceability verification, supply chain reverse tracking and the like. Precise detection and safe traceability of the quality of the prefabricated dishes are achieved, the quality safety of the prefabricated dishes is effectively guaranteed, the credibility of consumers is improved, meanwhile, intelligent optimization and self-adaptive learning capabilities are achieved, and the overall performance and operation efficiency of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of prefabricated food detection and traceability, and specifically relates to a prefabricated food quality detection device and a safety traceability method. Background Art

[0002] As a convenient and fast food, the demand for prefabricated food has increased rapidly in the market in recent years. It simplifies the cooking steps and saves consumers' time, and is widely popular in both the catering industry and home kitchens. However, prefabricated food faces many quality and safety problems during production, storage, and transportation, which seriously restricts the healthy development of the industry.

[0003] In terms of quality, the raw material quality of prefabricated food is uneven. In the production link, some enterprises choose poor-quality ingredients to reduce costs, such as unfresh meat and vegetables. The quality defects of these raw materials will directly affect the final quality of prefabricated food. At the same time, the differences in processing techniques also have a great impact on the quality of prefabricated food. Different processing temperatures, time controls, as well as seasoning and packaging methods, will all lead to differences in the taste and retention of nutritional components of prefabricated food. For example, overheating may damage the nutritional components in the dishes, and improper packaging may accelerate the deterioration of the dishes.

[0004] During storage and transportation, environmental factors are the key to affecting the quality of prefabricated food. Changes in temperature and humidity have a significant impact on the shelf life and quality of prefabricated food. Too high a temperature will accelerate the reproduction speed of microorganisms, resulting in the spoilage of the dishes; too high humidity is prone to the growth of mold, and too low humidity may cause the dishes to dry out and dehydrate, affecting the taste. Moreover, there is currently a lack of effective real-time monitoring means, and it is impossible to timely detect the quality changes of prefabricated food during storage and transportation. By the time consumers find problems, losses have often been caused.

[0005] From the perspective of safety traceability, there are many deficiencies in the existing traceability systems. Traditional traceability methods mainly rely on manual records and paper labels. This method is not only inefficient but also prone to problems such as recording errors and incomplete information. In the case of numerous supply chain links, once the information in a certain link is missing or incorrect, the traceability chain will be interrupted, and it is impossible to accurately track the source and flow of products.

[0006] In addition, the existing traceability systems lack an effective data sharing mechanism. The data between each link is isolated from each other, and it is impossible to achieve real-time sharing and collaborative processing of information. This makes it difficult for regulatory authorities to comprehensively supervise the entire supply chain, and it is also difficult for consumers to obtain accurate and complete product information. For example, when consumers buy prefabricated food, they cannot know key information such as the source of raw materials used in the production process of the dishes, the processing techniques, and the temperature and humidity changes during transportation, and cannot effectively evaluate the quality and safety of the products.

[0007] In terms of data security, with the development of information technology, traceability data faces the risks of being tampered with and leaked. If the traceability data is maliciously tampered with, it will mislead consumers and regulatory authorities, seriously affecting the market order and the rights and interests of consumers. Therefore, it is urgent to develop a technology and device that can comprehensively and accurately detect the quality of prefabricated dishes and achieve efficient and secure traceability. Summary of the Invention

[0008] The purpose of the present invention is to provide a device for detecting the quality of prefabricated dishes and a method for secure traceability to solve the problems raised in the above background technology.

[0009] To achieve the above purpose, the present invention provides the following technical solution: A device for detecting the quality of prefabricated dishes, the device includes: A multimodal data acquisition module, including a hyperspectral imaging sensor, a gas sensor array, a weight sensor, and a temperature and humidity sensor, for real-time acquisition of the physical characteristics, chemical components, weight changes, and environmental data of prefabricated dishes; A dynamic calibration module, including a reference sample library and a calibration algorithm, for dynamically adjusting the sensor output according to environmental parameters to eliminate environmental interference; A multi-source data fusion module, using a multi-source data fusion algorithm based on Kalman filtering, for spatio-temporal alignment and feature fusion of real-time data from different sensors to generate multi-dimensional quality indicators; A deep learning quality evaluation model, using a hybrid architecture combining a convolutional neural network and a long short-term memory network, inputting the multi-dimensional quality indicators, and outputting the quality grade and the probability of abnormality; A traceability data generation module, for binding the quality detection results with production batches, processing parameters, and logistics information to generate a unique traceability code.

[0010] Preferably, in the multimodal data acquisition module: The hyperspectral imaging sensor covers the visible light to near-infrared band, with a resolution of not less than 5 nm, for detecting surface microbial contamination and component distribution; The gas sensor array includes metal oxide semiconductor sensors and electrochemical sensors, for detecting the concentration of volatile organic compounds and hydrogen sulfide; The weight sensor has an accuracy of 0.1 grams, for real-time monitoring of packaging integrity; The temperature and humidity sensor is integrated in a sealed cavity, with a sampling frequency ≥ 10 Hz.

[0011] Preferably, the specific implementation of the multi-source data fusion module includes: Construct a spatio-temporal alignment layer, using a sliding window mechanism to match the timestamps of sensor data, and unifying the spatial reference through coordinate transformation; The design feature extraction layer extracts the spectral features of the hyperspectral image, the time series features of the gas concentration, and the trend features of the weight change respectively; Implement the fusion decision layer, calculate the weights of each feature through the Bayesian network, and output the fused quality index vector.

[0012] Preferably, in the dynamic calibration module: The reference sample library contains standard sample data under different temperature and humidity conditions; The calibration algorithm is an adaptive compensation model based on the least squares method, and its formula is:

[0013] where, is the output of the calibrated sensor, is the original data, and are the real-time temperature and humidity deviations respectively, and are the compensation coefficients obtained through offline calibration.

[0014] Preferably, the training process of the deep learning quality evaluation model includes: Data collection: Collect 10,000 groups of labeled prefabricated vegetable sample data, covering four categories: normal products, microbial contamination, oxidative deterioration, and physical damage; Feature engineering: Perform principal component analysis dimensionality reduction on the hyperspectral image and extract the first 20 principal components; Calculate the moving average and first-order difference for the gas data; Model architecture: Use ResNet-50 to extract image features, an LSTM network to process time series data, and a fully connected layer to output classification results; Loss function: Use Focal Loss to solve the problem of class imbalance and introduce a temperature parameter to adjust the prediction confidence.

[0015] Preferably, the device further includes an anomaly detection module, and its implementation method is: Construct an unsupervised detection algorithm based on the isolation forest, input the multi-dimensional quality index, and calculate the anomaly score; Set a dynamic threshold adjustment mechanism to adaptively update the decision threshold according to the KL divergence of the historical data distribution; When the anomaly score exceeds the threshold, trigger an alarm and record the anomaly type in the traceability database.

[0016] Preferably, the specific steps of the traceability data generation module include: Encode the production batch information into a 32-bit hash value; Bind the quality inspection result with the hash value through the blockchain smart contract to generate an immutable traceability record; Adopt a lightweight Merkle tree structure to store logistics node data, supporting fast verification.

[0017] Preferably, the device further includes an adaptive learning module, and its implementation method is as follows: Adopt a reinforcement learning framework, with the quality detection error as the reward signal; Design a policy network to dynamically adjust the hyperparameters of the deep learning model, including the learning rate and batch size; Optimize the sensor sampling frequency through the Q-learning algorithm to achieve a balance between accuracy and energy consumption.

[0018] Preferably, the present invention further includes a safety traceability method for prefabricated dishes, and the method includes the following steps: Step S1: Multi-dimensional data collection and binding. Real-time obtain the hyperspectral characteristics, gas concentration, weight fluctuation and environmental parameters of prefabricated dishes through a multi-modal data collection module, and at the same time associate the production batch code, processing equipment log and cold chain logistics track to generate a structured traceability data packet; Step S2: Distributed encrypted storage. Use a distributed storage network based on the IPFS protocol to fragment and store the traceability data packet on multiple nodes, and write the hash value of the storage location into the blockchain smart contract; Step S3: Dynamic consensus verification. Adopt an improved practical Byzantine fault tolerance algorithm to verify the consistency of cross-node data, optimize the consensus efficiency by introducing a dynamic weight mechanism, and generate an immutable block hash chain; Step S4: Lightweight traceability verification. Consumers scan the packaging QR code to trigger the zero-knowledge proof protocol, verify the data integrity based on the Merkle tree path, and do not expose the original sensitive information; Step S5: Supply chain reverse tracing. When quality anomalies are detected, construct a supply chain topology network through a graph database, locate high-risk nodes based on the PageRank algorithm, and generate a multi-dimensional traceability report containing disposal suggestions.

[0019] Compared with the prior art, the beneficial effects of the present invention are: Through the multi-modal data collection module, the present invention integrates hyperspectral imaging sensors, gas sensor arrays, weight sensors and temperature and humidity sensors to achieve real-time collection of the physical characteristics, chemical components, weight changes and environmental data of prefabricated dishes. The hyperspectral imaging sensor can accurately detect surface microbial contamination and component distribution, the gas sensor array can detect the concentration of volatile organic compounds and hydrogen sulfide, the weight sensor monitors the packaging integrity in real time, the temperature and humidity sensor provides environmental parameters, and the multi-dimensional data collection provides a rich and accurate data basis for quality detection.

[0020] The dynamic calibration module adjusts the sensor output dynamically according to the reference sample library and calibration algorithm, based on environmental parameters. Through an adaptive compensation model based on the least squares method, it effectively eliminates the interference of environmental factors such as temperature and humidity on sensor data, ensuring the accuracy of the collected data, and thus improving the reliability of quality inspection. In different temperature and humidity environments, this module can calibrate the sensor data in real time, making the detection results more accurately reflect the quality of prefabricated dishes.

[0021] The multi-source data fusion module uses an algorithm based on Kalman filtering to perform spatio-temporal alignment and feature fusion on the real-time data of different sensors, generating multi-dimensional quality indicators. At the same time, the deep learning quality evaluation model adopts a hybrid architecture combining convolutional neural network and long short-term memory network to analyze the multi-dimensional quality indicators, accurately outputting the quality level and abnormal probability. This way of data fusion and deep learning can evaluate the quality of prefabricated dishes more comprehensively and accurately than traditional quality evaluation methods, and timely discover potential quality problems.

[0022] The traceability data generation module binds the quality inspection results with production batches, processing parameters, and logistics information to generate a unique traceability code. Using blockchain smart contracts and lightweight Merkle tree structures, it ensures the immutability of traceability records and the rapid verification of logistics node data. Consumers can perform lightweight traceability verification based on the zero-knowledge proof protocol by scanning the packaging QR code, obtaining relevant product information without exposing the original sensitive information. In terms of reverse tracing in the supply chain, a supply chain topology network is constructed through a graph database, and high-risk nodes are located based on the PageRank algorithm to generate multi-dimensional traceability reports and provide handling suggestions, effectively ensuring the quality and safety of prefabricated dishes and enhancing consumers' trust.

[0023] The device also includes an anomaly detection module and an adaptive learning module. The anomaly detection module, based on the isolation forest algorithm and dynamic threshold adjustment mechanism, can timely detect abnormal situations in the quality of prefabricated dishes and alarm and record them. The adaptive learning module adopts a reinforcement learning framework, using the quality inspection error as a reward signal to dynamically adjust the hyperparameters of the deep learning model and the sensor sampling frequency, optimizing energy consumption while ensuring detection accuracy, realizing the intelligence and adaptability of the device, and improving the overall performance and operation efficiency of the system. Description of the Drawings

[0024] Figure 1 It is the working principle diagram of the prefabricated dish quality detection device described in the present invention; Figure 2 It is the working flow chart of the multi-source data fusion module; Figure 3 It is the working flow chart of the training of the deep learning quality evaluation model; Figure 4It is a flowchart of the working process of the adaptive learning module. Specific implementation manners

[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0026] Please refer to Figures 1-4 , the present invention provides a prefabricated dish quality detection device and a safety traceability method. The prefabricated dish quality detection device mainly consists of a multi-modal data acquisition module, a dynamic calibration module, a multi-source data fusion module, a deep learning quality evaluation model, and a traceability data generation module.

[0027] The multi-modal data acquisition module integrates hyperspectral imaging sensors, gas sensor arrays, weight sensors, and temperature and humidity sensors to collect the physical characteristics, chemical components, weight changes, and environmental data of prefabricated dishes in real time. These sensors work together to obtain information about prefabricated dishes from multiple dimensions, providing a data basis for subsequent detection and evaluation.

[0028] The dynamic calibration module uses a reference sample library and a calibration algorithm to dynamically adjust the sensor output according to environmental parameters, effectively eliminating environmental interference and ensuring the accuracy of the data collected by the sensors. Changes in environmental factors such as temperature and humidity may affect the measurement accuracy of the sensors. Through the dynamic calibration module, the sensor data can be corrected in real time.

[0029] The multi-source data fusion module adopts a multi-source data fusion algorithm based on Kalman filtering to perform spatio-temporal alignment and feature fusion on the real-time data of different sensors, generating multi-dimensional quality indicators. Since the data collected by different sensors have differences in time and space, this module processes the data through specific methods to integrate multi-dimensional indicators that can more comprehensively reflect the quality of prefabricated dishes.

[0030] The deep learning quality evaluation model uses a hybrid architecture combining convolutional neural networks and long short-term memory networks, taking the multi-dimensional quality indicators as inputs and outputting the quality grade and anomaly probability of prefabricated dishes. This model is trained with a large amount of data and can accurately evaluate the quality of prefabricated dishes, timely discovering potential quality problems.

[0031] The traceability data generation module binds the quality detection results with production batches, processing parameters, and logistics information to generate a unique traceability code. This enables each prefabricated dish to have its corresponding traceability information, facilitating tracking and management in subsequent links.

[0032] The present invention will be further described below in conjunction with Embodiments 1 to 5: Embodiment 1: This embodiment elaborates in detail the specific composition and working principle of the multi-modal data acquisition module, whose function is to accurately obtain real-time data in multiple aspects of prefabricated dishes, providing a reliable basis for subsequent detection and evaluation.

[0033] The hyperspectral imaging sensor covers the visible light to near-infrared band, with a resolution of not less than 5 nm. In practical applications, its working principle is to utilize the differences in the absorption and reflection characteristics of different substances for light of different wavelengths to perform imaging detection on the surface of prefabricated dishes. For example, for surface microbial contamination, during the growth of microorganisms, the substance composition on the surface of prefabricated dishes will change, and these compositional changes will present unique spectral characteristics in the hyperspectral image. By analyzing these characteristics, it is possible to determine whether there is microbial contamination on the surface of prefabricated dishes and the degree of contamination. At the same time, this sensor can also detect the distribution of components in prefabricated dishes, such as detecting the uniformity of the distribution of different nutritional components in prefabricated dishes in the dishes, providing important physical characteristic data for quality evaluation.

[0034] The gas sensor array consists of metal oxide semiconductor sensors and electrochemical sensors. The metal oxide semiconductor sensors detect volatile organic compounds (VOCs) to reflect the freshness and spoilage of prefabricated dishes. When prefabricated dishes deteriorate, various volatile organic compounds will be generated, and different types of volatile organic compounds represent different spoilage reasons. For example, lipid oxidation will produce specific volatile aldehyde substances. The electrochemical sensor is mainly used to detect the concentration of hydrogen sulfide, which is usually produced by protein decomposition. An increase in its concentration means that prefabricated dishes may be contaminated by microorganisms and protein has deteriorated. Through the collaborative work of these two sensors, it is possible to comprehensively detect the gas components generated by prefabricated dishes and reflect the quality changes of prefabricated dishes from the perspective of chemical composition.

[0035] The weight sensor has an accuracy of 0.1 g and monitors the packaging integrity in real time. During the packaging process of prefabricated dishes, if the packaging is damaged, it may cause a change in weight. The weight sensor continuously monitors the weight of prefabricated dishes. Once an abnormal weight fluctuation is detected, it can be preliminarily judged that there is a problem with the packaging. For example, during storage and transportation, if the weight suddenly decreases, it may be that the packaging has leaked, external air has entered, or internal moisture has been lost, which will affect the quality and shelf life of prefabricated dishes. The weight sensor can detect such potential problems in a timely manner.

[0036] The temperature and humidity sensor is integrated in a sealed cavity, and the sampling frequency is ≥10Hz. The temperature and humidity of the environment where the pre-made dishes are located have an important impact on their quality. Excessive temperature will accelerate the growth of microorganisms and chemical reactions, resulting in the deterioration of pre-made dishes; too high humidity may cause the growth of microorganisms, while too low humidity may cause the pre-made dishes to dry and dehydrate. The temperature and humidity sensor collects the temperature and humidity data in the sealed cavity at a high sampling frequency, providing accurate environmental parameters for the dynamic calibration module to calibrate the data of other sensors. At the same time, it can also reflect the real-time situation of the storage environment of pre-made dishes, providing environmental data support for quality assessment.

[0037] Embodiment 2: The role of the multi-source data fusion module is to effectively fuse different types of data obtained by the multi-modal data acquisition module, generate comprehensive and accurate multi-dimensional quality indicators, and improve the reliability of quality detection.

[0038] When constructing the spatio-temporal alignment layer, a sliding window mechanism is used to match the timestamps of sensor data. The frequencies and times of data collection by different sensors may vary. The sliding window mechanism can screen and match the data at a certain time interval. For example, the hyperspectral imaging sensor may collect an image every once in a while, while the gas sensor and the weight sensor output data in real time. Through the sliding window, the data is processed at a certain time step (such as 1 second), the data of different sensors within the same time window are associated, and a unified timestamp is added to them. At the same time, the spatial reference is unified through coordinate transformation. Since different sensors may have different detection positions and angles when detecting pre-made dishes, the spatial coordinates of the data need to be transformed so that they can be processed in the same spatial coordinate system to ensure the spatio-temporal consistency of the data.

[0039] The design feature extraction layer extracts features for different types of data respectively. For hyperspectral images, spectral analysis technology is used to extract their spectral features. For example, parameters such as reflectivity and absorption rate in different bands are calculated, and these parameters can reflect the content and distribution of various components in pre-made dishes. For gas concentration data, time series analysis methods are used to extract time series features, such as calculating the change trend and peak value of gas concentration over a period of time. The weight change data is extracted with trend features through trend analysis to judge whether the weight is gradually increasing, decreasing or remaining stable.

[0040] The implementation fusion decision-making layer calculates the weights of each feature through a Bayesian network. A Bayesian network is a graphical model based on probabilistic reasoning. It can calculate the weight of each feature according to the correlation between different features and their influence on quality indicators. For example, when judging whether prefabricated dishes are spoiled, the gas concentration feature may have a greater impact on spoilage judgment than the weight change feature, and the Bayesian network will assign a higher weight to the gas concentration feature. In this way, each feature is weighted and fused according to its importance, and the fused quality indicator vector is output. This vector comprehensively reflects the quality status of prefabricated dishes in multiple dimensions and provides more accurate data support for subsequent quality evaluation.

[0041] Example 3: The function of the dynamic calibration module is to calibrate the sensor data in real time according to environmental changes, reduce the interference of environmental factors on the detection results, and ensure the accuracy of the detection data.

[0042] The reference sample library contains standard sample data under different temperature and humidity conditions. When establishing the reference sample library, a large number of prefabricated dish samples are prepared, and various sensor data of these samples are obtained using high-precision detection equipment in different temperature and humidity combination environments and stored in the reference sample library as standard sample data. For example, set up environmental chambers with multiple different temperatures (such as 5°C, 10°C, 15°C, etc.) and humidities (such as 40%RH, 60%RH, 80%RH, etc.), place the prefabricated dish samples in them, and collect hyperspectral image data, gas concentration data, weight data, etc. of each sample under different environments to construct the reference sample library.

[0043] The calibration algorithm uses an adaptive compensation model based on the least squares method, and the formula is:

[0044] Where, is the calibrated sensor output, is the original data, and are the real-time temperature and humidity deviations respectively, and are the compensation coefficients obtained through offline calibration. In actual work, the temperature and humidity sensors collect the temperature and humidity data of the environment in real time, and calculate the real-time temperature and humidity deviations and . and are the compensation coefficients obtained through offline calibration. Before the equipment leaves the factory or during regular calibration, the data in the reference sample library is used and calculated using the least squares method. When the sensor collects the original data , the calibrated sensor output is calculated according to the above formula.For example, when the temperature rises and causes the gas sensor output to be high, the calibration algorithm, combined with the real-time temperature deviation and compensation coefficient, corrects the original data to obtain more accurate gas concentration data, effectively eliminating the impact of temperature and humidity changes on the sensor's measurement accuracy.

[0045] Embodiment 4: This embodiment introduces in detail the training process and practical application of the deep learning quality assessment model, which uses deep learning technology to accurately assess the quality of pre-prepared dishes, output quality grades and abnormal probabilities, and provide strong support for pre-prepared dish quality monitoring.

[0046] During the data collection phase, 10,000 sets of labeled pre-prepared food sample data were collected, covering four categories: normal products, microbial contamination, oxidation deterioration, and physical damage. In actual operations, these sample data are obtained in a variety of ways. Normally produced pre-prepared food samples are collected from the production line as normal product data; microbial contamination samples are simulated by artificial inoculation of microorganisms; pre-prepared food is exposed to the air for a certain period of time to cause oxidation deterioration, and oxidation deterioration samples are obtained; physical damage is artificially caused to pre-prepared food, such as squeezing, scratching, etc., and physical damage samples are collected. Each sample is labeled in detail and its category is recorded.

[0047] In the feature engineering phase, principal component analysis is performed on the hyperspectral image to reduce its dimension and extract the first 20 principal components. Hyperspectral images contain a large amount of band information and have a high data dimension. Direct processing will increase the amount of calculation and may result in information redundancy. Principal component analysis (PCA) converts the original data into a set of unrelated principal components through linear transformation. These principal components can retain most of the information of the original data. After PCA processing, the first 20 principal components are extracted, which not only reduces the data dimension but also retains the key spectral features. For gas data, the moving average and first-order difference are calculated. The moving average can smooth the fluctuations of the gas concentration data and reflect the trend of the data more clearly; the first-order difference is used to highlight the rate of change of the data, which can more keenly capture the changes in gas concentration and provide more valuable features for the model.

[0048] The model architecture uses ResNet-50 to extract image features, LSTM network to process time series data, and the fully connected layer to output classification results. ResNet-50 is a classic convolutional neural network with strong image feature extraction capabilities and can automatically learn complex features in hyperspectral images. LSTM network is good at processing time series data and can effectively capture long-term and short-term dependencies for time series data such as changes in gas concentration over time and weight changes. The image features extracted by ResNet-50 and the time series features processed by the LSTM network are fused and input into the fully connected layer for classification, outputting the quality grade and abnormality probability of the pre-prepared dishes.

[0049] The loss function uses Focal Loss to solve the class imbalance problem and introduces a temperature parameter to adjust the prediction confidence. In actual sample data, there may be significant differences in the number of samples of different classes. For example, the number of normal product samples may be much larger than the number of microbial contamination samples, which may cause the model to be biased towards the class with a larger number during the training process. Focal Loss assigns different weights to samples of different classes, enabling the model to pay more attention to the class with a smaller number, thereby solving the class imbalance problem. At the same time, a temperature parameter is introduced to adjust the confidence of the prediction results. The larger the temperature parameter, the more uniform the distribution of the prediction results, and the greater the uncertainty of the model; the smaller the temperature parameter, the more concentrated the prediction results in a certain class, and the higher the confidence of the model. By reasonably adjusting the temperature parameter, the prediction performance of the model can be optimized.

[0050] Example 5: The specific steps of the traceability data generation module are as follows: Encode the production batch information into a 32-bit hash value, and use a hash algorithm (such as the SHA-256 algorithm) to encrypt the production batch information to generate a unique 32-bit hash value, which is used as the identifier of the production batch. Bind the quality inspection results to the hash value through a blockchain smart contract to generate an immutable traceability record. Blockchain technology has the characteristics of decentralization and immutability, and a smart contract is an automatically executed program running on the blockchain. In the present invention, the smart contract associates the quality inspection results (including quality grade, abnormal probability, etc.) with the production batch hash value. Once recorded on the blockchain, the data cannot be tampered with. A lightweight Merkle tree structure is used to store logistics node data, supporting fast verification. A Merkle tree is a binary tree structure. The logistics node data (such as transportation time, transportation location, temperature change, etc.) is hashed according to certain rules to construct a Merkle tree. When verifying the integrity of logistics data, only the root hash value of the Merkle tree and the relevant path hash values need to be verified, without verifying all the data, greatly improving the verification efficiency.

[0051] The anomaly detection module constructs an unsupervised detection algorithm based on Isolation Forest, inputs multi-dimensional quality indicators, and calculates anomaly scores. The Isolation Forest algorithm constructs multiple isolation trees and uses the path length of each sample in the tree as the anomaly score. Normal samples are usually located in the dense area of the data distribution and have a short path length; while abnormal samples are located in the sparse area and have a long path length. A dynamic threshold adjustment mechanism is set to adaptively update the decision threshold according to the KL divergence of the historical data distribution. KL divergence is used to measure the difference between two probability distributions. By calculating the KL divergence between the current data distribution and the historical data distribution, the change of the data is judged. If the KL divergence exceeds a certain threshold, it indicates that the data distribution has changed significantly, and at this time, the decision threshold for anomaly detection is adjusted accordingly. When the anomaly score exceeds the threshold, an alarm is triggered and the anomaly type is recorded in the traceability database for subsequent tracking and analysis of the anomaly situation.

[0052] The adaptive learning module adopts a reinforcement learning framework and uses the quality detection error as the reward signal. In reinforcement learning, the agent (which can be regarded as the entire detection system in the present invention) interacts with the environment (the prefabricated dish sample and its detection process) and adjusts its own behavior according to the reward signal feedback by the environment. The policy network is designed to dynamically adjust the hyperparameters of the deep learning model, including the learning rate and batch size. The learning rate affects the convergence speed of model training, and the batch size affects the stability and efficiency of model training. The policy network dynamically adjusts these hyperparameters according to the quality detection error through an optimization algorithm (such as the Adam algorithm) to continuously optimize the model during the training process. The sensor sampling frequency is optimized through the Q-learning algorithm to achieve a balance between accuracy and energy consumption. The Q-learning algorithm is a classic reinforcement learning algorithm. By continuously trying different sampling frequencies, calculating the Q value according to the quality detection error and energy consumption, and selecting the optimal sampling frequency, the energy consumption of the sensor is reduced while ensuring the detection accuracy.

[0053] The present invention also includes a method for tracing the safety of prefabricated dishes, and the method includes: Step S1: Multi-dimensional data collection and binding. The hyperspectral characteristics, gas concentration, weight fluctuation and environmental parameters of the prefabricated dishes are obtained in real time through the multi-modal data collection module, and at the same time, the production batch code, processing equipment log and cold chain logistics track are associated to generate a structured traceability data packet; Step S2: Distributed encrypted storage. The traceability data packet is fragmented and stored in multiple nodes by using a distributed storage network based on the IPFS protocol, and the hash value of the storage location is written into the blockchain smart contract; Step S3: Dynamic consensus verification. An improved Practical Byzantine Fault Tolerance algorithm is used to verify the consistency of cross-node data, and the consensus efficiency is optimized by introducing a dynamic weight mechanism to generate an immutable block hash chain; Step S4: Lightweight traceability verification. Consumers scan the QR code on the package to trigger the zero-knowledge proof protocol, verify data integrity based on the Merkle tree path without exposing the original sensitive information. Step S5: Reverse tracing of the supply chain. When quality anomalies are detected, a supply chain topology network is constructed through a graph database, high-risk nodes are located based on the PageRank algorithm, and a multi-dimensional traceability report containing disposal suggestions is generated.

[0054] The implementation method of this method refers to the above embodiments and will not be elaborated in the specification.

[0055] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device.

[0056] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A prefabricated food quality detection device, characterized in that, Including: A multi-modal data acquisition module, including a hyperspectral imaging sensor, a gas sensor array, a weight sensor, and a temperature and humidity sensor, for real-time acquisition of the physical characteristics, chemical components, weight changes, and environmental data of prefabricated dishes; A dynamic calibration module, including a reference sample library and a calibration algorithm, for dynamically adjusting the sensor output according to environmental parameters to eliminate environmental interference; A multi-source data fusion module, adopting a multi-source data fusion algorithm based on Kalman filtering, for spatio-temporal alignment and feature fusion of real-time data from different sensors to generate multi-dimensional quality indicators; A deep learning quality evaluation model, adopting a hybrid architecture combining a convolutional neural network and a long short-term memory network, inputting the multi-dimensional quality indicators, and outputting the quality grade and the abnormal probability; A traceability data generation module, for binding the quality inspection results with production batches, processing parameters, and logistics information to generate a unique traceability code.

2. The prefabricated food quality detection device according to claim 1, wherein, In the multi-modal data acquisition module: The hyperspectral imaging sensor covers the visible light to near-infrared band, with a resolution of not less than 5nm, for detecting surface microbial contamination and component distribution; The gas sensor array includes metal oxide semiconductor sensors and electrochemical sensors, for detecting the concentration of volatile organic compounds and hydrogen sulfide; The weight sensor has an accuracy of 0.1 grams, for real-time monitoring of packaging integrity; The temperature and humidity sensor is integrated in a sealed cavity, with a sampling frequency ≥ 10Hz.

3. The prefabricated food quality detection device according to claim 1, characterized in that The specific implementation of the multi-source data fusion module includes: Constructing a spatio-temporal alignment layer, using a sliding window mechanism to match the timestamps of sensor data, and unifying the spatial reference through coordinate transformation; Designing a feature extraction layer, respectively extracting the spectral features of hyperspectral images, the time series features of gas concentrations, and the trend features of weight changes; Implementing a fusion decision layer, calculating the weights of each feature through a Bayesian network, and outputting the fused quality indicator vector.

4. The prefabricated dish quality detection device according to claim 1, wherein In the dynamic calibration module: The reference sample library contains standard sample data under different temperature and humidity conditions; The calibration algorithm is an adaptive compensation model based on the least squares method, and its formula is: wherein, is the output of the calibrated sensor, is the original data, and are the real-time temperature and humidity deviations respectively, and are the compensation coefficients obtained through offline calibration.

5. The prefabricated food quality detection device according to claim 1, characterized in that, The training process of the deep learning quality evaluation model includes: Data acquisition: Collect 10,000 groups of labeled prefabricated dish sample data, covering four categories: normal products, microbial contamination, oxidative deterioration, and physical damage; Feature engineering: Conduct principal component analysis dimensionality reduction on hyperspectral images, and extract the first 20 principal components; Calculate the moving average and first-order difference for gas data; Model architecture: Use ResNet-50 to extract image features, an LSTM network to process time series data, and a fully connected layer to output classification results; Loss function: Use Focal Loss to solve the class imbalance problem, and introduce a temperature parameter to adjust the prediction confidence.

6. The prefabricated food quality detection device according to claim 1, wherein, It also includes an anomaly detection module, and its implementation method is: Construct an unsupervised detection algorithm based on isolation forest, input the multi-dimensional quality indicators, and calculate the anomaly score; Set a dynamic threshold adjustment mechanism, and adaptively update the decision threshold according to the KL divergence of the historical data distribution; When the anomaly score exceeds the threshold, trigger an alarm and record the anomaly type in the traceability database.

7. The prefabricated food quality detection device according to claim 1, characterized in that, The specific steps of the traceability data generation module include: Encode the production batch information into a 32-bit hash value; Bind the quality inspection results with the hash value through a blockchain smart contract to generate an immutable traceability record; Adopt a lightweight Merkle tree structure to store logistics node data, supporting fast verification.

8. The prefabricated food quality detection device according to claim 1, wherein, It also includes an adaptive learning module, and its implementation method is as follows: Adopt a reinforcement learning framework with the quality inspection error as the reward signal; Design a policy network to dynamically adjust the hyperparameters of the deep learning model, including the learning rate and batch size; Optimize the sensor sampling frequency through the Q-learning algorithm to achieve a balance between accuracy and energy consumption.

9. A method for safely tracing prefabricated dishes, characterized in that, It includes the following steps: Step S1: Multi-dimensional data collection and binding. Real-time obtain the hyperspectral characteristics, gas concentration, weight fluctuation and environmental parameters of the prefabricated dishes through a multi-modal data collection module, and at the same time associate the production batch code, processing equipment log and cold chain logistics track to generate a structured traceability data packet; Step S2: Distributed encrypted storage. Use a distributed storage network based on the IPFS protocol to shard and store the traceability data packet to multiple nodes, and write the hash value of the storage location into the blockchain smart contract; Step S3: Dynamic consensus verification. Adopt an improved practical Byzantine fault tolerance algorithm to verify the consistency of cross-node data, and optimize the consensus efficiency by introducing a dynamic weight mechanism to generate an immutable block hash chain; Step S4: Lightweight traceability verification. Consumers scan the packaging QR code to trigger the zero-knowledge proof protocol, verify the data integrity based on the Merkle tree path, and do not expose the original sensitive information; Step S5: Supply chain reverse tracing. When quality anomalies are detected, construct a supply chain topology network through a graph database, locate high-risk nodes based on the PageRank algorithm, and generate a multi-dimensional traceability report containing disposal suggestions.

Citation Information

Patent Citations

  • Pork freshness intelligent detection device

    CN101144780A

  • Multi-feature fusion-based meat freshness hyperspectral image visual detection

    CN103900972A

  • Quick pork freshness nondestructive testing method based on gas sensor technology

    CN103983676A

  • System and method for managing meat products based on e-commerce platform

    CN104809544A

  • Mango quality nondestructive detection method and mango quality nondestructive detection apparatus

    CN105067531A

Cited By

  • Food quality safety traceability method based on big data

    CN120822974A

  • Roast chicken eating quality grading intelligent judgment method based on multi-mode fusion

    CN120892948A

  • Method, system and device for detecting abnormity of storage environment for tobacco primary processing

    CN121278609A

  • Credible data tracing system and method for prefabricated dish supply chain

    CN121441510A

  • Premade food risk management method and system

    CN121684643A