Product sampling detection accuracy evaluation method and system based on AI
By using negative immune screening of key samples and analysis of masking interference features, combined with difference curve correction, an AI product detection accuracy evaluation model was constructed. This model solved the problem of deviation in detection results under complex backgrounds and achieved efficient and accurate evaluation of detection results.
Patent Information
- Application Number
- CN202511144258.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-15
AI Technical Summary
In existing AI vision product quality inspection technologies, interference factors such as complex backgrounds and lighting changes lead to large deviations in the accuracy assessment results, and the impact of key samples on the model's detection performance cannot be effectively quantified, making it difficult to improve assessment efficiency and accuracy.
By using negative immune screening of key samples, occlusion interference feature analysis and topological persistence annotation, combined with difference curve correction, an accuracy evaluation model is constructed to quantify the detection stability and asymptotic behavior under occlusion conditions.
It improves the efficiency and accuracy of AI sampling inspection, provides interpretable inspection results, and supports reliable evidence for production line release and model iteration.
Smart Images

Figure CN120976181A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of evaluation, in particular to an AI-based product sampling detection accuracy evaluation method and system. BACKGROUND
[0002] With the advancement of intelligent manufacturing, AI vision-based product quality detection has been widely used in 3C, lithium battery, pharmaceutical and other industries. High-speed production lines produce millions of images every day. Enterprises rely on deep learning models for defect identification and classification, and evaluate the qualification rate of the entire batch of products through sampling. The credibility of detection accuracy evaluation is directly related to the risk of release and after-sales cost.
[0003] The prior art relies on AI simple sampling or statistics, and lacks effective modeling for complex background, light changes, partial occlusion and other interference, resulting in large evaluation result deviation. Modeling a large amount of data takes a long time, and the influence of key samples on model detection performance cannot be quantified, making it difficult to reveal the detection stability and asymptotic behavior of defect features under different shielding conditions for samples under long-time detection. Improving the evaluation efficiency and accuracy of detection results has become a problem to be solved. The present application improves the evaluation efficiency and interpretability of detection results by immune negative screening of key samples, shielding interference and topological persistence analysis, difference curve correction and asymptotic calculation, so that the evaluation time range and evaluation sample range of AI sampling detection accuracy are improved. SUMMARY
[0004] The purpose of the present application is to provide an AI-based product sampling detection accuracy evaluation method and system.
[0005] To achieve the above purpose, the present application is implemented according to the following technical solutions: The present application provides an AI-based product sampling detection accuracy evaluation method in the first aspect, comprising: Obtaining image data and true label samples of products to be detected, and screening key samples from the image data by immune negative selection algorithm; According to the edge information of the key samples, the secondary data set of the image data is gradient-shielded to obtain a first shielding image, a second shielding image and an image shielding degree, and the shielding interference features are extracted from the first shielding image and the second shielding image using a wavelet convolution network; The shielding interference features of the first shielding image and the second shielding image are topologically persistent labeled, and the labeled data, the image data and the true label samples are input into an AI detection model to obtain a first result, a second result, a true label result and an image detection result; According to the first result, the second result, a first difference curve and a second difference curve are obtained by detecting the time sequence, the first difference curve is scaled using the true label in the detection result, and a third difference curve is obtained; Based on the true label and the image detection result, a detection bias is obtained, the second difference curve is corrected according to the detection bias and the third difference curve, and the fourth difference curve is obtained by correcting, and the image detection asymptote is obtained by the image masking degree; According to the image detection asymptote, the key sample proportion, the image masking degree and the third difference curve, an accuracy evaluation model is obtained, and the AI detection accuracy evaluation result is output by using the accuracy evaluation model.
[0006] Further, the method for screening the key sample comprises: Based on the true label sample, a defect-free self sample is generated by an immune negative selection algorithm, an initial detector is randomly generated according to the feature dimension of the image data, the number of the initial detector is set to 1.2 to 1.5 times the total amount of the image data sample, the Euclidean distance and the cosine similarity between the initial detector and the self sample are calculated, the affinity is calculated by a weighted value according to the Euclidean distance and the cosine similarity, the initial average affinity is floated by 15% to 20% as the affinity threshold, and the detector lower than the affinity threshold is taken as an optimized detector set; According to the optimized detector set and the image data, an optimized average affinity is calculated, the sample with the optimized average affinity lower than the affinity threshold is taken as a candidate key sample, if the candidate key sample corresponds to a defective feature in the true label, the matching degree of the defective feature and the sensitive feature of the AI detection model is calculated, the candidate key sample with the matching degree higher than a preset judgment threshold is taken as a key sample, and the position, feature type and corresponding relationship with the true label of the key sample in the image data are recorded; If the candidate key sample has no defective feature, the candidate sample affinity between the candidate key sample and the self sample is calculated, and the candidate key sample with the candidate sample affinity lower than the initial average affinity is taken as a key sample, and the sensitive feature includes edge mutation feature, area gray abnormal feature and shape distortion feature.
[0007] Further, the method for obtaining the first masking image, the second masking image and the image masking degree comprises: Based on the key sample, the edge feature similarity is calculated according to the cosine distance of the edge direction histogram, the sample with the edge feature similarity greater than 60% in the image data is taken as a secondary data set, the edge contour is extracted from the image of the secondary data set by the edge detection algorithm, the edge contour is expanded by 5 pixels, and the horizontal gradient, vertical gradient, gradient direction and gradient amplitude are calculated by the Sobel operator; The first occlusion template is the union of the horizontal gradient and gradient direction between -15° and 15° and between 165° and 195°. The second occlusion template is the union of the vertical gradient and gradient direction between 75° and 105° and between 255° and 285°. The occlusion intensity is determined by positive correlation linear mapping based on the gradient magnitude. The first and second occlusion templates are then processed pixel-by-pixel with samples from the secondary dataset to obtain the first and second occlusion images. The areas of regions with a pixel value change rate greater than 20% in the first and second occlusion images are counted, and the proportion of the region area to the total area of the corresponding occlusion image is taken as the image occlusion degree.
[0008] Furthermore, the method for obtaining the occlusion interference features includes: Based on the first and second occlusion images, the occlusion inpainting model iteratively repairs the occlusion area until the absolute value of the difference between the energy function outputs in two consecutive iterations is less than 1. The first and second restored images are obtained respectively. The expression for the occlusion restoration model is: , Where E is the energy function output of the occlusion inpainting model, and u is the inpainted image. The pixel matrix range for each occluded image. Let be the L1 norm of the image gradient, which is obtained from the horizontal and vertical gradients corresponding to each occluded image, and S be the image occlusion degree. To mask the image, M is the gradient magnitude. The maximum gradient magnitude of the secondary dataset. Let L0 be the norm of the image gradient; The first and second restored images are respectively input into a dual wavelet-based convolutional network. The dual wavelet-based convolutional network extracts gradient defect features using a db4 wavelet-based convolutional kernel and extracts abrupt defect features using a haar wavelet-based convolutional kernel. Max pooling and sigmoid activation are performed based on the gradient defect features and abrupt defect features to obtain the occlusion interference features of the first and second restored images, respectively.
[0009] Furthermore, the method for obtaining the labeled data includes: Based on the occlusion interference feature, the Euclidean distance between the feature point and the key sample is used as the horizontal axis, and the gradient magnitude of the feature point is used as the vertical axis. The feature points are mapped to a two-dimensional topological space according to the horizontal and vertical axes. The two-dimensional topological space is triangulated. The feature points of the topological branches after triangulation are traversed in ascending order according to the gradient magnitude. If the gradient magnitude of 5 consecutive pixels exceeds the median gradient magnitude of the secondary dataset and the pixel area is greater than 10 pixels, it is used as a birth sign; otherwise, it is used as a death sign. The difference between the birth sign and the death sign is used as the feature persistence, and the average persistence of the secondary dataset is used as the persistence threshold. Topological branches with feature persistence greater than 0.3 times the persistence threshold are designated as key topological branches. Based on the center coordinates of the topological branches, the key topological branches are mapped back to the image data using an inverse mapping algorithm. The mapping position, gradient interval, and topology type are recorded to obtain the topological mapping region. Pixel values with an image occlusion degree greater than 0.5 are labeled as occlusion-induced defects based on the topological mapping region; otherwise, they are labeled as original defects. This yields the labeled data of the image data. The labeled data includes feature persistence, the ratio of defect area to occlusion area, and the spatial overlap between occlusion interference features and true labels.
[0010] Furthermore, the method for obtaining the third difference curve includes: Based on the first occluded image and the second occluded image, first annotation data and second annotation data are obtained through topological persistent annotation, respectively. The first annotation data, second annotation data, image data and real annotation samples are respectively input into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result. The first result includes the defect prediction location, product type and confidence level. Based on the detection time sequence, the first result and the second result are mapped to a time sequence. The defect confidence difference between the first result and the second result is calculated for each sample according to the time sequence. The mean Euclidean distance of the predicted position is calculated to obtain the first difference curve. The defect confidence difference between the second result and the real labeled result is calculated. The mean Euclidean distance between the predicted position and the real labeled predicted position is calculated to obtain the second difference curve. The confidence deviation and predicted position deviation between the actual annotation results and the image detection results are used as the baseline deviation features. Based on the baseline deviation features, linear regression fitting is performed on the defect confidence difference and the mean Euclidean distance of the predicted position of the first difference curve to obtain the confidence scaling factor and the position scaling factor. The first difference curve is then multiplied point by point by the confidence scaling factor and the position scaling factor to obtain the third difference curve.
[0011] Furthermore, the method for obtaining the image detection asymptotics includes: The detection bias is obtained based on the real annotation results and image detection results. Feature persistence and spatial overlap are obtained based on the first annotation data and the second annotation data. The Pearson correlation coefficient between feature persistence and the confidence dimension of detection bias is calculated. The intersection-union ratio between spatial overlap and the location dimension of detection bias is calculated to obtain confidence association persistence and location association persistence. Max-min normalization is performed on confidence association persistence and location association persistence respectively to obtain topological confidence weight and topological location weight. The product of the topological confidence weight and the confidence deviation is calculated based on the third difference curve. This product is then added to the confidence deviation of the corresponding position on the second difference curve, and the confidence deviation of the detection deviation is subtracted to obtain the confidence deviation of the fourth difference curve. The topological position weight is multiplied by the predicted position deviation of the third difference curve, and this product is added to the predicted position deviation of the second difference curve, and the predicted position deviation of the detection deviation is subtracted to obtain the predicted position deviation of the fourth difference curve. Based on the fourth difference curve, the image detection asymptoticism is obtained through image occlusion. The formula for calculating the image detection asymptoticism is as follows: , Where A is the image detection asymptoticism. This represents the confidence level bias. For topological confidence weights, To predict positional deviation, For topological position weights, The proportion of key samples. The average gradient magnitude, Let be the mean occlusion degree of an occluded image. The mean occlusion value of the second occluded image. This is the fourth difference curve.
[0012] Furthermore, the method for obtaining the accuracy evaluation result of the quasi-AI detection includes: A defect feature diagonal matrix is constructed based on the image detection asymptoticity, the proportion of key samples, and the mean of the occlusion degrees of the first and second occluded images. The gradient occlusion interference is negatively constrained by exponential decay based on the mean of the occlusion degrees of the first and second occluded images. A difference statistical symmetric matrix is constructed based on the mean and variance of the third difference curve. An accuracy evaluation model is obtained based on the defect feature diagonal matrix and the difference statistical symmetric matrix. The AI detection accuracy evaluation result is output based on the accuracy evaluation model. The expression of the accuracy evaluation model is as follows: , in The AI detection accuracy evaluation result is shown, where A represents the image detection asymptoticity. The proportion of key samples. The occlusion degree of the first occluded image is the average of the occlusion degrees of the second occluded image. The third difference curve The mean, The third difference curve The variance.
[0013] A second aspect of the present invention provides an AI-based product sampling inspection accuracy evaluation system, comprising: Key sample screening module: used to acquire image data and real labeled samples of the product to be tested, and to screen key samples from the image data using an immune negative selection algorithm; The occluded defect feature extraction module is used to perform gradient occlusion on the secondary dataset of the image data based on the edge information of the key samples, to obtain a first occluded image, a second occluded image and an image occlusion degree, and to extract the occluded defect features using the first occluded image and the second occluded image through a wavelet convolutional network. Topological persistence annotation module: used to perform topological persistence annotation on the occluded defect features of the first occluded image and the second occluded image, and input the annotation data, image data and real annotation samples into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result; The third difference curve acquisition module is used to obtain the first difference curve and the second difference curve through the detection time sequence based on the first result and the second result, and to scale the first difference curve using the real annotation result in the detection result to obtain the third difference curve. Image detection asymptoticity acquisition module: used to obtain the detection deviation based on the real annotation results and image detection results, correct the second difference curve according to the detection deviation and the third difference curve, and obtain the image detection asymptoticity through the image occlusion degree according to the fourth difference curve obtained by correction; The detection accuracy evaluation module is used to obtain an accuracy evaluation model based on the image detection asymptoticism, key sample ratio, image occlusion degree, and third difference curve, and to output the AI detection accuracy evaluation result using the accuracy evaluation model.
[0014] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects: This invention employs immune negative selection of key samples, using defect-free self-samples as a benchmark to adaptively generate detectors. It selects key samples most sensitive to model performance, reducing redundant computation and improving the targeting of evaluation. Through occlusion-topology joint feature analysis, it transforms the edge information of key samples into gradient occlusion templates, and then uses topological persistence annotation to quantify the stability of defects under occlusion conditions. This reveals the impact of real-world conditions such as occlusion and noise on detection results, providing interpretable feature evolution curves. By using difference curves and asymptotic correction, it uses the first to fourth difference curves to correct confidence and positional deviations layer by layer, calculates the detection asymptoticity, constructs an accuracy evaluation model, and forms a mapping from local error to global confidence, providing interpretable evidence for production line release, model iteration, and risk traceability. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the steps of the AI-based product sampling inspection accuracy evaluation method in an embodiment of the present invention. Detailed Implementation
[0016] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0017] Reference Figure 1 As shown, this invention provides an AI-based method for evaluating the accuracy of product sampling inspection, including: Acquire image data and real labeled samples of the product to be tested, and use an immune negative selection algorithm to screen key samples from the image data; In the actual evaluation, 1000 surface images of electronic components were acquired, including 500 defective images and 500 defect-free images. Real-world labeled samples were obtained, and the defect locations, types, and confidence levels were manually labeled. 100 images were randomly selected from the defect-free images and processed using a 5x5 Gaussian blur and histogram equalization to generate a self-sample set. LBP texture with a radius of 3 and a neighborhood of 8 was extracted from the image data, and then processed using a 5x5 pixel window gray-level co-occurrence matrix to obtain 10-dimensional features. 1300 initial detectors were generated, representing 1.3 times the total number of samples. Euclidean distance and cosine similarity were calculated between the initial detectors and the self-samples, and affinity was calculated using weighted values. ,in As the initial detector, As a self-sample, For Euclidean distance, For cosine similarity, the initial affinity was calculated iteratively, with an average value of 0.35. The average value was increased by 18% to obtain an affinity threshold of 0.413. Detectors with affinity less than 0.413 were retained as an optimized detector set, totaling 850. The average optimized affinity between each image and the detector was calculated based on the optimized detector set. Samples with an average optimized affinity lower than the affinity threshold were selected as candidate key samples, totaling 200. The matching degree between the real defects and the sensitive features of the AI detection model was calculated based on 120 candidate samples containing defects. Samples with a matching degree greater than 60% were retained, resulting in 80 key samples. The affinity between the candidate samples and their own samples was calculated based on the 80 candidate samples without defects. Samples with an affinity less than 0.35 were retained, resulting in 50 key samples. These were combined to obtain 130 key samples. Their image index, LBP features, gray-level co-occurrence matrix features, and correspondence with the real labeled defect features were recorded. Gradient occlusion is performed on the secondary dataset of the image data based on the edge information of the key samples to obtain a first occluded image, a second occluded image, and an image occlusion degree. The first occluded image and the second occluded image are used to extract occlusion interference features through a wavelet convolutional network. In the actual evaluation, Canny edge detection was performed on each key sample and candidate image to extract edge contours, and orientation histogram quantization was performed. The edge directions from 0° to 180° were divided into 12 bins, and the edge pixel ratio of each bin was counted to generate a 12-dimensional feature vector. Among them, a key sample containing horizontal scratches had edge directions concentrated in bin1 (0°~15°) and bin12 (165°~180°). The cosine distance of the edge orientation histograms was calculated for the candidate images and key samples. Images with a cosine distance less than 0.4 were retained, and a total of 60 images were selected as the secondary dataset. The edge contours were extended by 5 pixels, and the horizontal gradient, vertical gradient, gradient direction, and gradient magnitude were calculated using the Sobel operator. The first occlusion template and the second occlusion template were operated pixel by pixel with the samples in the secondary dataset to obtain the first occlusion image and the second occlusion image. The area of the region with a pixel value change rate greater than 20% in the first occlusion image and the second occlusion image was counted. The proportion of the region area to the total area of the corresponding occlusion image was used as the image occlusion degree, and the average occlusion degree was 0.375%. Based on the first and second occluded images, an occluded repair model iteratively repairs the occluded region. The pixel matrix ranges from 640 to 480, the gradient magnitude of the scratch region is 150, and the maximum gradient magnitude of the secondary dataset is 200. Gradient descent is used with a learning rate of 0.01 until convergence after approximately 100 iterations. The absolute value of the difference between the energy function outputs in two consecutive iterations is less than [value missing]. The scratch area in the first repaired image was restored from a decay of 35% to a value close to the true value of 95%. After restoration, the decay was slightly reduced due to smoothing. The second repaired image had a lower occlusion degree in the original occluded image, and the difference between the repaired image and the original image was less than 5%, almost identical. The first and second repaired images were respectively input into a dual wavelet basis convolutional network. The dual wavelet basis convolutional network extracted the gradient defect features using a 3×3 db4 wavelet basis convolutional kernel and extracted the abrupt defect features using a 5×5 haar wavelet basis convolutional kernel. Based on the gradient defect features and abrupt defect features, 4×4 max pooling and sigmoid activation were performed, and the features were spliced according to the feature channels. The features were normalized to obtain the occlusion interference features of the first repaired image in 160×120×2 dimensions and the occlusion interference features of the second repaired image. The occlusion interference features of the first occluded image and the second occluded image are topologically persistently annotated. The annotated data, image data and real annotated samples are input into the AI detection model to obtain the first result, the second result, the real annotated result and the image detection result. In the actual evaluation, 32 feature points were obtained based on the occlusion interference features of the first repaired image, distributed around the horizontal scratch. The center coordinates of the key sample were obtained as (200, 205). The Euclidean distance between the feature points and the key sample was used as the horizontal axis, and the gradient magnitude of the feature points was used as the vertical axis. The feature points were mapped to a two-dimensional topological space according to the horizontal and vertical axes. Delaunay triangulation was performed on the two-dimensional topological space to form a petal-shaped triangle cluster around the center, reflecting the gradual edge structure of the scratch. The feature points of the topological branches after triangulation were traversed in ascending order according to the gradient magnitude. If the gradient magnitude of 5 consecutive pixels exceeds the median gradient magnitude of 100 in the secondary dataset and the triangulation area is greater than 10 pixels, it is used as a feature birth mark. Otherwise, it is used as a feature death mark. The birth position of a feature in a certain topological branch is 120, and the death mark is 80. The difference between the feature birth mark and the feature death mark is used as the feature persistence. The wider the gradient range of the feature that survives in the topological space, the higher the stability. The average persistence of the secondary dataset, 40, is used as the persistence threshold. The topological branches with feature persistence greater than 12 are taken as key topological branches. Based on the center coordinates (5.39, 120) of the topological branches, the key topological branches are mapped back to the image data (198, 204) through linear inverse mapping. The mapping position, gradient interval and topology type are recorded to obtain the topological mapping region. Pixel values with image occlusion greater than 0.5 are marked as occlusion-induced defects according to the topological mapping region, and otherwise marked as original defects to obtain the labeled data of the image data. The labeled data includes feature persistence 40, the ratio of defect area to occlusion area 0.1, and the spatial overlap between occlusion interference features and real labels 0.0125. Based on the first occluded image and the second occluded image, the first labeled data and the second labeled data are obtained respectively through topological persistence labeling. The first labeled data, the second labeled data, the image data and the real labeled samples are input into the AI detection model to obtain the first result, the second result, the real labeled result and the image detection result. Among them, the value of sample 1 in the first result is 0.82, and the predicted position is (195, 203). Based on the first and second results, a first difference curve and a second difference curve are obtained through detection time sequence. The first difference curve is scaled using the real annotation results in the detection results to obtain a third difference curve. In the actual evaluation, the first and second results are mapped to a time series based on the detection time sequence. For time series 1, the confidence difference is calculated to be 0.15, and the Euclidean distance of the predicted position is 3.16 pixels, forming a two-dimensional difference curve to obtain the first difference curve. The defect confidence difference between the second result and the actual labeled result is calculated to be 0.65, and the mean Euclidean distance between the predicted position and the actual labeled predicted position is calculated to be 2.24 pixels. In time series 51, the second result is a defect-free sample, so the mean distance is infinite at this time, and the second difference curve is obtained. Based on the baseline deviation characteristics, linear regression fitting is performed on the defect confidence difference and the mean Euclidean distance of the predicted position of the effective defect samples from time series 1 to 50 to obtain a confidence scaling factor of 1.2 and a position scaling factor of 1.5. The first difference curve is multiplied point by point by the confidence scaling factor and the position scaling factor to obtain the third difference curve. In the third difference curve, the confidence deviation of time series 1 is 0.108, and the position deviation is 4.74 pixels. The detection deviation is obtained based on the real annotation results and image detection results. The second difference curve is corrected according to the detection deviation and the third difference curve. The image detection asymptoticity is obtained through the image occlusion degree according to the fourth difference curve obtained by correction. In the actual evaluation, feature persistence and spatial overlap are obtained based on the first and second labeled data. The Pearson correlation coefficient between feature persistence and the confidence dimension of detection bias is calculated to be 0.8, and the intersection-union ratio between spatial overlap and the location dimension of detection bias is calculated to be 0.6. Max-min normalization is performed to obtain the topological confidence weight of 0.8 and the topological location weight of 0.6. The product of the topological confidence weight and the confidence deviation is calculated based on the third difference curve. The product is added to the confidence deviation of the corresponding position of the second difference curve, and the confidence deviation of the detection bias is subtracted to obtain the confidence deviation of the fourth difference curve. The topological location weight is multiplied by the predicted location deviation of the third difference curve, and the product is added to the predicted location deviation of the second difference curve and subtracted to obtain the predicted location deviation of the detection bias to obtain the predicted location deviation of the fourth difference curve. The image detection asymptoticity is obtained based on the fourth difference curve through image occlusion, where the image detection asymptoticity of time sequence 1 is 0.631. An accuracy evaluation model is obtained based on the image detection asymptoticism, key sample ratio, image occlusion degree, and third difference curve. The accuracy evaluation model is then used to output the AI detection accuracy evaluation result.
[0018] In the actual evaluation, a defect feature diagonal matrix was constructed based on the image detection asymptoticism of 0.63, the key sample ratio of 0.13, and the mean of the occlusion degree of the first and second occluded images of 0.00375. The gradient occlusion interference is negatively constrained by exponential decay based on the average of the occlusion degrees of the first and second occluded images. A symmetric matrix of difference statistics is constructed based on the mean of 0.15 and variance of 0.02 of the third difference curve. An accuracy evaluation model is obtained based on the diagonal matrix of defect features and the symmetric matrix of difference statistics. The AI detection accuracy evaluation result of detection sequence 1 is 0.397 based on the accuracy evaluation model.
[0019] In this embodiment, the method for screening the key samples includes: Defect-free self-samples are generated based on real labeled samples using an immune negative selection algorithm. Initial detectors are randomly generated according to the feature dimensions of the image data, with the number of initial detectors set to 1.2 to 1.5 times the total number of image data samples. The Euclidean distance and cosine similarity between the initial detectors and the self-samples are calculated. Affinity is calculated by weighting the Euclidean distance and cosine similarity. The initial average affinity is increased by 15% to 20% as the affinity threshold, and detectors below the affinity threshold are used as the optimized detector set. The optimized average affinity is calculated based on the optimized detector set and image data. Samples with optimized average affinity lower than the affinity threshold are selected as candidate key samples. If the real annotation corresponding to the candidate key sample has defective features, the matching degree between the defective features and the sensitive features of the AI detection model is calculated. Candidate key samples with matching degree higher than the preset judgment threshold are selected as key samples. The position, feature type and correspondence between the key sample and the real annotation in the image data are recorded. If the candidate key sample has no defect features, the candidate sample affinity between the candidate key sample and the self sample is calculated. The candidate key sample with a candidate sample affinity lower than the initial average affinity is taken as the key sample. The sensitive features include edge mutation features, regional gray-level anomaly features, and shape distortion features.
[0020] In this embodiment, the method for obtaining the first occlusion image, the second occlusion image, and the image occlusion degree includes: Based on key samples, edge feature similarity is calculated according to the cosine distance of the edge direction histogram. Samples with edge feature similarity greater than 60% in the image data are used as secondary datasets. Based on the images of the secondary datasets, edge contours are extracted by edge detection algorithms. The edge contours are expanded by 5 pixels and the horizontal gradient, vertical gradient, gradient direction and gradient magnitude are calculated by Sobel operator. The first occlusion template is the union of the horizontal gradient and gradient direction between -15° and 15° and between 165° and 195°. The second occlusion template is the union of the vertical gradient and gradient direction between 75° and 105° and between 255° and 285°. The occlusion intensity is determined by positive correlation linear mapping based on the gradient magnitude. The first and second occlusion templates are then processed pixel-by-pixel with samples from the secondary dataset to obtain the first and second occlusion images. The areas of regions with a pixel value change rate greater than 20% in the first and second occlusion images are counted, and the proportion of the region area to the total area of the corresponding occlusion image is taken as the image occlusion degree.
[0021] In this embodiment, the method for obtaining the occlusion interference features includes: Based on the first and second occlusion images, the occlusion inpainting model iteratively repairs the occlusion area until the absolute value of the difference between the energy function outputs in two consecutive iterations is less than 1. The first and second restored images are obtained respectively. The expression for the occlusion restoration model is: , Where E is the energy function output of the occlusion inpainting model, and u is the inpainted image. The pixel matrix range for each occluded image. Let be the L1 norm of the image gradient, which is obtained from the horizontal and vertical gradients corresponding to each occluded image, and S be the image occlusion degree. To mask the image, M is the gradient magnitude. The maximum gradient magnitude of the secondary dataset. Let L0 be the norm of the image gradient; The first and second restored images are respectively input into a dual wavelet-based convolutional network. The dual wavelet-based convolutional network extracts gradient defect features using a db4 wavelet-based convolutional kernel and extracts abrupt defect features using a haar wavelet-based convolutional kernel. Max pooling and sigmoid activation are performed based on the gradient defect features and abrupt defect features to obtain the occlusion interference features of the first and second restored images, respectively.
[0022] In this embodiment, the method for obtaining the labeled data includes: Based on the occlusion interference feature, the Euclidean distance between the feature point and the key sample is used as the horizontal axis, and the gradient magnitude of the feature point is used as the vertical axis. The feature points are mapped to a two-dimensional topological space according to the horizontal and vertical axes. The two-dimensional topological space is triangulated. The feature points of the topological branches after triangulation are traversed in ascending order according to the gradient magnitude. If the gradient magnitude of 5 consecutive pixels exceeds the median gradient magnitude of the secondary dataset and the pixel area is greater than 10 pixels, it is used as a birth sign; otherwise, it is used as a death sign. The difference between the birth sign and the death sign is used as the feature persistence, and the average persistence of the secondary dataset is used as the persistence threshold. Topological branches with feature persistence greater than 0.3 times the persistence threshold are designated as key topological branches. Based on the center coordinates of the topological branches, the key topological branches are mapped back to the image data using an inverse mapping algorithm. The mapping position, gradient interval, and topology type are recorded to obtain the topological mapping region. Pixel values with an image occlusion degree greater than 0.5 are labeled as occlusion-induced defects based on the topological mapping region; otherwise, they are labeled as original defects. This yields the labeled data of the image data. The labeled data includes feature persistence, the ratio of defect area to occlusion area, and the spatial overlap between occlusion interference features and true labels.
[0023] In this embodiment, the method for obtaining the third difference curve includes: Based on the first occluded image and the second occluded image, first annotation data and second annotation data are obtained through topological persistent annotation, respectively. The first annotation data, second annotation data, image data and real annotation samples are respectively input into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result. The first result includes the defect prediction location, product type and confidence level. Based on the detection time sequence, the first result and the second result are mapped to a time sequence. The defect confidence difference between the first result and the second result is calculated for each sample according to the time sequence. The mean Euclidean distance of the predicted position is calculated to obtain the first difference curve. The defect confidence difference between the second result and the real labeled result is calculated. The mean Euclidean distance between the predicted position and the real labeled predicted position is calculated to obtain the second difference curve. The confidence deviation and predicted position deviation between the actual annotation results and the image detection results are used as the baseline deviation features. Based on the baseline deviation features, linear regression fitting is performed on the defect confidence difference and the mean Euclidean distance of the predicted position of the first difference curve to obtain the confidence scaling factor and the position scaling factor. The first difference curve is then multiplied point by point by the confidence scaling factor and the position scaling factor to obtain the third difference curve.
[0024] In this embodiment, the method for obtaining the image detection asymptotics includes: The detection bias is obtained based on the real annotation results and image detection results. Feature persistence and spatial overlap are obtained based on the first annotation data and the second annotation data. The Pearson correlation coefficient between feature persistence and the confidence dimension of detection bias is calculated. The intersection-union ratio between spatial overlap and the location dimension of detection bias is calculated to obtain confidence association persistence and location association persistence. Max-min normalization is performed on confidence association persistence and location association persistence respectively to obtain topological confidence weight and topological location weight. The product of the topological confidence weight and the confidence deviation is calculated based on the third difference curve. This product is then added to the confidence deviation of the corresponding position on the second difference curve, and the confidence deviation of the detection deviation is subtracted to obtain the confidence deviation of the fourth difference curve. The topological position weight is multiplied by the predicted position deviation of the third difference curve, and this product is added to the predicted position deviation of the second difference curve, and the predicted position deviation of the detection deviation is subtracted to obtain the predicted position deviation of the fourth difference curve. Based on the fourth difference curve, the image detection asymptoticism is obtained through image occlusion. The formula for calculating the image detection asymptoticism is as follows: , Where A is the image detection asymptoticism. This represents the confidence level bias. For topological confidence weights, To predict positional deviation, For topological position weights, The proportion of key samples. The average gradient magnitude, Let be the mean occlusion degree of an occluded image. The mean occlusion value of the second occluded image. This is the fourth difference curve.
[0025] In this embodiment, the method for obtaining the accuracy evaluation result of the quasi-AI detection includes: A defect feature diagonal matrix is constructed based on the image detection asymptoticity, the proportion of key samples, and the mean of the occlusion degrees of the first and second occluded images. The gradient occlusion interference is negatively constrained by exponential decay based on the mean of the occlusion degrees of the first and second occluded images. A difference statistical symmetric matrix is constructed based on the mean and variance of the third difference curve. An accuracy evaluation model is obtained based on the defect feature diagonal matrix and the difference statistical symmetric matrix. The AI detection accuracy evaluation result is output based on the accuracy evaluation model. The expression of the accuracy evaluation model is as follows: , in The AI detection accuracy evaluation result is shown, where A represents the image detection asymptoticity. The proportion of key samples. The occlusion degree of the first occluded image is the average of the occlusion degrees of the second occluded image. The third difference curve The mean, The third difference curve The variance.
[0026] A second aspect of the present invention also provides an AI-based product sampling inspection accuracy evaluation system, comprising: Key sample screening module: used to acquire image data and real labeled samples of the product to be tested, and to screen key samples from the image data using an immune negative selection algorithm; The occluded defect feature extraction module is used to perform gradient occlusion on the secondary dataset of the image data based on the edge information of the key samples, to obtain a first occluded image, a second occluded image and an image occlusion degree, and to extract the occluded defect features using the first occluded image and the second occluded image through a wavelet convolutional network. Topological persistence annotation module: used to perform topological persistence annotation on the occluded defect features of the first occluded image and the second occluded image, and input the annotation data, image data and real annotation samples into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result; The third difference curve acquisition module is used to obtain the first difference curve and the second difference curve through the detection time sequence based on the first result and the second result, and to scale the first difference curve using the real annotation result in the detection result to obtain the third difference curve. Image detection asymptoticity acquisition module: used to obtain the detection deviation based on the real annotation results and image detection results, correct the second difference curve according to the detection deviation and the third difference curve, and obtain the image detection asymptoticity through the image occlusion degree according to the fourth difference curve obtained by correction; The detection accuracy evaluation module is used to obtain an accuracy evaluation model based on the image detection asymptoticism, key sample ratio, image occlusion degree, and third difference curve, and to output the AI detection accuracy evaluation result using the accuracy evaluation model.
[0027] The above description is merely an example and illustration of the structure of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the structure of the invention or exceed the scope defined in the claims, all of which should fall within the protection scope of the present invention.
Claims
1. An AI-based method for evaluating the accuracy of product sampling inspection, characterized in that, Includes the following steps: Acquire image data and real labeled samples of the product to be tested, and use an immune negative selection algorithm to screen key samples from the image data; Gradient occlusion is performed on the secondary dataset of the image data based on the edge information of the key samples to obtain a first occluded image, a second occluded image, and an image occlusion degree. The first occluded image and the second occluded image are used to extract occlusion interference features through a wavelet convolutional network. The occlusion interference features of the first occluded image and the second occluded image are topologically persistently annotated. The annotated data, image data and real annotated samples are respectively input into the AI detection model to obtain the first result, the second result, the real annotated result and the image detection result. Based on the first and second results, a first difference curve and a second difference curve are obtained through detection time sequence. The first difference curve is scaled using the real annotation results in the detection results to obtain a third difference curve. The detection deviation is obtained based on the real annotation results and image detection results. The second difference curve is corrected according to the detection deviation and the third difference curve. The image detection asymptoticity is obtained through the image occlusion degree according to the fourth difference curve obtained by correction. An accuracy evaluation model is obtained based on the image detection asymptoticism, key sample ratio, image occlusion degree, and third difference curve. The accuracy evaluation model is then used to output the AI detection accuracy evaluation result.
2. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for screening the key samples includes: Defect-free self-samples are generated based on real labeled samples using an immune negative selection algorithm. Initial detectors are randomly generated according to the feature dimensions of the image data, with the number of initial detectors set to 1.2 to 1.5 times the total number of image data samples. The Euclidean distance and cosine similarity between the initial detectors and the self-samples are calculated. Affinity is calculated by weighting the Euclidean distance and cosine similarity. The initial average affinity is increased by 15% to 20% as the affinity threshold, and detectors below the affinity threshold are used as the optimized detector set. The optimized average affinity is calculated based on the optimized detector set and image data. Samples with optimized average affinity lower than the affinity threshold are selected as candidate key samples. If the real annotation corresponding to the candidate key sample has defective features, the matching degree between the defective features and the sensitive features of the AI detection model is calculated. Candidate key samples with matching degree higher than the preset judgment threshold are selected as key samples. The position, feature type and correspondence between the key sample and the real annotation in the image data are recorded. If the candidate key sample has no defect features, the candidate sample affinity between the candidate key sample and the self sample is calculated. The candidate key sample with a candidate sample affinity lower than the initial average affinity is taken as the key sample. The sensitive features include edge mutation features, regional gray-level anomaly features, and shape distortion features.
3. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, A method for obtaining the first occlusion image, the second occlusion image, and the image occlusion degree includes: Based on key samples, edge feature similarity is calculated according to the cosine distance of the edge direction histogram. Samples with edge feature similarity greater than 60% in the image data are used as secondary datasets. Based on the images of the secondary datasets, edge contours are extracted by edge detection algorithms. The edge contours are expanded by 5 pixels and the horizontal gradient, vertical gradient, gradient direction and gradient magnitude are calculated by Sobel operator. The first occlusion template is the union of the horizontal gradient and gradient direction between -15° and 15° and between 165° and 195°. The second occlusion template is the union of the vertical gradient and gradient direction between 75° and 105° and between 255° and 285°. The occlusion intensity is determined by positive correlation linear mapping based on the gradient magnitude. The first and second occlusion templates are then processed pixel-by-pixel with samples from the secondary dataset to obtain the first and second occlusion images. The areas of regions with a pixel value change rate greater than 20% in the first and second occlusion images are counted, and the proportion of the region area to the total area of the corresponding occlusion image is taken as the image occlusion degree.
4. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for obtaining the occlusion interference features includes: Based on the first and second occlusion images, the occlusion inpainting model iteratively repairs the occlusion area until the absolute value of the difference between the energy function outputs in two consecutive iterations is less than 1. The first and second restored images are obtained respectively. The expression for the occlusion restoration model is: , Where E is the energy function output of the occlusion inpainting model, and u is the inpainted image. The pixel matrix range of each occluded image. Let be the L1 norm of the image gradient, which is obtained from the horizontal and vertical gradients corresponding to each occluded image, and S be the image occlusion degree. To mask the image, M is the gradient magnitude. The maximum gradient magnitude of the secondary dataset. Let L0 be the norm of the image gradient; The first and second restored images are respectively input into a dual wavelet-based convolutional network. The dual wavelet-based convolutional network extracts gradient defect features using a db4 wavelet-based convolutional kernel and extracts abrupt defect features using a haar wavelet-based convolutional kernel. Max pooling and sigmoid activation are performed based on the gradient defect features and abrupt defect features to obtain the occlusion interference features of the first and second restored images, respectively.
5. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for obtaining the labeled data includes: Based on the occlusion interference feature, the Euclidean distance between the feature point and the key sample is used as the horizontal axis, and the gradient magnitude of the feature point is used as the vertical axis. The feature points are mapped to a two-dimensional topological space according to the horizontal and vertical axes. The two-dimensional topological space is triangulated. The feature points of the topological branches after triangulation are traversed in ascending order according to the gradient magnitude. If the gradient magnitude of 5 consecutive pixels exceeds the median gradient magnitude of the secondary dataset and the pixel area is greater than 10 pixels, it is used as a birth sign; otherwise, it is used as a death sign. The difference between the birth sign and the death sign is used as the feature persistence, and the average persistence of the secondary dataset is used as the persistence threshold. Topological branches with feature persistence greater than 0.3 times the persistence threshold are designated as key topological branches. Based on the center coordinates of the topological branches, the key topological branches are mapped back to the image data using an inverse mapping algorithm. The mapping position, gradient interval, and topology type are recorded to obtain the topological mapping region. Pixel values with an image occlusion degree greater than 0.5 are labeled as occlusion-induced defects based on the topological mapping region; otherwise, they are labeled as original defects. This yields the labeled data of the image data. The labeled data includes feature persistence, the ratio of defect area to occlusion area, and the spatial overlap between occlusion interference features and true labels.
6. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for obtaining the third difference curve includes: Based on the first occluded image and the second occluded image, first annotation data and second annotation data are obtained through topological persistent annotation, respectively. The first annotation data, second annotation data, image data and real annotation samples are respectively input into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result. The first result includes the defect prediction location, product type and confidence level. Based on the detection time sequence, the first result and the second result are mapped to a time sequence. The defect confidence difference between the first result and the second result is calculated for each sample according to the time sequence. The mean Euclidean distance of the predicted position is calculated to obtain the first difference curve. The defect confidence difference between the second result and the real labeled result is calculated. The mean Euclidean distance between the predicted position and the real labeled predicted position is calculated to obtain the second difference curve. The confidence deviation and predicted position deviation between the actual annotation results and the image detection results are used as the baseline deviation features. Based on the baseline deviation features, linear regression fitting is performed on the defect confidence difference and the mean Euclidean distance of the predicted position of the first difference curve to obtain the confidence scaling factor and the position scaling factor. The first difference curve is then multiplied point by point by the confidence scaling factor and the position scaling factor to obtain the third difference curve.
7. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for obtaining the image detection asymptotics includes: The detection bias is obtained based on the real annotation results and image detection results. Feature persistence and spatial overlap are obtained based on the first annotation data and the second annotation data. The Pearson correlation coefficient between feature persistence and the confidence dimension of detection bias is calculated. The intersection-union ratio between spatial overlap and the location dimension of detection bias is calculated to obtain confidence association persistence and location association persistence. Max-min normalization is performed on confidence association persistence and location association persistence respectively to obtain topological confidence weight and topological location weight. The product of the topological confidence weight and the confidence deviation is calculated based on the third difference curve. This product is then added to the confidence deviation of the corresponding position on the second difference curve, and the confidence deviation of the detection deviation is subtracted to obtain the confidence deviation of the fourth difference curve. The topological position weight is multiplied by the predicted position deviation of the third difference curve, and this product is added to the predicted position deviation of the second difference curve, and the predicted position deviation of the detection deviation is subtracted to obtain the predicted position deviation of the fourth difference curve. Based on the fourth difference curve, the image detection asymptoticism is obtained through image occlusion. The formula for calculating the image detection asymptoticism is as follows: , Where A is the image detection asymptoticism. This represents the confidence level bias. For topological confidence weights, To predict positional deviation, For topological position weights, The proportion of key samples. The average gradient magnitude, Let be the mean occlusion degree of an occluded image. The mean occlusion value of the second occluded image. This is the fourth difference curve.
8. The AI-based product sampling inspection accuracy evaluation method according to claim 1, characterized in that, The method for obtaining the accuracy evaluation result of the quasi-AI detection includes: A defect feature diagonal matrix is constructed based on the image detection asymptoticity, the proportion of key samples, and the mean of the occlusion degrees of the first and second occluded images. The gradient occlusion interference is negatively constrained by exponential decay based on the mean of the occlusion degrees of the first and second occluded images. A difference statistical symmetric matrix is constructed based on the mean and variance of the third difference curve. An accuracy evaluation model is obtained based on the defect feature diagonal matrix and the difference statistical symmetric matrix. The AI detection accuracy evaluation result is output based on the accuracy evaluation model. The expression of the accuracy evaluation model is as follows: , in The AI detection accuracy evaluation result is shown, where A represents the image detection asymptoticity. The proportion of key samples. The occlusion degree of the first occluded image is the average of the occlusion degrees of the second occluded image. The third difference curve The mean, The third difference curve The variance.
9. An AI-based product sampling inspection accuracy evaluation system, used to execute the AI-based product sampling inspection accuracy evaluation method according to any one of claims 1 to 8, characterized in that, The system includes: Key sample screening module: used to acquire image data and real labeled samples of the product to be tested, and to screen key samples from the image data using an immune negative selection algorithm; The occluded defect feature extraction module is used to perform gradient occlusion on the secondary dataset of the image data based on the edge information of the key samples, to obtain a first occluded image, a second occluded image and an image occlusion degree, and to extract the occluded defect features using the first occluded image and the second occluded image through a wavelet convolutional network. Topological persistence annotation module: used to perform topological persistence annotation on the occluded defect features of the first occluded image and the second occluded image, and input the annotation data, image data and real annotation samples into the AI detection model to obtain the first result, the second result, the real annotation result and the image detection result; The third difference curve acquisition module is used to obtain the first difference curve and the second difference curve through the detection time sequence based on the first result and the second result, and to scale the first difference curve using the real annotation result in the detection result to obtain the third difference curve. Image detection asymptoticity acquisition module: used to obtain the detection deviation based on the real annotation results and image detection results, correct the second difference curve according to the detection deviation and the third difference curve, and obtain the image detection asymptoticity through the image occlusion degree according to the fourth difference curve obtained by correction; The detection accuracy evaluation module is used to obtain an accuracy evaluation model based on the image detection asymptoticism, key sample ratio, image occlusion degree, and third difference curve, and to output the AI detection accuracy evaluation result using the accuracy evaluation model.
Citation Information
Patent Citations
Product detection method, electronic equipment and storage medium
CN117522773A
Disease marker expression network reconstruction feature key point determination method
CN120279988A
A technique for the detection and removal of local defects in digital continuous-tone images
EP0624848A2