Automatic food detection method, device and equipment
By using Robotic Process Automation (RPA) technology to capture food testing data from multi-source data platforms, and then automatically processing and comparing it, the problem of repetitive labor and high error rate in food testing data review is solved, achieving efficient and accurate data integration and review.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CENT TESTING INT GRP CO LTD
- Filing Date
- 2025-12-26
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies rely on manual information extraction from multiple heterogeneous data platforms during the food testing data review stage, resulting in a large amount of repetitive work, a high error rate, and low process efficiency.
Robotic Process Automation (RPA) technology is used to capture task data from a multi-source data platform, automatically process it to generate structured audit information items, and automatically compare them based on preset food testing business rules to generate audit prompt information.
It has enabled automated collection and integration of cross-platform data, reduced human error, improved the efficiency and accuracy of information extraction, ensured the standardization and comprehensive coverage of the review process, and reduced the error rate and process cycle.
Smart Images

Figure CN121998576A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an automated food detection method, apparatus and equipment. Background Technology
[0002] With the rapid development of artificial intelligence and automation technologies, their applications in natural language understanding, data processing, and process automation are deepening, providing technological possibilities for the intelligent transformation of food testing data review. As a core link in quality control, food testing report review must ensure the accuracy and consistency of multi-dimensional information, including sample information, testing items, method applicability, qualification compliance, result reliability, and judgment correctness. This information comes from various heterogeneous data sources, such as the national sampling platform, sample photos, Laboratory Information Management System (LIMS), protocol forms, and national and product standards, resulting in a high degree of complexity and cross-system integration requirements for the review process.
[0003] Currently, some technologies have been applied to specific stages of data review, such as automated review systems for pre-packaged food labels based on OCR and NLP, LIMS anomaly labeling mechanisms relying on rule engines and statistical models, and research and patents using semantic analysis to assist in verifying report conclusions. However, these existing technologies all focus on specific stages or single data types in the review process and have not yet formed an integrated solution covering the entire chain from sample information entry, test item matching, method qualification verification to result determination. Due to the lack of systematic capture, structured processing, and automated comparison capabilities for multi-source heterogeneous data, existing technologies are unable to cope with the real-world scenarios of food testing and review, where information is scattered, formats are inconsistent, and logical relationships are complex.
[0004] Therefore, current technologies still heavily rely on manual cross-platform and cross-document information verification and comparison during the food testing data review stage. This results in repetitive and arduous manual labor, and is prone to omissions and errors due to fatigue and negligence, leading to a high error rate. Furthermore, errors are often only discovered in the later stages of review or even during report generation, causing rework, delays, and low efficiency. The food testing industry urgently needs a systematic technical solution that can integrate multi-source data and achieve fully automated and intelligent review throughout the entire process.
[0005] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0006] The main purpose of this application is to provide an automated food testing method, apparatus, and equipment, which aims to solve the technical problems of high repetitive workload, high error rate, and low process efficiency caused by relying on manual information extraction between multi-source heterogeneous data platforms during the food testing data review stage.
[0007] To achieve the above objectives, this application proposes an automated food detection method, the method comprising: The multi-source task data of the current pending inspection task is retrieved from the multi-source data platform using Robotic Process Automation (RPA) technology. The multi-source task data includes at least one or more of the following: sample information text, sample images, and inspection plan table. The multi-source task data is processed automatically to generate structured audit information items; Based on preset food testing business rules, the structured audit information items from different information sources are automatically compared; Based on the comparison results, an audit prompt message is generated for the current audit task.
[0008] In one embodiment, the multi-source data platform includes at least a laboratory information management system and a food safety sampling platform. The step of retrieving multi-source task data for the current pending testing task from the multi-source data platform using Robotic Process Automation (RPA) technology includes: Extracting sample information text from the laboratory information management system using RPA technology; and / or; Sample images are captured from the food safety sampling platform using RPA technology; and / or; The RPA technology is used to retrieve the detection plan table and related judgment criteria documents of the current pending detection task from a specified location associated with the task.
[0009] In one embodiment, the step of automating the processing of the multi-source task data to generate structured audit information items includes: Intelligent information extraction is performed on the sample images in the multi-source task data to obtain a first structured information set; The detection scheme table in the multi-source task data is subjected to condition parsing and standardization to obtain a second structured information set; The judgment criteria document is parsed in a targeted manner to obtain a third structured information set; The first, second, and third structured information sets are integrated and aligned to generate unified structured audit information items.
[0010] In one embodiment, the step of intelligently extracting information from sample images in the multi-source task data to obtain a first structured information set includes: The sample image is subjected to orientation correction, grayscale conversion, noise reduction, and contrast enhancement to generate a preprocessed image; The preprocessed image is subjected to at least one of horizontal, vertical, center diffusion, and slider cropping to generate multiple sub-region images; Optical character recognition (OCR) is performed on each sub-region image and the original preprocessed image, and the recognition results are summarized to generate a preliminary text recognition result set. The content with a confidence level lower than a preset threshold and the corresponding image regions in the preliminary text recognition result set are input into the natural language processing model. Named entity recognition technology is used to selectively extract and structure the first structured information set containing key information of the sample.
[0011] In one embodiment, the step of performing condition parsing and standardization on the detection scheme table in the multi-source task data to obtain a second structured information set includes: The cells in the detection scheme table containing production date conditions are parsed, and the conditional statements are converted into associated judgment criterion codes using regular expressions; The test plan table is standardized and cleaned by splitting all merged cells and filling them with content, processing special characters and standardizing field naming, and generating a cleaned test plan table. Based on the cleaned detection scheme table and the judgment criterion code, a second structured information set is generated.
[0012] In one embodiment, the step of performing targeted parsing of the judgment criterion file to obtain a third structured information set includes: Determine the type of the judgment criteria file; If the type is an editable PDF, then the text and table information related to the detection item are located and extracted using the PDF text extraction library in the Python script; If the type is a scanned PDF, the PDF page is converted into an image, and then the intelligent information extraction is used to extract text information related to the detection item. The extracted text and table information are structured, and a mapping table between detection items and standard limit values is established to generate a third structured information set.
[0013] In one embodiment, the step of automatically comparing the structured audit information items from different information sources based on preset food testing business rules includes: Compare the execution standard number in the structured audit information item with the execution standard number in the laboratory information management system; and / or; Compare the production date in the structured audit information item with the production date in the laboratory information management system after format normalization; and / or; The specifications and models in the structured audit information items are compared with the specifications and models in the laboratory information management system and the platform based on their similarity.
[0014] In one embodiment, the step of generating review prompt information for the current review task based on the comparison results includes: Analyze the anomaly type and anomaly level of each abnormal record in the comparison results; The system matches and fills in the anomaly type with a preset natural language prompt template library to generate a preliminary prompt text for each anomaly record. Based on the anomaly level and the preset processing strategy, an operation guide is generated and combined with the corresponding preliminary prompt text to form the review prompt information for the current pending inspection task.
[0015] Furthermore, to achieve the above objectives, this application also proposes an automated food detection device, which includes: The data capture module is used to capture multi-source task data of the current inspection task to be reviewed from the multi-source data platform through Robotic Process Automation (RPA) technology. The multi-source task data includes at least one or more of the following: sample information text, sample image, and inspection plan table. The data processing module is used to automatically process the multi-source task data and generate structured audit information items; The rule comparison module is used to automatically compare the structured audit information items from different information sources based on preset food testing business rules; The prompt generation module is used to generate audit prompt information for the current auditable detection task based on the comparison results.
[0016] In addition, to achieve the above objectives, this application also proposes an automated food testing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the automated food testing method described above.
[0017] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the automated food detection method described above.
[0018] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the automated food detection method described above.
[0019] One or more technical solutions proposed in this application have at least the following technical effects: This application utilizes Robotic Process Automation (RPA) technology to extract multi-source task data for the current pending inspection task from a multi-source data platform. The multi-source task data includes at least one or more of sample information text, sample images, and inspection plan tables. The multi-source task data is then automatically processed to generate structured inspection information items. Based on preset food inspection business rules, the structured inspection information items from different information sources are automatically compared. Based on the comparison results, inspection prompts are generated for the current pending inspection task. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating an embodiment of the automated food detection method of this application. Figure 2 This is a flowchart illustrating Embodiment 2 of the automated food detection method of this application; Figure 3 This is a flowchart illustrating Embodiment 3 of the automated food detection method of this application; Figure 4 This is a flowchart illustrating Embodiment 4 of the automated food detection method of this application; Figure 5 This is a schematic diagram of the module structure of the automated food detection device according to an embodiment of this application; Figure 6 This is a schematic diagram of the equipment structure of the hardware operating environment involved in the automated food detection method in this application embodiment.
[0023] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0024] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0025] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0026] Existing technologies suffer from problems such as high repetitive workload, high error rate, and low process efficiency due to reliance on manual information extraction between multiple heterogeneous data platforms during the food testing data review stage.
[0027] This application provides a solution that uses Robotic Process Automation (RPA) technology to retrieve multi-source task data for a current pending inspection task from a multi-source data platform. The multi-source task data includes at least one or more of sample information text, sample images, and inspection plan tables. The solution automatically processes the multi-source task data to generate structured inspection information items. Based on preset food inspection business rules, the structured inspection information items from different information sources are automatically compared. Based on the comparison results, inspection prompts are generated for the current pending inspection task.
[0028] Based on this, embodiments of this application provide an automated food detection method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the automated food detection method of this application.
[0029] In this embodiment, the automated food detection method includes steps S10 to S40: Step S10: Using Robotic Process Automation (RPA) technology, retrieve multi-source task data for the current pending inspection task from the multi-source data platform. The multi-source task data includes at least one or more of the following: sample information text, sample images, and inspection plan table. It should be noted that the purpose of this application embodiment is to construct an automated data acquisition entry point. RPA technology refers to a process automation technology that uses software robots to simulate human operations on a computer graphical user interface, automatically executing rule-based, repetitive tasks. A multi-source data platform refers to multiple information systems or data storage locations that coexist and are independent of each other in a food testing business scenario, such as the National Food Safety Sampling and Inspection Information System (referred to as the National Sampling Platform), the Laboratory Information Management System (LIMS), and file servers storing various electronic documents (such as protocol tables, standard PDFs), etc. Multi-source task data refers to the set of all data related to a specific testing task to be reviewed, obtained from multiple platforms respectively; sample information text typically refers to sample attributes recorded in structured or unstructured text form, such as sample name, specifications, production date, etc.; sample images refer to digital images of the food packaging to be tested obtained through photography or scanning, which include visual information such as labels and markings; the testing protocol table is an electronic spreadsheet or document that guides specific testing tasks, specifying key information such as the items to be tested, the standards adopted, the judgment criteria, and the limit requirements.
[0030] This embodiment utilizes RPA technology, enabling the system to automatically log into relevant platforms, navigate to designated task interfaces, and accurately retrieve required data items and file links according to preset rules. This transforms the tedious process of manually switching between different software interfaces and copying and pasting, which originally required reviewers, into an automated process with no human intervention. This significantly improves the efficiency and accuracy of data collection, avoids potential omissions or input errors from manual operations, replaces manual intervention, and achieves automatic data collection and integration across systems and platforms.
[0031] In one possible implementation, the RPA robot can be configured to simultaneously retrieve sampling information (including URLs of sample photos) from the national sampling platform, export the list of test items and limits for the current task from the LIMS backend database, and download the corresponding test protocol table file from a specified network path or shared directory.
[0032] Step S20: Automated processing of the multi-source task data to generate structured audit information items; It should be noted that, in this embodiment of the application, automated processing refers to the process where the system calls a series of algorithms and tools to transform, clean, identify, and parse the raw data without human intervention. Structured audit information items refer to data units that extract key audit-related information from the raw data and organize and store it using uniform field names, data types, and formats. For example, a data object containing "Field Name: Production Date", "Value: 2023-10-27", and "Data Type: Date".
[0033] This embodiment employs specific processing strategies for different types of data. The system can transform text in images, logical relationships in complex tables, and key parameters in non-standard text into structured data points, solving the problem of inconsistent formats in multi-source data and the difficulty in directly using unstructured information (such as images and complex tables) for comparison. Specifically, to handle complex scenarios (such as glare, tilt, or dense text in sample images), automated processing may also include image preprocessing (such as straightening, binarization, and region cropping) and combining with more powerful AI models for assisted recognition to improve the accuracy of information extraction.
[0034] Step S30: Based on preset food testing business rules, the structured audit information items from different information sources are automatically compared. It should be noted that, in this embodiment, the preset food testing business rules refer to a series of logical judgment conditions and data consistency criteria predefined in the system based on food testing industry norms, standards, and laboratory quality control requirements. These rules encode the experience and knowledge of the review experts. "Structured review information items from different information sources" refers to structured data from different channels such as the national sampling platform, sample images, LIMS, and protocol tables, all expressing the same review points. Automated comparison refers to the process by which the system automatically invokes the business rules to programmatically check whether these information items from different channels, targeting the same thing, are consistent and conform to logical relationships.
[0035] This embodiment, by executing preset multi-dimensional and multi-level comparison rules, discovers deep-seated issues ranging from simple differences in text input to complex issues such as standard applicability and quantity compliance. It achieves standardization and comprehensive coverage of the review process and ensures the objectivity and reliability of the review conclusions.
[0036] In one possible implementation, the preset business rules include: 1) Information consistency comparison rules, such as verifying whether the "implementation standard" text entered by the national sampling platform completely matches the "implementation standard" information item identified from the sample image; 2) Logical compliance comparison rules, such as judging whether the "judgment standard" information item selected in the LIMS conforms to the date condition rules defined in the scheme table based on the sample's "production date" information item; 3) Numerical compliance comparison rules, such as checking whether the "limit value" information item of a certain additive entered in the LIMS is not stricter than (i.e. not greater than) the smaller of the "limit value" information items specified in the two information sources, the national standard and the product standard (strictest principle).
[0037] Step S40: Based on the comparison results, generate an audit prompt message for the current audit task.
[0038] It should be noted that, in this embodiment of the application, the comparison result refers to the set of conclusions generated by the system after automatically comparing all relevant information items according to business rules. These conclusions are usually marked as "consistent," "inconsistent," or "missing," and are accompanied by specific details of the differences. The audit prompt information refers to the descriptive text or visual signals generated by the system based on the comparison results, which are directed at the audit personnel and clearly point to specific issues and backgrounds. Its purpose is to guide manual review and decision-making.
[0039] This embodiment presents machine-detected anomalies to auditors in a clear, intuitive, and operable manner. This frees auditors from massive amounts of information without anomalies, allowing them to focus their attention on a small number of items that truly pose risks or questions, thereby greatly improving the relevance and efficiency of manual review.
[0040] In traditional food testing information and data review processes, information flows unidirectionally between customer service, testing, first review, and second review stages. Reviewers must actively search and compare information across various fragmented platforms and documents, resulting in lengthy, inefficient, and error-prone processes. This application addresses this by constructing a fully automated closed loop centered on automatic data capture, intelligent processing, structured and rule-based automatic comparison, and visualized result prompts. This transforms the traditional process into a parallel, proactive, and intelligent collaborative system, replacing manual searching and entry across multiple platforms. This fundamentally reduces repetitive and low-skilled labor; eliminates omissions and errors caused by human factors; and ensures that any inconsistencies are detected and clearly located early in the process, guiding personnel to focus on anomaly handling and avoiding rework caused by errors being discovered downstream. This shortens the overall testing cycle and significantly reduces operating costs.
[0041] In one possible implementation, the multi-source data platform includes at least a laboratory information management system and a food safety sampling platform. The step of retrieving multi-source task data for the current pending testing task from the multi-source data platform using Robotic Process Automation (RPA) technology includes: Extracting sample information text from the laboratory information management system using RPA technology; and / or; Sample images are captured from the food safety sampling platform using RPA technology; and / or; The RPA technology is used to retrieve the detection plan table and related judgment criteria documents of the current pending detection task from a specified location associated with the task.
[0042] It should be noted that, in this embodiment, the laboratory information management system refers to the core software platform used to manage testing tasks, samples, methods, results, resources, and the quality system. It stores key sample information text, such as basic sample information, testing items, selected method standards, and entered test results and limits, entered or imported by customer service personnel. The food safety sampling platform specifically refers to official regulatory platforms like the National Food Safety Sampling and Inspection Information System (referred to as the National Sampling Platform), which stores authoritative electronic information of sampling orders and sample images as evidence. The testing plan table is a guidance document (usually in Excel format) prepared by the technical department for a specific sampling task or product type, clarifying the items to be tested, the applicable standards, and the judgment criteria. The relevant judgment standard documents usually refer to PDF documents of national standards (such as GB2760) or product standards related to the task, serving as the original authoritative basis for limit value determination. The purpose of using RPA technology to retrieve data from the platform or designated locations is to break down the barriers between regulatory information flow and internal laboratory information flow, achieving automated and accurate aggregation of key audit data.
[0043] In this embodiment, the automated pre-review system deploys an RPA software robot to simulate the interactive behavior of authorized users, automatically completing a series of actions such as logging into the system, navigating to the target page, locating specific task data, and performing copy or download operations. It defines a technical path that is completely different from traditional manual review: instead of passively browsing and manually recording information between various system interfaces, it actively and programmatically "extracts" structured or semi-structured raw data from the source system. It aims to fundamentally solve the problems of inefficiency and operational errors caused by reviewers having to frequently switch between multiple independent software environments such as LIMS, browsers (accessing the national sampling platform), and file servers, and copy and paste in the traditional process.
[0044] Furthermore, referring to Figure 2 The second embodiment of the automated food detection method of this application provides a flowchart, based on the above. Figure 2 The embodiment shown further refines the step S20, "automatically processing the multi-source task data to generate structured audit information items," including steps A201-A204: Step A201: Perform intelligent information extraction on the sample images in the multi-source task data to obtain a first structured information set; It should be noted that, in this embodiment, intelligent information extraction refers to the process of automatically and accurately locating and reading the text and symbol information contained in a sample image by comprehensively utilizing a series of technologies such as optical character recognition, artificial intelligence image recognition, and natural language processing. The first structured information set refers to the data set extracted from the image and organized in key-value pairs or a similar format. Each data item contains an information category (such as "execution standard") and its corresponding identification value (such as "Q / AHXL 0158S").
[0045] This embodiment first performs necessary preprocessing on the original image to optimize recognition conditions; then, it uses a Python script or basic OCR for rapid recognition; for complex areas or specific structured information where OCR performance is poor, it calls a more powerful AI model for enhanced recognition and semantic understanding; it can systematically extract a complete set of key audit elements from an image, including sample name, execution standard, specifications, production date, ingredient list, manufacturer, etc., to achieve automated and high-precision digital transcription of sample label information, greatly improving the breadth and accuracy of information extraction.
[0046] Step A202: Perform condition parsing and standardization on the detection scheme table in the multi-source task data to obtain the second structured information set; It should be noted that, in this embodiment, condition parsing specifically refers to understanding and decomposing the semantic descriptions in the table that depend on specific conditions (such as production date, product type); standardization refers to eliminating formatting elements in the table that are not conducive to program reading, such as merged cells, special characters, and multi-level headers, and unifying the names and data formats of key fields. The second structured information set refers to the well-organized structured data table or set obtained after the above processing, where each row of data represents a specific testing item and all its related requirements (including possible effective conditions).
[0047] In this embodiment, the system identifies and splits all merged cells to ensure that the content of each cell is independent; it cleans up hidden characters such as line breaks and extra spaces; in particular, for cells containing conditional judgments, it splits them into multiple independent records with explicit conditional fields through regular expressions and semantic analysis; the solution table, due to its original design intention of being "human-readable," suffers from the problem of being "machine-unfriendly," enabling the computer to obtain the review requirements of each inspection item as accurately as querying a database.
[0048] Step A203: Perform targeted parsing on the judgment criterion file to obtain a third structured information set; It should be noted that, in this embodiment, the judgment standard document refers to the national standard, industry standard, or product standard document that serves as the final basis for determining whether the test results are qualified or not, and it is usually in PDF format. Targeted parsing refers to extracting specific information related to the current audit task from the document, rather than full-text conversion. Its extraction targets mainly include key data fields such as food classification, test items, limit values, and units. The third structured information set refers to the structured data set parsed from one or more judgment standard documents, indexed by test items or food classification, representing the authoritative benchmark value for audit comparison.
[0049] The purpose of this embodiment is to establish a standard limit database that can be automatically queried by computers, in order to replace the manual searching of standard texts for limit values.
[0050] In one possible implementation, frequently used standards can be pre-verified manually and structurally stored to form a local standard database; for uncommon or newer versions of standards, real-time parsing is used.
[0051] Step A204: Integrate and align the first structured information set, the second structured information set, and the third structured information set to generate a unified structured audit information item.
[0052] It should be noted that, in this embodiment, data integration and alignment refers to the operation of associating, merging, and unifying the formats of sample information texts, the first structured information set, the second structured information set, and the third structured information set from different sources with different formats and granularities. A unified structured audit information item is an integrated and standardized data model or set, in which each audit element (e.g., "the execution standard of a sample") is associated with its value in different information sources to facilitate consistency comparison.
[0053] This embodiment associates data items that describe the same entity based on common key identifiers (such as test item name, sample ID, food classification code, etc.) or semantic similarity, and reorganizes and formats them according to a predefined, unified data model. This enables the system to quickly obtain the values of the audit points in different dimensions such as platform, photos, plans, and national standards, thereby executing multi-dimensional and cross-comparison rules.
[0054] In one possible implementation, the data alignment process may include string fuzzy matching to handle subtle differences in descriptions of the same item name from different sources, and unit conversion to ensure that numerical comparisons are performed in the same units.
[0055] Furthermore, referring to Figure 3 The third embodiment of the automated food detection method of this application provides a flowchart, based on the above. Figure 3 The illustrated embodiment further refines the step of "intelligently extracting information from sample images in the multi-source task data to obtain a first structured information set," including steps A301 to A304: Step A301: Perform orientation correction, grayscale conversion, noise reduction, and contrast enhancement on the sample image to generate a preprocessed image; It should be noted that in this embodiment, orientation correction refers to automatically detecting and rotating the image to ensure that the main text in the image is in a standard horizontal or vertical reading direction, correcting any tilt or inversion caused by the shooting angle. Grayscale conversion refers to converting a color image into a grayscale image containing only brightness information using Python code. Noise reduction specifically refers to using image filtering algorithms (such as Gaussian blur) to reduce randomly occurring pixels (noise) in the image that interfere with the text features, making the text outlines clearer. Contrast enhancement refers to adjusting the brightness distribution of image pixels to increase the difference in brightness between the foreground (text) and the background, making the text easier for recognition algorithms to distinguish.
[0056] This embodiment constructs an automated image processing pipeline that corrects and enhances the original image using computer vision algorithms. The key technical point lies in the selection and combination of algorithm parameters to adapt to the imaging characteristics of different types of packaging materials, thereby improving the machine readability of the original image and the accuracy of information extraction.
[0057] In one possible implementation, orientation correction can be achieved by analyzing the gradient direction of the image or by calling the orientation detection function of an OCR library such as Pytesseract; noise reduction and contrast enhancement can be accomplished by sequentially applying Gaussian filters and adaptive histogram equalization or binarization (threshold segmentation) algorithms.
[0058] Step A302: Perform at least one of the following sub-region cropping methods on the preprocessed image: horizontal, vertical, center diffusion, and slider cropping, to generate multiple sub-region images; It should be noted that in this embodiment, regional cropping refers to the process of cutting a whole "preprocessed image" into multiple smaller "sub-region images" according to specific geometric rules. Horizontal cropping refers to cutting the image into several long strip-shaped sub-images of equal height along the horizontal direction; vertical cropping refers to cutting the image into several vertical strip-shaped sub-images of equal width along the vertical direction; center diffusion cropping refers to gradually expanding the cropping rectangular area outward from the image center point as the origin, generating a series of sub-images that gradually increase in size from the inside out; slider cropping refers to using a rectangular window of a fixed size to slide across the image at a certain step size, traversing all possible positions for cropping.
[0059] This embodiment addresses the problem that when performing OCR recognition directly on a large image, incomplete content recognition or decreased recognition accuracy may occur due to excessively high image resolution, dense text, or difficulty in recognizing local areas, ensuring that all key text areas can be effectively scanned.
[0060] Step A303: Perform optical character recognition (OCR) on each sub-region image and the original preprocessed image, and summarize the recognition results to generate a preliminary text recognition result set; It should be noted that in this embodiment, OCR refers to the technology of using computer algorithms to detect text regions in an image and convert their pixel information into computer-editable and processable character codes. The preliminary text recognition result set refers to the text pool or list formed by summarizing and deduplicating all recognized text strings after performing OCR recognition on the preprocessed image and all sub-region images respectively.
[0061] This embodiment aggregates the original text data by batch recognizing the preprocessed and cropped image sets. Optionally, to improve efficiency, the system can use a multi-threaded or asynchronous task approach to perform OCR recognition on multiple sub-region images simultaneously.
[0062] Step A304: Input the content with a confidence level lower than a preset threshold and the corresponding image region in the preliminary text recognition result set into the natural language processing model, and use named entity recognition technology to selectively extract and structure the first structured information set containing key information of the sample.
[0063] It should be noted that in this embodiment, confidence level refers to the probability assessment score of the OCR engine on the correctness of each text or text block it recognizes, typically a value between 0 and 1. The preset threshold is a pre-set confidence level threshold used to filter out low-quality recognition results. Natural language processing model refers to a machine learning model that has been trained to understand and process human language, specifically used for understanding and parsing text. Named entity recognition technology refers to automatically identifying entity words belonging to predefined categories (such as names of people, organizations, dates, standard numbers, numerical values, etc.) from unstructured text.
[0064] This embodiment uses an AI model to compensate for the shortcomings of OCR technology in semantic understanding and anti-interference capabilities, achieving a leap from "messy text collections" to "precise structured data". Optionally, connecting to a large model such as Kimi AI can not only process low-confidence text, but also directly extract information end-to-end from complex image regions that are difficult for OCR to handle.
[0065] Furthermore, referring to Figure 4 The fourth embodiment of the automated food detection method of this application provides a flowchart, based on the above. Figure 4 The illustrated embodiment further refines the step of "performing conditional parsing and standardization of the detection scheme table in the multi-source task data to obtain a second structured information set," including steps A401-A403: Step A401: Parse the cells in the detection scheme table that contain the production date condition, and convert the conditional statements into associated judgment criterion codes using regular expressions; It should be noted that in this embodiment, the testing plan table refers to a technical document in spreadsheet (such as Excel) used to guide the sampling and inspection of specific categories of food. Its content typically includes testing items, selectable testing methods, judgment criteria, and corresponding limit requirements. A cell containing a production date condition specifically refers to a cell in the table that contains a natural language statement that makes a conditional judgment based on the time variable of "production date," such as a cell containing "Production date before February 8, 2025: GB 2760-2014; Production date after February 8, 2025: GB 2760-2024." A conditional statement specifically refers to the raw text string in such cells. A regular expression is a tool used to match, find, and replace specific patterns in text, using a formalized syntax to describe the rules governing the composition of strings. The judgment standard code is a unique number representing a specific technical standard referenced in the conditional statement, such as "GB 2760-2014."
[0066] Step A402: Standardize and clean the test plan table by splitting all merged cells and filling them with content, processing special characters and unifying field naming, and generating a cleaned test plan table. It should be noted that in this embodiment, standardized cleaning transforms the messy original table into a neat, clean, and unified data source. Handling special characters refers to identifying, removing, or replacing non-display characters (such as line breaks, carriage returns, and tabs) and redundant spaces in cell text to prevent interference with accurate text matching and comparison. Unified field naming refers to standardizing the column headers (i.e., field names) of the table. For example, different column names expressing the same meaning (such as "test item" and "inspection item") are unified into "test item," or "limit value" and "limit quantity" are unified into "limit quantity value," thereby establishing a stable and consistent data index key. This embodiment, through deep formatting of the original testing plan table, aims to eliminate all data noise and structural defects caused by manual typesetting that hinder accurate machine reading.
[0067] In one possible implementation, the table cleaning is efficiently accomplished using Python's Pandas library. The fillna method of the DataFrame object (in conjunction with forward fill) is used to handle empty values after splitting merged cells. The strip and replace methods of the string object are used to clean up special characters, and a column name renaming mapping dictionary is used to achieve uniform field naming.
[0068] Step A403: Based on the cleaned detection scheme table and the judgment criterion code, generate a second structured information set.
[0069] It should be noted that in this embodiment, based on the cleaned testing scheme table, a judgment standard code is integrated with the dynamic association rules between production date conditions and judgment criteria to output a highly structured and itemized second structured information set. The second structured information set is usually in the form of a JSON array or a database table, where each record fully and clearly defines the review rules for a testing item in a specific context (especially time conditions), including core fields such as testing item, judgment criteria, limit value, and limit unit.
[0070] In one possible implementation, the step of performing targeted parsing of the judgment criterion file to obtain a third structured information set includes: Determine the type of the judgment criteria file; If the type is an editable PDF, then the text and table information related to the detection item are located and extracted using the PDF text extraction library in the Python script; If the type is a scanned PDF, the PDF page is converted into an image, and then the intelligent information extraction is used to extract text information related to the detection item. The extracted text and table information are structured, and a mapping table between detection items and standard limit values is established to generate a third structured information set.
[0071] It should be noted that in this embodiment, the judgment standard document refers to the PDF document that serves as the final basis for determining the pass / fail status of the test results, such as national standards (GB), industry standards, or product standards. The PDF text extraction library specifically refers to third-party libraries such as pdfplumber and PyMuPDF, which are specifically designed for accurately parsing text, tables, and location information from editable PDFs. For different formats of standard PDFs: for text-based (editable) PDFs, libraries such as pdfplumber are used to directly parse the text stream and tables, locate target chapters and tables, and extract structured information; for scanned image PDFs, the pages must first be converted into images, and then OCR+AI technology is used for recognition and extraction. Due to the relatively high authority and seriousness of standard document formats, the key and difficult points of parsing lie in accurately identifying table structures, handling cross-page tables, and understanding complex footnotes.
[0072] Alternatively, in addition to using the base library, heuristic rules can be combined to perform post-processing and logical verification on the extracted tabular data to ensure that the generated mapping relationship is accurate.
[0073] In one possible implementation, the step of automatically comparing the structured audit information items from different information sources based on preset food testing business rules includes: Compare the execution standard number in the structured audit information item with the execution standard number in the laboratory information management system; and / or; Compare the production date in the structured audit information item with the production date in the laboratory information management system after format normalization; and / or; The specifications and models in the structured audit information items are compared with the specifications and models in the laboratory information management system and the platform based on their similarity.
[0074] It should be noted that format normalization refers to converting data from different sources and with potentially different forms of expression into a unified and comparable standard format; similarity matching determines whether two text strings are describing the same thing by calculating the degree of similarity between them (such as edit distance and cosine similarity), rather than requiring complete character-level consistency. This is suitable for scenarios where there may be subtle differences in description, such as "240 grams / bag" and "240 grams".
[0075] Optionally, the dimensions of automated comparison include information matching, classification consistency, completeness of testing items, and compliance with limits. For example, comparing the basic information between the national sampling platform and LLMS; comparing the national sampling platform with sample images to verify the accuracy of the information entered on the platform; comparing the testing protocol table with the four-level food classification of LLMS to avoid omissions of testing items due to classification errors; verifying and comparing the sample quantity and the prepared sample quantity to meet testing needs; verifying the completeness of testing items to ensure that all items specified in the testing protocol table are covered in LLMS; verifying qualifications to ensure that the testing methods selected by LLMS meet the customer requirements of the testing protocol table; and verifying limits to ensure that the limits selected by LLMS comply with strict judgment and that the limit values are entered correctly.
[0076] This embodiment aims to use preset and explicit business rules to programmatically verify the structured values of the same audit element from different information sources in order to discover potential manual input errors or inconsistencies in information sources.
[0077] In one possible implementation, the step of generating audit prompt information for the current auditable detection task based on the comparison results includes: Analyze the anomaly type and anomaly level of each abnormal record in the comparison results; The system matches and fills in the anomaly type with a preset natural language prompt template library to generate a preliminary prompt text for each anomaly record. Based on the anomaly level and the preset processing strategy, an operation guide is generated and combined with the corresponding preliminary prompt text to form the review prompt information for the current pending inspection task.
[0078] It should be noted that in this embodiment, the comparison result refers to a structured report output by the automated comparison module, which contains the inspection conclusions of all executed comparison rules. Each conclusion is typically marked as "consistent" or "inconsistent." For "inconsistent" cases, an exception record is generated. The exception type identifies the specific business rule category violated by the inconsistency, such as "execution standard number mismatch," "production date format difference," "limit value exceeding regulations," or "omission of inspection items," indicating the nature of the problem. The exception level is a classification based on the severity of the exception's impact on the report's accuracy and process, such as "serious error" and "general error." The natural language prompt template library is a predefined, configurable collection of text templates. Each template corresponds to an exception type and contains fixed explanatory text and placeholders for inserting specific difference data (such as {platform value}, {photo value}). The operation guidance is derived from the exception level and provides suggestions or mandatory instructions on how to handle the exception, such as "Please manually check and correct," "The process has been suspended; contact customer service for modification," or "It is recommended to refer to a certain standard for confirmation." The review prompt information refers to a complete and readable feedback content that integrates the problem description (initial prompt text) and processing suggestions (operation guidelines).
[0079] This embodiment standardizes, visualizes, and makes the review feedback process more operational. It not only significantly reduces the mental burden on reviewers to understand the machine output results, but also optimizes the processing efficiency of the workflow through hierarchical guidance, ensuring that critical errors can be intercepted and handled in a timely manner.
[0080] In one possible implementation, the natural language prompt template library can be designed to be scalable, allowing administrators to add new templates based on new problem types encountered in actual business operations; the mapping relationship between anomaly levels and handling strategies can also be flexibly configured in the system backend to adapt to the quality control requirements of different laboratories.
[0081] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the food automation detection method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0082] This application also provides an automated food detection device; please refer to [reference needed]. Figure 5 The automated food testing device includes: The data capture module 10 is used to capture multi-source task data of the current inspection task to be reviewed from the multi-source data platform through robotic process automation (RPA) technology. The multi-source task data includes at least one or more of the following: sample information text, sample image, and inspection plan table. Data processing module 20 is used to automatically process the multi-source task data and generate structured audit information items; The rule comparison module 30 is used to automatically compare the structured audit information items from different information sources based on preset food testing business rules. The prompt generation module 40 is used to generate audit prompt information for the current auditable detection task based on the comparison results.
[0083] The automated food testing device provided in this application, employing the automated food testing method described in the above embodiments, can solve the technical problems of high repetitive workload, high error rate, and low process efficiency caused by relying on manual information extraction between multi-source heterogeneous data platforms during the food testing data review stage. Compared with the prior art, the beneficial effects of the automated food testing device provided in this application are the same as those of the automated food testing method provided in the above embodiments, and other technical features in the automated food testing device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0084] This application provides an automated food testing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the automated food testing method in Embodiment 1 above.
[0085] The following is for reference. Figure 6 The diagram illustrates a structural schematic suitable for implementing the automated food inspection equipment of the embodiments of this application. The automated food inspection equipment in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), vehicle terminals (e.g., vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The automated food inspection equipment shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments in this application.
[0086] like Figure 6As shown, the automated food inspection equipment may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the automated food inspection equipment. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the automated food inspection equipment to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows automated food inspection equipment with various systems, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.
[0087] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0088] The automated food testing equipment provided in this application, employing the automated food testing method described in the above embodiments, solves the technical problems of high repetitive workload, high error rate, and low process efficiency caused by relying on manual information extraction between multi-source heterogeneous data platforms during the food testing data review stage. Compared with the prior art, the beneficial effects of the automated food testing equipment provided in this application are the same as those of the automated food testing method provided in the above embodiments, and other technical features of this automated food testing equipment are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0089] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0090] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0091] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the automated food detection method in the above embodiments.
[0092] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0093] The aforementioned computer-readable storage medium may be included in automated food testing equipment; or it may exist independently and not be assembled into automated food testing equipment.
[0094] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the automated food testing equipment, the automated food testing equipment: uses Robotic Process Automation (RPA) technology to retrieve multi-source task data for the current testing task to be reviewed from a multi-source data platform, wherein the multi-source task data includes at least one or more of sample information text, sample images, and testing plan tables; automatically processes the multi-source task data to generate structured review information items; automatically compares the structured review information items from different information sources based on preset food testing business rules; and generates review prompt information for the current testing task to be reviewed based on the comparison results.
[0095] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0097] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0098] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned automated food testing method. This solves the technical problems of high repetitive workload, high error rate, and low process efficiency caused by relying on manual information extraction between multi-source heterogeneous data platforms during the food testing data review stage. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the automated food testing method provided in the above embodiments, and will not be repeated here.
[0099] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the automated food detection method described above.
[0100] The computer program product provided in this application can solve the technical problems of high repetitive workload, high error rate, and low process efficiency caused by relying on manual information extraction between multi-source heterogeneous data platforms during the food testing data review stage. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the automated food testing method provided in the above embodiments, and will not be repeated here.
[0101] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. An automated food detection method, characterized in that, The automated food detection method includes: The multi-source task data of the current pending inspection task is retrieved from the multi-source data platform using Robotic Process Automation (RPA) technology. The multi-source task data includes at least one or more of the following: sample information text, sample images, and inspection plan table. The multi-source task data is processed automatically to generate structured audit information items; Based on preset food testing business rules, the structured audit information items from different information sources are automatically compared; Based on the comparison results, an audit prompt message is generated for the current audit task.
2. The automated food detection method as described in claim 1, characterized in that, The multi-source data platform includes at least a laboratory information management system and a food safety sampling platform. The process of retrieving multi-source task data for the current pending testing task from the multi-source data platform using Robotic Process Automation (RPA) technology includes: Extracting sample information text from the laboratory information management system using RPA technology; and / or; Sample images are captured from the food safety sampling platform using RPA technology; and / or; The RPA technology is used to retrieve the detection plan table and related judgment criteria documents of the current pending detection task from a specified location associated with the task.
3. The automated food detection method as described in claim 2, characterized in that, The step of automating the processing of the multi-source task data to generate structured audit information items includes: Intelligent information extraction is performed on the sample images in the multi-source task data to obtain a first structured information set; The detection scheme table in the multi-source task data is subjected to condition parsing and standardization to obtain a second structured information set; The judgment criteria document is parsed in a targeted manner to obtain a third structured information set; The first, second, and third structured information sets are integrated and aligned to generate unified structured audit information items.
4. The automated food detection method as described in claim 3, characterized in that, The step of intelligently extracting information from the sample images in the multi-source task data to obtain the first structured information set includes: The sample image is subjected to orientation correction, grayscale conversion, noise reduction, and contrast enhancement to generate a preprocessed image; The preprocessed image is subjected to at least one of horizontal, vertical, center diffusion, and slider cropping to generate multiple sub-region images; Optical character recognition (OCR) is performed on each sub-region image and the original preprocessed image, and the recognition results are summarized to generate a preliminary text recognition result set. The content with a confidence level lower than a preset threshold and the corresponding image regions in the preliminary text recognition result set are input into the natural language processing model. Named entity recognition technology is used to selectively extract and structure the first structured information set containing key information of the sample.
5. The automated food detection method as described in claim 3, characterized in that, The step of performing condition parsing and standardization on the detection scheme table in the multi-source task data to obtain the second structured information set includes: The cells in the detection scheme table containing production date conditions are parsed, and the conditional statements are converted into associated judgment criterion codes using regular expressions; The test plan table is standardized and cleaned by splitting all merged cells and filling them with content, processing special characters and standardizing field naming, and generating a cleaned test plan table. Based on the cleaned detection scheme table and the judgment criterion code, a second structured information set is generated.
6. The automated food detection method as described in claim 3, characterized in that, The step of performing targeted parsing of the judgment criterion document to obtain the third structured information set includes: Determine the type of the judgment criteria file; If the type is an editable PDF, then the text and table information related to the detection item are located and extracted using the PDF text extraction library in the Python script; If the type is a scanned PDF, the PDF page is converted into an image, and then the intelligent information extraction is used to extract text information related to the detection item. The extracted text and table information are structured, and a mapping table between detection items and standard limit values is established to generate a third structured information set.
7. The automated food detection method according to any one of claims 3-6, characterized in that, The step of automatically comparing the structured audit information items from different information sources based on preset food testing business rules includes: Compare the execution standard number in the structured audit information item with the execution standard number in the laboratory information management system; and / or; Compare the production date in the structured audit information item with the production date in the laboratory information management system after format normalization; and / or; The specifications and models in the structured audit information items are compared with the specifications and models in the laboratory information management system and the platform based on their similarity.
8. The automated food detection method as described in claim 7, characterized in that, The step of generating review prompt information for the current review task based on the comparison results includes: Analyze the anomaly type and anomaly level of each abnormal record in the comparison results; The system matches and fills in the error type with a preset natural language prompt template library to generate a preliminary prompt text for each error record. Based on the anomaly level and the preset processing strategy, an operation guide is generated and combined with the corresponding preliminary prompt text to form the review prompt information for the current pending inspection task.
9. An automated food testing device, characterized in that, The automated food testing device includes: The data capture module is used to capture multi-source task data of the current inspection task to be reviewed from the multi-source data platform through Robotic Process Automation (RPA) technology. The multi-source task data includes at least one or more of the following: sample information text, sample image, and inspection plan table. The data processing module is used to automatically process the multi-source task data and generate structured audit information items; The rule comparison module is used to automatically compare the structured audit information items from different information sources based on preset food testing business rules; The prompt generation module is used to generate audit prompt information for the current auditable detection task based on the comparison results.
10. An automated food testing device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the automated food detection method as described in any one of claims 1 to 8.