Food package integrity detection method and system based on convolutional neural network

By applying convolutional neural network and attention mechanism in food packaging integrity detection for feature analysis, and combining Bayesian decision-making theory and deep reinforcement learning algorithm for dynamic risk assessment, the existing detection methods are solved, and efficient and accurate packaging defect detection and production control are achieved.

CN119919352AActive Publication Date: 2025-05-02CSSC HAISHEN MEDICAL TECH CO LTD

Patent Information

Application Number
CN202411872700.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-05-02
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

The existing food packaging integrity detection methods have problems such as low detection accuracy, poor adaptability and slow reaction speed, making it difficult to effectively identify complex or subtle packaging defects.

Method used

A detection method based on convolutional neural network (CNN) and attention mechanism is adopted, combined with Bayesian decision theory and deep reinforcement learning algorithm, multi-level feature analysis and dynamic risk assessment are carried out to generate optimized anomaly detection results and production control schemes.

Benefits of technology

It significantly improves the detection accuracy and recognition ability of food packaging defects, enhances the system's adaptability and response efficiency, and can more accurately identify various types of packaging defects and adjust production control strategies in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919352A_ABST
    Figure CN119919352A_ABST
Patent Text Reader

Abstract

The invention provides a food package integrity detection method and system based on a convolutional neural network. The method comprises the following steps: acquiring food packaging images in real time by high-definition cameras deployed from multiple angles on a production line, and obtaining a food packaging image data set; based on the food package image data set, performing anomaly detection processing on the food package image to generate a preliminary anomaly detection result; according to the preliminary anomaly detection result, a deep reinforcement learning algorithm is used to carry out dynamic risk assessment processing on an abnormal condition, and an anomaly confirmation report is obtained; and feeding back a detection result to a production control system in real time through a cloud service platform by utilizing the abnormity confirmation report, performing self-adaptive adjustment processing on the speed of a production line, the selection of a packaging material or early warning information, and generating an optimized production control scheme. According to the technical scheme provided by the invention, the detection precision of food packaging defects is remarkably improved, and the problem of low detection precision in an existing scheme is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of food packaging integrity detection, and in particular, to a food packaging integrity detection method and system based on convolutional neural network. Background Art

[0002] With the rapid development of the food industry, the requirements for product quality and safety are increasing. As one of the important links in ensuring food safety, the integrity of food packaging directly affects the shelf life, safety and brand image of the product. In the actual production process, due to mechanical failure, material problems or operational errors, food packaging may be damaged or not tightly sealed, which may not only affect the quality of the food, but also lead to serious consequences such as product recalls.

[0003] Existing food packaging integrity inspection methods mainly rely on traditional manual visual inspection or automatic inspection systems based on simple image processing technology. Although these methods can meet basic inspection needs to a certain extent, they have the following limitations: manual visual inspection is time-consuming and laborious and easily affected by subjective factors, making it difficult to ensure the consistency and accuracy of inspection; automatic inspection systems based on traditional image processing technology can usually only identify predefined specific types of defects and have poor adaptability to complex and changing packaging styles.

[0004] Traditional image processing algorithms are limited by their feature extraction capabilities and are unable to effectively identify subtle or complex packaging defects, resulting in low detection accuracy. Existing systems often use fixed rules to make abnormal judgments and cannot adapt well to the impact of changing conditions between different batches of products or within different time periods on the same production line. The time interval between discovering a problem and taking corresponding measures is long, and it is impossible to prevent unqualified products from entering the market in a timely manner. Summary of the invention

[0005] The embodiments of the present application provide a food packaging integrity detection method and system based on a convolutional neural network to solve the problem of low detection accuracy in the prior art.

[0006] In a first aspect, an embodiment of the present application provides a food packaging integrity detection method based on a convolutional neural network, comprising:

[0007] High-definition cameras deployed at multiple angles on the production line collect food packaging images in real time, and use a secure and stable network protocol to transmit the image data to a cloud server to obtain a food packaging image dataset;

[0008] Based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results;

[0009] Based on the preliminary anomaly detection results, the Bayesian decision theory is combined with the historical detection data of food packaging and environmental parameters, and a deep reinforcement learning algorithm is used to perform dynamic risk assessment processing on the abnormal situation to obtain an abnormality confirmation report;

[0010] By using the abnormal confirmation report, the detection results are fed back to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the early warning information are adaptively adjusted to generate an optimized production control plan.

[0011] Optionally, based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results, including:

[0012] Using the food packaging image dataset, multi-level feature extraction is performed on the image data, and local and global features in the image are captured through convolutional layers, pooling layers, and fully connected layers to obtain multi-level feature information;

[0013] Based on the multi-level feature information, the key area information in the image is weighted in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain optimized feature representation;

[0014] According to the optimized feature representation, anomaly detection rules are designed to automatically identify and process abnormal situations in food packaging images to obtain abnormality detection candidate results;

[0015] Using the anomaly detection candidate results, the detection model is tested multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules;

[0016] Based on the optimized anomaly detection rules, a preliminary anomaly detection result is finally generated.

[0017] Optionally, based on the multi-level feature information, the key area information in the image is weighted in combination with an attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain an optimized feature representation, including:

[0018] In calculating the attention weight A iBefore, it is necessary to enhance meaningful features and reduce internal covariate shift by aggregating feature information at different levels and applying normalization techniques to ensure consistency between feature maps;

[0019]

[0020] Among them, A i represents the attention weight of the i-th feature map; F i is the i-th feature map extracted from multi-level feature information; W a and b a are the weight matrix and bias vector in the attention mechanism respectively; N is the total number of feature maps; W c and b c is the weight matrix and bias vector used to enhance the nonlinear transformation of the feature map; α is a hyperparameter used to adjust the impact of the ReLU nonlinear transformation; W e and b e is the weight matrix and bias vector used to introduce the softmax function; γ is a hyperparameter used to adjust the impact of the softmax function; ReLU is an activation function used to introduce nonlinearity; softmax is an activation function used to introduce normalization processing;

[0021] After calculating the attention weight A i After that, it is combined with the original feature map, and through weighted and nonlinear transformation, the background noise is reduced, the target area is highlighted, and the optimized feature representation is generated. i ;

[0022] O i =σ(W o ·(A i +W b ·B i +β·tanh(W d ·(A i -B i )+b d )+δ·sigmoid(W f ·(A i +B i )+b f ))+b o )

[0023] Among them, O i is the optimized i-th feature representation; W o and b o is the weight matrix and bias vector used to generate the optimized feature representation; W b is the weight matrix used to reduce background interference; B i Based on F iThe calculated background feature map is obtained through a specific background extraction algorithm; σ is an activation function used to introduce nonlinearity; W d and b d is the weight matrix and bias vector used to further process the difference between attention weight and background feature map; β is a hyperparameter used to adjust the influence of background feature map difference; W f and b f is the weight matrix and bias vector used to introduce the sigmoid function; δ is a hyperparameter used to adjust the impact of the sigmoid function; tanh is an activation function used to enhance the contrast of the feature map; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing;

[0024] After calculating the optimized feature representation O i Finally, through steps such as feature dimension reduction, selection and fusion, redundant information is removed, the most representative features are retained, and the generalization ability of the model and the efficiency of feature representation are improved.

[0025] Optionally, the designing of anomaly detection rules based on the optimized feature representation, automatically identifying and processing anomalies in food packaging images, and obtaining anomaly detection candidate results includes:

[0026] Based on the optimized feature representation, common abnormal types in food packaging images are analyzed and processed to obtain a key feature set of the abnormal types;

[0027] According to the key feature set of the anomaly type, design detection rules for different anomaly types and generate an anomaly detection rule set;

[0028] Using the anomaly detection rule set, the abnormal conditions in the food packaging image are automatically identified and processed, and by comparing the features in the image with the preset rules, possible abnormal areas are marked to generate anomaly detection marks;

[0029] According to the anomaly detection mark, combined with the probability of anomaly occurrence and confidence assessment, a comprehensive evaluation process is performed on each suspected anomaly area to obtain an anomaly detection candidate result.

[0030] Optionally, the method uses the anomaly detection candidate results to test the detection model multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules, including:

[0031] Using the anomaly detection candidate results, the detection results are compared with the true labels, the detection model is tested multiple times through cross-validation technology, ensuring that each test uses a different data subset as a validation set, and a model performance evaluation report is generated;

[0032] According to the model performance evaluation report, analyze the performance of the model under different conditions and evaluate the accuracy of anomaly detection;

[0033] Based on the accuracy evaluation of the anomaly detection, identify the weaknesses of the model under specific conditions, adjust the anomaly detection rules in a targeted manner, optimize the key characteristic indicators of the anomaly type, and generate optimization suggestions;

[0034] The anomaly detection rules are iteratively optimized using the optimization suggestions to ensure the stability and consistency of the model under different conditions and generate optimized anomaly detection rules.

[0035] Optionally, according to the preliminary abnormality detection result, the abnormal situation is dynamically assessed for risk using a deep reinforcement learning algorithm in combination with the historical detection data of food packaging and environmental parameters through Bayesian decision theory to obtain an abnormality confirmation report, including:

[0036] Based on the preliminary abnormality detection results, combined with historical detection data of food packaging and current environmental parameters, a risk assessment model for abnormal situations is constructed to generate an initial risk assessment framework;

[0037] Using Bayesian decision theory, a probability analysis is performed on the anomaly location, type and confidence level in the preliminary anomaly detection results to quantify the possibility of anomaly occurrence and generate an anomaly probability assessment;

[0038] Based on the anomaly probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact of different processing strategies, dynamically adjust the anomaly processing strategy to reduce the negative impact of the anomaly, and generate a strategy optimization plan;

[0039] The strategy optimization scheme is used to conduct dynamic risk assessment processing on abnormal situations, comprehensively consider the possibility, impact and processing cost factors of the abnormalities, and generate an abnormality confirmation report.

[0040] Optionally, based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, and the abnormal processing strategy is dynamically adjusted to reduce the negative impact caused by the abnormality, and a strategy optimization solution is generated, including:

[0041] In calculating the future return R t Previously, a comprehensive analysis of the anomaly detection results and the current status was required to ensure that the model could fully consider the long-term impact in the future;

[0042]

[0043] Among them, R t represents the sum of future returns starting from time t; r t+kis the immediate reward obtained at time t+k; T is the total length of the time series; γ is a discount factor used to reduce the importance of future rewards; k is a discount factor used to make the model pay more attention to short-term benefits while not overly ignoring long-term benefits; λ is a hyperparameter used to adjust the impact of state value changes; V(s t+k ) is in state s t+k The state value under t ) is in the current state s t The state value under the condition; ReLU is an activation function used to introduce nonlinearity to ensure that the positive value of the state value change has a positive impact on the return; μ is a hyperparameter used to adjust the impact of the state distance; D(s t+k ,s t ) is the state s t+k and status t The distance measure between them; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing to ensure that the positive value of the distance measure has a positive impact on the return;

[0044] After calculating the future return R t After that, update the state-action value function Q(s t , a t ), introduce the heuristic function H(s t , a t ) and the conflict measure C(s t , a t ), generate the optimal action selection probability π θ (a t |s t ) to ensure that the actions chosen maximize returns and avoid potential risks

[0045]

[0046] Among them, π θ (a t |s t ) means in state s t Next select action a t The probability of Q(s t , a t ; θ) is the state-action value function, which means that in state s t Take action a t ; β is a hyperparameter used to adjust the heuristic function H(s t , a t );H(s t , a t) is a heuristic function used to provide additional policy guidance; tanh is an activation function used to introduce nonlinearity and enhance the flexibility of the policy; η is a hyperparameter used to adjust the impact of the conflict measure; C(s t , a t ) is to take action a in state st t The conflict measure is used to evaluate the feasibility and potential risk of the action; ReLU is the activation function used to introduce nonlinearity to ensure that the positive value of the conflict measure has a positive impact on the strategy; τ is the temperature parameter used to control the exploration and utilization balance of the strategy; softmax is the activation function used to convert the state-action value function into a probability distribution;

[0047] After calculating the optimal action selection probability π θ (a t |s t ), selects and executes the optimal action, updates the parameters of the policy network through online or offline learning, regularly evaluates the policy performance and makes dynamic adjustments, and finally generates a solution that can dynamically optimize the exception handling strategy, reduce the negative impact of exceptions, and improve system performance and stability.

[0048] Optionally, the method uses Bayesian decision theory to perform probability analysis on the abnormal location, type and confidence level in the preliminary abnormality detection result, quantify the possibility of abnormality occurrence, and generate an abnormality probability assessment, including:

[0049] Based on the preliminary anomaly detection results, key information such as the anomaly location, type and confidence level are extracted to build a probability model of the anomaly event;

[0050] Using Bayesian decision theory and combining historical food packaging inspection data, the probability of abnormal events is estimated a priori to form a priori probability distribution.

[0051] According to the prior probability distribution, combined with the abnormal location, type and confidence level in the current detection result, the probability of the abnormal event actually occurring under the current detection conditions is calculated to obtain the posterior probability;

[0052] The posterior probability is used to quantify the actual possibility of the abnormal event occurring and generate an abnormal probability assessment.

[0053] Optionally, the abnormal confirmation report is used to feed back the detection results to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the early warning information are adaptively adjusted to generate an optimized production control plan, including:

[0054] The abnormality confirmation report is used to collate and analyze the test results, and the test results are fed back to the production control system in real time through the cloud service platform to obtain production control instructions;

[0055] According to the production control instructions, the production parameters of the production line are evaluated to determine a list of production parameters that need to be adjusted;

[0056] Based on the list of production parameters that need to be adjusted, design and implement an adaptive adjustment strategy, use automated control technology to accurately adjust the production process, and generate an adjusted production state;

[0057] In combination with the adjusted production status, when an abnormal situation is detected, an early warning message is immediately issued to remind the operator to take corresponding measures and generate an optimized production control plan.

[0058] In a second aspect, an embodiment of the present application provides a food packaging integrity detection system based on a convolutional neural network, comprising:

[0059] The transmission module is used to collect food packaging images in real time from high-definition cameras deployed at multiple angles on the production line, and transmit the image data to the cloud server using a secure and stable network protocol to obtain a food packaging image dataset;

[0060] An analysis module is used to perform multi-level feature analysis on key area information in the image based on the food packaging image dataset using a pre-built and deeply optimized convolutional neural network model combined with an attention mechanism algorithm, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results;

[0061] An evaluation module is used to dynamically evaluate the abnormal situation based on the preliminary abnormality detection result by using Bayesian decision theory combined with historical detection data of food packaging and environmental parameters, and using a deep reinforcement learning algorithm to obtain an abnormality confirmation report;

[0062] The adjustment module is used to utilize the abnormal confirmation report to feed back the detection results to the production control system in real time through the cloud service platform, to adaptively adjust the speed of the production line, the selection of packaging materials or the early warning information, and to generate an optimized production control plan.

[0063] In a third aspect, an embodiment of the present application provides a computing device, comprising a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement a food packaging integrity detection method based on a convolutional neural network as described in the first aspect.

[0064] In a fourth aspect, an embodiment of the present application provides a computer storage medium, characterized in that a computer program is stored therein, and when the computer program is executed by a computer, a food packaging integrity detection method based on a convolutional neural network as described in the first aspect is implemented.

[0065] In an embodiment of the present application, high-definition cameras deployed from multiple angles on the production line collect food packaging images in real time, and use a secure and stable network protocol to transmit the image data to a cloud server to obtain a food packaging image data set; based on the food packaging image data set, a pre-built and deeply optimized convolutional neural network model combined with an attention mechanism algorithm is used to perform multi-level feature analysis on key area information in the image, and anomaly detection processing is performed on the food packaging image to generate preliminary anomaly detection results; based on the preliminary anomaly detection results, a deep reinforcement learning algorithm is used to perform dynamic risk assessment processing on abnormal situations through Bayesian decision theory combined with historical detection data and environmental parameters of food packaging to obtain an anomaly confirmation report; using the anomaly confirmation report, the detection results are fed back to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the early warning information are adaptively adjusted to generate an optimized production control plan.

[0066] The technical solution of this application has the following beneficial effects:

[0067] By adopting a food packaging integrity detection method based on a convolutional neural network combined with an attention mechanism, the feature analysis capability and the accuracy of abnormal situation recognition in the detection process can be significantly improved. In particular, in response to the defect of "low detection accuracy" mentioned in the existing solutions, the present invention utilizes the powerful feature expression ability of the deep learning model to more effectively capture subtle differences in the image, thereby improving the recognition rate of various types of packaging defects. In addition, the method also introduces a risk assessment mechanism that combines Bayesian decision theory with deep reinforcement learning, making the entire detection process more intelligent and flexible, and able to dynamically adjust strategies according to actual conditions, further enhancing the practical value and economic benefits of the system.

[0068] Furthermore, the embodiment of the present application provides an anomaly detection method based on a food packaging image dataset, which performs multi-level feature analysis on key area information in the image by combining a pre-built and deeply optimized convolutional neural network model with an attention mechanism algorithm. The method first uses convolutional layers, pooling layers, and fully connected layers to capture local and global features of the image and obtain multi-level feature information; then, the key areas are weighted in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and generate optimized feature representations; then, anomaly detection rules are designed based on the optimized feature representations, abnormal situations are automatically identified, and candidate results for anomaly detection are obtained; finally, the model is tested multiple times through cross-validation technology to evaluate its accuracy, ensure stability and consistency under different conditions, and finally generate preliminary anomaly detection results. Through multi-level feature extraction and attention mechanisms, this method significantly improves the detection accuracy of food packaging defects, effectively solves the problem of low detection accuracy in existing solutions, and enhances the stability and consistency of the model under different conditions.

[0069] Furthermore, the embodiment of the present application provides a dynamic risk assessment method based on the preliminary abnormality detection results, and constructs a risk assessment model by combining the historical detection data of food packaging and the current environmental parameters. The method uses Bayesian decision theory to perform a probability analysis on the abnormal location, type and its confidence, and generates an abnormal probability assessment; then, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, dynamically adjust the abnormal processing strategy to reduce the negative impact, and generate a strategy optimization plan; finally, the possibility, impact and processing cost factors of the abnormality are comprehensively considered to generate an abnormal confirmation report. Through Bayesian decision theory and deep reinforcement learning algorithms, this method realizes the dynamic risk assessment of abnormal situations and the optimization of processing strategies, effectively solves the problems of lack of flexibility and slow response speed in existing solutions, and improves the system's adaptability and response efficiency.

[0070] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0072] Figure 1 A flowchart of a food packaging integrity detection method based on a convolutional neural network provided in an embodiment of the present application;

[0073] Figure 2 A structural schematic diagram of a food packaging integrity detection system based on a convolutional neural network provided in an embodiment of the present application;

[0074] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0076] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to different types.

[0077] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0078] Figure 1 A flowchart of a food packaging integrity detection method based on a convolutional neural network is provided for an embodiment of the present application, such as Figure 1 As shown, the method includes:

[0079] 101. High-definition cameras deployed from multiple angles on the production line collect food packaging images in real time, and use a secure and stable network protocol to transmit the image data to the cloud server to obtain a food packaging image dataset;

[0080] High-definition cameras refer to video equipment that can provide high-resolution images and are used to capture detailed visual information of food packaging. Secure and stable network protocols refer to technical standards that ensure that data is not tampered with or lost during transmission, such as HTTPS and TLS. Cloud servers are computing resources located on the Internet that are used to store and process large amounts of data. The food packaging image dataset is a collection of food packaging images captured by high-definition cameras and transmitted to cloud servers.

[0081] In the embodiment of the present application, multiple high-definition cameras are installed on the production line to capture images of food packaging from different angles in real time. These images are transmitted to the cloud server through a secure and stable network protocol to form a data set containing various food packaging images, providing basic data for subsequent anomaly detection and analysis.

[0082] Assume that a food processing plant has two production lines, and each production line is equipped with four high-definition cameras, located above, below, and on both sides of the production line. These cameras continuously capture images of food packaging at a rate of 10 frames per second. The captured images are uploaded to the Alibaba Cloud server through the factory's internal LAN and encrypted using the HTTPS protocol. The server receives and stores these images, forming a dataset containing thousands of food packaging images for subsequent deep learning model training and anomaly detection.

[0083] 102. Based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results;

[0084] Convolutional Neural Network (CNN) is a deep learning model that is particularly suitable for processing image data and can automatically extract features from images. The attention mechanism algorithm is a technique that enhances the model's attention to specific areas, helping the model to identify key areas more accurately. Multi-level feature analysis means that the model can capture both local details and global structure of the image at the same time.

[0085] In this step, the images in the food packaging image dataset are analyzed using the trained convolutional neural network model combined with the attention mechanism algorithm. The model extracts multi-level features in the image through convolutional layers, pooling layers, and fully connected layers, and highlights potential abnormal areas through the attention mechanism. Finally, the model generates preliminary anomaly detection results, indicating the possible location and type of defects.

[0086] Optionally, in step 102, based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results, including:

[0087] The food packaging image data set is used to perform multi-level feature extraction processing on the image data, and local and global features in the image are captured through convolution layers, pooling layers and fully connected layers to obtain multi-level feature information; based on the multi-level feature information, the key area information in the image is weighted in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain optimized feature representation; according to the optimized feature representation, anomaly detection rules are designed to automatically identify abnormal situations in food packaging images to obtain abnormal detection candidate results; using the abnormal detection candidate results, the detection model is tested multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules; based on the optimized anomaly detection rules, a preliminary anomaly detection result is finally generated.

[0088] The method of designing anomaly detection rules based on the optimized feature representation, automatically identifying and processing anomalies in food packaging images, and obtaining anomaly detection candidate results includes:

[0089] Based on the optimized feature representation, common abnormal types in food packaging images are analyzed and processed to obtain key feature sets of abnormal types; based on the key feature sets of abnormal types, detection rules for different abnormal types are designed to generate an abnormal detection rule set; using the anomaly detection rule set, abnormal situations in food packaging images are automatically identified and processed, and possible abnormal areas are marked by comparing features in the image with preset rules to generate abnormal detection marks; based on the abnormal detection marks, combined with the probability of abnormal occurrence and confidence assessment, each suspected abnormal area is comprehensively evaluated and processed to obtain abnormal detection candidate results.

[0090] The method of using the candidate results of anomaly detection to test the detection model multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules includes:

[0091] Using the anomaly detection candidate results, the detection results are compared with the true labels, and the detection model is tested multiple times through cross-validation technology to ensure that each test uses a different data subset as a validation set, and a model performance evaluation report is generated; based on the model performance evaluation report, the performance of the model under different conditions is analyzed to evaluate the accuracy of anomaly detection; based on the anomaly detection accuracy evaluation, the weaknesses of the model under specific conditions are identified, the anomaly detection rules are adjusted in a targeted manner, the key characteristic indicators of the anomaly type are optimized, and optimization suggestions are generated; using the optimization suggestions, the anomaly detection rules are iteratively optimized to ensure the stability and consistency of the model under different conditions, and the optimized anomaly detection rules are generated.

[0092] In the embodiments of the present application, firstly, a multi-level feature extraction process is performed using a food packaging image dataset, and local and global features in the image are captured through convolutional layers, pooling layers, and fully connected layers; secondly, the key area information in the image is weighted in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain an optimized feature representation; thirdly, based on the optimized feature representation, anomaly detection rules are designed to automatically identify and process abnormal situations in food packaging images to obtain candidate anomaly detection results; finally, the detection model is tested multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules.

[0093] Suppose a food processing plant wants to improve the accuracy of packaging integrity detection on its production line. First, a large number of food packaging images are collected from high-definition cameras installed on the production line and transmitted to the cloud server through a secure and stable network protocol to form a data set containing thousands of images; secondly, a pre-built and deeply optimized convolutional neural network model is used. The model extracts multi-level features of the image through convolutional layers, pooling layers, and fully connected layers, capturing local and global features such as the edges and color changes of the packaging bags; then, combined with the attention mechanism algorithm, weight processing is performed on key areas in the image, such as the seal, to highlight potential abnormal areas, reduce background noise, and obtain optimized feature representations; then, based on these optimized feature representations, common abnormality types are analyzed (such as loose seals, damage, etc.), detection rules for different abnormality types are designed, and an abnormality detection rule set is generated; using this rule The new food packaging images are automatically identified and processed, possible abnormal areas are marked, and the probability of abnormal occurrence and confidence assessment are combined to generate abnormal detection candidate results; finally, the detection model is tested multiple times through cross-validation technology, each time using a different data subset as the validation set, and a model performance evaluation report is generated to analyze the performance of the model under different conditions, identify the weaknesses of the model under specific conditions, adjust the anomaly detection rules in a targeted manner, optimize the key feature indicators of the anomaly type, generate optimization suggestions, and iteratively optimize the anomaly detection rules according to the optimization suggestions to ensure the stability and consistency of the model under different conditions and generate the final preliminary anomaly detection results; through the above steps, food processing plants can detect packaging defects on the production line in real time and efficiently, thereby improving production quality and efficiency.

[0094] This application considers that in the food packaging integrity detection method based on convolutional neural network, in order to improve the attention to the key area information in the image and reduce background interference, an attention mechanism algorithm is introduced. By calculating the attention weight of each feature map, potential abnormal areas can be highlighted, thereby generating an optimized feature representation, further improving the detection accuracy and robustness of the model.

[0095] Optionally, based on the multi-level feature information, the key area information in the image is weighted in combination with an attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain an optimized feature representation, including:

[0096] In calculating the attention weight A i Before, it is necessary to enhance meaningful features and reduce internal covariate shift by aggregating feature information at different levels and applying normalization techniques to ensure consistency between feature maps;

[0097]

[0098] Among them, Ai represents the attention weight of the i-th feature map; F i is the i-th feature map extracted from multi-level feature information; W a and b a are the weight matrix and bias vector in the attention mechanism respectively; N is the total number of feature maps; W c and b c is the weight matrix and bias vector used to enhance the nonlinear transformation of the feature map; α is a hyperparameter used to adjust the impact of the ReLU nonlinear transformation; W e and b e is the weight matrix and bias vector used to introduce the softmax function; γ is a hyperparameter used to adjust the impact of the softmax function; ReLU is an activation function used to introduce nonlinearity; softmax is an activation function used to introduce normalization processing;

[0099] After calculating the attention weight A i After that, it is combined with the original feature map, and through weighted and nonlinear transformation, the background noise is reduced, the target area is highlighted, and the optimized feature representation is generated. i ;

[0100] O i =σ(W o ·(A i +W b ·B i +β·tanh(W d ·(A i -B i )+b d )+δ·sigmoid(W f ·(A i +B i )+b f ))+b o )

[0101] Among them, O i is the optimized i-th feature representation; W o and b o is the weight matrix and bias vector used to generate the optimized feature representation; W b is the weight matrix used to reduce background interference; B i Based on F i The calculated background feature map is obtained through a specific background extraction algorithm; σ is an activation function used to introduce nonlinearity; W d and b d is the weight matrix and bias vector used to further process the difference between attention weight and background feature map; β is a hyperparameter used to adjust the influence of background feature map difference; W f and bf is the weight matrix and bias vector used to introduce the sigmoid function; δ is a hyperparameter used to adjust the impact of the sigmoid function; tanh is an activation function used to enhance the contrast of the feature map; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing;

[0102] After calculating the optimized feature representation O i Finally, through steps such as feature dimension reduction, selection and fusion, redundant information is removed, the most representative features are retained, and the generalization ability of the model and the efficiency of feature representation are improved.

[0103] This formula aims to, when designing an algorithm for food packaging integrity detection, we introduced an attention mechanism to help the model focus more on key areas in the image while reducing the impact of background noise. Through a series of carefully designed steps, including feature extraction, nonlinear transformation, and normalization, we calculate the importance weights of each image part. These weights are then used to emphasize important features and relatively weaken the role of irrelevant background information. This process not only enhances the model's sensitivity to potential problem areas, but also improves the accuracy and reliability of the detection results. In short, such a design aims to improve the performance of the entire detection system by optimizing feature representation.

[0104] The following is a brief introduction to the design reasons of each sub-item of the formula:

[0105]

[0106] Linear transformation part: W a ·F i +b a : Linear transformation for basic extraction of features;

[0107] Nonlinear transformation part: α·ReLU(W c ·F i +b c ): Introducing nonlinearity to enhance feature expression capabilities;

[0108] Normalization processing part: γ softmax(W e ·F i +b e ): Normalization is performed through the softmax function to ensure a reasonable weight distribution;

[0109] The following is a brief introduction to how to obtain the parameters of the formula:

[0110] W a , b a , W c , b c , We , b e are the weight matrix and bias vector learned during the training process; α and γ are hyperparameters, and the optimal values ​​are usually determined by cross-validation and other methods; F i is the i-th feature map extracted from multi-level feature information;

[0111] The following is a brief introduction to the design reasons of each sub-item of the formula:

[0112] O i =σ(W o ·(A i +W b ·B i +β·tanh(W d ·(A i -B i )+b d )+δ·sigmoid(W f ·(A i +B i )+b f ))+b o )

[0113] Background feature map processing part: β·tanh(W d ·(A i -B i )+b d ): The difference between the attention weight and the background feature map is processed by the tanh function to reduce background interference;

[0114] Feature fusion part: δ·σ(W f ·(A i +B i )+b f ): The attention weight and background feature map are fused through the sigmoid function to enhance the feature representation;

[0115] Final activation part: σ(W o ·(...)+b o ): Generate the final optimized feature representation through the activation function σ;

[0116] The following is a brief introduction to how to obtain the parameters of the formula:

[0117] W o , b o , W b , W d , b d , W f , b f They are also learned during the training process; β and δ are hyperparameters and need to be adjusted in a similar way; Bi Based on F i Background feature map obtained by a specific background extraction algorithm;

[0118] Assume a feature map F i =[1,2,3,4],W a =[0.5,0.5,0.5,0.5], b a =0.1,W c =[0.2,0.2,0.2,0.2], b c =0.05,α=1.0,W e =[0.3,0.3,0.3,0.3], b e =0.15,γ=0.5;

[0119] First, calculate the linear transformation part: W a ·F i +b a =0.5×1+0.5×2+0.5×3+0.5×4+0.1=5.1; Nonlinear transformation part: ReLU(W c ·F i +b c )=max(0,0.2×1+0.2×2+0.2×3+0.2×4+0.05)=1.85;

[0120] Normalization processing part: softmax(W e ·F i +b e )=softmax([0.3×1+0.3×2+0.3×3+0.3×4+0.15])=softmax([3.15])=[1.0];

[0121] Attention Weight

[0122] Background feature map B i =[-1,-2,-3,-4],W b =[0.4,0.4,0.4,0.4], W d =[0.1, 0.1, 0.1, 0.1], b d =0.2, β=0.8, W f =[0.15, 0.15, 0.15, 0.15], b f =0.1, δ=0.6;

[0123] Background feature map processing part: tanh(W d ·(A i -B i )+b d)=tanh([0.1×(1-(-1))+0.2])=tanh([0.4])=0.3799;

[0124] Feature fusion part: σ(W j ·(A i +B i )+b f )=σ([0.15×(1+(-1))+0.1])=σ([0.1])=0.5249;

[0125] The final optimized feature representation O i =σ(W o ·(1.0+0.4×(-1)+0.8×0.3799+0.6×0.5249)+b o );

[0126] Assume W o =[0.6,0.6,0.6,0.6], b o =0.3, then O i =σ([0.6×(1.0-0.4+0.304+0.315)+0.3])=σ([0.6×1.219+0.3])=σ([1.0314])=0.736;

[0127] Through the above steps, we get the optimized feature representation O i =0.736, which indicates that after the attention mechanism is processed, the information in the key area is significantly enhanced, while the background noise is effectively suppressed, thereby improving the model's ability to identify abnormal situations. Suppose we set a threshold to distinguish between normal and abnormal situations, for example, the threshold is set to 0.5. i =0.736 is greater than the set threshold of 0.5, which indicates that this area is a potential abnormal area and needs special attention.

[0128] 103. Based on the preliminary abnormality detection results, the Bayesian decision theory is combined with the historical detection data of food packaging and environmental parameters, and a deep reinforcement learning algorithm is used to perform dynamic risk assessment processing on the abnormal situation to obtain an abnormality confirmation report;

[0129] Bayesian decision theory is a statistical method used to make optimal decisions based on prior knowledge and current observation data. Historical detection data includes various abnormal situations recorded in past detections and their processing results. Environmental parameters refer to external factors that affect the detection results, such as temperature, humidity, etc. Deep reinforcement learning algorithm is a machine learning technology that learns the optimal behavior pattern by simulating different strategies.

[0130] In this step, based on the preliminary anomaly detection results, combined with historical detection data and current environmental parameters, the Bayesian decision theory is used to quantify the probability of anomalies. Then, a deep reinforcement learning algorithm is used to simulate the long-term impact of different processing strategies, and the anomaly processing strategy is dynamically adjusted to reduce the negative impact of anomalies. Finally, the possibility, impact and processing cost of the anomaly are comprehensively considered to generate an anomaly confirmation report.

[0131] Optionally, in step 103, according to the preliminary abnormality detection result, a deep reinforcement learning algorithm is used to perform dynamic risk assessment processing on the abnormal situation by combining the historical detection data of the food packaging and the environmental parameters through Bayesian decision theory to obtain an abnormality confirmation report, including:

[0132] According to the preliminary anomaly detection results, combined with the historical detection data of food packaging and the current environmental parameters, a risk assessment model for abnormal situations is constructed to generate an initial risk assessment framework; using Bayesian decision theory, a probability analysis is performed on the abnormal location, type and confidence level in the preliminary anomaly detection results, the possibility of the occurrence of the anomaly is quantified, and an abnormal probability assessment is generated; based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, and the abnormal processing strategy is dynamically adjusted to reduce the negative impact caused by the anomaly, and a strategy optimization plan is generated; using the strategy optimization plan, a dynamic risk assessment is performed on the abnormal situation, and the possibility, impact and processing cost factors of the abnormality are comprehensively considered to generate an abnormality confirmation report.

[0133] The method of using Bayesian decision theory to perform probability analysis on the abnormal location, type and confidence level in the preliminary abnormality detection results, quantify the possibility of abnormality occurrence, and generate an abnormality probability assessment includes:

[0134] Based on the preliminary anomaly detection results, key information such as the anomaly location, type and confidence level are extracted to construct a probability model of abnormal events. The Bayesian decision theory is used in combination with historical detection data of food packaging to make a priori estimates of the probability of occurrence of abnormal events to form a priori probability distribution. According to the prior probability distribution, in combination with the anomaly location, type and confidence level in the current detection results, the probability of the actual occurrence of the abnormal event under the current detection conditions is calculated to obtain a posterior probability. The posterior probability is used to quantify the actual possibility of the occurrence of abnormal events and generate an abnormal probability assessment.

[0135] In the embodiments of the present application, firstly, based on the preliminary anomaly detection results, combined with the historical detection data of food packaging and the current environmental parameters, a risk assessment model for abnormal situations is constructed to generate an initial risk assessment framework; secondly, the Bayesian decision theory is used to perform a probability analysis on the abnormal location, type and confidence level, quantify the possibility of the occurrence of the anomaly, and generate an abnormal probability assessment; thirdly, based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, dynamically adjust the abnormal processing strategy to reduce the negative impact caused by the anomaly, and generate a strategy optimization plan; finally, the strategy optimization plan is used to perform a dynamic risk assessment on the abnormal situation, comprehensively consider the possibility of the abnormality, the degree of impact and the processing cost factors, and generate an abnormal confirmation report.

[0136] Suppose a food processing plant wants to conduct a dynamic risk assessment of packaging anomalies on its production line. First, based on the preliminary abnormal detection results (such as loose seals, damage, etc.), combined with the factory's food packaging historical detection data in the past year (including various abnormal situations and their processing results) and current environmental parameters (such as workshop temperature 25°C, humidity 60%), a risk assessment model is constructed to generate an initial risk assessment framework; secondly, using Bayesian decision theory, the abnormal location (such as the seal), type (such as loose seal) and its confidence level (such as 90%) are extracted to construct a probability model for abnormal events, and the probability of occurrence of abnormal events is estimated a priori in combination with historical detection data to form a priori probability distribution; then, based on the prior probability distribution, combined with the abnormal location, type and confidence level in the current detection results, the probability of the abnormal event actually occurring under the current detection conditions is calculated to obtain the posterior probability; then, The posterior probability is used to quantify the actual possibility of abnormal events and generate an abnormal probability assessment. Secondly, based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact of different processing strategies (such as immediate shutdown for inspection, continued production but enhanced monitoring, etc.), and the abnormal processing strategy is dynamically adjusted to reduce the negative impact of the abnormality and generate a strategy optimization plan. Finally, the strategy optimization plan is used to conduct a dynamic risk assessment of the abnormal situation, comprehensively consider the possibility of the abnormality, the degree of impact and the processing cost factors, and generate an abnormal confirmation report, which lists the abnormal location, type, probability of occurrence and recommended processing strategy in detail. Through the above steps, food processing plants can evaluate the packaging abnormality risks on the production line in real time and accurately, and take the best processing measures to improve production efficiency and product quality.

[0137] This application considers that in the food packaging integrity detection method based on convolutional neural network, a deep reinforcement learning algorithm is used to simulate the long-term impact of different processing strategies and dynamically adjust the abnormal processing strategy to reduce the negative impact of abnormalities. t and the state-action value function Q(st , a t ), combining the heuristic function and the conflict measure to generate the optimal action selection probability π θ (a t |s t ), thereby optimizing the exception handling strategy.

[0138] Optionally, based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, and the abnormal processing strategy is dynamically adjusted to reduce the negative impact caused by the abnormality, and a strategy optimization solution is generated, including:

[0139] In calculating the future return R t Previously, a comprehensive analysis of the anomaly detection results and the current status was required to ensure that the model could fully consider the long-term impact in the future;

[0140]

[0141] Among them, R t represents the sum of future returns starting from time t; r t+k is the immediate reward obtained at time t+k; T is the total length of the time series; γ is a discount factor used to reduce the importance of future rewards; k is a discount factor used to make the model pay more attention to short-term benefits while not overly ignoring long-term benefits; λ is a hyperparameter used to adjust the impact of state value changes; V(s t+k ) is in state s t+k The state value under t ) is in the current state s t The state value under the condition; ReLU is an activation function used to introduce nonlinearity to ensure that the positive value of the state value change has a positive impact on the return; μ is a hyperparameter used to adjust the impact of the state distance; D(s t+k ,s t ) is the state s t+k and status t The distance measure between them; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing to ensure that the positive value of the distance measure has a positive impact on the return;

[0142] After calculating the future return R t After that, update the state-action value function Q(s t , a t ), introduce the heuristic function H(s t , a t ) and the conflict measure C(s t , a t ), generate the optimal action selection probability π θ (at |s t ) to ensure that the actions chosen maximize returns and avoid potential risks

[0143]

[0144] Among them, π θ (a t |s t ) means in state s t Next select action a t The probability of Q(s t , a t ; θ) is the state-action value function, which means that in state s t Take action a t ; β is a hyperparameter used to adjust the heuristic function H(s t , a t );H(s t , a t ) is a heuristic function used to provide additional policy guidance; tanh is an activation function used to introduce nonlinearity and enhance the flexibility of the policy; η is a hyperparameter used to adjust the impact of the conflict measure; C(s t , a t ) is in state s t Take action a t The conflict measure is used to evaluate the feasibility and potential risk of the action; ReLU is the activation function used to introduce nonlinearity to ensure that the positive value of the conflict measure has a positive impact on the strategy; τ is the temperature parameter used to control the exploration and utilization balance of the strategy; softmax is the activation function used to convert the state-action value function into a probability distribution;

[0145] After calculating the optimal action selection probability π θ (a t |s t ), selects and executes the optimal action, updates the parameters of the policy network through online or offline learning, regularly evaluates the policy performance and makes dynamic adjustments, and finally generates a solution that can dynamically optimize the exception handling strategy, reduce the negative impact of exceptions, and improve system performance and stability.

[0146] The formula is designed to dynamically adjust the exception handling strategy through deep reinforcement learning algorithms, taking into account the long-term impact in the future, so as to maximize system performance and reduce the negative impact of exceptions.

[0147] The following is a brief introduction to the design reasons of each sub-item of the formula:

[0148]

[0149] Instant Rewards t+k : represents the immediate reward obtained at time t+k, which is used to evaluate the effect of the current action;

[0150] Discount Factor Section γ k : Used to reduce the importance of future rewards and ensure that recent rewards have a greater impact on decisions;

[0151] State value change part: λ·ReLU(V(s t+k )-V(s t )) : Introducing nonlinearity through the ReLU activation function to ensure that positive changes in state value have a positive impact on the reward;

[0152] State distance measurement part μ·sigmoid(D(s t+k ,s t )):Introducing nonlinear transformation and normalization through sigmoid activation function to ensure that positive values ​​of distance metric have a positive impact on the reward;

[0153] Instant Rewards t+k : represents the immediate reward obtained at time t+k, which is used to evaluate the effect of the current action;

[0154] Discount Factor Section γ k : Used to reduce the importance of future rewards and ensure that recent rewards have a greater impact on decisions;

[0155] The following is a brief introduction to how to obtain the parameters of the formula:

[0156] r t+k is the immediate reward obtained through simulation or actual operation; γ is the discount factor, which is usually set to a value between 0.95 and 0.99; λ and μ are hyperparameters, which are determined by methods such as cross-validation; V(s t+k ) and V(s t ) is the state value function obtained through training; D(s t+k ,s t ) is the distance measure between states, which can use Euclidean distance or other measurement methods;

[0157] The following is a brief introduction to the design reasons of each sub-item of the formula:

[0158]

[0159] State value change part: λ·ReLU(V(s t+k )-V(s t )) : Introducing nonlinearity through the ReLU activation function to ensure that positive changes in state value have a positive impact on the reward;

[0160] State distance metric part μ·σ(D(s t+k ,s t )):Introducing nonlinear transformation and normalization through sigmoid activation function to ensure that positive values ​​of distance metric have a positive impact on the reward;

[0161] State-action value function part: Q(s t , a t ;θ): indicates that in state s t Take action a t The expected return is the basis for strategy optimization;

[0162] Heuristic function part β·tanh(H(s t , a t )): Introducing nonlinearity through the tanh activation function to provide additional strategy guidance;

[0163] Conflict metric part η·ReLU(C(s t , a t )): Introducing nonlinearity through the ReLU activation function to ensure that positive values ​​of the conflict measure have a positive impact on the policy;

[0164] Temperature parameter part τ: used to control the exploration and utilization balance of the strategy, ensuring that the model finds a suitable balance between exploring new strategies and utilizing existing strategies;

[0165] The following is a brief introduction to how to obtain the parameters of the formula:

[0166] θ is the parameter of the policy network, which is learned through the training process; Q(s t , a t ; θ) is the state-action value function obtained through training; β and η are hyperparameters, determined by methods such as cross-validation; H(s t , a t ) is a heuristic function designed based on domain knowledge; C(s t , a t ) is the conflict metric, designed based on domain knowledge; τ is the temperature parameter, usually set to around 1.0;

[0167] Suppose that in food packaging integrity testing, we want to optimize the exception handling strategy on the production line. First, set some parameters:

[0168] γ=0.95, λ=0.1, μ=0.05, β=0.2, η=0.1, τ=1.0

[0169] Calculate future return R t :

[0170] Assume the current state st and future states t+1 ,s t+2 , ..., s t+T The state values ​​are V(s t )=0.5,V(s t+1 )=0.6,V(s t+2 )=0.7,...;Instant reward r t+1 =0.1, r t+2 = 0.2, ...; state distance metric D(s t+1 ,s t )=0.1,D(s t+2 ,s t )=0.2,...

[0171]

[0172] R t =0.95 0 ·(0.1+0.1·ReLU(0.6-0.5)+0.05·σ(0.1))+0.95 1 ·(0.2+0.1·ReLU(0.7-0.5)+0.05·σ(0.2))+...

[0173] R t =0.1+0.01+0.005+0.95·(0.2+0.02+0.01)+...

[0174] R t =0.115+0.95·0.23+...

[0175] R t =0.115+0.2185+...

[0176] R t =0.3335+...

[0177] Assume that the final calculation result is R t =1.0

[0178] Update the state-action value function Q(s t , a t ):

[0179] Assume Q(s t , a t ;θ)=0.8,H(s t , a t )=0.1,C(s t , a t )=0.05

[0180] Q(s t , a t ;θ)+β·tanh(H(s t ,a t ))+η·ReLU(C(s t ,a t ))=0.8+0.2·tanh(0.1)+0.1·ReLU(0.05)

[0181] =0.8+0.2·0.0996+0.1·0.05

[0182] =0.8+0.01992+0.005

[0183] =0.82492

[0184] Calculate the optimal action selection probability π θ (a t |s t ):

[0185]

[0186] Assuming there is only one action, then π θ (a t |s t )=1.0

[0187] By calculation, we get the future return R t = 1.0 and the optimal action selection probability π θ (a t |s t )=1.0. This means that in the current state, the selected action a t is optimal and can maximize the long-term return of the system, and this action will bring significant positive effects in future time series. Therefore, this action can be performed and the parameters of the policy network can be further optimized through online or offline learning to further improve the performance and stability of the system.

[0188] 104. Utilize the abnormal confirmation report to feed back the detection results to the production control system in real time through the cloud service platform, perform adaptive adjustment processing on the speed of the production line, the selection of packaging materials or the early warning information, and generate an optimized production control plan.

[0189] Cloud service platform refers to a platform that provides remote computing and data processing services, which can process and feedback data in real time. Production control system is a system used to monitor and control the operation of production lines, and can adjust production parameters based on feedback information. Adaptive adjustment processing refers to automatically adjusting parameters in the production process based on real-time feedback information to optimize production efficiency and quality.

[0190] In this step, the abnormal confirmation report is used to feed back the test results to the production control system in real time through the cloud service platform. Based on the feedback information, the control system makes adaptive adjustments to the speed of the production line, the selection of packaging materials, or issues early warning information, thereby generating an optimized production control plan to ensure the efficiency of the production process and product quality.

[0191] Optionally, the abnormal confirmation report in step 104 is used to feed back the detection results to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the warning information are adaptively adjusted to generate an optimized production control plan, including:

[0192] The detection results are collated and analyzed using the abnormality confirmation report, and the detection results are fed back to the production control system in real time through the cloud service platform to obtain production control instructions; according to the production control instructions, the production parameters of the production line are evaluated to determine a list of production parameters that need to be adjusted; based on the list of production parameters that need to be adjusted, an adaptive adjustment strategy is designed and implemented, and the production process is accurately adjusted using automated control technology to generate an adjusted production status; combined with the adjusted production status, when an abnormal situation is detected, an early warning message is immediately issued to remind operators to take corresponding measures to generate an optimized production control plan.

[0193] In the embodiments of the present application, first, the detection results are collated and analyzed using the abnormal confirmation report, and these results are fed back to the production control system in real time through the cloud service platform to obtain corresponding production control instructions; secondly, the production parameters of the production line are evaluated according to the production control instructions, and a list of specific parameters that need to be adjusted is determined; thirdly, based on the list of production parameters that need to be adjusted, an adaptive adjustment strategy is designed and implemented, and the production process is accurately adjusted using automated control technology to generate an adjusted production status; finally, in combination with the adjusted production status, when an abnormal situation is detected, an early warning message is immediately issued to remind the operator to take corresponding measures and generate an optimized production control plan.

[0194] Suppose a food processing plant wants to monitor and adaptively adjust packaging anomalies on its production line in real time. First, the detection results are collated and analyzed using abnormal confirmation reports (such as loose seals, damage, etc.), and these results are fed back to the production control system in real time through the Alibaba Cloud service platform to obtain production control instructions (such as reducing the production line speed, changing packaging materials, etc.); secondly, according to the production control instructions, the current production parameters such as the speed of the production line and the selection of packaging materials are evaluated, and a list of specific parameters that need to be adjusted is determined (such as reducing the production line speed from 100 packages per minute to 80 packages per minute and using more durable packaging materials); thirdly, based on the list of production parameters that need to be adjusted, an adaptive adjustment strategy is designed and implemented, and the production process is accurately adjusted using automated control technology to generate an adjusted production status (such as the production line speed has been reduced to 80 packages per minute and new packaging materials have been put into use); finally, combined with the adjusted production status, when an abnormal situation is detected (such as loose seals), an early warning message is immediately issued to remind the operator to take corresponding measures (such as checking whether the sealing equipment is working properly) and generate an optimized production control plan; through the above steps, food processing plants can monitor the status of the production line in real time and dynamically adjust production parameters according to abnormal situations to ensure the efficiency of the production process and product quality.

[0195] Figure 2 A structural schematic diagram of a food packaging integrity detection system based on a convolutional neural network is provided for an embodiment of the present application, such as Figure 2 As shown, the device comprises:

[0196] The transmission module 21 is used to collect food packaging images in real time from high-definition cameras deployed at multiple angles on the production line, and transmit the image data to a cloud server using a secure and stable network protocol to obtain a food packaging image data set;

[0197] An analysis module 22 is used to perform multi-level feature analysis on key area information in the image based on the food packaging image dataset using a pre-built and deeply optimized convolutional neural network model combined with an attention mechanism algorithm, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results;

[0198] An evaluation module 23 is used to perform a dynamic risk evaluation on the abnormal situation using a deep reinforcement learning algorithm based on the preliminary abnormality detection result and combining the historical detection data of food packaging and environmental parameters through Bayesian decision theory to obtain an abnormality confirmation report;

[0199] The adjustment module 24 is used to use the abnormal confirmation report to feed back the detection results to the production control system in real time through the cloud service platform, adaptively adjust the speed of the production line, the selection of packaging materials or the warning information, and generate an optimized production control plan.

[0200] Figure 2 The food packaging integrity detection system based on convolutional neural network can perform Figure 1 The implementation principle and technical effect of the food packaging integrity detection method based on convolutional neural network described in the embodiment are not described in detail. The specific way in which each module and unit performs operations in the food packaging integrity detection system based on convolutional neural network in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.

[0201] In one possible design, Figure 2 A food packaging integrity detection system based on a convolutional neural network in the illustrated embodiment can be implemented as a computing device, such as Figure 3 As shown, the computing device may include a storage component 31 and a processing component 32;

[0202] The storage component 31 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 32 .

[0203] The processing component 32 is used to: collect food packaging images in real time from high-definition cameras deployed at multiple angles on the production line, and transmit the image data to a cloud server using a secure and stable network protocol to obtain a food packaging image data set; based on the food packaging image data set, use a pre-built and deeply optimized convolutional neural network model combined with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results; based on the preliminary anomaly detection results, use a deep reinforcement learning algorithm to perform dynamic risk assessment processing on abnormal situations through Bayesian decision theory combined with historical detection data and environmental parameters of food packaging, and obtain an anomaly confirmation report; use the anomaly confirmation report to feed back the detection results to the production control system in real time through the cloud service platform, perform adaptive adjustment processing on the speed of the production line, the selection of packaging materials or early warning information, and generate an optimized production control plan.

[0204] The processing component 32 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component may also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0205] The storage component 31 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0206] Of course, the computing device may also include other components, such as input / output interfaces, display components, communication components, etc.

[0207] The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc.

[0208] The communication component is configured to facilitate, among other things, wired or wireless communications between the computing device and other devices.

[0209] Among them, the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. In this case, the computing device can refer to a cloud server, and the above-mentioned processing components, storage components, etc. can be basic server resources rented or purchased from the cloud computing platform.

[0210] The present application also provides a computer storage medium storing a computer program, wherein the computer program can achieve the above-mentioned Figure 1 The illustrated embodiment is a method for detecting food packaging integrity based on a convolutional neural network.

[0211] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0212] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0213] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0214] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A food packaging integrity detection method based on convolutional neural network, characterized in that: include: High-definition cameras deployed at multiple angles on the production line collect food packaging images in real time, and use a secure and stable network protocol to transmit the image data to a cloud server to obtain a food packaging image dataset; Based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results; Based on the preliminary anomaly detection results, a deep reinforcement learning algorithm is used to dynamically assess the risk of abnormal situations by combining historical detection data of food packaging and environmental parameters through Bayesian decision theory to obtain an abnormality confirmation report; By using the abnormal confirmation report, the detection results are fed back to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the early warning information are adaptively adjusted to generate an optimized production control plan.

2. The method according to claim 1, characterized in that Based on the food packaging image dataset, a pre-built and deeply optimized convolutional neural network model is used in combination with an attention mechanism algorithm to perform multi-level feature analysis on key area information in the image, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results, including: Using the food packaging image dataset, multi-level feature extraction processing is performed on the image data, and local and global features in the image are captured through convolutional layers, pooling layers, and fully connected layers to obtain multi-level feature information; Based on the multi-level feature information, the key area information in the image is weighted and processed in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain optimized feature representation; According to the optimized feature representation, anomaly detection rules are designed to automatically identify and process abnormal situations in food packaging images to obtain abnormality detection candidate results; Using the anomaly detection candidate results, the detection model is tested multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules; Based on the optimized anomaly detection rules, a preliminary anomaly detection result is finally generated.

3. The method according to claim 2, characterized in that Based on the multi-level feature information, the key area information in the image is weighted in combination with the attention mechanism algorithm to highlight potential abnormal areas, reduce background interference, and obtain optimized feature representation, including: In calculating the attention weight A i Before, it is necessary to enhance meaningful features and reduce internal covariate shift by aggregating feature information at different levels and applying normalization techniques to ensure consistency between feature maps; Among them, A i represents the attention weight of the i-th feature map; F i is the i-th feature map extracted from multi-level feature information; W a and b a are the weight matrix and bias vector in the attention mechanism respectively; N is the total number of feature maps; W c and b c is the weight matrix and bias vector used to enhance the nonlinear transformation of the feature map; α is a hyperparameter used to adjust the impact of the ReLU nonlinear transformation; W e and b e It is the weight matrix and bias vector used to introduce the softmax function; γ is a hyperparameter used to adjust the influence of the softmax function; ReLU is an activation function used to introduce nonlinearity; softmax is an activation function used to introduce normalization processing; After calculating the attention weight A i After that, it is combined with the original feature map, and through weighted and nonlinear transformation, the background noise is reduced, the target area is highlighted, and the optimized feature representation is generated. i ; O i =σ(W o ·(A i +W b ·B i +β·tanh(W d ·(A i -B i )+b d )+δ·sigmoid(W f ·(A i +B i )+b f ))+b o ) Among them, O i is the optimized i-th feature representation; W o and b o is the weight matrix and bias vector used to generate the optimized feature representation; W b is the weight matrix used to reduce background interference; B i Based on F i The calculated background feature map is obtained through a specific background extraction algorithm; σ is an activation function used to introduce nonlinearity; W d and b d is the weight matrix and bias vector used to further process the difference between attention weight and background feature map; β is a hyperparameter used to adjust the influence of background feature map difference; W f and b f is the weight matrix and bias vector used to introduce the sigmoid function; δ is a hyperparameter used to adjust the impact of the sigmoid function; tanh is an activation function used to enhance the contrast of the feature map; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing; After calculating the optimized feature representation O i Finally, through steps such as feature dimension reduction, selection and fusion, redundant information is removed, the most representative features are retained, and the generalization ability of the model and the efficiency of feature representation are improved.

4. The method according to claim 2, characterized in that: The method of designing anomaly detection rules based on the optimized feature representation, automatically identifying and processing anomalies in food packaging images, and obtaining anomaly detection candidate results includes: Based on the optimized feature representation, common abnormal types in food packaging images are analyzed and processed to obtain a key feature set of the abnormal types; According to the key feature set of the anomaly type, design detection rules for different anomaly types and generate an anomaly detection rule set; Using the anomaly detection rule set, the abnormal conditions in the food packaging image are automatically identified and processed, and by comparing the features in the image with the preset rules, possible abnormal areas are marked to generate anomaly detection marks; According to the anomaly detection mark, combined with the probability of anomaly occurrence and confidence assessment, a comprehensive evaluation process is performed on each suspected anomaly area to obtain an anomaly detection candidate result.

5. The method according to claim 2, characterized in that: The method uses the anomaly detection candidate results to test the detection model multiple times through cross-validation technology to evaluate the accuracy of anomaly detection, ensure the stability and consistency of the model under different conditions, and generate optimized anomaly detection rules, including: Using the anomaly detection candidate results, the detection results are compared with the true labels, the detection model is tested multiple times through cross-validation technology, ensuring that each test uses a different data subset as a validation set, and a model performance evaluation report is generated; According to the model performance evaluation report, analyze the performance of the model under different conditions and evaluate the accuracy of anomaly detection; Based on the accuracy evaluation of the anomaly detection, identify the weaknesses of the model under specific conditions, adjust the anomaly detection rules in a targeted manner, optimize the key characteristic indicators of the anomaly type, and generate optimization suggestions; The anomaly detection rules are iteratively optimized using the optimization suggestions to ensure the stability and consistency of the model under different conditions and generate optimized anomaly detection rules.

6. The method according to claim 1, characterized in that According to the preliminary abnormality detection results, the Bayesian decision theory is combined with the historical detection data of food packaging and environmental parameters, and a deep reinforcement learning algorithm is used to perform dynamic risk assessment on the abnormal situation to obtain an abnormality confirmation report, including: Based on the preliminary abnormality detection results, combined with historical detection data of food packaging and current environmental parameters, a risk assessment model for abnormal situations is constructed to generate an initial risk assessment framework; Using Bayesian decision theory, a probability analysis is performed on the anomaly location, type and confidence level in the preliminary anomaly detection results to quantify the possibility of anomaly occurrence and generate an anomaly probability assessment; Based on the anomaly probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact of different processing strategies, dynamically adjust the anomaly processing strategy to reduce the negative impact of the anomaly, and generate a strategy optimization plan; The strategy optimization scheme is used to conduct dynamic risk assessment processing on abnormal situations, comprehensively consider the possibility, impact and processing cost factors of the abnormalities, and generate an abnormality confirmation report.

7. The method according to claim 6, characterized in that Based on the abnormal probability assessment, a deep reinforcement learning algorithm is used to simulate the long-term impact under different processing strategies, dynamically adjust the abnormal processing strategy to reduce the negative impact caused by the abnormality, and generate a strategy optimization plan, including: In calculating the future return R t Previously, a comprehensive analysis of the anomaly detection results and the current status was required to ensure that the model could fully consider the long-term impact in the future; Among them, R t represents the sum of future returns starting from time t; r t+k is the immediate reward obtained at time t+k; T is the total length of the time series; γ is a discount factor used to reduce the importance of future rewards; γk 是 The discount factor is used to make the model pay more attention to short-term benefits while not overly ignoring long-term benefits; λ is a hyperparameter used to adjust the impact of state value changes; V(s t+k ) is in state s t+k The state value under t ) is in the current state s t The state value under the condition; ReLU is an activation function used to introduce nonlinearity to ensure that the positive value of the state value change has a positive impact on the return; μ is a hyperparameter used to adjust the impact of the state distance; D(s t+k ,s t ) is the state s t+k and status t The distance measure between them; sigmoid is an activation function used to introduce nonlinear transformation and normalization processing to ensure that the positive value of the distance measure has a positive impact on the return; After calculating the future return R t After that, update the state-action value function Q(s t , a t ), introduce the heuristic function H(s t , a t ) and the conflict measure C(s t , a t ), generate the optimal action selection probability π θ (at|s t ) to ensure that the actions chosen maximize returns and avoid potential risks Among them, π θ (a t |s t ) means in state s t Next select action a t The probability of Q(s t , a t ; θ) is the state-action value function, which means that in state s t Take action a t The expected return; β is a hyperparameter used to adjust the heuristic function H(s t , a t ) influence; H(s t , a t ) is a heuristic function used to provide additional policy guidance; tanh is an activation function used to introduce nonlinearity and enhance the flexibility of the policy; η is a hyperparameter used to adjust the impact of the conflict measure; C(s t , a t ) is in state s t Take action a t The conflict measure is used to evaluate the feasibility and potential risk of the action; ReLU is the activation function used to introduce nonlinearity to ensure that the positive value of the conflict measure has a positive impact on the strategy; τ is the temperature parameter used to control the exploration and utilization balance of the strategy; softmax is the activation function used to convert the state-action value function into a probability distribution; After calculating the optimal action selection probability π θ (a t ∣s t ), selects and executes the optimal action, updates the parameters of the policy network through online or offline learning, regularly evaluates the policy performance and makes dynamic adjustments, and finally generates a solution that can dynamically optimize the exception handling strategy, reduce the negative impact of exceptions, and improve system performance and stability.

8. The method according to claim 6, characterized in that The Bayesian decision theory is used to perform probability analysis on the abnormal location, type and confidence level in the preliminary abnormality detection results, quantify the possibility of abnormality occurrence, and generate an abnormality probability assessment, including: Based on the preliminary anomaly detection results, key information such as the anomaly location, type and confidence level are extracted to build a probability model of the anomaly event; Using Bayesian decision theory and combining historical food packaging inspection data, the probability of abnormal events is estimated a priori to form a priori probability distribution. According to the prior probability distribution, combined with the abnormal location, type and confidence level in the current detection result, the probability of the abnormal event actually occurring under the current detection conditions is calculated to obtain the posterior probability; The posterior probability is used to quantify the actual possibility of the abnormal event occurring and generate an abnormal probability assessment.

9. The method according to claim 1, characterized in that: The abnormal confirmation report is used to feed back the detection results to the production control system in real time through the cloud service platform, and the speed of the production line, the selection of packaging materials or the early warning information are adaptively adjusted to generate an optimized production control plan, including: The abnormality confirmation report is used to collate and analyze the test results, and the test results are fed back to the production control system in real time through the cloud service platform to obtain production control instructions; According to the production control instructions, the production parameters of the production line are evaluated to determine a list of production parameters that need to be adjusted; Based on the list of production parameters that need to be adjusted, design and implement an adaptive adjustment strategy, use automated control technology to accurately adjust the production process, and generate an adjusted production state; In combination with the adjusted production status, when an abnormal situation is detected, an early warning message is immediately issued to remind the operator to take corresponding measures and generate an optimized production control plan.

10. A food packaging integrity detection system based on convolutional neural network, characterized in that: include: The transmission module is used to collect food packaging images in real time from high-definition cameras deployed at multiple angles on the production line, and transmit the image data to the cloud server using a secure and stable network protocol to obtain a food packaging image dataset; An analysis module is used to perform multi-level feature analysis on key area information in the image based on the food packaging image dataset using a pre-built and deeply optimized convolutional neural network model combined with an attention mechanism algorithm, perform anomaly detection processing on the food packaging image, and generate preliminary anomaly detection results; An evaluation module is used to dynamically evaluate the abnormal situation based on the preliminary abnormality detection result by using Bayesian decision theory combined with historical detection data of food packaging and environmental parameters, and using a deep reinforcement learning algorithm to obtain an abnormality confirmation report; The adjustment module is used to utilize the abnormal confirmation report to feed back the detection results to the production control system in real time through the cloud service platform, to adaptively adjust the speed of the production line, the selection of packaging materials or the early warning information, and to generate an optimized production control plan.

Citation Information

Patent Citations

  • SAR (Synthetic Aperture Radar) image target detection method based on full-space coding attention module

    CN115147731A

  • X-ray security check image dangerous goods detection method based on attention mechanism

    CN115393796A

  • Infrared small target detection method based on multi-mechanism attention collaborative fusion comparison

    CN115546610A

  • Hair restorer production process management method and system

    CN117391641A

  • Quality evaluation classification method and system based on convolutional neural network

    CN117726240A

Cited By

  • Cable production data management method and system based on Internet of Things

    CN120782337A

  • Packaging material production quality intelligent monitoring method based on industrial internet of things

    CN120931047A