Intelligent visual inspection and closed-loop control system for beverage cup
By employing bimodal feature acquisition and Bayesian belief propagation calculation in the visual inspection system for beverage cups, the problem of differentiated imaging requirements was solved, enabling the complete preservation of defect information and accurate location of root causes, thereby improving the reliability of the inspection system and the adaptability to the production process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG YASTAI PACKAGING NEW MATERIALS CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-05
AI Technical Summary
Existing visual inspection systems for beverage cups struggle to simultaneously address the imaging needs of both highly reflective and low-contrast areas. This results in the loss of image information for some defect types, affecting the reliability of the detection algorithm and hindering the automatic inference of the root cause of defects, leading to production interruptions and delayed feedback.
A dual-modal feature acquisition module is used to acquire images at the same physical moment with short and long exposure parameters, extract feature vectors of high-frequency edge information and low-frequency region information, and generate defect feature data packets through hash encoding. The root cause is then identified by using the process causality matrix and Bayesian belief propagation calculation, and closed-loop control commands are generated.
It achieves compatibility with different imaging conditions, ensures complete preservation of defect information, simplifies the fault diagnosis process, improves the accuracy of diagnostic results and adaptability to the production process, and reduces the risk of production interruption.
Smart Images

Figure CN121978107A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of industrial control systems, and relates to an intelligent visual inspection and closed-loop control system for beverage cups. Background Technology
[0002] In the automated production of pre-packaged foods such as beverage cups, quality inspection is a crucial step in ensuring product safety and consistency. Current production lines typically deploy machine vision-based online inspection systems that use industrial cameras to capture product images and algorithms to identify defects such as seal wrinkles or abnormal liquid levels. This automated inspection method, to some extent, replaces manual visual inspection and meets the demands of high-speed production.
[0003] Existing visual inspection solutions typically employ fixed imaging parameter strategies to acquire image data. To clearly capture different types of defect features, specific optical conditions are often required. For example, capturing high-frequency edge information at the sealing layer usually requires a short exposure time to suppress motion blur, while detecting low-contrast liquid level lines or dark foreign objects inside a cup relies on a longer exposure time to ensure sufficient light flux. Conventional inspection systems struggle to simultaneously meet these diverse inspection needs, essentially making trade-offs between different imaging conditions.
[0004] However, a single imaging strategy may result in the loss of image information for some defect types during the acquisition stage, thus affecting the reliability of the detection algorithm and posing a certain risk of missed detections or false alarms. Furthermore, existing systems are typically limited to a binary judgment of pass or fail, making it difficult to automatically infer the root cause of defects based on visual defect information. When consecutive defective products occur, manual inspection and adjustment of upstream equipment is often required, which can easily lead to production interruptions and introduces a certain degree of lag in the feedback loop. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides an intelligent visual detection and closed-loop control system for beverage cups.
[0006] A smart vision detection and closed-loop control system for beverage cups includes:
[0007] The dual-modal feature acquisition module acquires two original images at the same physical moment using a first exposure parameter and a second exposure parameter, and extracts features carrying different defect modes from the two original images to construct a set of dual feature vectors, wherein the exposure time of the first exposure parameter is less than the exposure time of the second exposure parameter.
[0008] The defect feature encoding module generates a salt value based on the current production line batch number and timestamp, and performs a hash operation on the dual feature vector set using the salt value to generate a defect feature data package containing semantic code and verification information.
[0009] The causal node activation module receives defect feature data packets and verifies data integrity. After verification, it uses the semantic code in the packet as an index to access the preset process causal matrix and activates the root cause nodes that characterize potential fault sources.
[0010] The root cause reasoning module starts from the root cause node, uses the coordinate information parsed from the defect feature data package as a constraint, performs Bayesian belief propagation calculation on the process causality matrix, and generates a posterior probability vector of process parameters that quantifies the possibility of each process parameter being a source of failure.
[0011] The control command generation module parses the posterior probability vector of process parameters to identify the root cause parameters, and calls the feature-parameter sensitivity function to calculate the physical adjustment amount to generate closed-loop control commands.
[0012] A further aspect of the present invention includes a dual-modal feature acquisition module, used to perform the following operations:
[0013] From the original image acquired with the first exposure parameters, extract the edge gradient direction histogram vector representing high-frequency edge information;
[0014] From the original image acquired using the second exposure parameter, extract the color moments and contrast vectors that represent low-frequency regions and color information;
[0015] Write the edge gradient direction histogram vector, color moments, and contrast vector into a predefined data structure to complete the construction of the dual feature vector set.
[0016] A further aspect of the present invention includes a defect feature encoding module, which performs the following steps:
[0017] The production line batch number and timestamp are concatenated to calculate the hash value, and the salt value is then extracted.
[0018] The salt value is concatenated with the serialized data of the dual feature vector set, and then input into a hash function to calculate the hash digest.
[0019] Extract the first segment of the hash digest as the row index address, and retrieve the corresponding semantic code in the preset defect semantic lookup table;
[0020] Extract the last bit data of the hash digest and apply bitmasking operations to generate a checksum. Encapsulate the semantic code, checksum, and region of interest coordinates of the original image into a defect feature data packet.
[0021] A further aspect of the present invention includes a causal node activation module, used to perform the following steps:
[0022] Based on the synchronized production line batch number and timestamp, a local salt value is regenerated. This local salt value is used to perform a reverse lookup on the semantic code in the defect feature data packet to obtain the theoretical hash digest and calculate the local checksum.
[0023] The local checksum is compared with the checksum carried in the defect feature data packet by a hardware gating circuit, and an enable signal is output only when the two match.
[0024] When triggered by an enable signal, the row vectors indexed by semantic codes in the process causal matrix are read, and the process parameters whose probability values in the row vectors exceed the preset activation threshold are identified as root cause nodes.
[0025] A further aspect of the present invention includes a root cause reasoning module, which performs the following operations:
[0026] The semantic code is used to retrieve the corresponding approximate value of the feature vector in a pre-defined reverse lookup table as observational evidence;
[0027] Using the coordinates of the region of interest in the defect feature data package, a subset of related process parameters is selected from the preset process parameter-spatial region association table to form a restricted computation space.
[0028] Within a limited computational space, the prior probabilities of root cause nodes and associated nodes are iteratively updated based on observational evidence until the probability change satisfies the convergence condition.
[0029] A further aspect of the present invention includes a control instruction generation module, used to perform the following operations:
[0030] Identify the element with the highest probability in the posterior probability vector of process parameters that exceeds the preset confidence threshold, and lock its corresponding parameter as the root cause parameter.
[0031] Obtain the feature-parameter sensitivity function bound to the root cause parameter, substitute the difference between the approximate value of the feature vector retrieved in the root cause reasoning module and the preset reference value into the function, and calculate the physical adjustment amount;
[0032] The physical adjustment quantity is encoded according to the communication protocol format of the target device and encapsulated into a data frame containing the target address and function code.
[0033] A further aspect of this invention involves extracting the edge gradient direction histogram vector representing high-frequency edge information, specifically including:
[0034] The original image acquired with the first exposure parameters is converted into a grayscale image matrix, and the gradient magnitude and direction of each pixel are calculated.
[0035] The image is divided into multiple cells and the gradient direction histogram is calculated. Adjacent cells are combined into blocks and the histograms within the blocks are normalized.
[0036] Concatenate the histogram descriptors of all blocks to generate edge gradient direction histogram vectors.
[0037] A further aspect of this invention involves extracting color moments and contrast vectors that characterize low-frequency regions and color information, specifically including:
[0038] The original image acquired by the second exposure parameter is converted to the HSV color space, and the first, second, and third moments of the hue, saturation, and lightness channels are calculated respectively to form the color moment feature vector.
[0039] Calculate the mean local contrast of the grayscale image corresponding to the original image acquired using the second exposure parameter;
[0040] The color moment feature vector is concatenated with the local contrast mean to generate the color moment and contrast vector.
[0041] A further embodiment of the present invention also includes a matrix update module, used to perform the following steps:
[0042] For the root cause parameter that leads to the improvement, its prior probability value in the corresponding row of the process causality matrix is increased according to the preset learning rate;
[0043] The prior probability values of other process parameters in this row are reduced proportionally.
[0044] In a further embodiment of the present invention, the matrix update module is also used to perform the following steps:
[0045] When the cumulative number of products processed by the system reaches the preset periodic threshold, a global decay mechanism is triggered.
[0046] A preset decay factor is applied to all probability elements in the process causality matrix to regress their values toward a uniform distribution.
[0047] In summary, the present invention has the following beneficial technical effects:
[0048] 1. By acquiring short-exposure and long-exposure dual-modal images at the same physical moment, and extracting in parallel the edge gradient direction histogram vector representing high-frequency edge information and the color moment and contrast vector representing low-frequency region information, this dual-modal feature acquisition method solves the problem that a single exposure parameter cannot simultaneously meet the imaging needs of high-reflectivity and low-contrast regions. This ensures the complete preservation of defect information from different physical causes, providing a more comprehensive data foundation for subsequent fault diagnosis.
[0049] 2. The extracted dual feature vector set is hashed and verified to generate a defect feature data package containing semantic codes, which is then used as an index to directly access the process causal matrix. This mechanism transforms high-dimensional visual features into structured index information, establishing a direct query link from visual appearance to potential physical fault sources. Compared to traditional complex rule-based reasoning or black-box models, this approach simplifies the initial localization process, ensuring the integrity of data transmission and effectively reducing the search space for subsequent reasoning.
[0050] 3. This method utilizes the coordinate constraints of the region of interest to constrain the computational space and performs Bayesian belief propagation computation using eigenvectors as observational evidence. It performs probabilistic inference within a local subset of process parameters directly related to defects, combining prior knowledge from the process causality matrix with real-time quantitative evidence from current detection. This enables the system to quantitatively assess the probability of multiple potential fault sources, thereby pinpointing root cause parameters. Compared to simply relying on table lookups, this improves the accuracy and confidence of diagnostic results.
[0051] 4. A feedback-based matrix update mechanism is introduced. After confirming that the closed-loop control commands effectively improve defects, the prior probabilities of corresponding causal relationships in the process causal matrix are updated online, combined with a periodic global decay strategy. This mechanism enables the diagnostic model to accumulate control experience through positive feedback, while utilizing decay factors to adapt to long-term drift caused by equipment aging or environmental changes. This allows the system to maintain the effectiveness of diagnosis and control during long-term operation and possess adaptability to changes in the production process. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. The drawings are used to provide a further understanding of the present invention.
[0053] Figure 1 This discloses a first frame schematic diagram of an embodiment of this application.
[0054] Figure 2 This discloses a flowchart of an embodiment of this application.
[0055] Figure 3 This discloses a second frame schematic diagram in an embodiment of this application. Detailed Implementation
[0056] The following is in conjunction with the appendix Figure 1 - Figure 2 A preferred description of the present invention is provided below.
[0057] See attached document Figure 1 - Figure 2This invention proposes an intelligent visual detection and closed-loop control system for beverage cups, comprising the following modules:
[0058] The dual-modal feature acquisition module acquires two original images at the same physical moment using a first exposure parameter and a second exposure parameter, and extracts features carrying different defect modes from the two original images to construct a set of dual feature vectors, wherein the exposure time of the first exposure parameter is less than the exposure time of the second exposure parameter.
[0059] The defect feature encoding module generates a salt value based on the current production line batch number and timestamp, and performs a hash operation on the dual feature vector set using the salt value to generate a defect feature data package containing semantic code and verification information.
[0060] The causal node activation module receives defect feature data packets and verifies data integrity. After verification, it uses the semantic code in the packet as an index to access the preset process causal matrix and activates the root cause nodes that characterize potential fault sources.
[0061] The root cause reasoning module starts from the root cause node, uses the coordinate information parsed from the defect feature data package as a constraint, performs Bayesian belief propagation calculation on the process causality matrix, and generates a posterior probability vector of process parameters that quantifies the possibility of each process parameter being a source of failure.
[0062] The control command generation module parses the posterior probability vector of process parameters to identify the root cause parameters, and calls the feature-parameter sensitivity function to calculate the physical adjustment amount to generate closed-loop control commands.
[0063] In one embodiment of the present invention, the dual-modal feature acquisition module is used to perform the following steps:
[0064] From the original image acquired with the first exposure parameter, extract the edge gradient direction histogram vector representing high-frequency edge information; from the original image acquired with the second exposure parameter, extract the color moment and contrast vector representing low-frequency region and color information; write the edge gradient direction histogram vector, color moment and contrast vector into a predefined data structure to complete the construction of the dual feature vector set.
[0065] Specifically, the system acquires spatiotemporally synchronized dual images of the beverage cups and extracts the set of dual feature vectors. The core processing unit, typically an industrial controller or high-performance industrial computer integrating a field-programmable gate array (FPGA), first executes image acquisition control. This processing unit sends synchronized hardware trigger signals to two industrial cameras or one industrial camera supporting dual trigger modes via its general-purpose input / output pins or a dedicated camera trigger interface. This signal ensures that at the same physical moment, the cameras acquire the same field of view of the target beverage cups on the production line conveyor belt.
[0066] It should be understood that the spatiotemporally synchronized dual images here refer to two original images acquired at the same physical moment, with different exposure parameters but strictly aligned field of view. The specific acquisition strategy is as follows: one acquisition channel uses a short exposure parameter, i.e., the first exposure parameter, with the exposure time set between 0.1ms and 1ms. This parameter setting is based on calculations of the production line conveyor belt speed and pixel resolution. For example, when the conveyor belt speed is 1.5m / s and the camera resolution is 0.1mm / pixel, in order to limit motion blur to within 1 pixel, the exposure time needs to be less than... Considering the pulse width limitation of the stroboscopic light source, this embodiment preferably uses 0.08ms to 0.2ms, combined with a high-brightness stroboscopic LED ring light source of up to 30,000 lux. The assumed scenario for this parameter setting is to capture the clear edges and textures of a beverage cup on a high-speed conveyor belt, in order to freeze high-speed movement and suppress overexposure in highly reflective areas, such as avoiding overexposure caused by reflections from metal or plastic, thereby generating a short-exposure original image.
[0067] The other acquisition channel uses long exposure parameters, also known as the second exposure parameters, with the exposure time set between 10ms and 50ms. This range is determined based on the photosensitive characteristic curve of the dark area of the object being measured, ensuring that the average pixel grayscale value reaches 40%-60% of the dynamic range in the cup bottom or liquid surface area where the ambient light is weak, i.e., 100-150 in 8-bit grayscale. This parameter setting aims to ensure that details in low-brightness areas such as the liquid surface and dark foreign objects are fully displayed, such as enhancing the visibility of low-contrast targets such as fruit pulp or bubbles inside the cup, thereby generating a long-exposure original image.
[0068] Two image frames are transmitted in real-time, as a pixel stream, to a pre-allocated dual-port cache in the processing unit's memory via Camera Link or CoaXPress interface. This cache employs a ping-pong operation mechanism to achieve seamless writing and reading of image data. Subsequently, the processing unit invokes its hardware processing unit, such as the logic processing unit within the FPGA or the CUDA core of the graphics processor, to execute two feature extraction tasks in parallel:
[0069] The first task, for short-exposure raw images, involves the processing unit calling a function from a computer vision library to calculate the histogram of oriented gradients (HOR). For example, the `compute` method of the `cv::HOGDescriptor` class in the OpenCV library. This method first converts the short-exposure raw image into a grayscale image matrix, then uses the Sobel operator to calculate the gradient components of each pixel in the horizontal and vertical directions, thus obtaining the gradient magnitude and direction. Next, the image is divided into dense cells, and the histogram of oriented gradients for all pixels within each cell is calculated. Adjacent cells are then combined into blocks, and all histograms within each block are normalized to enhance robustness to changes in illumination. Finally, the histogram descriptors of all blocks are concatenated to calculate and output a high-dimensional floating-point array as the edge gradient orientation histogram vector. It should be noted that this vector is a high-dimensional floating-point array, and its dimension is determined by the image size, cell size, block size, and the number of histogram intervals. In a typical configuration of this embodiment, its dimension is 3780. The calculation of this dimension is based on the following:
[0070] The region of interest is normalized to 64x128 pixels, the cell size is set to 8x8 pixels, the block size is 16x16 pixels (2x2 cells), the block stride is 8x8 pixels, and the gradient direction is quantized into 9 intervals. Under this configuration, the number of blocks in the horizontal direction is... The number of blocks in the vertical direction is The total number of blocks is Each block contains There are 9 cells, each with 9 feature values, so each block generates There are 1 feature. The final vector dimension is 1. This high-dimensional setting is intended to preserve sufficient spatial structural information to distinguish subtle wrinkles and defects.
[0071] The second task, parallel to the first, involves the processing unit calling a color feature calculation function for the long-exposure raw image. This function first converts the image from the RGB color space to the HSV color space, separating the hue, saturation, and lightness channels. For each channel, its first, second, and third moments—mean, variance, and skewness—are calculated, collectively forming a nine-dimensional color moment feature vector. Simultaneously, the local contrast of the grayscale image of the long-exposure raw image is calculated, typically by calculating the standard deviation of pixel values within the neighborhood of each pixel, and the average contrast of the entire image is used as a scalar feature. Finally, the nine-dimensional color moment vector is concatenated with the contrast scalar to form a ten-dimensional floating-point array, serving as the color moment and contrast vector. Specifically, the first three dimensions of this vector correspond to the mean, variance, and skewness of the hue channel in the HSV color space; the middle three dimensions correspond to the moments of the saturation channel; the last three dimensions correspond to the moments of the lightness channel; and the final dimension is the average grayscale contrast of the entire image.
[0072] The processing unit logically binds the edge gradient direction histogram vector with the color moment and contrast vector, and writes them together into a structure or data dictionary. This data set is defined as a set of dual feature vectors representing different defect modes.
[0073] For example, suppose the system processing unit triggers acquisition, obtaining one frame of short-exposure raw image and one frame of long-exposure raw image, both with a resolution of 640 pixels by 480 pixels. For the short-exposure image, the FPGA logic unit calls an optimized gradient calculation kernel. First, the image is divided into 8-pixel by 8-pixel cells, and a gradient histogram in 9 directions is calculated for each cell. Every 2 by 2 cells forms a block, and the block slides across the image with an 8-pixel step. Finally, the specific values of the edge gradient direction histogram vector are calculated, for example, the values of its first five dimensions are 0.15, 0.22, 0.08, 0.31, and 0.05. For the long-exposure image, another set of processing logic is executed in parallel. The system converts the image to HSV space and calculates the mean of the hue channel to be 0.65, the variance to be 0.12, and the skewness to be -0.03; the mean of the saturation channel to be 0.30, the variance to be 0.05, and the skewness to be 0.10; and the mean of the lightness channel to be 0.70, the variance to be 0.08, and the skewness to be 0.02. Simultaneously, the mean of the local contrast of the grayscale image is calculated to be 25.6. Therefore, the color moments and contrast vectors are constructed as [0.65, 0.12, -0.03, 0.30, 0.05, 0.10, 0.70, 0.08, 0.02, 25.6]. The processing unit then creates a data object named DualFeatureSet, whose hog_feature member is assigned the edge gradient direction histogram vector, and whose ccm_feature member is assigned the color moments and contrast vectors. This DualFeatureSet object is the set of dual feature vectors generated in this processing.
[0074] In one embodiment of the present invention, the defect feature encoding module is used to perform the following steps:
[0075] The production line batch number and timestamp are concatenated to calculate the hash value, and a salt value is generated. The salt value is concatenated with the serialized data of the dual feature vector set and input into a hash function to calculate the hash digest. The first segment of the hash digest is used as the row index address, and the corresponding semantic code is retrieved in the preset defect semantic lookup table. The last segment of the hash digest is extracted and bitmasking is applied to generate a checksum. The semantic code, checksum, and region of interest coordinates of the original image are encapsulated into a defect feature data package.
[0076] Specifically, the process of performing quantum encoding and feature packet generation to encrypt and encapsulate the set of dual feature vectors into a defect feature quantum packet is as follows.
[0077] First, the core processing unit dynamically generates a hash salt value based on the current production line batch number and timestamp. It should be understood that this hash salt value is a random or pseudo-random string, such as a 64-bit binary sequence, used to enhance the uniqueness of the hash operation. It is generated as follows: the production line batch number is a string identifier, and the timestamp is a millisecond-precision value obtained from the system clock; the two are concatenated and then the SHA-256 hash function is used to calculate a 256-bit intermediate hash value, with the first 64 bits used as the hash salt value. Alternatively, the first 32 bits of the MD5 hash value of the production line batch number can be XORed with the last 32 bits of the current millisecond-precision timestamp to ensure its dynamism and uniqueness.
[0078] Next, the core processing unit extracts the edge gradient direction histogram vector from the dual feature vector set and serializes its floating-point values into a continuous byte stream. The core processing unit concatenates the hash salt value byte stream with the edge gradient direction histogram vector byte stream and inputs it into the SHA-256 hash function for calculation, obtaining a 256-bit hash digest.
[0079] The core processing unit extracts the first 24 bits from the hash digest as an index address to query the high-dimensional defect semantic lookup table pre-stored in non-volatile memory. It should be noted that this high-dimensional defect semantic lookup table is a static query data structure, loaded from external flash memory into static random access memory during system initialization. Its address width is 24 bits, corresponding to 16,777,216 entries. Each entry stores a 128-bit semantic code, which is pre-assigned during the system calibration phase based on historical defect feature clustering results, representing a specific defect cause pattern. A specific allocation example is as follows: 100,000 historical defect samples from the production line are collected, and their 3790-dimensional features (3780 dimensions + 10 dimensions) are subjected to K-Means clustering, with the number of cluster centers set to [value missing]. There are approximately 16 million clusters. The ID of each cluster center serves as the index address, and the physical causal code corresponding to that cluster center, annotated by experts, is the 128-bit semantic code. The 128-bit semantic code is a fixed-length binary identifier used to directly index the causal matrix in subsequent steps. The core processing unit uses a 24-bit address as the row index to read the corresponding 128-bit semantic code from the lookup table.
[0080] Simultaneously, during the SHA-256 hash operation, the core processing unit extracts the remaining 128 to 159 bits (32 bits total) of data from the hash digest and applies a preset bitmask operation to generate a 32-bit checksum. This process transforms the original edge gradient direction histogram vector, color moments, and contrast vectors into irreversible encoded information, namely semantic code and checksum. The 32-bit checksum can also be obtained by performing modulo-2 division on a specific segment of the SHA-256 hash digest, and its generating polynomial can adopt the CRC-32-IEEE 802.3 standard polynomial for verifying data integrity.
[0081] Finally, the core processing unit encapsulates the semantic code, checksum, and region of interest coordinates initially determined from the short-exposure raw image through edge detection. The region of interest coordinates are bounding rectangle coordinates of connected components determined by algorithms such as Canny edge detection. The origin of these coordinates is typically the top-left corner of the image. In pixels, these coordinates are represented as quadruples, indicating the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the suspected defective region in the image. Each coordinate is represented by a 16-bit unsigned integer. The encapsulation follows a predefined data packet structure, sequentially containing a 16-bit synchronization header (0xAA55), a 128-bit semantic code, a 32-bit checksum, and four 16-bit coordinate values, collectively generating a highly structured defect feature quantum packet. This defect feature quantum packet is a binary data packet with a total length of 240 bits (30 bytes), and its structure strictly follows the order of synchronization header, semantic code, checksum, and coordinates.
[0082] In one feasible embodiment of the present invention, assume that the current production line batch number is the string BATCH001 and the timestamp is 1625097600000 milliseconds. The core processing unit concatenates the batch number and the timestamp into the string: BATCH0011625097600000, calculates its SHA-256 hash value, obtains a 256-bit digest, and takes the first 64 bits as the hash salt value, assuming its hexadecimal representation is: "a1b2c3d4e5f67890".
[0083] The core processing unit reads the edge gradient direction histogram vector from the dual feature vector set. This vector is a 3780-dimensional floating-point array, with example values for the first five dimensions: (0.15, 0.22, 0.08, 0.31, 0.05). The system serializes this vector into a byte stream according to IEEE 754 single-precision floating-point format, assuming its starting byte is a segment of binary data. The core processing unit concatenates the salt byte stream a1b2c3d4e5f67890 with this vector byte stream, inputs it into the SHA-256 function, and calculates a new 256-bit hash digest, assuming its hexadecimal representation is:
[0084] "d4e5f67890a1b2c3e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3".
[0085] The system extracts the first 24 bits of the hash digest, d4e5f6, as the lookup table address, corresponding to the decimal address 13959158. Using this address, it accesses the high-dimensional defect semantic lookup table and retrieves the preset 128-bit semantic code, assumed to be represented in hexadecimal as 1234567890ABCDEF1234567890ABCDEF. Simultaneously, the system extracts bits 128 to 159 of the hash digest, assumed to be the hexadecimal segment 89ABCDEF, and performs an operation with the preset mask to obtain a 32-bit checksum, assumed to be 89ABCDEF. The coordinates of the region of interest determined from the short-exposure original image are assumed to be the upper left corner (100, 150) and the lower right corner (200, 250). Finally, the core processing unit encapsulates the data: first, it writes a 16-bit synchronization header of 0xAA55, then writes a 128-bit semantic code: 1234567890ABCDEF1234567890ABCDEF, then writes a 32-bit checksum of 89ABCDEF, and finally writes 16-bit coordinate values (100, 150, 200, 250) sequentially, generating a continuous 240-bit binary sequence, i.e., the defect feature quantum packet.
[0086] In one embodiment of the present invention, the causal node activation module is configured to perform the following steps:
[0087] Based on the synchronized production line batch number and timestamp, a local salt value is regenerated. This local salt value is used to perform a reverse lookup on the semantic code in the defect feature data packet to obtain a theoretical hash digest and calculate a local checksum. The local checksum is compared with the checksum carried in the defect feature data packet through a hardware gating circuit, and an enable signal is output only when the two match. When the enable signal is triggered, the row vectors indexed by the semantic code in the process causality matrix are read, and the process parameters with probability values exceeding the preset activation threshold in the row vectors are identified as root cause nodes.
[0088] The process of key verification and causal node activation of defect-featured quantum packets to initially map physical origins is as follows.
[0089] Specifically, the core processing unit receives defect feature quantum packets via its high-speed serial bus. First, based on the production line batch number controller and system clock synchronized with the defect feature encoding module, the core processing unit regenerates the hash salt value using the exact same algorithm. As previously mentioned, the reverse lookup table is a query data structure stored in read-only memory or flash memory, its contents generated during system calibration. This ensures that for any semantic code legally generated by the defect feature encoding module, a unique, corresponding theoretical hash digest fragment can be retrieved using the hash salt value.
[0090] The core processing unit extracts a 128-bit semantic code from the defect feature quantum packet. It takes the regenerated hash salt value as input and performs a reverse lookup operation on the 128-bit semantic code using the same SHA-256 hash function as in the defect feature encoding module. This operation is not direct decryption; instead, it uses the semantic code as a query key to retrieve data from a reverse lookup table that is a mirror image of the high-dimensional defect semantic lookup table. The key-value pairs stored in the reverse lookup table are mappings from the semantic code to the hash digest of the original feature vector. Through this retrieval, the system obtains a theoretical 256-bit hash digest.
[0091] Subsequently, the core processing unit calculates a local 32-bit checksum from bits 128 to 159 of the theoretical hash digest, using the same bitmasking operation as the defect feature encoding module. Next, a dedicated hardware gating circuit is activated, which compares the local checksum in parallel with the 32-bit checksum extracted from the defect feature quantum packet. It should be noted that the hardware gating circuit is a digital logic circuit composed of a set of XOR and AND gates, with a comparison threshold set to complete agreement (i.e., all bits are equal). This ensures the integrity and uniqueness of the data packet's origin; any bit transmission error or tampering will result in verification failure. Only when every bit of the two checksums is completely identical will its final output pin generate a high-level active signal. This high-level signal acts as an enable signal, triggering the clock gating switch of subsequent causal mapping logic in the core processing unit, allowing the relevant processor core or logic unit to begin operation. If the comparison results are inconsistent, the enable signal remains low, subsequent logic is locked, and the core processing unit sends a retransmission request to the data source via the bus.
[0092] After successful verification, the activated processing logic uses the 128-bit semantic code as the direct row index address to access the process causality matrix stored in its internal static random access memory. This process causality matrix is a two-dimensional probabilistic sparse matrix, storing only non-zero entries in actual engineering. The row address space of the matrix corresponds one-to-one with the numerical space of the semantic code, and the column indices correspond to all adjustable process parameters, such as... List, This represents the total number of independently controllable process parameters for the production line, typically between 50 and 200. Elements in the matrix... Indicates when semantic codes appear When the defect is represented, the process parameters This is the prior probability of the root cause, derived from statistical analysis of historical production line failure data and expert experience. The initial value is set according to the following rule: for parameters with no prior knowledge, they are initialized to a uniform distribution. For known correlated parameters, such as sealing film wrinkles being strongly correlated with temperature and pressure, set an initial high probability value, such as 0.4, according to the Failure Mode and Effects Analysis manual, and then distribute the remaining probability equally among the other parameters.
[0093] Accessing the matrix via its semantic code address simultaneously retrieves all column data for the corresponding row, i.e., the probability vector. The specific defect pattern represented by that row, along with one or more process parameter columns whose probability values exceed a preset activation threshold, is defined as the root cause node activated in this detection. It should be understood that a root cause node is the process parameter identifier corresponding to the column in the activated row of the process causality matrix whose probability value is greater than or equal to the preset threshold. For example, the preset threshold is set to 0.6. This threshold of 0.6 is based on the statistical distribution of confidence in correct diagnoses from historical data. Specifically, it is determined by analyzing the ROC curve (Receiver Operating Characteristic curve) and selecting the critical probability value where the recall rate is greater than 95% and the false alarm rate is less than 5% as the activation threshold. This threshold is used to filter low-probability causes and focus on high-probability fault sources.
[0094] For example, based on the defect feature quantum packet of the aforementioned example, the 128-bit semantic code 1234567890ABCDEF1234567890ABCDEF and the 32-bit checksum 89ABCDEF are extracted after the synchronization header. The system regenerates the same 64-bit hash salt value: a1b2c3d4e5f67890 based on the same batch number BATCH001 and timestamp 1625097600000. Next, the system uses this salt value and the received semantic code as input to perform a lookup in the reverse lookup table. Assume that bits 128 to 159 of the theoretical hash digest returned by the lookup are also exactly 89ABCDEF. The hardware gating circuit compares the locally calculated checksum 89ABCDEF bit by bit with the checksum 89ABCDEF in the data packet; if the results are identical, the circuit outputs a high-level enable signal. Subsequently, the processing logic is activated, converting the semantic code into a row address and accessing the process causality matrix. Assuming the row vector corresponding to this address has 150 columns, i.e., M=150, the probability value of the sealing machine pressure valve opening in column 23 is 0.85, the probability value of the cup holder servo motor Y-axis position in column 45 is 0.72, and the probabilities of the remaining columns are all below 0.6. Based on the threshold of 0.6, the system activates two root cause nodes: node A (sealing machine pressure valve opening) and node B (cup holder servo motor Y-axis position). These two nodes represent the potential physical fault sources initially mapped from the current encryption defect information.
[0095] In one embodiment of the present invention, the root cause reasoning module is configured to perform the following steps:
[0096] The semantic code is used to retrieve the corresponding approximate value of the feature vector in the preset reverse lookup table as observation evidence; the coordinates of the region of interest in the defect feature data package are used to select the relevant process parameter subset in the preset process parameter-spatial region association table to form a restricted computation space; within the restricted computation space, the prior probabilities of the root cause node and the associated node are iteratively updated based on the observation evidence until the probability change satisfies the convergence condition.
[0097] Specifically, after successfully activating the root cause node, the core processing unit immediately initiates a parallel Bayesian belief propagation computation on the topological structure of the process causality matrix, starting from that node. First, the core processing unit uses the approximate values of the edge gradient direction histogram vector and the color moment and contrast vector, recovered through reverse hash decoding, as the observation evidence vector for this inference. Simultaneously, the core processing unit resolves the coordinates of the region of interest from the generated defect feature quantum packet. Internally, the core processing unit maintains a process parameter-spatial region association table. This table, based on engineering drawings of the equipment's mechanical operating range, defines which physical region of the cup body each process parameter primarily affects. For example, sealing machine parameters primarily affect the cup rim region, and filling valve parameters primarily affect the cup body region. The system uses the region of interest coordinates to perform a matching query in the association table, filtering out a subset of process parameters associated with the currently suspected defect region. This filtered subset constitutes the constrained computational space for this belief propagation. This subset of process parameters, filtered based on the region of interest coordinates, aims to significantly reduce the number of parameters that need to be updated and improve computational efficiency.
[0098] Next, within the limited computational space, the core processing unit initializes the posterior probability value for each process parameter node to be evaluated. The process parameter nodes include root cause nodes and other related nodes, and their prior values are directly taken from the probability corresponding to the current semantic code line in the process causality matrix.
[0099] Subsequently, the system performs iterative belief propagation updates. It should be noted that Bayesian belief propagation is an iterative algorithm for approximate reasoning on a probabilistic graphical model, used in this scheme to update the probability of anomalies in various process parameters given observational evidence. In each iteration, for each process parameter node, the system calculates the likelihood that the evidence supports the parameter's anomaly based on its conditional probability relationship with the observed evidence node. Specifically, the system calls a pre-stored conditional probability table, which is a three-dimensional lookup table with dimensions: [process parameter number] × [evidence feature component index] × [feature value discrete interval]. Each entry in the table stores a probability value, obtained through statistical analysis of a historical defect case database. Furthermore, the table defines the probability that each component of the observed evidence vector falls within a specific numerical interval when a process parameter deviates from its normal value. For example, for the sealing temperature parameter, when it is abnormally high, the probability that the component representing the high-frequency edge in the E-HOG vector falls into the [0.8, 1.0] interval is 0.9, while the probability of falling into the [0.0, 0.2] interval is only 0.05. Discrete intervals typically divide the eigenvalue range [0, 1] into 10 to 20 equal intervals. The system compares the values of each component of the currently observed evidence vector with this table to calculate the joint likelihood value of the simultaneous occurrence of all evidence components. Then, according to Bayes' theorem, the prior probability of the node is updated using this likelihood value to obtain the posterior probability of this iteration.
[0100] Updates to all nodes are performed in parallel. This iterative process continues until the change in the posterior probability of all nodes is less than a preset convergence threshold or the maximum number of iterations is reached, for example, 10. The convergence threshold is, for example, 0.01, and is set to 0.01 based on a typical engineering trade-off between computational accuracy and real-time requirements. The probability change corresponding to this threshold is insufficient to change the final ranking order. Finally, the core processing unit outputs a posterior probability vector of the process parameters, corresponding one-to-one with the process parameters within the constrained computational space, quantifying the probability that each parameter is the root cause of the current defect. This vector is a floating-point array, the length of which is equal to the number of parameters within the constrained computational space, the value range of each element is [0, 1], and the sum of all elements is 1.
[0101] In the transmission of beliefs, for a certain process parameter node Its posterior probability The update is based on an approximate calculation using Bayes' theorem:
[0102]
[0103] Represents the vector of observed evidence. It is a node The prior probabilities are obtained from the process causality matrix; In the given Observed under true conditions The likelihood value, Represents the set of all process parameter nodes within a constrained computational space. Likelihood value The components of the hypothetical evidence vector are obtained by querying the conditional probability table. If conditions are independent, then ,in It is given by the conditional probability table.
[0104] For example, the system has activated root cause node A, namely the opening degree of the sealing machine pressure valve, with a prior probability of 0.85; and node B, namely the Y-axis position of the cup holder servo motor, with a prior probability of 0.72. Assume that the decoded observation evidence vector has a key dimension value of 0.18 in its E-HOG part and a key dimension value of 0.68 in its CCM part. The region of interest coordinates parsed from the defect feature quantum packet are (100, 150, 200, 250). After consulting the process parameter-spatial region correlation table, it is determined that this region is mainly related to the opening degree of the sealing machine pressure valve and the Y-axis position of the cup holder servo motor. Therefore, the limited computational space S only contains nodes A and B. The system queries the conditional probability table: for node A, when it is an anomaly, the conditional probability of observing the E-HOG key feature value of 0.18. The conditional probability of observing a key eigenvalue of 0.68 for CCM was found. For node B, the corresponding conditional probability is: , Assuming the conditions are independent, the likelihood value is:
[0105] ;
[0106] .
[0107] Prior probability , It needs to be normalized as follows:
[0108] ;
[0109] .
[0110] Substituting into Bayes' formula, the denominator is: Then the posterior probability is:
[0111] ;
[0112] .
[0113] After one iteration, the posterior probability of node A changes from 0.542 to 0.677, and that of node B changes from 0.458 to 0.323. The system continues to iterate until convergence, assuming eventual stability. , The posterior probability vector of the process parameters output by the system is [0.82, 0.18] for nodes A and B.
[0114] In one embodiment of the present invention, the control instruction generation module is configured to perform the following steps:
[0115] The element with the highest probability in the posterior probability vector of the process parameters that exceeds the preset confidence threshold is identified, and its corresponding parameter is locked as the root cause parameter. The feature-parameter sensitivity function bound to the root cause parameter is obtained, and the difference between the approximate value of the feature vector retrieved in the root cause reasoning module and the preset reference value is substituted into the function to calculate the physical adjustment amount. The physical adjustment amount is encoded according to the communication protocol format of the target device and encapsulated into a data frame containing the target address and function code.
[0116] Specifically, the process of generating and outputting high-confidence closed-loop control commands to complete the conversion from visual signals to physical execution is as follows:
[0117] The core processing unit receives and parses the posterior probability vector of the process parameters. The system iterates through all elements in the vector, using a maximum value lookup function to identify the element with the highest posterior probability value and its corresponding process parameter identifier. The system is configured to only recognize a root cause as valid and initiate subsequent control if the highest probability value exceeds a preset confidence threshold, such as 0.5; otherwise, an alert is triggered. The confidence threshold of 0.5 is set to ensure that the probability of this cause is significantly higher than other competing causes. Since the sum of probabilities is 1, if the maximum value is less than 0.5, it indicates that there are at least two equally likely causes, in which case automatic adjustment carries a high risk, and manual intervention should be initiated.
[0118] Next, the core processing unit accesses the metadata area bound to the root cause parameter in the process causality matrix, retrieving a pointer to a preset feature-parameter sensitivity function. This sensitivity function is a predefined mathematical mapping relationship, typically employing a linear or piecewise linear model, used to convert changes in the high-dimensional feature space into adjustments within a single process parameter domain. Its coefficients... The results were obtained through offline calibration experiments, for example, by slightly adjusting the parameters while keeping other parameters constant. Acquire images and calculate feature vector changes. ,but It can be approximated as The data is stored in the metadata of the process causality matrix. The core processing unit takes the edge gradient direction histogram vector and the approximate values of the color moment and contrast vector recovered by reverse hash decoding as input parameters into the sensitivity function. This function performs calculations, and the output is a scalar or vector value representing the physical adjustment amount required to achieve correction, such as pressure correction value, displacement correction value, or angle correction value. It should be noted that the physical adjustment amount is a numerical value with physical units and a sign, and its positive or negative sign indicates the adjustment direction. To prevent the system from over-adjusting, its absolute value is usually limited to a preset safety boundary. For example, the maximum adjustment amount does not exceed 10% of the normal set value. This safety boundary is set based on the stability requirements of the equipment's PID controller to avoid system oscillation caused by large step signal inputs. For example, the normal sealing temperature is 180℃, and the single closed-loop adjustment range is limited by hardware to within ±18℃.
[0119] Subsequently, the core processing unit invokes its industrial communication protocol stack. Based on the specific protocol supported by the target device, such as the sealing machine PLC or the filling machine servo drive (e.g., Modbus TCP or PROFINET), it encapsulates the physical adjustment amount, target device address, function code, and adjustment delay parameters into a data frame conforming to the protocol specification. Here, the control protocol format refers to the application layer data unit format of the industrial fieldbus or Ethernet protocol, such as the Modbus TCP protocol function code 06 data frame. This data frame is the unique closed-loop control instruction used for real-time adjustment of the front-end production process. Finally, the core processing unit sends this instruction data frame to the corresponding industrial network through its industrial Ethernet physical interface.
[0120] Feature-parameter sensitivity functions typically employ linear or piecewise linear models. For root cause parameters... Its adjustment amount The calculation formula is shown in the following example:
[0121]
[0122] It is this parameter The sensitivity coefficient matrix or scalar, whose values are determined by regression analysis during equipment calibration, is stored in the metadata of the process causality matrix. It is the observed feature vector obtained by decoding, which integrates the key dimensions of E-HOG and CCM. This is the reference eigenvector value corresponding to the parameter when it is at the standard process setpoint. (Function output) This is the required physical adjustment amount.
[0123] For example, the core processing unit parses the received posterior probability vector of the process parameters as [0.82, 0.18], corresponding to the parameters A - the opening of the sealing machine pressure valve and B - the Y-axis position of the cup holder servo motor. The system identifies node A as having the highest probability of 0.82, which is greater than 0.5, and therefore identifies it as the root cause. The system then queries the metadata of node A from the process causality matrix, obtains its sensitivity function form as the aforementioned linear model, and reads the preset sensitivity coefficients. The unit is kPa / characteristic unit, i.e., kPa / unit, and the reference characteristic value is... Assuming that the specific fused feature dimension value is in the observed feature vector obtained from decoding... The value is 0.18. Substitute this value into the formula to calculate the adjustment amount. This means that the pressure setting corresponding to the opening of the sealing machine's pressure valve needs to be reduced by 0.9 kPa. The coefficient -15.0 kPa / unit here indicates that for every 0.1 increase in the characteristic value, the corresponding pressure needs to be reduced by 1.5 kPa to return to the normal state.
[0124] The system then calls the Modbus TCP protocol stack. Assuming the target PLC's station address is 1 and the holding register address of the control pressure valve is 40001, the value to be written is the current pressure setpoint, assuming it's 101.3 kPa. Adding the adjustment amount of -0.9 kPa equals 100.4 kPa. The system multiplies 100.4 by a scaling factor, for example, 10, then converts it to the integer 1004, encapsulating it into a Modbus TCP write register instruction frame. Finally, this instruction frame is sent to the production line network via the network port, thus generating and outputting the closed-loop control instruction.
[0125] In one embodiment of the present invention, a matrix update module is further included, which is used to perform the following steps:
[0126] Please see Figure 3 For the root cause parameter that leads to improvement, the prior probability value of the parameter in the corresponding row of the process causality matrix is increased according to the preset learning rate; the prior probability values of other process parameters in the same row are reduced proportionally; when the cumulative number of products processed by the system reaches the preset period threshold, a global decay mechanism is triggered; and a preset decay factor is applied to all probability elements in the process causality matrix to make their values regress to a uniform distribution.
[0127] Specifically, the process of adaptively updating the process causal matrix online to achieve continuous autonomous optimization of the control model is as follows.
[0128] After the core processing unit sends closed-loop control commands and a preset delay time for process adjustments to take effect (e.g., two production cycle times), the system automatically triggers the model update verification process. This routine first checks whether the defects have been improved by querying the secondary confirmation signal from the production line quality inspection terminal or by re-acquiring images of subsequent products at the same location and performing rapid analysis by the quantum feature encoder and the causal backpropagation controller.
[0129] If the improvement is confirmed, the system determines that the adjustment to the root cause parameter is effective and automatically triggers the reinforcement learning update mechanism. The reinforcement learning update mechanism is an algorithm that incrementally adjusts the internal probability model based on feedback results. Its core is to adjust the confidence level of the corresponding causal relationship based on the success or failure of the control action. The update mechanism first targets the process parameter that led to the improvement, assuming it is the parameter corresponding to the j-th column in the process causality matrix. The system reads the semantic code of this parameter for the currently activated parameter from the matrix's metadata, i.e., the learning rate corresponding to the row address. Learning rate It is a decimal between 0 and 1, with a typical value range of 0.01 to 0.1. In this scheme, 0.05 is preferred. The basis for setting it is to balance the influence of new experience and old knowledge. The larger the value, the higher the trust weight of a single successful adjustment. The value of 0.05 means that the system needs about 20 consistent successful feedbacks to fully establish the probabilistic dominance of the causal relationship. This is in line with the principle of incremental learning in industrial production to prevent accidental factors from misleading the model.
[0130] The system then accesses the prior probability vector corresponding to the current semantic code line in the process causality matrix and retrieves the current prior probability value corresponding to that parameter. Next, the system performs positive feedback amplification calculations:
[0131]
[0132] The new probability value is calculated according to the formula and written back to the same position in the matrix. Meanwhile, to keep the sum of probabilities in this row equal to 1, the system updates all other parameters in this row. The probability is reduced proportionally, and the updated formula is:
[0133]
[0134] This operation achieves positive reinforcement of the knowledge base.
[0135] In addition, the system independently maintains a global update counter. Whenever this counter reaches a preset periodic threshold, the system triggers a periodic decay update. The periodic threshold refers to the production quantity interval that triggers the global decay update; setting it to 10,000 is based on an engineering estimate of the drift time constant of typical equipment parameters. For example, assuming a high-speed production line of 100 cups per minute, 10,000 cups corresponds to approximately 1.5 to 2 hours of production time. This aligns with the equipment's thermal equilibrium establishment time and the wear cycle of consumables, such as Teflon tape. During this update, the system iterates through every probability element in the process causality matrix. And apply a preset attenuation factor Update according to the formula:
[0136]
[0137] Where M represents the total number of process parameters. Attenuation factor. It is a number close to 1 The typical value ranges from 0.99 to 0.999; this scheme sets it to 0.995, meaning that after every 10,000 product cycles, the weight of old experience decays by approximately 0.5%. This value is set to strike a balance between maintaining model stability and adapting to long-term, slow changes. This operation causes all probability values to slightly regress towards a uniform distribution, preventing the model from becoming rigid due to over-reliance on early experience and enabling it to slowly adapt to long-term performance drift of production line equipment. Finally, the system writes the updated matrix back to non-volatile memory, generating an updated process causality matrix for use in the subsequent detection and diagnostic processes for all products.
[0138] For example, the system confirms that after the closed-loop control command corresponding to the j-th column of the matrix for the root cause parameter, the sealing machine pressure valve opening (node A), is executed, the sealing defect of the next product disappears. The system determines that the adjustment is effective and triggers an update. Assuming that in the prior probability vector corresponding to the current semantic code line, The other parameter in the same row as this parameter is the Y-axis position of the cup holder servo motor, i.e., node B, which corresponds to the probability of the k-th column. Learning rate The default value is 0.05. First, update the probability of node A: Next, update the probability of node B: first calculate the sum of probabilities for other parameters. Then the attenuation coefficient is: . .
[0139] After the update, the sum of the row vector probabilities is approximately 0.829 + 0.139 = 0.968, which needs to be renormalized to obtain the final result. , Meanwhile, assume the global update counter reaches 10000, triggering periodic decay. Assume the total number of matrix parameters M = 150, and the decay factor... It is 0.995. For the newly updated... After attenuation:
[0140] .
[0141] After performing similar operations on all elements, the updated process causality matrix is generated and stored.
[0142] Each of the modules can be implemented in whole or in part through software, hardware, or a combination thereof. It supports hardware embedded in or independent of the processor in the computer device, and also supports software stored in the memory of the computer device, so that the processor can call and execute the operations corresponding to each of the above modules.
[0143] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. An intelligent visual detection and closed-loop control system for beverage cups, characterized in that, include: The dual-modal feature acquisition module acquires two original images at the same physical moment using a first exposure parameter and a second exposure parameter, and extracts features carrying different defect modes from the two original images to construct a set of dual feature vectors, wherein the exposure time of the first exposure parameter is less than the exposure time of the second exposure parameter. The defect feature encoding module generates a salt value based on the current production line batch number and timestamp, and performs a hash operation on the dual feature vector set using the salt value to generate a defect feature data package containing semantic code and verification information. The causal node activation module receives the defect feature data packet and verifies the data integrity. After the verification is passed, it uses the semantic code in the defect feature data packet as an index to access the preset process causal matrix and activates the root cause node that represents the potential fault source. The root cause reasoning module starts from the root cause node, uses the coordinate information parsed from the defect feature data package as a constraint, performs Bayesian belief propagation calculation on the process causality matrix, and generates a posterior probability vector of process parameters that quantifies the possibility of each process parameter being a source of failure. The control command generation module parses the posterior probability vector of process parameters to identify the root cause parameters, and calls the feature-parameter sensitivity function to calculate the physical adjustment amount to generate closed-loop control commands.
2. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, The dual-modal feature acquisition module is used to perform the following operations: From the original image acquired with the first exposure parameters, extract the edge gradient direction histogram vector representing high-frequency edge information; From the original image acquired using the second exposure parameter, extract the color moments and contrast vectors that represent low-frequency regions and color information; Write the edge gradient direction histogram vector, color moments, and contrast vector into a predefined data structure to complete the construction of the dual feature vector set.
3. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, The defect feature encoding module is used to perform the following steps: The production line batch number and timestamp are concatenated to calculate the hash value, and the salt value is then extracted. The salt value is concatenated with the serialized data of the dual feature vector set, and then input into a hash function to calculate the hash digest. Extract the first segment of the hash digest as the row index address, and retrieve the corresponding semantic code in the preset defect semantic lookup table; Extract the last bit data of the hash digest and apply bitmasking operations to generate a checksum. Encapsulate the semantic code, checksum, and region of interest coordinates of the original image into a defect feature data packet.
4. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, The causal node activation module is used to perform the following steps: Based on the synchronized production line batch number and timestamp, a local salt value is regenerated. This local salt value is used to perform a reverse lookup on the semantic code in the defect feature data packet to obtain the theoretical hash digest and calculate the local checksum. The local checksum is compared with the checksum carried in the defect feature data packet by a hardware gating circuit, and an enable signal is output only when the two match. When triggered by an enable signal, the row vectors indexed by semantic codes in the process causal matrix are read, and the process parameters whose probability values in the row vectors exceed the preset activation threshold are identified as root cause nodes.
5. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, The root cause reasoning module is used to perform the following steps: The semantic code is used to retrieve the corresponding approximate value of the feature vector in a pre-defined reverse lookup table as observational evidence; Using the coordinates of the region of interest in the defect feature data package, a subset of related process parameters is selected from the preset process parameter-spatial region association table to form a restricted computation space. Within a limited computational space, the prior probabilities of root cause nodes and associated nodes are iteratively updated based on observational evidence until the probability change satisfies the convergence condition.
6. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, The control instruction generation module is used to perform the following operations: Identify the element with the highest probability in the posterior probability vector of process parameters that exceeds the preset confidence threshold, and lock its corresponding parameter as the root cause parameter. Obtain the feature-parameter sensitivity function bound to the root cause parameter, substitute the difference between the approximate value of the feature vector retrieved in the root cause reasoning module and the preset reference value into the function, and calculate the physical adjustment amount; The physical adjustment quantity is encoded according to the communication protocol format of the target device and encapsulated into a data frame containing the target address and function code.
7. The intelligent visual detection and closed-loop control system for beverage cups according to claim 2, characterized in that, Extracting the edge gradient direction histogram vector representing high-frequency edge information specifically includes: The original image acquired with the first exposure parameters is converted into a grayscale image matrix, and the gradient magnitude and direction of each pixel are calculated. The image is divided into multiple cells and the gradient direction histogram is calculated. Adjacent cells are combined into blocks and the histograms within the blocks are normalized. Concatenate the histogram descriptors of all blocks to generate edge gradient direction histogram vectors.
8. The intelligent visual detection and closed-loop control system for beverage cups according to claim 2, characterized in that, Extracting color moments and contrast vectors representing low-frequency regions and color information specifically includes: The original image acquired by the second exposure parameter is converted to the HSV color space, and the first, second, and third moments of the hue, saturation, and lightness channels are calculated respectively to form the color moment feature vector. Calculate the mean local contrast of the grayscale image corresponding to the original image acquired using the second exposure parameter; The color moment feature vector is concatenated with the local contrast mean to generate the color moment and contrast vector.
9. The intelligent visual detection and closed-loop control system for beverage cups according to claim 1, characterized in that, It also includes a matrix update module for performing the following steps: For the root cause parameter that leads to the improvement, its prior probability value in the corresponding row of the process causality matrix is increased according to the preset learning rate; The prior probability values of other process parameters in this row are reduced proportionally.
10. The intelligent visual detection and closed-loop control system for beverage cups according to claim 9, characterized in that, The matrix update module is also used to perform the following operations: When the cumulative number of products processed by the system reaches the preset periodic threshold, a global decay mechanism is triggered. A preset decay factor is applied to all probability elements in the process causality matrix to regress their values toward a uniform distribution.