Test plan management method and device based on ai vision

By using AI vision-based test scheme management methods to dynamically adjust detection paths and template combinations, the problems of insufficient detection accuracy and adaptability in existing technologies are solved. This enables efficient structural feature extraction and adaptive optimization, thereby improving detection accuracy and system stability.

CN121169871BActive Publication Date: 2026-04-17LUDONG UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LUDONG UNIVERSITY
Filing Date
2025-09-17
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing industrial testing solutions and management methods lack task awareness capabilities and cannot effectively adapt and control paths in multi-task and multi-template scenarios, resulting in decreased detection accuracy, insufficient template matching rate, and delayed feedback response, making it difficult to adapt to complex detection environments with strong image structural heterogeneity.

Method used

An AI vision-based test scheme management method is adopted, which combines a task control context mechanism, a topology template switching mechanism, and a feedback optimization aggregation strategy to dynamically adjust the detection path. Specific channel paths are selected and activated through task control context units. The optimal topology template combination is called in combination with image structure complexity and historical scoring records to generate structure optimization vectors for network weight allocation and template path scoring function updates.

Benefits of technology

It improves the adaptability of test paths, enhances the accuracy of structural feature extraction, realizes dynamic self-learning optimization, and improves detection accuracy and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121169871B_ABST
    Figure CN121169871B_ABST
Patent Text Reader

Abstract

This invention discloses a test scheme management method and apparatus based on AI vision, comprising the following steps: S1, acquiring the image to be tested and preprocessing it to generate an inference input image; S2, extracting the detection category, threshold, and target region coordinates of the image corresponding to the task, constituting task parameters; S3, inputting the inference image and task parameters into an improved TTNet, activating specific channel paths and optimal template combinations, and outputting prediction results and template path numbers; S4, comparing the prediction with the task parameters to generate image detection labels; S5, recording the image number, task type, path number, and label as a test log; S6, extracting the path number and channel number of unqualified images to generate a structure optimization vector; S7, updating the channel weights and path scoring function using the structure optimization vector to dynamically adjust the test path. This invention achieves precise control of the test scheme path, improves detection accuracy and feedback response efficiency, and is applicable to various types of industrial vision inspection tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial test management technology, and in particular to a test scheme management method and apparatus based on AI vision. Background Technology

[0002] In traditional industrial testing solution management, different image detection tasks typically rely on manually configuring fixed detection models and static template combinations. This makes dynamic optimization difficult based on test task type, image structural complexity, and historical misclassification records. Common methods generally lack task awareness, have simplistic model structures, and cannot effectively adapt and adjust paths in multi-task, multi-template scenarios, leading to decreased detection accuracy, insufficient template matching rates, and delayed feedback responses. Furthermore, existing systems lack error path analysis and structural adjustment mechanisms for non-compliant images during execution, failing to achieve closed-loop optimization of test paths and impacting overall testing efficiency and accuracy.

[0003] Furthermore, mainstream visual inspection networks generally rely on unified feature extraction channels and static template selection mechanisms when handling changes in task parameters, lacking task-type-guided context selection strategies and path optimization capabilities, making them ill-suited for complex inspection environments with highly heterogeneous image structures. They also fail to establish effective feedback aggregation mechanisms for adjusting the structure of template paths and channel activations from historical detection errors, limiting the network's self-learning and adaptive capabilities. Existing test scheme management methods generally lack dynamic feedback optimization capabilities, easily leading to problems such as path failure, feature redundancy, and recognition confusion in continuous detection. Therefore, there is an urgent need to construct an integrated visual inspection test scheme management method with task control capabilities, template selection mechanisms, and structural optimization feedback capabilities.

[0004] Therefore, how to provide AI vision-based test solution management methods and devices is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] One objective of this invention is to propose a test scheme management method and device based on AI vision. This invention combines a task control context mechanism, a topology template switching mechanism, and a feedback optimization aggregation strategy to achieve adaptive path activation and dynamic optimization of test tasks. It has the advantages of strong task adaptability, high efficiency in structural optimization, and good detection accuracy.

[0006] The test scheme management method based on AI vision according to an embodiment of the present invention includes the following steps:

[0007] S1. Acquire the image to be tested and preprocess it to generate the inference input image;

[0008] S2. Based on the task type corresponding to the image, extract the target category, judgment threshold and target region coordinates to form task parameters;

[0009] S3. Input the inference input image and task parameters into the improved TTNet network, which includes a task control context unit, a template switching mechanism and a feedback tuning aggregator. The task control context unit selects and activates a specific channel path according to the task type. The template switching mechanism calls the optimal topology template combination based on the image structure complexity and historical scoring records, performs structural feature extraction and detection inference, and outputs the predicted target category, predicted coordinates, predicted confidence and template path number.

[0010] S4. Based on the target category and target region coordinates in the task parameters, compare the prediction results one by one to see if the category is consistent and whether the coordinates fall within the error threshold range, generate a detection label for each image, and mark it as qualified or unqualified.

[0011] S5. Record the image number, task type, template path number, and detection marker as a test execution log;

[0012] S6. Extract the template path number and channel path number of all non-compliant images from the detection markers, input them into the feedback tuning aggregator, aggregate the activation features of historical error paths and the current detection channel, and generate a structure optimization vector.

[0013] S7. Use the structure optimization vector to update the path scoring function of the channel weight allocation and template switching mechanism of the task control context unit, and dynamically adjust the test path.

[0014] Optionally, the preprocessing in step S1 includes performing resolution unification, brightness normalization, and edge enhancement operations on the image to be tested to generate an inference input image.

[0015] Optionally, the threshold in step S2 includes a category confidence threshold and a coordinate deviation threshold, which are used to control the criteria for judging the validity of the detection results.

[0016] Optionally, the process of the task control context unit selecting and activating a specific channel path according to the task type in step S3 includes:

[0017] S311. Read the task type identifier in the task parameters and map the task type identifier to a preset channel priority index table. The index table is a vector of length N, where each position corresponds to a channel path number in the network backbone.

[0018] S312. Extract the edge image from the inference input image, use the Sobel operator to calculate the gradient magnitude of each pixel in the horizontal and vertical directions, perform mean pooling on the gradient magnitude image to obtain the mean vector of the edge response.

[0019] S313. Extract the color distribution features of the image, convert the image to the HSV color space, and calculate the mean and variance of the H, S, and V channels respectively to form a color statistical vector.

[0020] S314. The mean vector of edge response and the color statistics vector are concatenated to form a structure-aware feature vector, which is then input into the channel scoring calculation unit. The convolution kernels corresponding to each channel are called to perform one-dimensional convolution on the structure-aware feature vector in sequence to obtain a response score vector of length N.

[0021] S315. Multiply the channel priority index table and the response score vector element by element to generate a fusion score vector. Sort the fusion score vector from largest to smallest and obtain the set of channel path numbers in the top k positions of the sorting, which will be used as the set of channel paths activated by the current task.

[0022] S316. During the model forward propagation phase, only the channels corresponding to the channel path set are enabled, while the remaining channels remain frozen. At the same time, the channel path number set is recorded in the structured test execution log.

[0023] Optionally, the template switching mechanism in step S3, which calls the optimal topology template combination based on image structure complexity and historical scoring records, includes:

[0024] S321. Divide the inference input image into several image regions of fixed size, use an edge detection operator to extract the edge image for each region, and calculate the gray-level variance of the pixels in the edge image within each region as the structural complexity score of the region.

[0025] S322. Calculate the average value and fluctuation range of the structural complexity score for all image regions, combine them into the structural complexity index of the current image, and save it by binding the image number.

[0026] S323. Read the set of template path numbers corresponding to the current task type, retrieve the historical detection accuracy, average number of false detections and number of task calls corresponding to each template path number from the template performance database, and construct a template historical scoring record table.

[0027] S324. For each template path number, assign a scoring weight based on the template historical scoring record table, match and score it with the structural complexity index of the current image, and generate a comprehensive score value for each template path number.

[0028] S325. Sort all template path numbers from high to low according to the comprehensive score, and select the top-ranked template path numbers to form the template combination set for the current task.

[0029] S326. In the channel path that has been activated in the task control context unit, the template parameters in the template combination set are called in sequence to perform image feature extraction and target detection operations, and the corresponding predicted target category and predicted coordinates are output respectively.

[0030] S327. Associate the template path number used in each detection with the corresponding prediction result and save it as a set of structured detection results.

[0031] Optionally, step S4 specifically includes:

[0032] S41. Extract the predicted target category, prediction confidence, prediction coordinates and template path number corresponding to each image from the structured detection result set, and establish a correspondence with the image number;

[0033] S42. Call the target category and category confidence threshold in the task parameters, perform a matching judgment between the predicted target category and the target category. If they do not match, it is judged as unqualified; if they match but the prediction confidence is lower than the category confidence threshold, it is judged as unqualified and a corresponding unqualified label is generated.

[0034] S43. Call the target area coordinates and coordinate deviation threshold in the task parameters to calculate the error values ​​between the predicted coordinates and the target coordinates in the horizontal and vertical directions.

[0035] S44. Compare the horizontal and vertical errors with the coordinate deviation thresholds respectively. If the error in either direction exceeds the threshold, it is judged as unqualified and a corresponding unqualified mark is generated.

[0036] S45. When the predicted target category is consistent, the prediction confidence is not lower than the threshold, and the predicted coordinates fall within the allowable error range, a corresponding qualified label is generated.

[0037] S46. Write the image number, task type, template path number, and detection tag into the structured detection tag table.

[0038] Optionally, step S6 includes the following operations:

[0039] S61. Filter out all images marked as unqualified from the detection markers, extract the corresponding template path number and channel path number, call the historical scoring log recorded by the template switching mechanism and the channel path record activated in the task control context unit, align and aggregate the current activated feature vector of the channel path corresponding to the unqualified image with the path scoring weight corresponding to the historical scoring record, and construct the path association tensor.

[0040] S62. Based on the coupling relationship between the activation features of each path and the score residual in the path association tensor, perform a similarity-weighted average operation according to path clustering to generate the aggregated feature vector of historical error paths and the aggregated activation vector of the current channel.

[0041] S63. After concatenating the historical error path aggregated feature vector with the current channel activation aggregated vector, input the input to the feedback tuning aggregator to perform channel response deviation calculation and extract the high-frequency activation mode of each channel in the error sample.

[0042] S64. Number the channel paths with the highest m% activation frequency in the task control context unit, calculate the corresponding average gradient direction, construct the corrected gradient vector according to the average gradient direction, and apply it to the weight parameters corresponding to the channel path to form the channel correction vector.

[0043] S65. Based on the average score residual of the template path number in the historical score record, construct a score offset factor, and perform field-level weighted adjustment in combination with the current weight coefficient of the score function to form a template correction vector.

[0044] S66. For the channel path number that was not selected in the scoring ranking, call the average gradient direction of the most recent task cycle, generate a gradient vector in the opposite direction, scale it according to the preset decay coefficient to form a negative correction amount, apply the negative correction amount to the weight parameters of the corresponding channel path, and complete the negative gradient decay process.

[0045] S67. After concatenating the channel correction vector and the template correction vector, input them into the feature fusion function to perform a joint transformation of the channel dimension and the path dimension, generating a structure optimization vector.

[0046] According to an embodiment of the present invention, a test scheme management device based on AI vision includes:

[0047] The image acquisition and preprocessing module is used to acquire the image to be tested and perform preprocessing operations to generate the inference input image;

[0048] The task parameter extraction module is used to extract the target category, judgment threshold, and target region coordinates based on the task type of the image.

[0049] An improved TTNet network module is used to receive inference input images and task parameters, and perform structural feature extraction and detection inference operations;

[0050] The task control context unit is used to select and activate specific channel paths according to the task type and control the response process of characteristic channels.

[0051] The template switching mechanism is used to call the optimal combination of topological templates based on the image structure complexity and historical scoring records;

[0052] The detection result comparison module is used to compare each detection result according to the task parameters and generate detection tags;

[0053] The test execution log recording module is used to record image number, task type, template path number, and detection tag information;

[0054] The feedback tuning aggregator is used to aggregate the activation features of historical error paths and the current detection channel to generate a structure optimization vector;

[0055] The path dynamic update module is used to apply the structure optimization vector to the channel weight allocation and path scoring function update operations.

[0056] The beneficial effects of this invention are:

[0057] (1) Improve test path adaptability: The present invention dynamically selects and activates channel paths based on task type through task control context unit, and calls the optimal topology template combination by template switching mechanism in combination with image structure complexity and historical scoring records. It can automatically adjust the detection path according to different test tasks and improve the system's adaptability to diverse test scenarios.

[0058] (2) Enhance the accuracy of structural feature extraction: This invention utilizes a template switching mechanism coupled with a reasoning strategy based on structural complexity, combined with a structural optimization vector generated by a feedback tuning aggregator, to continuously optimize the task control path and template combination strategy, thereby improving the accuracy of structural feature extraction and detection accuracy.

[0059] (3) Realize dynamic self-learning optimization mechanism: This invention collects structural information of unqualified image detection paths through a feedback tuning aggregator, generates structural optimization vectors and updates network weight allocation and template path scoring function, realizes adaptive correction based on historical error paths, and improves the long-term stability and automatic optimization capability of the test system. Attached Figure Description

[0060] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0061] Figure 1 This is an overall flowchart of the test scheme management method based on AI vision proposed in this invention;

[0062] Figure 2 This is a block diagram of the module structure of the test scheme management device based on AI vision proposed in this invention. Detailed Implementation

[0063] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0064] refer to Figure 1and Figure 2 The test scheme management method based on AI vision includes the following steps:

[0065] S1. Acquire the image to be tested and preprocess it to generate the inference input image;

[0066] S2. Based on the task type corresponding to the image, extract the target category, judgment threshold and target region coordinates to form task parameters;

[0067] S3. Input the inference input image and task parameters into the improved TTNet network, which includes a task control context unit, a template switching mechanism and a feedback tuning aggregator. The task control context unit selects and activates a specific channel path according to the task type. The template switching mechanism calls the optimal topology template combination based on the image structure complexity and historical scoring records, performs structural feature extraction and detection inference, and outputs the predicted target category, predicted coordinates, predicted confidence and template path number.

[0068] S4. Based on the target category and target region coordinates in the task parameters, compare the prediction results one by one to see if the category is consistent and whether the coordinates fall within the error threshold range, generate a detection label for each image, and mark it as qualified or unqualified.

[0069] S5. Record the image number, task type, template path number, and detection marker as a test execution log;

[0070] S6. Extract the template path number and channel path number of all non-compliant images from the detection markers, input them into the feedback tuning aggregator, aggregate the activation features of historical error paths and the current detection channel, and generate a structure optimization vector.

[0071] S7. The structure optimization vector is used to update the path scoring function of the channel weight allocation and template switching mechanism of the task control context unit, dynamically adjusting the test path. In actual implementation, the parameter update operation of the task control context unit and the template switching mechanism takes the structure optimization vector as the core input to complete the dynamic adjustment of the test path. First, the channel correction component and template correction component are extracted from the structure optimization vector generated by the feedback tuning aggregator. The channel correction component is used to guide the weight allocation adjustment operation of each channel path within the task control context unit. Specifically, the current weight of each channel path is quantified, and a weighted adjustment is performed according to the positive and negative direction and magnitude of the channel correction component. The weight of the channel path with high response intensity in the error sample is increased, and the activation probability of low response or misjudged related paths is suppressed. The weight update process applies a normalization function while retaining the relative differences between channels to keep the total activation degree of the channels constant.

[0072] Meanwhile, the template correction component is fed into the template switching mechanism, which acts on the core parameters of the path scoring function. The template switching mechanism records the detection accuracy, complexity adaptability, and scoring confidence level of each template path in past task executions. The template correction component locates the corresponding scoring function term based on the template path number that erroneous in the feedback, applies an offset adjustment to the scoring weight value, and reduces the priority of failed paths. A gradient smoothing adjustment coefficient is introduced into the scoring function to avoid excessive offset causing instability to the overall path strategy.

[0073] After the channel path weights and template path scores are updated, the system executes the test path reconstruction logic. In the new round of task control, the task control context unit reactivates the path combination based on the updated channel weights, and the template switching mechanism calls the topology template combination with higher priority based on the updated scoring function to form the adjusted test path, thereby improving the accuracy and stability in subsequent image processing tasks. This process iterates dynamically after each round of task execution to build an adaptive optimization mechanism based on structural feedback.

[0074] In this embodiment, the preprocessing in step S1 includes performing resolution unification, brightness normalization, and edge enhancement operations on the image to be tested to generate an inference input image.

[0075] In this embodiment, the judgment threshold in step S2 includes a category confidence threshold and a coordinate deviation threshold, which are used to control the validity judgment criteria of the detection results.

[0076] In this embodiment, the process of the task control context unit selecting and activating a specific channel path according to the task type in step S3 includes:

[0077] S311. Read the task type identifier in the task parameters and map the task type identifier to a preset channel priority index table. The index table is a vector of length N, where each position corresponds to a channel path number in the network backbone.

[0078] S312. Extract the edge image from the inference input image, use the Sobel operator to calculate the gradient magnitude of each pixel in the horizontal and vertical directions, perform mean pooling on the gradient magnitude image to obtain the mean vector of the edge response.

[0079] S313. Extract the color distribution features of the image, convert the image to the HSV color space, and calculate the mean and variance of the H, S, and V channels respectively to form a color statistical vector.

[0080] S314. The mean vector of edge response and the color statistics vector are concatenated to form a structure-aware feature vector, which is then input into the channel scoring calculation unit. The convolution kernels corresponding to each channel are called to perform one-dimensional convolution on the structure-aware feature vector in sequence to obtain a response score vector of length N.

[0081] S315. Multiply the channel priority index table and the response score vector element by element to generate a fusion score vector. Sort the fusion score vector from largest to smallest and obtain the set of channel path numbers in the top k positions of the sorting, which will be used as the set of channel paths activated by the current task.

[0082] S316. During the model forward propagation phase, only the channels corresponding to the channel path set are enabled, while the remaining channels remain frozen. At the same time, the channel path number set is recorded in the structured test execution log.

[0083] In this embodiment, the template switching mechanism in step S3, which calls the optimal topology template combination based on image structure complexity and historical scoring records, includes the following steps:

[0084] S321. Divide the inference input image into several image regions of fixed size, use an edge detection operator to extract the edge image for each region, and calculate the gray-level variance of the pixels in the edge image within each region as the structural complexity score of the region.

[0085] S322. Calculate the average value and fluctuation range of the structural complexity score for all image regions, combine them into the structural complexity index of the current image, and save it by binding the image number.

[0086] S323. Read the set of template path numbers corresponding to the current task type, retrieve the historical detection accuracy, average number of false detections and number of task calls corresponding to each template path number from the template performance database, and construct a template historical scoring record table.

[0087] S324. For each template path number, assign a scoring weight based on the template historical scoring record table, match and score it with the structural complexity index of the current image, and generate a comprehensive score value for each template path number.

[0088] S325. Sort all template path numbers from high to low according to the comprehensive score, and select the top-ranked template path numbers to form the template combination set for the current task.

[0089] S326. In the channel path that has been activated in the task control context unit, the template parameters in the template combination set are called in sequence to perform image feature extraction and target detection operations, and the corresponding predicted target category and predicted coordinates are output respectively.

[0090] S327. Associate the template path number used in each detection with the corresponding prediction result and save it as a set of structured detection results.

[0091] In this embodiment, step S4 specifically includes:

[0092] S41. Extract the predicted target category, prediction confidence, prediction coordinates and template path number corresponding to each image from the structured detection result set, and establish a correspondence with the image number;

[0093] S42. Call the target category and category confidence threshold in the task parameters, perform a matching judgment between the predicted target category and the target category. If they do not match, it is judged as unqualified; if they match but the prediction confidence is lower than the category confidence threshold, it is judged as unqualified and a corresponding unqualified label is generated.

[0094] S43. Call the target area coordinates and coordinate deviation threshold in the task parameters to calculate the error values ​​between the predicted coordinates and the target coordinates in the horizontal and vertical directions.

[0095] S44. Compare the horizontal and vertical errors with the coordinate deviation thresholds respectively. If the error in either direction exceeds the threshold, it is judged as unqualified and a corresponding unqualified mark is generated.

[0096] S45. When the predicted target category is consistent, the prediction confidence is not lower than the threshold, and the predicted coordinates fall within the allowable error range, a corresponding qualified label is generated.

[0097] S46. Write the image number, task type, template path number, and detection tag into the structured detection tag table.

[0098] In this embodiment, step S6 includes the following steps:

[0099] S61. Filter out all images marked as unqualified from the detection markers, extract the corresponding template path number and channel path number, call the historical scoring log recorded by the template switching mechanism and the channel path record activated in the task control context unit, align and aggregate the current activated feature vector of the channel path corresponding to the unqualified image with the path scoring weight corresponding to the historical scoring record, and construct the path association tensor.

[0100] S62. Based on the coupling relationship between the activation features of each path and the scoring residual in the path association tensor, a similarity-weighted average operation is performed according to path clustering to generate historical error path aggregated feature vectors and current channel activation aggregated vectors. Specifically, the path association tensor serves as the core input structure of the feedback tuning aggregator, used to record the activation features and corresponding scoring residuals of each test path during task execution. The path association tensor is constructed as follows: using the template path number and channel path number corresponding to each historical unqualified sample image as the index dimension, the intermediate activation feature vector generated by the corresponding image in the improved TTNet network is recorded, and paired and bound with the scoring residuals generated by the detection label comparison results to form a multi-dimensional path feature tensor set with scoring error attributes.

[0101] Based on the multidimensional path feature tensor, the system performs path clustering and partitioning operations. During the clustering process, a distance metric method based on the cosine similarity of activation features is used to calculate the activation feature similarity between each path. Based on the similarity threshold, all paths are divided into several path clusters with similar activation patterns to ensure that the paths in each cluster have similar misjudgment features and network response patterns.

[0102] For each path cluster, the score residuals of all paths in the cluster are extracted and coupled with the corresponding activation feature vectors for modeling. A weighted average operation is then performed, with the weighting coefficients set based on the absolute value of the score residuals. The larger the score residual, the higher the weight of that path in the aggregation, thus guiding the aggregation result to retain more feature information of high-biased paths. This process generates two target vectors:

[0103] (1) Historical error path aggregation feature vector: reflects the common activation features of high error paths in historical tasks in the cluster, and is used to represent the structural failure mode in past tasks;

[0104] (2) Current channel activation aggregation vector: Focuses on the feature response results of the channel path triggered when the current task is executed, and combines the relative weights within its cluster to form a structural perception expression of the current test path state;

[0105] Ultimately, these two aggregated vectors, as intermediate representations of the structure optimization vector generation process, enter the next stage of channel and template correction. This entire process ensures that the optimization operation is based on error-driven path structure awareness, thereby improving the targeting and stability of the tuning strategy.

[0106] S63. The historical error path aggregated feature vector and the current channel activation aggregated vector are concatenated and then input into the feedback tuning aggregator to perform channel response deviation calculation and extract the high-frequency activation patterns of each channel in the error samples. Specifically, in step S63, the historical error path aggregated feature vector generated in step S62 is concatenated with the current channel activation aggregated vector to form a fused input feature vector. The concatenation operation is aligned according to the channel dimension, that is, the historical aggregated features and the current task response features are merged under the same channel index to ensure that the position of each channel in the input vector is consistent. This fused vector is used as the input of the feedback tuning aggregator to carry out the fine calculation process of channel response deviation.

[0107] The feedback tuning aggregator first performs response bias calculation for each channel. Specifically, in the fusion vector, the difference between the historical activation value and the current activation value at each channel position is calculated, and then normalized using the standard deviation to generate a channel response bias distribution vector. This distribution reflects the consistency of each channel's response in historical error samples with its response in the current task. A higher bias value indicates that the channel was frequently activated in error samples but failed to correctly complete the detection task, potentially indicating interference with the response or invalid feature extraction.

[0108] Based on the deviation distribution vector, the system further performs a high-frequency activation channel extraction operation, statistically analyzes the average activation intensity of each channel in all historical error samples, and performs joint analysis with the channel response deviation value to extract a set of channels with significant response deviation and high historical activation frequency as a candidate set of channel paths to be optimized. This set constitutes the target subset of subsequent weight adjustment operations, ensuring that the optimization process focuses on the channel paths that have the greatest impact on performance.

[0109] The core of the entire design lies in identifying channel response patterns that are repeatedly activated but contribute little in error detection by integrating the behavioral characteristics of channels in historical and current tasks. This provides a data support basis for the redistribution of channel weights and improves the adaptability and generalization ability of the network structure.

[0110] S64. Number the channel paths with the highest m% activation frequency in the task control context unit, calculate the corresponding average gradient direction, construct the corrected gradient vector according to the average gradient direction, and apply it to the weight parameters corresponding to the channel path to form the channel correction vector.

[0111] S65. Based on the average score residual of the template path number in the historical scoring records, a scoring offset factor is constructed. Combined with the current weight coefficient of the scoring function, a field-level weighted adjustment is performed to form a template correction vector. Specifically, the historical scoring records in the test execution log are first called to filter out all unqualified samples corresponding to the current task type, and their template path numbers and scores are extracted. For each template path number, the system calculates its historical average score value and compares it with the set standard scoring threshold to calculate the average score residual. The average score residual is used to measure the degree of detection reliability shift of a certain template path in historical tasks, reflecting its possible structural adaptation insufficiency or feature matching error in erroneous samples.

[0112] Based on this, a template scoring offset factor is constructed. Specifically, for each template path number, its scoring offset factor is defined as the product of the positive and negative directions of its average scoring residual and the normalized result of the absolute value. The offset trend information is preserved and its numerical range is limited to ensure that the scoring offset plays a regulatory role on subsequent parameters within a controllable range.

[0113] The weight coefficients of the scoring function consist of several fields, corresponding to dimensions such as the structural complexity index of the template path, feature similarity score, and template coverage score. During the field-level weighting adjustment process, the system performs multiplicative correction on the weight coefficients of each field of the scoring function based on the scoring offset factor of each template path number. The adjustment method is as follows: if the offset factor is positive, the weight of the penalized field in the scoring function is increased; if the offset factor is negative, the weight of the guiding field is increased, thereby encouraging the system to give such paths a higher adaptation priority in the scoring.

[0114] Finally, the adjusted field weights are recombined to form a template correction vector. The template correction vector represents the template switching mechanism's intention to update the current scoring function structure, providing a precise basis for adjusting the execution path scoring function and template path sorting. This step ensures that the evolution of the scoring mechanism can continuously respond to historical misjudgment trends and improve the robustness and accuracy of template path selection.

[0115] S66. For the channel path number that was not selected in the scoring ranking, call the average gradient direction of the most recent task cycle, generate a gradient vector in the opposite direction, scale it according to the preset decay coefficient to form a negative correction amount, apply the negative correction amount to the weight parameters of the corresponding channel path, and complete the negative gradient decay process.

[0116] S67. The channel correction vector and template correction vector are concatenated and input into the feature fusion function to perform a joint transformation of the channel dimension and path dimension, generating a structure optimization vector. Specifically, the input feature fusion function receives the input vector after concatenating the channel correction vector and template correction vector. First, a linear mapping operation is performed in the channel dimension to compress the weight adjustment signals on different channel paths to a unified feature dimension. Then, attention weights are introduced in the path dimension to apply dynamic response enhancement to the correction components of each template path number, capturing their global effect strength in structure optimization. During the joint transformation, the fusion function constructs a set of trainable channel-path cross weight matrices to complete the interactive modeling and representation reconstruction between the channel dimension and path dimension. Finally, the structure optimization vector is output as the decision basis for dynamic updating of the test path.

[0117] According to an embodiment of the present invention, a test scheme management device based on AI vision includes:

[0118] The image acquisition and preprocessing module is used to acquire the image to be tested and perform preprocessing operations to generate the inference input image;

[0119] The task parameter extraction module is used to extract the target category, judgment threshold, and target region coordinates based on the task type of the image.

[0120] An improved TTNet network module is used to receive inference input images and task parameters, and perform structural feature extraction and detection inference operations;

[0121] The task control context unit is used to select and activate specific channel paths according to the task type and control the response process of characteristic channels.

[0122] The template switching mechanism is used to call the optimal combination of topological templates based on the image structure complexity and historical scoring records;

[0123] The detection result comparison module is used to compare each detection result according to the task parameters and generate detection tags;

[0124] The test execution log recording module is used to record image number, task type, template path number, and detection tag information;

[0125] The feedback tuning aggregator is used to aggregate the activation features of historical error paths and the current detection channel to generate a structure optimization vector;

[0126] The path dynamic update module is used to apply the structure optimization vector to the channel weight allocation and path scoring function update operations.

[0127] Example 1:

[0128] In industrial quality inspection image detection tasks, traditional static template matching methods generally suffer from poor adaptability and high adjustment costs in automated detection scenarios with multiple tasks and multiple targets. Especially in factory inspection production lines with complex image structures and diverse tasks, the model often struggles to dynamically select appropriate detection strategies based on task differences, leading to frequent misjudgments of qualified samples and missed detections of unqualified samples. To verify the comprehensive advantages of the AI ​​vision-based test scheme management method proposed in this invention in terms of dynamic task adaptation, structural optimization, and detection accuracy, it was deployed on a detection platform containing image samples of multiple task types for practical testing.

[0129] In practical applications, industrial inspection image data with different image structures and target task types are first collected. The image types cover three categories: structural component inspection, circuit board defect inspection, and solder joint integrity inspection. Each category contains approximately 1,000 images. During platform operation, the system performs inference input generation based on task parameters and inputs the task parameters into the constructed improved TTNet structure. The network activates different channel paths according to the task type, calls the corresponding topology template combination through the template switching mechanism, and outputs the detection target category, location, and confidence information. By comparing the annotation information, qualified and unqualified detection marks are generated. All detection marks are automatically recorded in the test log for feedback aggregation and structural adjustment.

[0130] When an unqualified sample is found, the system automatically extracts the corresponding template path number and channel path number, calls the feedback tuning aggregator, and combines the current image activation features with historical error sample records to generate a structure optimization vector. The structure optimization vector is applied to the task control context unit and the template switching mechanism to realize dynamic adjustment of channel path weights and adaptive optimization of the template path scoring function. After multiple rounds of detection and feedback optimization, the system exhibits excellent adaptive capabilities on multiple task types, improving the overall detection performance.

[0131] During the experiment, a static template comparison group was set up as a reference. The two groups were compared using the same image samples and task configurations. The detection accuracy, non-compliance recognition rate and average error of each group under the three task types were statistically analyzed. The results showed that the average detection accuracy of the method of the present invention was improved to more than 97% under dynamic tasks. The recognition rate and error control capability were also significantly better than the static method, which verified that the present invention has higher detection efficiency and stability in complex test environments.

[0132] The table below shows the comparison results of the detection performance metrics between the method of this invention and the traditional template method in three types of task images:

[0133] Table 1: Comparison of Multi-Task Image Detection Indicators

[0134]

[0135] In terms of the accuracy of qualified image recognition, the present invention achieved 97.8%, which is 5.5 percentage points higher than the traditional method's 92.3%. This indicates that the present invention has higher accuracy in identifying positive samples and can effectively reduce the risk of false alarms. In terms of the recall rate of unqualified image detection, the present invention showed a detection coverage of 93.1%, which is significantly better than the traditional method's 85.6%. This shows that the present invention can more fully identify potential unqualified images and improve the overall screening reliability. Considering the F1 score of both methods, the present invention obtained a high value of 0.955, which is significantly better than the traditional method's 0.885, showing a better balance between accuracy and recall.

[0136] In terms of error control, the average coordinate deviation of this invention is only 2.7 pixels, which is a significant improvement compared to the 4.6 pixels of the traditional solution. This indicates that it is more precise in target positioning. In terms of the number of template path calls, this invention averages 1.8 times, which is less than the 3.2 times of the traditional solution. This reflects the efficiency of the path planning strategy and avoids redundant calculations and unnecessary template matching.

[0137] Furthermore, in terms of the number of convergence rounds for the task path, this invention achieves convergence within 7 rounds, compared to the traditional method which requires an average of 12 rounds to reach convergence. This significantly shortens the time required for model inference and optimization, and the feedback response latency for structural optimization is also significantly reduced, from 186ms in the traditional method to 109ms in this invention, thus improving the real-time feedback capability of the system. Finally, in terms of test path switching efficiency, this invention achieves an accuracy adjustment rate of 91.2%, which is 14.4% higher than the 76.8% of the traditional solution, demonstrating the advantages of the feedback tuning aggregator and path scoring mechanism in dynamic updates.

[0138] Based on the above performance indicators, this invention outperforms traditional detection methods in key aspects such as accuracy, recall, path efficiency, error control, and real-time performance, demonstrating its greater practicality and promotional value in multi-task visual detection scenarios.

[0139] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for AI vision-based test plan management, characterized by, Includes the following steps: S1. Acquire the image to be tested and preprocess it to generate the inference input image; S2. Based on the task type corresponding to the image, extract the target category, judgment threshold and target region coordinates to form task parameters; S3. Input the inference input image and task parameters into the improved TTNet network, which includes a task control context unit, a template switching mechanism and a feedback tuning aggregator. The task control context unit selects and activates a specific channel path according to the task type. The template switching mechanism calls the optimal topology template combination based on the image structure complexity and historical scoring records, performs structural feature extraction and detection inference, and outputs the predicted target category, predicted coordinates, predicted confidence and template path number. The process by which the task control context unit selects and activates a specific channel path based on the task type includes: S311. Read the task type identifier in the task parameters and map the task type identifier to a preset channel priority index table. The index table is a vector of length N, where each position corresponds to a channel path number in the network backbone. S312. Extract the edge image from the inference input image, use the Sobel operator to calculate the gradient magnitude of each pixel in the horizontal and vertical directions, perform mean pooling on the gradient magnitude image to obtain the mean vector of the edge response. S313. Extract the color distribution features of the image, convert the image to the HSV color space, and calculate the mean and variance of the H, S, and V channels respectively to form a color statistical vector. S314. The mean vector of edge response and the color statistics vector are concatenated to form a structure-aware feature vector, which is then input into the channel scoring calculation unit. The convolution kernels corresponding to each channel are called to perform one-dimensional convolution on the structure-aware feature vector in sequence to obtain a response score vector of length N. S315. Multiply the channel priority index table and the response score vector element by element to generate a fusion score vector. Sort the fusion score vector from largest to smallest and obtain the set of channel path numbers in the top k positions of the sorting, which will be used as the set of channel paths activated by the current task. S316. During the model forward propagation phase, only the channels corresponding to the channel path set are enabled, and the remaining channels are kept frozen. At the same time, the channel path number set is recorded in the structured test execution log. The template switching mechanism, based on image structural complexity and historical scoring records, involves the following process: S321. Divide the inference input image into several image regions of fixed size, use an edge detection operator to extract the edge image for each region, and calculate the gray-level variance of the pixels in the edge image within each region as the structural complexity score of the region. S322. Calculate the average value and fluctuation range of the structural complexity score for all image regions, combine them into the structural complexity index of the current image, and save it by binding the image number. S323. Read the set of template path numbers corresponding to the current task type, retrieve the historical detection accuracy, average number of false detections and number of task calls corresponding to each template path number from the template performance database, and construct a template historical scoring record table. S324. For each template path number, assign a scoring weight based on the template historical scoring record table, match and score it with the structural complexity index of the current image, and generate a comprehensive score value for each template path number. S325. Sort all template path numbers from high to low according to the comprehensive score, and select the top-ranked template path numbers to form the template combination set for the current task. S326. In the channel path that has been activated in the task control context unit, the template parameters in the template combination set are called in sequence to perform image feature extraction and target detection operations, and the corresponding predicted target category and predicted coordinates are output respectively. S327. Associate the template path number used in each detection with the corresponding prediction result and save it as a set of structured detection results. S4. Based on the target category and target region coordinates in the task parameters, compare the prediction results one by one to see if the category is consistent and whether the coordinates fall within the error threshold range, generate a detection label for each image, and mark it as qualified or unqualified. S5. Record the image number, task type, template path number, and detection marker as a test execution log; S6. Extract the template path number and channel path number of all non-compliant images from the detection markers, input them into the feedback tuning aggregator, aggregate the activation features of historical error paths and the current detection channel, and generate a structure optimization vector. S7. Use the structure optimization vector to update the path scoring function of the channel weight allocation and template switching mechanism of the task control context unit, and dynamically adjust the test path. 2.The AI vision-based test plan management method of claim 1, wherein, The preprocessing in step S1 includes performing resolution unification, brightness normalization, and edge enhancement operations on the image to be tested to generate an inference input image. 3.The AI vision-based test plan management method of claim 2, wherein, The thresholds in step S2 include the category confidence threshold and the coordinate deviation threshold, which are used to control the criteria for judging the validity of the detection results.

4. The test scheme management method based on AI vision according to claim 3, characterized in that, Step S4 specifically includes: S41. Extract the predicted target category, prediction confidence, prediction coordinates and template path number corresponding to each image from the structured detection result set, and establish a correspondence with the image number; S42. Call the target category and category confidence threshold in the task parameters, perform a matching judgment between the predicted target category and the target category. If they do not match, it is judged as unqualified; if they match but the prediction confidence is lower than the category confidence threshold, it is judged as unqualified and a corresponding unqualified label is generated. S43. Call the target area coordinates and coordinate deviation threshold in the task parameters to calculate the error values ​​between the predicted coordinates and the target coordinates in the horizontal and vertical directions. S44. Compare the horizontal and vertical errors with the coordinate deviation thresholds respectively. If the error in either direction exceeds the threshold, it is judged as unqualified and a corresponding unqualified mark is generated. S45. When the predicted target category is consistent, the prediction confidence is not lower than the threshold, and the predicted coordinates fall within the allowable error range, a corresponding qualified label is generated. S46. Write the image number, task type, template path number, and detection tag into the structured detection tag table.

5. The test scheme management method based on AI vision according to claim 4, characterized in that, Step S6 includes the following steps: S61. Filter out all images marked as unqualified from the detection markers, extract the corresponding template path number and channel path number, call the historical scoring log recorded by the template switching mechanism and the channel path record activated in the task control context unit, align and aggregate the current activated feature vector of the channel path corresponding to the unqualified image with the path scoring weight corresponding to the historical scoring record, and construct the path association tensor. S62. Based on the coupling relationship between the activation features of each path and the score residual in the path association tensor, perform a similarity-weighted average operation according to path clustering to generate the aggregated feature vector of historical error paths and the aggregated activation vector of the current channel. S63. After concatenating the historical error path aggregated feature vector with the current channel activation aggregated vector, input the input to the feedback tuning aggregator to perform channel response deviation calculation and extract the high-frequency activation mode of each channel in the error sample. S64. Number the channel paths with the highest m% activation frequency in the task control context unit, calculate the corresponding average gradient direction, construct the corrected gradient vector according to the average gradient direction, and apply it to the weight parameters corresponding to the channel path to form the channel correction vector. S65. Based on the average score residual of the template path number in the historical score record, construct a score offset factor, and perform field-level weighted adjustment in combination with the current weight coefficient of the score function to form a template correction vector. S66. For the channel path number that was not selected in the scoring ranking, call the average gradient direction of the most recent task cycle, generate a gradient vector in the opposite direction, scale it according to the preset decay coefficient to form a negative correction amount, apply the negative correction amount to the weight parameters of the corresponding channel path, and complete the negative gradient decay process. S67. After concatenating the channel correction vector and the template correction vector, input them into the feature fusion function to perform a joint transformation of the channel dimension and the path dimension, generating a structure optimization vector.

6. An AI vision-based test plan management device, applied to any one of the AI ​​vision-based test plan management methods according to claims 1 to 5, characterized in that, Includes the following modules: The image acquisition and preprocessing module is used to acquire the image to be tested and perform preprocessing operations to generate the inference input image; The task parameter extraction module is used to extract the target category, judgment threshold, and target region coordinates based on the task type of the image. An improved TTNet network module is used to receive inference input images and task parameters, and perform structural feature extraction and detection inference operations; The task control context unit is used to select and activate specific channel paths according to the task type and control the response process of characteristic channels. The template switching mechanism is used to call the optimal combination of topological templates based on the image structure complexity and historical scoring records; The detection result comparison module is used to compare each detection result according to the task parameters and generate detection tags; The test execution log recording module is used to record image number, task type, template path number, and detection tag information; The feedback tuning aggregator is used to aggregate the activation features of historical error paths and the current detection channel to generate a structure optimization vector; The path dynamic update module is used to apply the structure optimization vector to the channel weight allocation and path scoring function update operations.

Citation Information

Patent Citations

  • Microchip appearance defect detection method based on convolutional neural network

    CN119693363A

  • Method and apparatus for processing images, device and storage medium

    US20220083808A1