Production process data set construction method and system for food quality traceability edge calculation
Through edge computing technology, multi-source heterogeneous data in food production is classified and processed in a layered manner, which solves the problems of data heterogeneity and cross-departmental collaboration difficulties, and realizes the richness and accuracy of food quality traceability data and adapts to flexibility Production demand.
Patent Information
- Application Number
- CN202411840160.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-12-13
AI Technical Summary
The multi-source heterogeneity of data and cross-departmental collaboration difficulties in food production lead to incomplete traceability data and missing key data, affecting the overall effect.
Adopt edge computing methods for food quality traceability, and use edge devices and cloud computing power to process and build a rich and accurate production process data set by layering the key data in the production process.
The integration and unity of heterogeneous data is realized, the product production process is accurately positioned, the integrity and accuracy of food quality traceability data is ensured, and the rapid processing and decoupling of different types of data is adapted to the current flexible production needs.
Smart Images

Figure CN119313361A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data acquisition and processing, and specifically relates to a production process data set construction method and system for edge computing for food quality traceability. Background Art
[0002] Food production quality traceability data comes from all aspects of the food production process, including food production data, food packaging data, food storage data, etc. At the same time, the data sources of these data are also different, including production equipment, packaging equipment, logistics conveyor belts, etc. This leads to the multi-source heterogeneity of production quality traceability data. Not only are the data sources different, but the data types and structures collected in each data source are also different.
[0003] In order to achieve transparency, intelligence and efficiency in the food production process, it is necessary to build a food production quality traceability data set based on technologies such as the Internet of Things (IoT) and blockchain. However, due to the large differences in production processes and quality requirements in different industries, existing general solutions may not be able to fully meet the needs of specific industries. In addition, the construction of quality traceability data sets involves multiple departments and links, and cross-departmental collaboration and communication may be difficult, which in turn leads to incomplete data collection, omission of key data, and other issues, ultimately affecting the overall effect. Summary of the invention
[0004] In response to the problems existing in the prior art, the present invention provides a method and system for constructing a production process data set for food quality traceability edge computing.
[0005] The hierarchical classification of multi-source heterogeneous data in the entire production process can lay a good foundation for the subsequent rapid and effective use of data and corresponding processing. The edge device can realize the decentralization of computing power, reduce the bandwidth waste of uploading unstructured data, and optimize the data heterogeneity problem faced during data collection. The dynamic and static data fusion of key data in the production process is realized, and the production process data set is constructed, so as to achieve the richness and accuracy of the content of the product traceability data set.
[0006] The first object of the present invention is to propose a method for constructing a production process data set for food quality traceability edge computing, comprising the following steps: S1: Collect key information in the food production process and upload it to edge devices and the cloud; S2: Classify the key data in the production process in layers according to food production operations, production data structure, production data processing and production data types; S3: Formulate a data processing plan or strategy for the key data classified in step S2, use the computing power of edge devices and the cloud to process the key data according to the processing plan or strategy, and obtain the processed edge-side JSON data set and cloud-side JSON data set; S4: The obtained edge-side JSON dataset and the cloud-side JSON dataset are associated and fused according to the corresponding relationship of the product's identification features to obtain a food traceability production process dataset.
[0007] Furthermore, the step S1 of collecting key information in the food production process and uploading the key information to the edge device and the cloud includes: Step S11, determining key information included in the food production process.
[0008] Step S12: deploy the key information collection devices described in step S11, realize the communication between each collection device and the edge device and the cloud, and upload the collected data.
[0009] Furthermore, the step S2 includes hierarchical classification of key data in the production process according to food production business, production data structure, production data processing and production data type: Step S21, classify the key data in the production process based on the production business stages in the actual production process, the categories include: mixing stage data class, packaging stage data class and warehousing stage data class.
[0010] Step S22: Categorize the key data in the production process based on the data storage structure characteristics, the categories include: structured data class, semi-structured data class and unstructured data class.
[0011] Step S23: Categorize the key data in the production process based on the data processing method, and the classification basis includes: priority, storage rule, processing strategy and linkage rule.
[0012] Key data comes from all stages of food production. The sources and structures of these data vary. If each key data is to be converted into the key-value pair text data type required to build a data set, a suitable data processing method needs to be developed. To meet the above requirements, key data is classified in detail from four perspectives: priority, storage rules, processing strategy, and linkage rules.
[0013] Step S24: Categorize the key data in the production process based on changes in data events, the categories include: static data class and dynamic data class.
[0014] Furthermore, the step S3 formulates a data processing plan or strategy for the key data classified in step S2, and uses the computing power of the edge device and the cloud to process the key data according to the processing plan or strategy, and obtains the processed edge-side JSON data set and the cloud-side JSON data set including: Step S31, select the corresponding data processing algorithm model for key data according to its data type characteristics in the production data structure layer.
[0015] Step S32: Select corresponding data processing solutions for key data in the production data processing layer according to their data types.
[0016] Step S33: Process the key data according to the data algorithm selection of step S31 and the data processing solution of step S32 to obtain an edge-side JSON data set and a cloud-side JSON data set.
[0017] Furthermore, in step S4, the edge-side JSON dataset and the cloud-side JSON dataset are associated and merged according to the corresponding relationship of the product identification features, and the food traceability production process dataset is obtained, including: Step S41: Establish a dynamic and static data fusion model to fuse the data belonging to the dynamic data class with the static objects in the edge-side JSON data set and the cloud-side JSON data set.
[0018] Step S42: Based on the dynamic and static data sets in step S41, the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set are merged with the dynamic and static data sets to obtain a food traceability production process data set.
[0019] The second object of the present invention is to propose a production process data set construction system for food quality traceability edge computing, including: Key information collection and upload module, used to collect key information in the food production process and upload key information to edge devices and the cloud; Key data classification module, used to classify key data in the production process in layers according to food production business, production data structure, production data processing and production data type; The key data processing module is used to formulate a data processing plan or strategy for the classified key data, and use the edge device and the cloud computing power to process the key data according to the processing plan or strategy to obtain the processed edge-side JSON data set and the cloud-side JSON data set; The edge-side dataset and cloud-side dataset fusion module is used to associate and fuse the obtained edge-side JSON dataset and cloud-side JSON dataset according to the corresponding relationship of the product's identification features to obtain a food traceability production process dataset.
[0020] Furthermore, the key data classification module includes: The production business stage data classification submodule is used to classify the key data in the production process based on the production business stages in the actual production process. The categories include: mixing stage data class, packaging stage data class and warehousing stage data class; The data storage structure feature classification submodule is used to classify the key data in the production process based on the data storage structure features. The categories include: structured data class, semi-structured data class and unstructured data class; The data processing method classification submodule is used to classify key data in the production process based on the data processing method. The classification basis includes: priority, storage rules, processing strategy and linkage rules; The data event change classification submodule is used to classify key data in the production process based on data event changes. The categories include: static data class and dynamic data class.
[0021] Furthermore, the edge data set and cloud data set fusion module includes: The dynamic and static data fusion model establishment submodule is used to establish a dynamic and static data fusion model to fuse the data belonging to the dynamic data class with the static objects in the edge-side JSON data set and the cloud-side JSON data set; The dynamic and static data fusion submodule is used to fuse the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set with the dynamic and static data set on the basis of the dynamic and static data set to obtain the food traceability production process data set.
[0022] The advantages of the present invention are: 1. The present invention fully considers the diversity and complexity of data in the food production process, and adopts targeted deep learning models or algorithms for multi-source heterogeneous food production data. Different processing strategies can be adopted according to different data structures, retaining the core features of heterogeneous data and converting them into a unified data format, achieving the fusion and unification of heterogeneous data in the food production process, and laying the foundation for the fusion and use of production data and quality inspection data.
[0023] 2. The present invention integrates and fuses edge data sets and cloud data sets, and can accurately locate the detailed production process data and status of a batch of products, thus realizing accurate traceability of food. At the same time, it realizes the fusion of dynamic data and static data. The fused food quality traceability production process data set can fully reflect the production process of food.
[0024] 3. The hierarchical classification method for key food production data in the present invention has good adaptability. When the type of collected data changes, it only needs to be reclassified and configured according to the classification method to quickly adapt to production. The classification architecture realizes the decoupling of different types of data processing and can well adapt to the current needs of flexible food production.
[0025] To summarize, the present invention solves the problem of inaccurate traceability data caused by the wide span and complex data types of traceability information in the food production process through technical means such as edge computing, deep learning models and image recognition algorithm application, multi-source heterogeneous data fusion, and multi-source heterogeneous data hierarchical classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of the specification of the embodiments of the present invention, illustrate embodiments consistent with the present invention and, together with the description, serve to explain the principles of the present invention.
[0027] Figure 1 It is a flow chart of a method for constructing a food quality traceability edge computing production process data set according to an embodiment of the present invention.
[0028] Figure 2 Schematic diagram of a hierarchical classification method for key data in a food production process in an embodiment.
[0029] Figure 3 It is a flow chart of the key data processing method in the food production process in the embodiment.
[0030] Figure 4 Schematic diagram of the structure of the dynamic and static data fusion model in the embodiment.
[0031] Figure 5 It is a schematic diagram of the method for constructing a dynamic and static data fusion model in an embodiment. DETAILED DESCRIPTION
[0032] The present invention will be further described below in conjunction with specific embodiments.
[0033] Example 1
[0034] Embodiment of a method for constructing a production process data set for edge computing of food quality traceability, Figure 1 The basic processing flow of this embodiment is shown, and the implementation steps are described in detail as follows: Step S1: Collect key information in the food production process and upload the key information to edge devices and the cloud.
[0035] The food production process data processed in this embodiment covers the complete process data from the input of raw materials at the beginning of food production to the storage of food after processing is completed.
[0036] Step S11, determining key information included in the food production process.
[0037] The key information in this embodiment can be determined based on whether the change of the information will have a direct impact on the quality of the food or whether the information is index information required for quality traceability. The various key information mentioned in this embodiment are: (1) Product information of the food and the proportion and quality of its raw materials; (2) Food production work order information and production plan; (3) Raw material batch information on the raw material packaging label; (4) pH information and temperature and humidity information of food during the mixing process during food production; (5) The temperature of the packaging sealing mechanism during food packaging; (6) Flow rate information of a single feeding from the food filling port during food packaging; (7) Speed information of the packaging bag conveying mechanism during food packaging; (8) Weight information of the finished product after food packaging; (9) Label information on the finished food packaging and packaging conditions; (10) Logistics information carried by the QR code on the food packaging; (11) Information on the association between finished food products, packaging boxes, and storage pallets; (12) Food quality inspection report.
[0038] It should be noted that the key information exemplified above is not necessary, and according to the above selection method, key data that meets the selection requirements can also be selected according to different production processes. At the same time, for ease of understanding, all key data mentioned in this embodiment are taken as examples of the above data.
[0039] Step S12: deploy the key information collection devices described in step S11, realize the communication between each collection device and the edge device and the cloud, and upload the collected data.
[0040] In order to collect the various key information described in step S11, it is necessary to deploy data collection equipment on several devices in the food production line, such as: (1) At the food raw material mixing device: An automatic weighing device is deployed at the raw material feeding port, and a pH value detection sensor and a temperature and humidity sensor are deployed in the raw material mixing kettle.
[0041] (2) Food Packaging Equipment Department: A temperature sensor is deployed at the food packaging sealing mechanism, a flow sensor is deployed at the food filling port, and a speed sensor is deployed at the food packaging conveying mechanism.
[0042] (3) At the conveyor belt of finished food products: Deploy weight sensors and speed sensors, and deploy industrial cameras above the conveyor belt.
[0043] (4) Food packaging and palletizing equipment: Deploy code scanning cameras near food packing machines and near food palletizing robots.
[0044] The sensors or weighing devices deployed on each production equipment are connected to the programmable logic controller (PLC) port on each device through cables, and the data is transmitted to the PLC through PLC programming. The PLC of each device is connected to the router through a network cable, and the Internet Protocol address (IP address) and port number of the PLC are configured using the PLC programming software to achieve the connection between the PLC and the router.
[0045] Industrial cameras and barcode scanning devices for image acquisition and QR code recognition should be equipped with GigE (Gigabit Ethernet) interfaces. The cameras should be connected to the router via network cables. The IP configuration tools provided with the cameras and barcode scanners should be used to configure the IP addresses of the devices to enable connectivity between the industrial cameras and barcode scanning devices and the routers.
[0046] It should be noted that the IP addresses configured for the above devices should belong to the same network segment or the connected switches should have the ability to communicate across network segments.
[0047] Furthermore, the router is connected to the edge device and cloud device via network cable or WIFI (wireless communication technology) to ensure that the information collected by each collection device in the production process can be uploaded to the edge and cloud devices.
[0048] Step S2: Figure 2 As shown, the key data in the production process are hierarchically classified according to food production business, production data structure, production data processing and production data type, so as to manage and process different types of data more clearly and ensure that each data category can be fully processed and utilized. Specifically, it includes: Step S21, classify the key data in the production process based on the production business stages in the actual production process, the categories include: mixing stage data class, packaging stage data class and warehousing stage data class.
[0049] In order to accurately locate the actual production business stage to which the key data belongs when conducting food quality traceability, so as to quickly locate and solve production quality problems, the key data needs to be classified according to the food production stage. This classification layer is called the food production business layer. Specific classifications include: (1) Data class in the mixing stage All key data in the food production and processing process, from the start of processing when the food order is received to the stage before the food is mixed and enters the packaging machine, belong to this category, such as: food product information and the ratio and quality of its various production raw materials, food production work order information and its production plan, raw material batch information carried on the raw material packaging label, food pH information and temperature and humidity information during the mixing process during food production, etc.
[0050] (2) Packaging stage data class All key data in the food production and processing stage from the time the food enters the packaging machine to the completion of the food packaging stage belong to this category, such as: the temperature of the packaging sealing mechanism during food packaging, the flow information of a single feed of the food filling port during food packaging, the speed information of the packaging bag conveying mechanism during food packaging, etc.
[0051] (3) Data in the storage stage
[0052] All key data in the food production and processing process from the completion of food packaging to the formal warehousing stage belongs to this category, such as: the weight information of the finished product after the food is packaged, the label information and packaging condition of the finished food packaging, the logistics information carried by the QR code on the food packaging, the association information between the finished food and the packaging box and the storage stacking, the food quality inspection report, etc.
[0053] Step S22: Categorize the key data in the production process based on the data storage structure characteristics, the categories include: structured data class, semi-structured data class and unstructured data class.
[0054] In order to store food quality traceability data in a relational database as a text data set to achieve the purpose of fast query and call of traceability information, it is necessary to convert key data into a key-value pair data type that meets the database storage requirements. To this end, it is necessary to classify key data according to the data storage structure characteristics to facilitate subsequent type conversion of key data. This classification layer is called the production data structure layer. Specific classifications include: (1) Structured data class Generally, all key data collected by the equipment that have the required structure for database storage belong to this category. Data collected by numerical sensors in production all meet the above requirements, such as: pH information and temperature and humidity information of food during the mixing process of food production, temperature of the packaging sealing mechanism during food packaging, flow information of single feeding of food filling port during food packaging, speed information of packaging bag conveying mechanism during food packaging, weight information of finished product after food packaging, etc.
[0055] (2) Semi-structured data Generally, all key data collected by equipment that have certain data structure characteristics but do not fully meet the data storage structure requirements of relational databases belong to this category. This type of data usually exists in XML (Extensible Markup Language) format and other file formats, such as: food product information and the ratio and quality of its various production raw materials, food production work order information and production plan, food quality inspection report, etc.
[0056] (3) Unstructured data Generally, all key data collected by the equipment that do not have a fixed data structure belong to this category. This type of data is usually multimedia data such as pictures and videos, such as: raw material batch information carried on the raw material packaging label, label information and packaging conditions carried on the finished food packaging, logistics information carried by the QR code on the food packaging, and the association information between the finished food and the packaging box and storage pallet.
[0057] Step S23: Categorize the key data in the production process based on the data processing method, and the classification basis includes: priority, storage rule, processing strategy and linkage rule.
[0058] Key data comes from various stages of food production. The sources and structures of these data vary. If each key data is to be converted into the key-value pair text data type required to build a data set, a suitable data processing method needs to be developed. To meet the above requirements, key data is classified in detail from four perspectives: priority, storage rules, processing strategy, and linkage rules. Specifically, it includes: Step S231: Categorize key data into high priority and low priority categories according to the priority of data processing.
[0059] High priority means that the data has a high demand for immediate processing, and if it cannot be processed in time, it will affect the production of food. Correspondingly, data that will not affect food production products even if it is not processed immediately is classified as low priority. Specific categories include: High priority category: such as the pH information and temperature and humidity information of food during the mixing process during food production, the temperature of the packaging sealing mechanism during food packaging, the flow rate information of a single feeding of the food filling port during food packaging, the speed information of the packaging bag conveying mechanism during food packaging, the weight information of the finished product after food packaging is completed, the label information carried on the finished food packaging and the packaging condition of the packaging, etc.
[0060] Low priority category: such as food product information and the ratio and quality of its various production raw materials, food production work order information and production plan, raw material batch information carried on the raw material packaging label, logistics information carried by the QR code on the food packaging, the association information between food finished products and packaging boxes and storage pallets, food quality inspection reports, etc.
[0061] Step S232: Categorize key data into edge storage and cloud storage categories according to the location of data storage.
[0062] Data in edge storage does not require long-term storage of original data. This type of data is stored on edge devices so that it can be processed and converted locally on edge devices close to the data collection side, thereby alleviating the bandwidth occupied by uploading data to the cloud. Correspondingly, cloud storage data requires long-term storage of original files to cope with possible traceability or proofreading in the future. Specific categories include: Edge storage: such as raw material batch information on raw material packaging labels, label information and packaging conditions on finished food packaging, logistics information carried by QR codes on food packaging, etc. Cloud storage: such as food product information and the ratio and quality of its various production raw materials, food production work order information and its production plan, the pH information and temperature and humidity information of food during the mixing process during food production, the temperature of the packaging sealing mechanism during food packaging, the flow rate information of a single feed from the food filling port during food packaging, the speed information of the packaging bag conveying mechanism during food packaging, the weight information of the finished product after food packaging is completed, the association information between the finished food product and the packaging box and storage palletizing, the food quality inspection report, etc.
[0063] Step S233: Divide the key data into edge processing category and cloud processing category according to the data processing plan.
[0064] Data in edge processing has the requirements of low latency and fast response. Such data needs to be processed instantly on edge devices using some lightweight algorithms and get results. Correspondingly, cloud processing data may require complex processing requirements such as complex calculations or big data analysis, and such data usually does not require high timeliness. Specific categories include: Edge processing: such as raw material batch information carried on the raw material packaging label, food pH information and temperature and humidity information during the mixing process during food production, the temperature of the packaging sealing mechanism during food packaging, the flow rate information of a single feeding of the food filling port during food packaging, the speed information of the packaging bag conveying mechanism during food packaging, the weight information of the finished product after food packaging is completed, the label information carried on the finished food packaging and the packaging condition of the packaging, the logistics information carried by the QR code on the food packaging, the association information between the finished food and the packaging box and the warehouse palletizing, etc.
[0065] Cloud processing: such as food product information and the ratio and quality of its various production raw materials, food production work order information and production plan, food quality inspection report, etc.
[0066] Step S24: Categorize the key data in the production process based on changes in data events, the categories include: static data class and dynamic data class.
[0067] Due to the asynchronous source of key data (each key data source updates data according to its own logic and schedule), all key data cannot be fully used when constructing the final data set. In order to solve this problem, it is necessary to ensure that the fusion model is dynamic when the data set is fused, and the sources of some key data are regarded as static objects. The changes of key data over time are regarded as events and associated with objects in chronological order. The above method can realize the logical association of all key information, and then realize the accurate tracking of traceability information.
[0068] Key data that changes frequently during a food production order cycle can be considered as dynamic data. Correspondingly, data that hardly changes during the order cycle is classified as static data. Specific categories include: Dynamic data category: such as food production work order information and its production plan, food pH information and temperature and humidity information during the mixing process during food production, the temperature of the packaging sealing mechanism during food packaging, the flow rate information of a single feed from the food filling port during food packaging, the speed information of the packaging bag conveying mechanism during food packaging, the weight information of the finished product after food packaging is completed, the label information carried on the finished food packaging and the packaging condition of the packaging, etc.
[0069] Static data: such as food product information and the ratio and quality of its raw materials, raw material batch information on raw material packaging labels, food quality inspection reports, information on the association between finished food products and packaging boxes and storage pallets, and logistics information carried by the QR code on food packaging.
[0070] By classifying the data of the entire production process according to production business, data type, data structure and processing in step 2, different types of data can be managed and processed more clearly, ensuring that each data category can be properly processed and utilized in subsequent steps.
[0071] It should be noted that the above classification case is only an embodiment. When actually classifying the key data of food production, classification can be performed based on the classification principles according to the needs.
[0072] Step S3: formulate a data processing plan or strategy for the key data classified in step S2, use the computing power of edge devices and the cloud to process the key data according to the processing plan or strategy, and obtain the processed edge-side JSON data set and cloud-side JSON data set.
[0073] Due to the heterogeneity of key data, it is necessary to process the key data into a data set in a unified format. JSON (JavaScript Object Notation) is designed based on a subset of ECMAScript. It is an open standard file format and data exchange format. It is easy for people to read and write, and it is also easy for machines to parse and generate. Therefore, JSON format is selected as the target format for data processing.
[0074] Edge devices required for critical data processing refer to hardware devices with edge computing capabilities that can process (such as data type conversion, key feature extraction of data, etc.) and analyze (such as fault diagnosis and feedback of processing signals, etc.) collected data at the edge of the data collection network (i.e., close to the data source or user) through some data processing models or algorithms deployed on the device. These devices can directly process or preliminarily process data from sensors or other data generating devices without sending all raw data to centralized cloud servers for processing, thereby reducing data transmission delays, alleviating network bandwidth pressure, and improving data processing efficiency and security. However, such devices have low computing power and can only deploy some lightweight models or algorithms.
[0075] The cloud devices required for key data processing refer to the central servers of the manufacturing enterprise or virtualized cloud servers based on cloud computing technology. These devices are generally far away from the production site, have high computing performance, can perform complex data processing, and can achieve long-term storage of some information.
[0076] Combine the following Figure 3 The processing of key data is further illustrated with examples.
[0077] Step S31, select the corresponding data processing algorithm model for key data according to its data type characteristics in the production data structure layer.
[0078] In order to achieve the conversion of key data formats, it is necessary to select data processing models suitable for different data structures, including: 1) Structured data class Structured data itself is well compatible with the JSON format. Fault diagnosis models such as CSDANet, MobileVit, CLFormer, etc. are used to determine whether the data is in a normal state, and the judgment result is written into the data. After that, only the key data of this type needs to be imported into Python, and the JSON conversion module in the Python standard library can be used to obtain the file data in JSON format.
[0079] 2) Semi-structured data The key data in the semi-structured data class is mostly text data. When processing files with a lot of text content such as logs, named entity recognition (NER) needs to be used to extract key information. Considering that the text content in the production scenario is relatively fixed, the pre-trained NER models in the food production scenario such as ALBERT, DistillBERT, ERNIE-Tiny, etc. can be used to obtain structured data, and the JSON conversion module in the Python standard library can be used to obtain file data in JSON format.
[0080] 3) Unstructured data The key data in the unstructured data category is multimedia data. The processing of this type of data involves defect detection, optical character recognition (OCR), and QR code recognition. Select image processing algorithms and deep learning frameworks to process multimedia data. Specifically: Use target detection models (such as YOLOv4-tiny, SSD MobileNet) to process the packaging of finished food products, such as identifying leaking bags, printing errors, etc. Use the ZBar library to read the logistics information carried by the QR code on the food packaging. After the above algorithm model extracts image features, use the predefined text template to generate JSON text, for example: template = "{'barcode ': '{XXX}', 'status ': '{XXX}', 'time ': '{XXX}'}".
[0081] Step S32: Select corresponding data processing solutions for key data in the production data processing layer according to their data types.
[0082] 1) High priority class Since the key data in this category will directly affect production safety, product quality or system stability and need to be processed and responded to immediately, the key data in this category will take priority in occupying the computing resources of edge devices and cloud devices. For example, the label information and packaging conditions of the finished food packaging need to be processed immediately on the edge device, and the weight information of the finished product after food packaging needs to be verified immediately on the edge device.
[0083] 2) Low priority class This type of data usually does not require data processing or the data processing does not require real-time performance. This type of data can be stored first and processed when computing resources are available. For example, feature extraction of food quality inspection reports, verification of the association information between food products and packaging boxes and storage pallets, etc.
[0084] 3) Edge storage Edge storage refers to storing data on edge nodes close to the data source for quick access and processing. This type of data is mostly real-time data or data that requires low-latency processing, so it is stored in edge devices.
[0085] 4) Cloud storage Cloud storage refers to storing data on a remote cloud platform for long-term preservation and complex data analysis. Since most of this type of data is non-real-time data or historical records, it needs to be stored in a cloud device for long-term preservation and complex data analysis.
[0086] 5) Edge processing This type of data is processed using the computing resources of edge devices to meet the needs of this type of data for fast processing and real-time response.
[0087] 6) Cloud processing This type of data is processed using the computing resources of cloud devices to meet the needs of complex computing for this type of data.
[0088] Step S33: Process the key data according to the data algorithm selection of step S31 and the data processing solution of step S32 to obtain an edge-side JSON data set and a cloud-side JSON data set.
[0089] For ease of understanding, the following are examples of key data processing methods: 1) Structured data processing Since structured data has a key-value pair data structure, it can be uploaded in JSON format when collected and uploaded to edge devices or cloud devices. Taking the mixing device as an example, the key data uploaded by mixing kettle A during a certain period of time is: { "timestamp": "2024-11-24,14:00:00", "equipment_id": "S001", "temperature": 25.0, "humidity": 60.0, "pH_value":6.4 } According to the processing scheme of the above steps, the data will be diagnosed in the edge device with the judgment results, and exported again in JSON format through Python. Specifically: Calling the deployed model in Python # Load the model model_path = 'path_to_model.tflite' interpreter = tf.lite.Interpreter(model_path=model_path) interpreter.allocate_tensors() Enter the data to be processed # Prepare input data input_data = np.array([[ data["temperature"], data["humidity"], data["pH_value"] ]], dtype=np.float32) Run the model and provide the model judgment results # Run inference status = run_inference(preprocessed_data) print(f"Status: {status}") Output # Export data to JSON format json_data = json.dumps(processed_data, indent=4) # Print JSON data print(json_data) # Write JSON data to a file with open('processed_data.json', 'w') as f: f.write(json_data) The data in this case has no outliers. After processing, the final edge-side JSON dataset is as follows: { "timestamp": "2024-11-24,14:00:00", "equipment_id": "S001", "temperature": 25.0, "humidity": 60.0, "pH_value":6.4, "status": "normal" } 2) Semi-structured data processing Semi-structured data is mostly stored in file formats such as XML, TXT, XLS, etc. Take the product quality inspection report of a batch as an example. The report format is XLS format. According to the processing scheme in the above steps, the data will be processed by natural language in the cloud device and key information will be extracted. Finally, it will be exported in JSON format through Python. You can use Python to read the file and complete the final processing. Specifically: Import the report into # Read Excel file file_path = '6972735572975-20240921.xls' df = pd.read_excel(file_path, sheet_name='Sheet1', header=None) Load a pre-trained NER model (such as DistillBERT) and extract key information # Load the pre-trained NER model ner_model = pipeline("ner", model="distilbert-base-cased", tokenizer="distilbert-base-cased") # Define a function to extract key information def extract_key_info(text): # Extract entities using NER model entities = ner_model(text) # Extract key information extracted_info = {} for entity in entities: if entity['entity'].startswith('B-'): key = entity['word'].strip().lower() value = text[entity['start']:entity['end']].strip() extracted_info[key] = value return extracted_info Convert the extracted information into JSON format and export it import json # Convert the extracted information into JSON format json_data = json.dumps(key_info, ensure_ascii=False, indent=4) # Print JSON data print(json_data) # Write JSON data to a file with open('inspection_report.json', 'w', encoding='utf-8') as f: f.write(json_data) The quality inspection report in this case is processed and the resulting cloud-side JSON data set is as follows: { "Inspection Number": "D2024203", "Product Name": "XX Non-iodized Edible Salt", "Production Date / Batch Number": "20240921", "Sample Number": "B2024-321", "Sample quantity": "220g×2 cans", "Representative quantity": "249 boxes", "Product Standard / Inspection Standard": "Q / ZLY 0002SⅡ", "Production Unit": "XXX Salt Products Co., Ltd." "Comprehensive judgment": "This batch of products is qualified" } 3) Unstructured data processing Unstructured data mostly exists in the form of multimedia data. Take a picture of the packaging of a packaged product as an example. The picture format is JPG. According to the processing scheme in the above steps, the data will be processed and judged for defects in the edge device, and finally the judgment results and other information will be generated into JSON text using a predefined text template. You can use Python to read the picture and complete the final processing. Specifically: Loading the defect detection model import cv2 import torch from datetime import datetime # Load the YOLOv4-tiny model model = torch.hub.load('ultralytics / yolov5', 'custom', path='yolov4-tiny.weights') Importing images and processing them # Read the image image_path = 'package_image.jpg' image = cv2.imread(image_path) # Perform target detection results = model(image) # Extract test results detections = results.pandas().xyxy[0] Define template and output # Define template template = { "status": "", "time": "", "defects": [] } # Check for defects if not detections.empty: template["status"] = "Defects Detected" for _, detection in detections.iterrows(): defect = { "class": detection['name'], "confidence": float(detection['confidence']), "bbox": [float(detection['xmin']), float(detection['ymin']), float(detection['xmax']), float(detection['ymax'])] } template["defects"].append(defect) else: template["status"] = "No Defects" # Record the current time template["time"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Convert the template to JSON format json_data = json.dumps(template, ensure_ascii=False, indent=4) # Print JSON data print(json_data) # Write JSON data to a file with open('package_info.json', 'w', encoding='utf-8') as f: f.write(json_data) The packaging image of the product packaging in this case is processed and the resulting edge-side JSON dataset is as follows: { "barcode:"XXX" "status": "Defects Detected", "time": "2024-11-24 15:30:00", "defects": [ { "class": "leak", "confidence": 0.95, "bbox": [100.0, 150.0, 200.0, 250.0] }, { "class": "print_error", "confidence": 0.85, "bbox": [300.0, 400.0, 400.0, 500.0] } ] } The above-mentioned data algorithms and data processing methods are all existing technologies and will not be elaborated here.
[0090] It should be noted that the above data processing model and data processing solution are only an embodiment. When actually processing key data of food production, it can be processed according to the needs based on the above principles.
[0091] Step S4: Associating and merging the obtained edge-side JSON dataset and the cloud-side JSON dataset according to the corresponding relationship between the product identification features to obtain a food traceability production process dataset.
[0092] Taking a package of food that has been processed and put into storage as an example, the product identification feature correspondence refers to a series of data correspondences that can be associated with the label and logistics code on the product packaging through the production work order information and its production plan, such as: which work order does the product belong to, which production line is used to produce the product in the work order, what equipment is on the production line, what sensors are on these equipment, etc. The above feature correspondences can be used to partially construct a food traceability production process data set.
[0093] Step S41: Figure 4 As shown, a dynamic and static data fusion model is established to fuse the data belonging to the dynamic data class in the edge-side JSON dataset and the cloud-side JSON dataset with the static objects.
[0094] The dynamic and static data fusion model consists of static objects and dynamic objects. The dynamic objects are the key data in the dynamic data class, which will change continuously with data collection. Static objects are all physical entities in the production process, such as: product A, food production line No. 1, flow sensor No. 2, food production work order B, etc.
[0095] like Figure 5As shown in the figure, an event-driven architecture (EDA) is used to help build a dynamic and static data fusion model. Apache Kafka (Kafka) is an open source distributed streaming platform. This platform is used as an example to illustrate the construction method of the data fusion model. The static object is defined as a Topic in the Kafka Broker (caching agent, the core component of the Kafka distributed messaging system, which is mainly responsible for the storage and forwarding of messages), and the topic contains the characteristic information UID (user ID). The dynamic object, as a Kafka Producer (message producer), sends data to the topic of its corresponding static object. The data of the dynamic object contains characteristic information associated with user information such as UID (user ID) and Timestamp, so that an information flow related to the topic can be formed within a certain topic. After that, SQL (database) can subscribe to topics related to a certain product through the database subscription plug-in, identify the relevant static information nodes through UID (user ID) and download information from the Kafka Broker in combination with the characteristic information. In the database, these information are stored in tables and associated with each other to obtain a dynamic and static data set that integrates static key data and dynamic key data.
[0096] The dynamic nodes are arranged in order in the topic according to the timestamps recorded when the data is collected every day. For example, the temperature of the packaging sealing mechanism during food packaging is associated with temperature sensor A. Since the temperature is constantly changing, the fused data example is: Temperature sensor A{Time:"2024.11.10.16:05:10",temperature:"120°C";Time:"2024.11.10.16:10:26",temperature:"123°C";……} Based on the above data fusion method, we only need to take a certain product as the target, the time when the product is packaged as the characteristic time, and dynamically select a time range to obtain a dynamic and static association data set related to the product. The dynamic objects in this data set are defined as state 1 to state N in chronological order, which is convenient for locating abnormal information in the traceability information later.
[0097] Step S42: Based on the dynamic and static data sets in step S41, the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set are merged with the dynamic and static data sets to obtain a food traceability production process data set.
[0098] The key information in the static data class only needs to find the corresponding static object in the dynamic and static data fusion model according to the corresponding relationship of the product's identification characteristics and associate it with it, and each static data class can be regarded as a static object in the dynamic and static data fusion model. For example, the quality inspection report of food is associated with a specific product produced in the batch number through the production batch number. Product A Dataset { Product: "Product A" barcode:"XXX", … "Inspection Number": "XXX", "Production Date / Batch Number": "XXX", "Sample Number": "XXX", "Comprehensive judgment": "This batch of products is qualified" … } After the above steps, the food traceability production process dataset can be obtained.
[0099] Example 2
[0100] This embodiment proposes a production process data set construction system embodiment for food quality traceability edge computing, including: Key information collection and upload module, used to collect key information in the food production process and upload key information to edge devices and the cloud; Key data hierarchical classification module, used to hierarchically classify key data in the production process according to food production business, production data structure, production data processing and production data type; The key data processing module is used to formulate a data processing plan or strategy for the classified key data, and use the edge device and the cloud computing power to process the key data according to the processing plan or strategy to obtain the processed edge-side JSON data set and the cloud-side JSON data set; The edge-side dataset and cloud-side dataset fusion module is used to associate and fuse the obtained edge-side JSON dataset and cloud-side JSON dataset according to the corresponding relationship of the product's identification features to obtain a food traceability production process dataset.
[0101] Preferably, the key data classification module includes: The production business stage data classification submodule is used to classify the key data in the production process based on the production business stages in the actual production process. The categories include: mixing stage data class, packaging stage data class and warehousing stage data class; The data storage structure feature classification submodule is used to classify the key data in the production process based on the data storage structure features. The categories include: structured data class, semi-structured data class and unstructured data class; The data processing method classification submodule is used to classify key data in the production process based on the data processing method. The classification basis includes: priority, storage rules, processing strategy and linkage rules; The data event change classification submodule is used to classify key data in the production process based on data event changes. The categories include: static data class and dynamic data class.
[0102] Preferably, the edge data set and cloud data set fusion module includes: The dynamic and static data fusion model establishment submodule is used to establish a dynamic and static data fusion model to fuse the data belonging to the dynamic data class with the static objects in the edge-side JSON data set and the cloud-side JSON data set; The dynamic and static data fusion submodule is used to fuse the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set with the dynamic and static data set on the basis of the dynamic and static data set to obtain the food traceability production process data set.
[0103] The specific implementation method of each module is the same as the steps of the aforementioned production process dataset construction method for food quality traceability edge computing, and will not be repeated here.
[0104] Example 3
[0105] This embodiment provides an electronic device, including: Memory for storing computer programs; The processor is used to execute the program stored in the memory to implement the steps of the aforementioned production process data set construction method embodiment for food quality traceability edge computing.
[0106] For the specific implementation of each step and related explanations, please refer to the aforementioned production process data set construction method for food quality traceability edge computing, which will not be repeated here.
[0107] The memory of the electronic device mentioned in this embodiment may include a random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory.
[0108] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0109] Example 4
[0110] An embodiment of the present invention also proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the aforementioned embodiment of the method for constructing a production process dataset for edge computing of food quality traceability. For the specific implementation of each step of the method and related explanations, please refer to the aforementioned embodiment of the method for constructing a production process dataset for edge computing of food quality traceability, which will not be repeated here.
[0111] It should be noted that the various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0112] In particular, for the device, electronic device, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0113] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A method for constructing a production process data set for edge computing of food quality traceability, characterized in that: The steps include: S1: Collect key information in the food production process and upload it to edge devices and the cloud; S2: Categorize the key data in the production process according to food production operations, production data structure, production data processing and production data types; S3: Formulate a data processing plan or strategy for the key data classified in step S2, and use the computing power of the edge device and the cloud to process the key data according to the processing plan or strategy to obtain a processed edge-side JSON data set and a cloud-side JSON data set; S4: The obtained edge-side JSON dataset and the cloud-side JSON dataset are associated and fused according to the corresponding relationship of the product's identification features to obtain a food traceability production process dataset.
2. The method for constructing a production process data set for food quality traceability edge computing according to claim 1 is characterized in that: The step S1 of collecting key information in the food production process and uploading the key information to the edge device and the cloud includes: Step S11, determining key information included in the food production process; Step S12: deploy the key information collection devices described in step S11, realize the communication between each collection device and the edge device and the cloud, and upload the collected data.
3. The method for constructing a production process data set for food quality traceability edge computing according to claim 1 is characterized in that: The step S2 includes hierarchical classification of key data in the production process according to food production business, production data structure, production data processing and production data type: Step S21, classifying the key data in the production process based on the production business stages in the actual production process, the categories include: mixing stage data class, packaging stage data class and warehousing stage data class; Step S22: Classify the key data in the production process based on the data storage structure characteristics, the categories include: structured data class, semi-structured data class, and unstructured data class; Step S23: Classify the key data in the production process based on the data processing method, and the classification basis includes: priority, storage rule, processing strategy and linkage rule; Step S24: Categorize the key data in the production process based on changes in data events, the categories include: static data class and dynamic data class.
4. The method for constructing a production process data set for food quality traceability edge computing according to claim 1 is characterized in that: In step S3, a data processing scheme or strategy is formulated for the key data classified in step S2, and the key data is processed using the edge device and the computing power of the cloud according to the processing scheme or strategy, and the processed edge-side JSON data set and cloud-side JSON data set are obtained, including: Step S31, selecting a corresponding data processing algorithm model for key data according to its data type characteristics in the production data structure layer; Step S32: Select a corresponding data processing solution for the key data in the production data processing layer according to its data type; Step S33: Process the key data according to the data algorithm selection of step S31 and the data processing solution of step S32 to obtain an edge-side JSON data set and a cloud-side JSON data set.
5. The method for constructing a production process data set for food quality traceability edge computing according to claim 1 is characterized in that: In step S4, the obtained edge-side JSON dataset and the cloud-side JSON dataset are associated and merged according to the corresponding relationship of the product identification features, and the obtained food traceability production process dataset includes: Step S41: Establish a dynamic and static data fusion model to fuse the data belonging to the dynamic data class and the static objects in the edge-side JSON data set and the cloud-side JSON data set; Step S42: Based on the dynamic and static data sets in step S41, the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set are merged with the dynamic and static data sets to obtain a food traceability production process data set.
6. A food quality traceability edge computing production process data set construction system, characterized by include: Key information collection and upload module, used to collect key information in the food production process and upload key information to edge devices and the cloud; Key data classification module, used to classify key data in the production process according to food production business, production data structure, production data processing and production data type; The key data processing module is used to formulate a data processing plan or strategy for the classified key data, and use the computing power of the edge device and the cloud to process the key data according to the processing plan or strategy to obtain the processed edge-side JSON data set and the cloud-side JSON data set; The edge-side dataset and cloud-side dataset fusion module is used to associate and fuse the obtained edge-side JSON dataset and cloud-side JSON dataset according to the corresponding relationship of the product's identification features to obtain a food traceability production process dataset.
7. The food quality traceability edge computing production process data set construction system according to claim 6, characterized in that: The key data classification module includes: The production business stage data classification submodule is used to classify the key data in the production process based on the production business stages in the actual production process. The categories include: mixing stage data class, packaging stage data class and warehousing stage data class; The data storage structure feature classification submodule is used to classify the key data in the production process based on the data storage structure features. The categories include: structured data class, semi-structured data class and unstructured data class; The data processing method classification submodule is used to classify key data in the production process based on the data processing method. The classification basis includes: priority, storage rules, processing strategy and linkage rules; The data event change classification submodule is used to classify key data in the production process based on data event changes. The categories include: static data class and dynamic data class.
8. The food quality traceability edge computing production process data set construction system according to claim 6, characterized in that: The edge data set and cloud data set fusion module includes: The dynamic and static data fusion model establishment submodule is used to establish a dynamic and static data fusion model to fuse the data belonging to the dynamic data class with the static objects in the edge-side JSON data set and the cloud-side JSON data set; The dynamic and static data fusion submodule is used to fuse the data belonging to the static data class in the edge-side JSON data set and the cloud-side JSON data set with the dynamic and static data set on the basis of the dynamic and static data set to obtain the food traceability production process data set.
9. An electronic device, comprising: Memory for storing computer programs; A processor is used to execute a program stored in a memory to implement a production process data set construction method for food quality traceability edge computing according to any one of claims 1 to 5.
10. A computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the aforementioned embodiment of the method for constructing a production process dataset for edge computing of food quality traceability. For the specific implementation of each step of the method and related explanations, please refer to the aforementioned embodiment of the method for constructing a production process dataset for edge computing of food quality traceability, which will not be repeated here.
Citation Information
Patent Citations
Source tracing method for food safety
CN108133380A
Method for tracing commutation failure of ultra-high-voltage direct-current power transmission system under edge-cloud cooperation
CN113791294A
Intelligent Internet of Things information processing platform and edge data processing method thereof
CN113965601A
Wheat quality safety credible traceability method based on chain network connector
CN115310983A
Commodity traceability method, system and device and storage medium
CN116629898A
Cited By
Food safety monitoring system based on big data
CN119941280A