An industrial visual inspection intelligent agent method and system with autonomous evolution capability

By constructing a multi-layer image feature space and visual structure semantic vectors, an execution trajectory topology graph is generated, and the judgment boundary is adjusted when the system's strong constraint verification is rejected. This solves the problem that existing industrial vision inspection systems cannot adaptively adjust, and realizes autonomous optimization of inspection skills and improvement of accuracy.

CN123181389APending Publication Date: 2026-11-27XINZHI FUTURE (DONGGUAN) DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611429018.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-15
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing industrial vision inspection systems cannot adaptively adjust on-site, leading to misjudgments or omissions in inspection results. Furthermore, their inspection skills cannot be autonomously optimized, failing to meet the real-time requirements of high-frequency line changeover production.

Method used

By constructing a multi-layer image feature space and visual structure semantic vectors, an execution trajectory topology graph is generated. When the system rejects the strong constraint check, the judgment boundary is adjusted. The memory unit is used to realize the autonomous evolution of the detection skill, including the joint encoding of the structural features of the generated execution trajectory topology graph and the visual structure semantic vector.

Benefits of technology

The detection system has achieved autonomous optimization under complex working conditions, improving detection accuracy and efficiency, reducing redundant exploration and misjudgment, and meeting the real-time adaptive requirements of high-frequency line changeover production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181389A_ABST
    Figure CN123181389A_ABST
Patent Text Reader

Abstract

The application discloses an industrial visual detection intelligent agent method and system with autonomous evolution capability, and belongs to the technical field of industrial visual detection. The method comprises the following steps: acquiring an original image of a workpiece to be detected, constructing a multi-layer image feature space based on gradient amplitude distribution, and generating a visual structure semantic vector in combination with color distribution; matching skill description codes in a candidate detection skill library, and mounting skills; generating an execution trajectory topology graph with image blocks as nodes during the detection process performed by the intelligent agent; determining whether a terminal state is reached according to the state of a terminal node and image edge continuity; and when the terminal state is reached, jointly encoding the structural features of the execution trajectory topology graph and the visual structure semantic vector into a memory unit, and writing the memory unit into a skill library that can be hotly covered. The method can adaptively correct the judgment rules in a single detection task, and accumulate the detection experience into reusable skill memories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial vision inspection technology, specifically to a method and system for an industrial vision inspection intelligent agent with autonomous evolution capabilities. Background Technology

[0002] In industrial visual inspection, deep learning-based models are typically trained offline and then deployed. However, they struggle to adapt to new defects on workpiece surfaces, texture changes due to process modifications, or lighting fluctuations. Conventional methods require collecting a large number of defect samples and initiating a complete training process, which is time-consuming and relies on manual annotation and parameter tuning, failing to meet the real-time adaptive requirements of high-frequency production line changes. While existing intelligent agent detection methods introduce task loading and step-by-step execution mechanisms, the state judgment during the detection process largely depends on preset rules and lacks the ability to dynamically correct its judgment logic based on intermediate execution feedback. Furthermore, the execution experience of each inspection process cannot be effectively accumulated and reused, and detection skills cannot be autonomously optimized with the accumulation of production batches. This leads to similar defects repeatedly triggering the same false positives or false negatives, resulting in persistently high maintenance costs.

[0003] The purpose of this invention is to solve two problems. The first problem is how to enable the agent to automatically adjust the judgment boundary and re-complete the detection within the same autonomous round, without restarting a new session, when the system strongly constrains the rejection detection results, thus avoiding interruption of the overall task or repeated execution of the global process due to local deviations. The second problem is how to fuse the execution structure information of a detection session with the visual semantic representation of the workpiece after a detection session is successfully completed, forming a memory unit that can be hot-written into the skill library. This allows the agent to directly retrieve the evolved skill description from the library when facing similar or related workpieces, reducing redundant exploration. Summary of the Invention

[0004] This invention provides an industrial vision inspection intelligent agent method and system with autonomous evolution capability. The purpose is to solve the problems of existing industrial vision inspection systems being unable to adaptively adjust the judgment boundary online when encountering inspection rejection, and being unable to autonomously transform the execution experience of each inspection into accumulative and reusable inspection skills, so as to realize the continuous autonomous optimization of the inspection system in the production process.

[0005] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides an industrial vision inspection intelligent agent method and system with autonomous evolution capability. This method can autonomously accumulate inspection experience and dynamically adjust inspection strategies without human intervention, thereby achieving continuous evolution of inspection capabilities.

[0006] This method acquires the original image of the workpiece to be detected and constructs a multi-layer image feature space based on the gradient magnitude distribution of the original image. Based on the multi-layer image feature space and the color distribution of the original image, a visual structure semantic vector of the workpiece to be detected is generated. The visual structure semantic vector is used to match skill description codes in a candidate detection skill library, and the successfully matched skills are attached to the agent. During the agent's detection process using the attached skills, an execution trajectory topology graph with image blocks as nodes is generated. The agent determines whether the current session has reached the final state based on the endpoint node state of the execution trajectory topology graph and the image edge continuity of the workpiece to be detected. If the final state is reached, the structural features of the execution trajectory topology graph and the visual structure semantic vector are jointly encoded into a memory unit and written into a hot-overwriteable skill library. When the system's strong constraint verification rejects the detection, the agent adjusts the local judgment boundary of the attached skill based on the gradient difference of the image region corresponding to the rejection within the same autonomous round and re-executes the rejected detection step.

[0007] As a technical solution of this invention, when constructing a multi-layer image feature space, the original image is subjected to multi-scale Gaussian filtering to generate multi-layer smoothed images. For each smoothed image layer, the gradient magnitude of each pixel is calculated and a gradient magnitude histogram is generated. The gradient magnitude histograms of the multi-layer smoothed images are stacked in scale hierarchy order to obtain a multi-layer image feature space. This feature space can effectively capture the response characteristics of workpiece edges at different scales, providing rich structural information for subsequent semantic understanding.

[0008] As a preferred embodiment of the present invention, when generating the visual structural semantic vector, the multi-layer image feature space is projected along the scale direction to generate a multi-scale gradient response vector for each pixel location; the color distribution of the original image is quantized and encoded to generate a color attribute label for each pixel location; for each pixel location, the multi-scale gradient response vector and the color attribute label are concatenated to generate a joint descriptor; spatial block statistics are performed on the joint descriptors of all pixel locations to generate the visual structural semantic vector. This vector integrates the multi-scale edge features and color distribution information of the workpiece, and can accurately express the visual structural semantics of the workpiece.

[0009] Preferably, during the matching of skill description codes, the visual structure semantic vector is divided into several semantic sub-intervals and interval centroids are generated; the projection overlap degree between each skill description code and the visual structure semantic vector on each semantic sub-interval is calculated; based on the spatial offset between the interval centroid of each semantic sub-interval and the corresponding skill description code segment, the projection overlap degree is adjusted to obtain the matching confidence degree, and the skill with the highest matching confidence degree is selected and attached to the agent. This matching method can tolerate slight changes in workpiece pose and appearance, improving the accuracy and robustness of skill selection.

[0010] As a technical solution of this invention, when generating the execution trajectory topology graph, the original image is divided into multiple layers of image blocks using a quadtree segmentation method, with each layer having a different scale. Each image block is used as a node in the execution trajectory topology graph, and edges are generated based on the spatial adjacency and scale inheritance relationships between the image blocks. When the attached skill performs a detection operation on any image block, the operation type identifier and the image block state parameters after the operation are recorded on the corresponding node of that image block. The execution trajectory topology graph is generated based on the image block state parameters of each node and the connection relationships of the edges. This topology graph can clearly present the execution path of the detection process and the state transitions of each image region. The recursion depth of the quadtree segmentation method is adaptively determined according to the resolution of the original image; the higher the resolution, the greater the recursion depth, to ensure a balance between the precision of image block segmentation and computational efficiency.

[0011] Preferably, when determining whether the current session has reached the final state, all nodes with an out-degree of zero are extracted from the execution trajectory topology graph as endpoint nodes, and the edge intensity value of the image patch corresponding to each endpoint node is obtained; the dispersion of the edge intensity values ​​of the image patches corresponding to all endpoint nodes is calculated, and an edge continuity index is generated based on the dispersion; if the edge continuity index is higher than a preset first final state threshold and all endpoint nodes have been subjected to detection operations by the attached skills, then the current session is determined to have reached the final state. This criterion combines detection coverage integrity and workpiece edge continuity, which can accurately identify the natural end time of the detection session and avoid omissions or premature termination.

[0012] In a preferred embodiment of the present invention, when jointly encoding the structural features of the execution trajectory topology graph and the visual structural semantic vector into a memory unit, the connection degree distribution and depth level distribution of each node are extracted from the execution trajectory topology graph to generate a structural feature vector; the structural feature vector is projected into the vector space of the visual structural semantic vector to generate a joint encoding vector; the joint encoding vector is associated with and stored with the skill description code of the skill attached to the current session to form a memory unit, and written to the skill library in a hot-overwrite manner. By solidifying the experience of each successful detection into a reusable memory unit, the agent can quickly retrieve similar experiences in subsequent detections, gradually realizing the autonomous evolution of detection skills.

[0013] When a system's strong constraint verification is rejected, the agent adjusts the local decision boundary of the attached skill based on the gradient difference of the image region corresponding to the rejection within the same autonomous round, and re-executes the rejected detection step. Specifically, the agent locates the image region corresponding to the rejected detection step based on the rejection result, extracts the edge pixel set and the internal pixel set of the image region; calculates the average gradient value of the edge pixel set and the average gradient value of the internal pixel set respectively, generating a gradient difference value between the edge pixel set and the internal pixel set; generates an offset of the local decision boundary based on the gradient difference value, and adjusts the decision boundary of the corresponding image region in the attached skill according to the offset; and re-executes the rejected detection step using the adjusted local decision boundary. This mechanism enables the agent to automatically correct the decision boundary based on local image features when encountering strong constraint verification anomalies without interrupting the current detection session, significantly improving the detection system's adaptability to individual workpiece differences and operating condition fluctuations.

[0014] Correspondingly, the present invention also provides an industrial vision inspection intelligent agent system with autonomous evolution capabilities, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the above-described method. This system can be deployed in industrial vision inspection sites, automatically accumulate inspection knowledge and optimize inspection behavior by running the above-described method, and continuously improve inspection accuracy and efficiency.

[0015] The technical effects and advantages provided by the present invention in the above technical solution are as follows: When a detection operation is rejected by the system's strong constraint verification, the agent extracts the edge pixel set and the internal pixel set of the image region corresponding to the rejection result, calculates the average gradient value of the two pixel sets, and generates a gradient difference value between the edge pixel set and the internal pixel set. Based on this gradient difference value, the offset of the local decision boundary is calculated, and the decision boundary of the corresponding image region in the attached skill is adjusted accordingly. The rejected detection step is re-executed within the same autonomous round using the adjusted local decision boundary, without interrupting the current session. This scheme utilizes the local gradient difference of the rejection region to directly drive the fine-tuning of the decision threshold, strictly limiting the adjustment range to the feature region related to the rejection reason, while preserving the original decision logic of other regions. This avoids restarting the entire detection process, and the time consumed for a single rejection correction is much lower than the traditional method that requires re-issuing the task from the host computer. It can effectively cope with boundary misjudgments caused by factors such as glitch and slight lighting changes, improving the first-pass yield of the detection system under complex conditions.

[0016] After a detection session is determined to have reached its final state, the connectivity degree distribution and depth level distribution of each node in the execution trajectory topology graph are extracted to generate a structural feature vector for the graph. This structural feature vector is projected into the vector space of the visual structural semantic vector to generate a joint encoding vector, which is then associated with the skill description code of the currently attached skill and stored as a memory unit. This memory unit is written to the skill library via hot-overwrite on disk. This joint encoding method allows the memory unit to carry both the visual semantic features of the workpiece and the structured behavioral features of the execution process. After the skill library is updated, when a new workpiece to be detected generates a similar visual structural semantic vector, the memory unit, which has been verified in practice, can be directly retrieved through matching, skipping the original matching process of the skill description code or narrowing the candidate range. The hot-overwrite mechanism allows the skill library to be dynamically updated during production without stopping the detection task. As production batches progress, the memory corresponding to different workpiece shapes and defect patterns in the skill library continues to accumulate. The detection path of the detection agent for repetitive structures is continuously shortened, and the detection behavior gradually tends to concentrate computing resources on new anomalies that have never been encountered before, achieving synchronous autonomous evolution of detection efficiency and accuracy. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0018] Figure 1 It is a flowchart of an industrial vision inspection intelligent agent method with autonomous evolution capability; Figure 2 This is a flowchart for determining the final state of a detection session based on the edge continuity index; Figure 3 It is a scatter plot of the projection overlap and spatial offset of each semantic sub-interval; Figure 4 This is a scatter plot showing the relationship between the block level depth and the mean confidence level of a quadtree image; Figure 5 It is a distribution map of edge intensity values ​​of image blocks at different depth levels; Figure 6 It is a comparison image of the average gradient between the edge pixel set and the internal pixel set of the image region corresponding to the rejected detection step. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] See Figure 1 This invention provides a method for an industrial vision inspection agent with autonomous evolution capability. The method includes: acquiring an original image of a workpiece to be inspected, and constructing a multi-layer image feature space based on the gradient magnitude distribution of the original image; generating a visual structure semantic vector of the workpiece to be inspected based on the multi-layer image feature space and the color distribution of the original image; matching skill description codes in a candidate detection skill library based on the visual structure semantic vector, and attaching the successfully matched skills to the agent; generating an execution trajectory topology graph with image blocks as nodes during the process of the agent performing detection with the attached skills; determining whether the current session has reached the final state based on the state of the endpoint node of the execution trajectory topology graph and the image edge continuity of the workpiece to be inspected; if the final state has been reached, jointly encoding the structural features of the execution trajectory topology graph and the visual structure semantic vector into a memory unit and writing it into a hot-overwriteable skill library; when the system strongly constrains the verification rejection, the agent adjusts the local judgment boundary of the attached skill according to the gradient difference of the image region corresponding to the rejection within the same autonomous round, and re-executes the rejected detection step.

[0021] In practice, the original image of the workpiece to be inspected is subjected to multi-scale Gaussian filtering to generate a multi-layered smooth image. Multi-scale Gaussian filtering is achieved by convolving the original image with multiple Gaussian kernels of different scales, with the standard deviation of each Gaussian kernel being... Different values ​​are taken, increasing sequentially, thus forming a multi-layered smooth image with scales ranging from fine to coarse. The set of standard deviations of the Gaussian kernel is denoted as... ,in This represents the total number of floors. The standard deviation corresponds to the smallest scale. This represents the standard deviation corresponding to the largest scale. Each smoothed image layer corresponds to a scale level, and the scale level number is denoted as . , .

[0022] For each smoothed image layer, calculate the gradient magnitude of each pixel. For scale layer number , A smooth image, at pixel coordinates gradient magnitude at Obtained through the following formula:

[0023] in, The scale level number is Smooth image at pixel coordinates grayscale value at that location express The rate of change of grayscale in the horizontal direction, express The grayscale change rate in the vertical direction. The grayscale change rates in the horizontal and vertical directions are obtained by convolving the smoothed image with the horizontal gradient operator and the vertical gradient operator.

[0024] A gradient magnitude histogram is generated for each smoothing layer based on the gradient magnitude of each pixel. When generating the gradient magnitude histogram, a range of gradient magnitude values ​​is pre-defined and the range is evenly divided. The interval, the first The gradient magnitude range of each interval is denoted as ,in , This is the lower limit for the gradient magnitude. This represents the upper limit of the gradient magnitude. The statistical scale level number is... In a smooth image, the gradient magnitude falls within the first... Number of pixels in each interval Thus, the scale hierarchy number is gradient magnitude histogram .

[0025] The gradient magnitude histograms of multiple smoothed images are stacked in scale order to generate a multi-layer image feature space. This multi-layer image feature space is a two-dimensional matrix, where rows correspond to different scale levels and columns correspond to interval indices of the gradient magnitude histograms. The elements in this multi-layer image feature space... That is , indicating the scale level number is In a smooth image, the gradient magnitude falls into the first... The number of pixels in each interval.

[0026] The multi-layer image feature space is projected along the scale direction to generate a multi-scale gradient response vector for each pixel location. For pixel coordinates... The gradient magnitude response of the pixel location at each scale level is extracted from the multi-layer image feature space. The extraction method is as follows: at scale level number... In a smooth image, based on pixel coordinates gradient magnitude at The range index to which it belongs The statistical value or gradient magnitude corresponding to this interval is used as the response value of the pixel position at this scale level. The pixel coordinates are then used as the response value of the pixel position at that scale level. exist The response values ​​at each scale level are arranged sequentially to form a multi-scale gradient response vector. ,in Represents pixel coordinates At the scale level The gradient response value.

[0027] The color distribution of the original image is quantized and encoded to generate a color attribute label for each pixel. The original image is then converted from the acquired color space to a uniform color space, in which the entire color gamut is divided into... There are 1 color category, and each color category has a category number. For pixel coordinates Based on the coordinates of its color value in a uniform color space, it is mapped to the nearest color category, and the corresponding category number is used as the color attribute label for the pixel location. .

[0028] For each pixel location, the multi-scale gradient response vector is concatenated with the color attribute label to generate a joint descriptor for that pixel location. For pixel coordinates... Its joint descriptor It is a composite vector consisting of multi-scale gradient response vectors. and color attribute tags It is assembled sequentially, that is... .

[0029] Spatial block statistics are performed on the joint descriptors for all pixel locations to generate the visual structure semantic vector. The original image is spatially divided into... The non-overlapping or overlapping image patches, the first The image blocks are denoted as For each image patch, the distribution characteristics of the joint descriptor for all pixel locations within that patch are statistically analyzed. This can be achieved by calculating the average value of each component of the joint descriptor or by constructing a histogram of each component. The [number of] [pixels] will then be [then the next] [pixel]. The statistical result vector of each image patch is denoted as: The statistical result vectors of all image patches are concatenated in a predetermined spatial order to obtain the final multidimensional vector, which is the visual structure semantic vector.

[0030] In practice, the visual structure semantic vector is divided into several semantic sub-intervals. The total dimension of the visual structure semantic vector is denoted as... The number of semantic sub-intervals is pre-defined as follows: , The value is 8. The partitioning method is as follows: the visual structure semantic vector is divided into... Each dimension is divided into equal parts according to index order. Segments, each segment contains the following number of dimensions. Or adjust appropriately based on the remainder to obtain _n_ semantic sub-intervals. The dimensional index range contained in each semantic sub-interval is denoted as ,in .

[0031] Generate the corresponding centroid for each semantic sub-interval. The centroid of a semantic sub-interval is a vector with the same dimension as the semantic sub-interval. This centroid vector is formed by the visual structure semantic vector at the th ... The semantic vector is composed of numerical values ​​across all dimensions within a semantic sub-interval. That is, if the visual structural semantic vector is denoted as... Then the first The centroid vector of each semantic subinterval for In index range Subvectors within, ,in Represents the semantic vector of visual structure The The values ​​of each dimension.

[0032] The candidate detection skill base stores multiple skill description codes, each of which is a vector with the same dimension as the visual structure semantic vector. For the first skill description code in the skill base... Each skill description code is denoted as Skill description code Divided according to the same dimensionality division method as the visual structure semantic vector. The first sub-segment, The subvectors corresponding to each sub-segment are denoted as . This subvector is composed of skill description codes. In index range The numerical composition within.

[0033] For each skill description code, calculate the projection overlap between the skill description code and the visual structure semantic vector in each semantic sub-interval. Projection overlap of semantic sub-intervals Using visual structural semantic vectors in the first The centroid vector of each semantic subinterval With skill description code The Sub-segment vectors The cosine similarity between the vectors is used to measure the similarity between them. The cosine similarity is calculated by dividing the inner product of the two vectors by the product of their magnitudes.

[0034] Calculate the first The centroid vector of each semantic subinterval With skill description code Sub-segment vectors Spatial offset between. Spatial offset Defined as the centroid vector of the interval and sub-segment vector The Euclidean distance between them.

[0035] Based on the spatial offset between the centroid of each semantic sub-interval and the corresponding skill description code segment, the projection overlap is adjusted to obtain the matching confidence of the skill description code. For the skill description code... Matching confidence The calculation formula is:

[0036] in, Indicates the first The matching confidence of each skill description code; The number of semantic sub-intervals is set to 8; The index representing the semantic sub-interval; Indicates the first The skill description code is in the first Projection overlap over semantic sub-intervals; Indicates the first The skill description code is in the first Spatial offset over semantic sub-intervals; This is the distance attenuation coefficient, and its value range is... Distance attenuation coefficient Set as The setting is based on: when the spatial offset When it is 1, This reduces the projection overlap to about 60% of its original value, thus moderately weakening the contribution of semantic sub-intervals with excessive offsets when integrating matching confidence.

[0037] After calculating the matching confidence of each skill description code in the candidate detection skill library in the above manner, select the skill description code corresponding to the highest matching confidence value, and attach the detection skill associated with the skill description code to the agent to complete the skill matching and attachment.

[0038] See Figure 3The figure illustrates the matching relationship between the centroid vector of each semantic sub-interval and the skill description code segments in the candidate detection skill base after dividing the visual structure semantic vector into eight semantic sub-intervals. The horizontal axis represents the projection overlap, which is the cosine similarity between the centroid of the visual structure semantic vector and the corresponding segment of the skill description code, ranging from approximately 0.58 to 0.87, reflecting the directional consistency of the two vectors in the semantic sub-interval. The vertical axis represents the spatial offset, which is the Euclidean distance between the centroid vector of the sub-interval and the skill description code sub-vector, ranging from approximately 0.1 to 1.3, reflecting the distance deviation between the two in the vector space. The points of different colors in the figure correspond to the eight semantic sub-intervals, and the distribution of the points reflects the relationship between the projection overlap and the spatial offset of each sub-interval.

[0039] Overall, the spatial offset decreases as the projection overlap increases, indicating that sub-intervals with higher matching degrees correspond to smaller spatial offsets. This aligns with the design principle of using spatial offset to attenuate and adjust the projection overlap. The projection overlap is concentrated in the range of 0.65 to 0.8, with most data points having spatial offsets between 0.1 and 0.8. This suggests that most semantic sub-intervals and skill description code segments exhibit good directional consistency and limited offset during the matching process. The data points in each semantic sub-interval show relatively similar distribution ranges in terms of projection overlap and spatial offset, with no significant outliers, reflecting the diverse matching characteristics between different semantic sub-intervals and skill description codes in the skill library.

[0040] In practice, the original image is divided into multiple layers of image blocks using a quadtree segmentation method, with each layer having a different scale. Quadtree segmentation starts with the entire original image as the root node image block and performs recursive segmentation operations on it. When segmenting an image block, it is divided equally in both the horizontal and vertical directions, generating four sub-image blocks of the same size. These four sub-image blocks are then assigned to the corresponding quadtree segmentation child nodes. This segmentation process continues until the recursion termination condition is met. The recursion depth is adaptively determined based on the resolution of the original image; the higher the resolution of the original image, the greater the recursion depth. In practice, the recursion depth is set... The calculation method is as follows ,in The pixel width of the original image. The pixel height of the original image. Indicates taking and The smaller value in This is the depth offset constant. Indicates rounding down. Depth offset constant. The setting is 6, based on the principle of controlling the recursion depth of images with common resolutions between 3 and 6 layers. This is applicable when the original image resolution is... hour, , recursion depth When the resolution of the original image is At that time, recursion depth When the resolution of the original image is At that time, recursion depth This allows the recursion depth to increase with increasing resolution. This generates... Layer image patch, number The scale of the layer image patch is the same as the original image size. ,in , The corresponding root node image block layer.

[0041] Each image patch is treated as a node in the execution trajectory topology graph. For each image patch generated by quadtree segmentation, a corresponding node is created in the execution trajectory topology graph. The node is identified by the quadtree path encoding of the image patch, which is determined by the level number of the image patch. It is composed of the image patch's position index within that layer. The position index represents the row and column index of the image patch among all image patches in its layer.

[0042] The edges of the execution trajectory topology graph are generated based on the spatial adjacency and scale inheritance relationships between image patches. Spatial adjacency is defined as follows: within the same level, if two image patches are spatially adjacent, then in the execution trajectory topology graph, there is an undirected edge between the nodes corresponding to these two image patches. Scale inheritance is defined as follows: if the first... A layer of image blocks is composed of the first If an image patch at a layer is generated through quadtree segmentation, then in the execution trajectory topology graph, there is a directed edge between the nodes corresponding to the image patches at the two different layers, with the direction of the directed edge starting from the first layer. The nodes of the layer point to the first Layer nodes.

[0043] After a mounted skill performs a detection operation on any image patch, it records the operation type identifier and the post-operation image patch state parameters on the corresponding node. The operation type identifier indicates the type of detection operation performed by the mounted skill on the image patch. Values ​​for the operation type identifier include edge detection, texture analysis, defect localization, and defect classification. The post-operation image patch state parameters include the number of detected defect candidate regions within the image patch, the set of center coordinates of the defect candidate regions, and the average confidence score of the defect candidate regions. These operation type identifiers and post-operation image patch state parameters are appended to the corresponding node in the execution trajectory topology graph as attribute key-value pairs.

[0044] Based on the image patch state parameters and edge connections of each node, an execution trajectory topology graph is generated. All nodes, edges, and the operation type identifier and post-operation image patch state parameters recorded on each node are integrated into a graph data structure. The execution trajectory topology graph is stored in the form of an adjacency list. Each entry in the adjacency list contains a node's path code, a list of directed edges pointing to its child nodes, a list of undirected edges connecting it to adjacent nodes, and the node's associated attribute dataset. Thus, the execution trajectory topology graph with image patches as nodes is obtained.

[0045] See Figure 4 In the figure, the horizontal axis represents the number of candidate defect regions, in units of "number", ranging from 0 to 18, and the vertical axis represents the mean confidence level, ranging from 0.5 to 1.0. The figure uses scatter points of different colors to distinguish the corresponding depth level δ, with colors from purple to yellow representing depth levels from 0 to 5, and the scatter points of each depth level are evenly distributed in the figure.

[0046] Overall, as the number of defect candidate regions increases, the mean confidence level shows a clear downward trend, reflecting that when fewer defect candidate regions are detected, the recorded mean confidence level is higher, reaching close to 1.0; while when the number of defect candidate regions increases to more than 10, the mean confidence level is mostly concentrated in the lower range of 0.5 to 0.7.

[0047] Regarding the distribution patterns at different depth levels, the root node level δ=0 (dark purple) exhibits a relatively dispersed distribution of the mean confidence score when the number of defect candidate regions is small (0 to 5), reaching a maximum of 0.98, indicating that this level is highly sensitive to a small number of defect candidate regions. As the depth level increases (δ=1 to δ=5, with the color gradually changing from purplish-red to yellow), the scattered points corresponding to each level gradually cluster towards regions with a larger number of defect candidate regions (more than 5) and a lower mean confidence score (0.5 to 0.8), indicating that the smaller the image patch scale (the deeper the level), the more defect candidate regions are detected, while the overall mean confidence score tends to decrease.

[0048] Furthermore, the yellow scattered points at the depth level (δ=5) remained relatively concentrated even when the number of defect candidate regions exceeded 10, with confidence levels fluctuating between 0.5 and 0.6. This indicates that the confidence level of the finest-grained image patch was relatively stable but low in identifying densely defected regions. In contrast, shallower levels (δ=0, 1) showed lower confidence levels when the number of defects was large, suggesting that their detection capability was mainly concentrated in scenarios with fewer defect candidate regions at larger scales.

[0049] In specific implementation, please refer to Figure 2 The algorithm iterates through all nodes in the execution trajectory topology graph. For each node, it counts the number of directed edges pointing from that node to its child nodes. These directed edges represent the scale inheritance relationships established during quadtree segmentation, pointing from the parent node to the child node. If a node has zero directed edges, it is marked as the endpoint node. The endpoint node corresponds to an image patch that is no longer subdivided in the quadtree segmentation, i.e., a leaf node image patch.

[0050] For each endpoint node, obtain the edge intensity value of the image patch corresponding to that endpoint node. The edge intensity value is calculated as follows: extract the pixel region of the image patch corresponding to the endpoint node, apply a horizontal edge detection convolution kernel and a vertical edge detection convolution kernel to that pixel region to obtain the horizontal and vertical gradient responses at each pixel location. For each pixel location within the pixel region, calculate the arithmetic square root of the sum of the squares of the horizontal and vertical gradient responses, and use this as the gradient magnitude at that pixel location. Calculate the arithmetic mean of the gradient magnitudes at all pixel locations within the pixel region; the resulting arithmetic mean is the edge intensity value of the image patch corresponding to that endpoint node. Then, the... The edge intensity value of the image patch corresponding to each endpoint node is denoted as . ,in , This represents the total number of endpoint nodes.

[0051] Calculate the dispersion of the image patch edge intensity values ​​corresponding to all endpoint nodes. The dispersion is measured using the coefficient of variation of the image patch edge intensity values. Defined as:

[0052] in, This represents the coefficient of variation of the edge intensity values ​​of the image patches corresponding to all endpoint nodes; Indicates the total number of endpoint nodes; Indicates the first The edge intensity values ​​of the image patches corresponding to each endpoint node; This represents the average edge intensity value of the image patch corresponding to all endpoint nodes. .

[0053] An edge continuity index is generated based on the aforementioned degree of dispersion. Edge continuity index The calculation method is as follows:

[0054] in, Indicates the continuity of the edge; This refers to the aforementioned coefficient of variation. The smaller the dispersion of the image patch edge intensity values, the better. The closer to 0, the stronger the edge continuity index. The closer the value is to 1, the more consistent the edge intensity of the image blocks at each endpoint node is, indicating good spatial continuity of the workpiece edge.

[0055] In specific implementation, a first final state threshold is preset. First final state threshold Set as The setting is based on: when the edge continuity index Higher than When, coefficient of variation Below This indicates that the edge strength fluctuation between endpoint nodes does not exceed 15% of the average edge strength, meeting the quality requirements for edge integrity in industrial visual inspection. If If all endpoint nodes have undergone detection operations by the attached skill, the current session is considered to have reached its final state. The method for determining whether an endpoint node has undergone detection operations by the attached skill is as follows: check if the endpoint node in the execution trajectory topology graph records an operation type identifier. If the node has an operation type identifier and the identifier is not empty, then the endpoint node is considered to have undergone detection operations by the attached skill. When both of the above conditions are met simultaneously, the agent terminates the current detection session.

[0056] See Figure 5 In the figure, the horizontal axis represents the endpoint node number, and the vertical axis represents the edge intensity value of the image patch corresponding to the endpoint node, with values ​​ranging from approximately 0.60 to 0.90. The legend distinguishes four different depth levels. , which are 2, 3, 4 and 5 respectively, corresponding to leaf node image blocks at different levels in quadtree segmentation.

[0057] From the distribution of points in the image, the depth levels... The points are generally located in a high edge intensity range, fluctuating between approximately 0.70 and 0.88, and exhibit a relatively uniform distribution, indicating that the edge intensity of image patches in deeper layers is generally stronger and more stable. (Depth layer) The point distribution is the second most common, with most edge strength values ​​concentrated in the 0.70 to 0.85 range, and the trend is similar to... The hierarchical levels are similar but slightly lower. Depth level and The point distribution is relatively scattered, with low edge intensity values, mainly concentrated between 0.62 and 0.78, and there are some nodes with weak edge intensity, indicating that the edge intensity of shallower layer image blocks is weak and fluctuates greatly.

[0058] In practical implementation, after determining that the current session has reached its final state, the connection degree distribution and depth level distribution of each node are extracted from the execution trajectory topology graph to generate the structural feature vector of the execution trajectory topology graph. For the [node name missing] node in the execution trajectory topology graph... For each node, count the total number of edges directly connected to it, which is used as the degree of that node, denoted as . The connectivity degree includes the sum of the number of neighboring nodes connected to this node via spatial adjacency edges and the number of parent and child nodes connected via scale inheritance edges. Simultaneously, the number of nodes is recorded. The level number of a node in the quadtree partition is used as the depth level of that node, denoted as . , ,in This indicates that the node is the root node image patch. This indicates that the node is the deepest level image patch.

[0059] The connectivity values ​​of all nodes in the execution trajectory topology graph are arranged in depth-first traversal order within the quadtree, forming a connectivity degree sequence. Statistics are extracted from this sequence, including the maximum connectivity degree, the variance of the connectivity degree, and the entropy of the connectivity degree sequence. The entropy of the connectivity degree sequence is calculated by counting the frequency of different connectivity degree values ​​in the sequence, and denoting the frequency of each different connectivity degree value as . ,in Indices for different connection degree values, and entropy values ​​of the connection degree sequence. The calculation formula is:

[0060] in, This represents the entropy value of the connection degree sequence; This represents the total number of different connection degree values ​​in the connection degree sequence; Indicates the ordinal index of different connectivity degree values. ; Indicates the first The frequency of different connectivity degree values ​​in the connectivity degree sequence The range of values ​​is Simultaneously, the distribution of depth levels of all nodes is statistically analyzed, and a depth-level histogram is generated. The depth-level histogram is a single... A dimensional vector, where the dimensional vector is... Each element is a depth level index. The number of nodes. The maximum connection degree, the variance of connection degree, the entropy of the connection degree sequence, and the depth-level histogram vector are concatenated in order. The resulting concatenated vector is the structural feature vector of the execution trajectory topology graph, denoted as . .

[0061] structural feature vectors Projecting the vectors onto the vector space of the visual structure semantic vectors generates a joint encoding vector. The dimension of the vector space of the visual structure semantic vectors is... The projection operation is implemented using a pre-defined linear mapping matrix, denoted as . The dimension of the linear mapping matrix is ,in Structural feature vectors The dimension of the joint encoding vector. We obtain this through matrix multiplication: Linear mapping matrix The value is determined by pre-training a large number of workpiece samples with structural feature vectors and visual structural semantic vectors through canonical correlation analysis. After the training converges, the linear mapping matrix remains fixed and no longer changes with the detection session.

[0062] Joint coding vector The skill description code is associated with the skill attached to the current session and stored to form a memory unit. The skill description code is the vector that best matches the visual structure semantic vector selected during the skill matching phase. The memory unit's data structure contains three fields: the joint encoding vector field stores the joint encoding vector. The skill description code field stores the skill description code. The timestamp field stores the system time of the current detection session. Memory units are written to the hot-overwriteable skill library using a disk hot-overwrite method. Disk hot-overwrite means that during system operation, without stopping or restarting the agent system, the memory units are directly serialized into a binary byte stream, and appended to the end of the skill library file via the operating system's file write interface. If the remaining storage space of the skill library file is lower than a preset storage space threshold, the earliest written memory units are deleted based on the timestamp field, the storage space is released, and then the write operation is performed again, thereby achieving online dynamic expansion of the skill library.

[0063] When a system-wide strong constraint verification rejection occurs, the image region corresponding to the rejected detection step is located based on the rejection result. System-wide strong constraint verification refers to the external quality control system reviewing the agent's detection results according to a preset workpiece defect judgment standard table. When the review result differs from the agent's detection result, the external quality control system issues a rejection signal. The rejection result includes the coordinate bounding box on the original image corresponding to the rejected detection step. Based on the coordinate bounding box in the rejection result, the image region corresponding to the rejected detection step is cropped from the original image, and this image region is denoted as... .

[0064] Extract image region The edge pixel set and the internal pixel set. For image regions An edge detection convolution kernel is applied to obtain the edge intensity response at each pixel location. The set of pixel locations whose edge intensity response is greater than a preset edge threshold is defined as the edge pixel set, denoted as . The preset edge threshold is set to the image region. Forty percent of the maximum intensity response at the inner edge. [Image region] The set of all pixel locations that are not marked as edge pixel sets is called the internal pixel set, denoted as . .

[0065] Calculate the edge pixel set separately Average gradient value and internal pixel set The average gradient value. The average gradient value of the edge pixel set. This is the arithmetic mean of the gradient magnitudes at all pixel locations within the edge pixel set. The average gradient value within the inner pixel set. This is the arithmetic mean of the gradient magnitudes at all pixel locations within the inner pixel set. It generates the gradient difference value between the edge pixel set and the inner pixel set. Gradient difference value The calculation method is the absolute value of the difference between the average gradient value of the edge pixel set and the average gradient value of the inner pixel set: .

[0066] Based on gradient difference value Generate the offset of the local decision boundary. Offset of the local decision boundary. This is obtained by multiplying the gradient difference value by a preset scaling factor: Proportionality coefficient Set as The setting is based on the following: In the mounting skill, the local judgment boundary is used to distinguish the grayscale or gradient threshold values ​​of defective pixels from normal pixels. When the gradient difference between the edge and the interior is large, it indicates that there is an abnormal gradient transition in the edge region, and the judgment boundary needs to be appropriately relaxed to avoid missed detection. (Scale coefficient) This ensures that the offset is approximately one-fifth of the gradient difference value, preventing excessively large single adjustments from causing oscillations at the decision boundary.

[0067] The judgment boundary of the corresponding image region in the mounting skill is adjusted according to the aforementioned offset. The mounting skill has preset settings for image regions. The decision boundary parameter set includes an upper and lower limit value for the defect decision threshold. Both the upper and lower limits are increased simultaneously. This yields the adjusted local decision boundaries. The rejected detection steps are then re-executed using these adjusted local decision boundaries, i.e., within the image region. The adjusted decision boundary parameter set is applied to re-determine the defect detection, generate new detection results, and submit the new detection results to the system strong constraint verification within the same autonomous round.

[0068] See Figure 6 In the figure, the horizontal axis represents the sample sequence number, totaling 500 samples, and the vertical axis represents the average gradient value (dimensionless). The curves consist of two lines: the average gradient value of the edge pixel set (solid line, orange) and the average gradient value of the inner pixel set (dashed line, blue). The average gradient value of the edge pixel set is generally stable between 0.65 and 0.85, with small fluctuations, exhibiting a high and stable gradient response level, indicating that the gradient intensity in the edge region is concentrated and has good consistency. The average gradient value of the inner pixel set remains in the lower range of 0.15 to 0.28, and the fluctuation range is smaller than that of the edge pixel set, reflecting a weaker gradient in the inner region and a significant difference between the gradients of the edges and the interior. The two curves remain clearly separated throughout the entire sample sequence range, without crossing or showing similar trends, indicating high stability and discriminative power of the gradient features of the edge pixel set and the inner pixel set.

[0069] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for an industrial vision inspection intelligent agent with autonomous evolution capability, characterized in that, include: Acquire the original image of the workpiece to be inspected, and construct a multi-layer image feature space based on the gradient magnitude distribution of the original image; Based on the multi-layer image feature space and the color distribution of the original image, a visual structural semantic vector of the workpiece to be detected is generated. Based on the visual structure semantic vector, match the skill description codes in the candidate detection skill library, and attach the successfully matched skills to the intelligent agent; During the process of the agent performing detection with the attached skills, an execution trajectory topology map with image blocks as nodes is generated; The agent determines whether the current session has reached the final state based on the state of the endpoint node in the execution trajectory topology map and the continuity of the image edges of the workpiece to be detected. If the final state is reached, the structural features of the execution trajectory topology graph and the visual structure semantic vector are jointly encoded into a memory unit and written into a hot-overwriteable skill library; When the system's strong constraint verification is rejected, the agent adjusts the local judgment boundary of the attached skill based on the gradient difference of the image region corresponding to the rejection within the same autonomous round, and re-executes the rejected detection step.

2. The industrial vision inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, The construction of a multi-layer image feature space based on the gradient magnitude distribution of the original image includes: The original image is subjected to multi-scale Gaussian filtering to generate a multi-layer smooth image; For each smoothed image layer, calculate the gradient magnitude of each pixel and generate a gradient magnitude histogram for each smoothed image layer based on the gradient magnitude of each pixel. The gradient magnitude histograms of multiple smooth images are stacked in scale hierarchy order to generate a multi-layer image feature space.

3. The industrial visual inspection intelligent agent method with autonomous evolution capability according to claim 2, characterized in that, The generation of the visual structural semantic vector of the workpiece to be detected includes: The multi-layer image feature space is projected along the scale direction to generate a multi-scale gradient response vector for each pixel location. The color distribution of the original image is quantized and encoded to generate a color attribute label for each pixel location; For each pixel location, the multi-scale gradient response vector is concatenated with the color attribute label to generate a joint descriptor for that pixel location; Spatial block statistics are performed on the joint descriptors of all pixel locations to generate the visual structure semantic vector.

4. The industrial vision inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, The skill description code in the candidate skill base matched based on the visual structure semantic vector includes: The visual structure semantic vector is divided into several semantic sub-intervals, and an interval centroid is generated for each semantic sub-interval; For each skill description code in the candidate detection skill library, calculate the projection overlap between the skill description code and the visual structure semantic vector in each semantic sub-interval; Based on the spatial offset between the centroid of each semantic sub-interval and the corresponding skill description code segment, the projection overlap is adjusted to obtain the matching confidence of each skill description code. The skill corresponding to the skill description code with the highest matching confidence is selected and attached to the intelligent agent.

5. The industrial visual inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, During the process of the agent performing detection using the attached skill, the generation of an execution trajectory topology map with image patches as nodes includes: The original image is divided into multiple layers of image blocks using a quadtree segmentation method, with each layer having a different scale; Each image block is used as a node in the execution trajectory topology graph, and the edges of the execution trajectory topology graph are generated based on the spatial adjacency and scale inheritance relationships between the image blocks. When the mounting skill performs a detection operation on any image block, it records the operation type identifier and the image block status parameters after the operation on the node corresponding to the image block. The execution trajectory topology graph is generated based on the image block state parameters of each node and the connection relationship of the edges.

6. The industrial visual inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, The intelligent agent determines whether the current session has reached the final state based on the state of the endpoint node in the execution trajectory topology map and the image edge continuity of the workpiece to be detected, including: Extract all nodes with an out-degree of zero from the execution trajectory topology graph as endpoint nodes, and obtain the edge intensity value of the image patch corresponding to each endpoint node; Calculate the dispersion of the edge intensity values ​​of the image blocks corresponding to all endpoint nodes, and generate an edge continuity index based on the dispersion. If the edge continuity index is higher than the preset first final state threshold and all endpoint nodes have been detected by the mounted skill, then the current session is determined to have reached the final state.

7. The industrial vision inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, The step of jointly encoding the structural features of the execution trajectory topology map and the visual structural semantic vector into a memory unit and writing it into a hot-overwriteable skill library includes: Extract the connection degree distribution and depth level distribution of each node from the execution trajectory topology graph to generate the structural feature vector of the execution trajectory topology graph; The structural feature vector is projected into the vector space of the visual structural semantic vector to generate a joint encoding vector; The joint encoding vector is associated with and stored with the skill description code of the skill attached to the current session to form the memory unit, and the memory unit is written to the skill library by hot-overwriting the disk.

8. The industrial vision inspection intelligent agent method with autonomous evolution capability according to claim 1, characterized in that, When the system's strong constraint verification is rejected, the agent adjusts the local decision boundary of the attached skill based on the gradient difference of the image region corresponding to the rejection within the same autonomous round, and re-executes the rejected detection step, including: Based on the rejection results of the system's strong constraint verification, the image region corresponding to the rejected detection step is located, and the edge pixel set and internal pixel set of the image region are extracted. Calculate the average gradient value of the edge pixel set and the average gradient value of the inner pixel set respectively to generate the gradient difference value between the edge pixel set and the inner pixel set; The offset of the local determination boundary is generated based on the gradient difference value, and the determination boundary of the corresponding image region in the mounted skill is adjusted according to the offset. The rejected detection steps are re-executed using the adjusted local decision boundaries.

9. The industrial vision inspection intelligent agent method with autonomous evolution capability according to claim 5, characterized in that, The recursion depth of the quadtree segmentation method is adaptively determined based on the resolution of the original image; the higher the resolution, the greater the recursion depth.

10. An industrial vision inspection intelligent agent system with autonomous evolution capability, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the industrial vision inspection intelligent agent method with autonomous evolution capability as described in any one of claims 1 to 9.