Industrial product surface defect positioning detection and attribution method
By combining the ResNet50 and XGBoost model with interpretable algorithms, the positioning detection and cause analysis of surface defects of industrial products is solved, and the problem of difficulty for production personnel to judge the location and cause of defects is improved, and the efficiency of production line adjustment is improved.
Patent Information
- Application Number
- CN202411811308.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-10
AI Technical Summary
It is difficult for production personnel to intuitively and accurately determine the location and cause of surface defects of industrial products, resulting in the inability to effectively adjust the production line.
Image defect detection and XGBoost model are used for production data defect detection, and the contribution value of each block and production factor to the model classification results is calculated by combining interpretable algorithms (such as Shapley values) to realize defect positioning and cause analysis.
Enable production personnel to intuitively and accurately judge the location of defects and analyze the causes of defects, provide guidance for production line adjustments and improve industrial production efficiency.
Smart Images

Figure CN119722631A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial product surface defect detection, and in particular to a method for positioning, detecting and attributing surface defects of industrial products. Background Art
[0002] With the rapid development of industrial automation and intelligence, product quality control has become a key link in the competitiveness of the industrial manufacturing industry. Production personnel can rely on artificial intelligence technology to achieve fully automatic and high-precision production defect detection. At the same time, the direct connection between detection results and production processes is also one of the current research hotspots in industrial production.
[0003] Machine learning technology, such as convolutional neural networks, has been adapted to automated defect detection tasks. Its ability to model complex features makes it more compatible with complex production processes. However, production personnel are usually unable to directly understand the decision-making process of neural networks, which results in them being unable to intuitively and accurately determine the location of defects, especially some subtle defects that are difficult to identify with the naked eye. At the same time, it is difficult for production personnel to analyze and summarize the causes of defects, and thus they are unable to make timely adjustments to production lines with defects.
[0004] Therefore, a method for positioning, detecting and attributing surface defects of industrial products is proposed to solve the above problems. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to provide a method for locating, detecting and attributing surface defects of industrial products, so that production personnel on the industrial production line can intuitively and accurately determine the location of the defects, and at the same time analyze and summarize the causes of the surface defects of industrial products, thereby providing guidance for the adjustment of the industrial production line. The technical solution is as follows:
[0006] Step S1, collecting surface defect images of industrial products on an industrial production line and their corresponding production data, and preprocessing the surface defect images of industrial products and their corresponding production data;
[0007] Step S2: Use the preprocessed industrial product surface defect image to train the ResNet50 model to obtain an image defect detection model;
[0008] Step S3: Use the preprocessed production data to train the XGBoost model to obtain a production data defect detection model;
[0009] Step S4, preprocessing the surface image of the industrial product to be tested, and inputting the preprocessed surface image of the industrial product to be tested into the image defect detection model to obtain the classification result of the surface image of the industrial product to be tested;
[0010] Step S5, setting the granularity η, dividing the surface image of the industrial product to be tested into η×η blocks; calculating the contribution value of each block to the classification result of the image defect detection model through an interpretable algorithm, and locating the surface defects of the industrial product according to the contribution value of each block to the classification result;
[0011] Step S6, preprocessing the production data to be tested, including:
[0012] The dimension of the production data set to be tested is defined as N′×M″; where N′ is the total number of samples in the production data set to be tested, and M″ is the total number of production factors in the production data set to be tested;
[0013] Step S7, inputting the preprocessed production data to be tested into the production data defect detection model to obtain the classification result of the production data;
[0014] Step S8: Calculate the contribution value of each production factor to the classification result of the production data defect detection model through an interpretable algorithm; and summarize the causes of surface defects of industrial products based on the contribution value of each production factor to the classification result.
[0015] Furthermore, the step S1 comprises:
[0016] A random seed is set based on the collected production data; and supplementary production data is obtained through a data generator based on the random seed.
[0017] Furthermore, the step S1 of preprocessing the industrial product surface defect image includes:
[0018] A1. Set the image size;
[0019] A2. Crop and scale the image so that it only contains the defective part;
[0020] A3. Classify the images according to defect types and label them with corresponding defect types.
[0021] Furthermore, the step S1 pre-processes the production data corresponding to the industrial product surface defect image, including:
[0022] B1. Delete the blanks;
[0023] B2. Define the production data corresponding to the surface defect image of industrial products as:
[0024]
[0025] Where data is the production data set corresponding to the surface defect images of industrial products, Α is the total number of samples in the production data set, Β is the total number of production factors in the production data set, and x αβis the data of the βth production factor in the αth sample, and α=1,2,…,Α,β=1,2,…,Β;
[0026] B3. Classify the production data corresponding to the industrial product surface defect image and label it with the same defect type label as the industrial product surface defect image.
[0027] Furthermore, the step S5 calculates the contribution value of each block to the classification result of the image defect detection model, specifically including:
[0028] The Shapley value of each block for the classification result of the image defect detection model is calculated through the shap library. The formula is as follows:
[0029]
[0030] Where P j represents the jth block, f * is the function representation of the image defect detection model, φ j (f * ,P j ) represents the Shapley value of the jth block output to the image defect detection model, S represents the block subset, and f * (S) represents the image defect detection model output of block subset S, N S Represents the set of all blocks, N S / {j} represents the set of all blocks after removing the jth block, S∪{j} represents the addition of block j to the block subset, |S| represents the number of elements in the block subset, and M represents the total number of blocks.
[0031] Furthermore, the step S5 of locating the surface defects of the industrial product specifically includes the following steps:
[0032] C1. Create a mask of size η×η and calculate the mask value of each block. The formula is as follows:
[0033]
[0034] Where M j Represents the mask value of the jth block, SHAP j represents the contribution value of the jth block to the classification result of the image defect detection model; l represents the depth value proportional to the Shapley value, which is used to adjust the color depth, that is, l = |SHAP j |;
[0035] C2, superimpose the mask on the original image to form a defect location heat map;
[0036] C3. Locate surface defects of industrial products based on defect location heat map.
[0037] Furthermore, the step S8 calculates the contribution value of each production factor to the classification result of the production data defect detection model, specifically including:
[0038] The Shapley value of each production factor for the classification result of the production data defect detection model is calculated through the shap library. The formula is as follows:
[0039]
[0040] In the formula, x i represents the i-th production factor, f is the function representation of the production data defect detection model, φ i (f,x i ) represents the Shapley value of the output of the production data defect detection model for the i-th production factor, S′ represents the production factor subset, f(S′) represents the output of the production data defect detection model for the production factor subset, N s′ Represents the set of all production factors, N S′ / {i} represents the set of all production factors after removing the i-th production factor, S′∪{i} represents adding factor i to the production factor subset, |S′| represents the number of elements in the production factor subset, and M′ represents the total number of production factors.
[0041] Furthermore, the causes of surface defects of industrial products are summarized in step S8, which specifically includes the following steps:
[0042] D1. Calculate the Shapley values of all production factors;
[0043] D2. Visualize the Shapley values of all production factors by drawing statistical graphs;
[0044] D3. Summarize the causes of surface defects of industrial products based on statistical charts.
[0045] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0046] 1. The present invention detects the surface image of the industrial product to be tested through a pre-trained image defect detection model, obtains the defect category of the surface image of the industrial product to be tested, and divides the surface image of the industrial product to be tested into η×η blocks. An interpretable algorithm is used to calculate the contribution value of each block to the classification result of the image defect detection model, thereby realizing the positioning detection of surface defects of industrial products, enabling production personnel to intuitively and accurately determine the location where the defects occur, and improving the interactivity of machine learning applications in the industrial direction.
[0047] 2. The present invention detects the production data to be tested corresponding to the surface image of the industrial product to be tested through a pre-trained production data defect detection model, obtains the defect category of the production data to be tested corresponding to the surface image of the industrial product to be tested, and uses an interpretable algorithm to calculate the contribution value of each production factor to the classification result of the production data defect detection model, analyzes and summarizes the causes of surface defects of industrial products, and further provides guidance for the adjustment of industrial production lines, thereby significantly improving the efficiency of industrial production. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 The figure is an overall flow chart of a method for locating, detecting and attributing surface defects of industrial products.
[0049] Figure 2 Schematic diagram of the construction process of image defect detection model and production data defect detection model.
[0050] Figure 3(a) is a schematic diagram of the steel surface defect image.
[0051] Figure 3(b) is a schematic diagram of production data corresponding to the steel surface defect image.
[0052] Figure 4 Defect location thermal map of the steel surface image to be tested.
[0053] Figure 5(a) is a bar chart showing the average contribution of various production factors to the “dirty” defect on the steel surface.
[0054] Figure 5(b) is a scatter plot of the distribution of “dirty” defect samples on the steel surface due to various production factors.
[0055] Figure 5(c) is the decision diagram of a single sample for the “dirty” defect on the steel surface. DETAILED DESCRIPTION
[0056] The following will clearly and completely describe the technical solution of the present invention in conjunction with the accompanying drawings in the present invention, so as to have a further understanding of the concept of the present invention, the technical problems solved, the technical features constituting the technical solution and the technical effects brought about.
[0057] Although Explainable Artificial Intelligence (XAI) does not directly participate in the decision-making process of neural networks, it can provide production personnel with guidance on production line adjustments, making defect detection based on machine learning more practical. Explanatory algorithms for neural networks were originally used in the field of mathematics to quantify the benefits in cooperative games, explaining the question of "how the game members led to this result." The present invention combines similar explanatory algorithms with the contribution of quantitative classification features to facilitate people's understanding of the decision-making process of neural networks. Its research and application in combination with industrial defect detection tasks has great potential.
[0058] Embodiment 1:
[0059] like Figure 1 As shown, it is an overall flow chart of a method for positioning, detecting and attributing surface defects of industrial products, which specifically includes the following steps:
[0060] Step S1, collecting surface defect images of industrial products on an industrial production line and their corresponding production data, and preprocessing the surface defect images of industrial products and their corresponding production data;
[0061] First, data is collected from industrial production lines. The collected data mainly includes two parts: surface defect images of industrial products and their corresponding production data;
[0062] Specifically, in this embodiment, as shown in Figures 3(a) and 3(b), steel surface defect images and their corresponding production data in NEU-DET (steel surface defect dataset) are obtained; since training a neural network usually requires sufficient data, a random seed seed is used to generate supplementary production data based on the acquired production data; this part of data is used to supplement the collected production data, and in the subsequent construction process of the production data defect detection model, it will be used to further optimize the training production data defect detection model f, so that the model can achieve better classification effect.
[0063] Preprocess the steel surface defect images, including:
[0064] A1. Set the image size;
[0065] The size of steel surface defect images is limited to 200×200 pixels.
[0066] A2. By cropping and scaling the image, the image only contains the defective part.
[0067] A3. Classify the images according to defect types and label them with corresponding defect types.
[0068] Preprocessing the production data corresponding to the steel surface defect image and the acquired supplementary production data includes:
[0069] B1. Delete the blank.
[0070] B2. Define the production data corresponding to the surface defect image of industrial products as:
[0071]
[0072] Among them, data is the production data set corresponding to the surface defect images of industrial products, A is the total number of samples in the production data set, B is the total number of production factors in the production data set, and x αβ is the data of the βth production factor in the αth sample, and α=1,2,…,A, β=1,2,…,B.
[0073] B3. Classify the production data corresponding to the steel surface defect image and label it with the same defect type label as the steel surface defect image.
[0074] Step S2: Use the preprocessed industrial product surface defect images to train the ResNet50 model to obtain the image defect detection model f * ;
[0075] like Figure 2 As shown in the figure, the preprocessed steel surface defect image is used to train the ResNet-50 pre-training model to obtain the image defect detection model f * , used for defect detection of surface images of industrial products to be tested, the parameters of the ResNet-50 pre-trained model are shown in Table 1;
[0076] Table 1. Image defect detection network parameters
[0077] parameter default value illustrate Input Shape (200,200,3) Input image shape Weights 'Imagenet' Pre-trained weights Include Top True Whether to include fully connected layers Pooling MaxPooling Pooling method for feature extraction Classes 6 Defect Category Optimizer Adam Optimizer Loss Function Categorical Crossentropy Default loss function LR 0.001 Learning Rate Batch Size 8 Training batch size Epochs 50 Training Theory Number Data Augmentation True Using data augmentation Regularization L2 Default regularization method
[0078] This network contains a convolution layer with a convolution kernel size of 1×1, 64 feature channels after convolution, a convolution stride of 2 (s2), batch normalization (BN) by default, and Relu as the activation function. At the same time, a maximum pooling layer is used to downsample the feature map, with a window size of 3×3 and a stride of 2. After multi-layer training of the network, a dimensionality reduction operation is performed through an average pooling layer with a pooling window of 7×7. The final fully connected layer contains 6 neurons, corresponding to 6 categories.
[0079] Step S3: Use the preprocessed production data and the supplementary production data to train the XGBoost model to obtain a production data defect detection model f;
[0080] The preprocessed production data and supplementary production data are used to train the XGBoost pre-trained model to obtain the production data defect detection model f, which is used for defect detection of the production data to be tested. The parameters of the XGBoost pre-trained model are shown in Table 2.
[0081] Table 2 Production data defect detection network parameters
[0082] parameter default value illustrate Booster gbtree Riser Type eta 0.3 Controlling the convergence speed Max_depth 6 Maximum depth of the tree Min_child_weight 1 Control the minimum weight and subsample 1 The proportion of data samples used n_estimators 100 Number of base model trees objective reg Objective Function lambda 1 L2 regularization parameter alpha 0 L1 regularization parameter seed 0 Random Seed eval_metric 'rmse' Evaluation Metrics
[0083] Step S4, preprocessing the surface image of the industrial product to be tested, and inputting the preprocessed surface image of the industrial product to be tested into the image defect detection model to obtain the classification result of the surface image of the industrial product to be tested;
[0084] Preprocessing of the steel surface images to be tested, including cropping, unifying the image size, and normalization operations, so that the neural network can receive images in a unified format, making it easier for ResNet-50 to extract features and obtain test results;
[0085] Assume that is the set of workpiece surface images to be predicted, the steel surface image i′∈I to be tested, the dimension of the steel surface image i′ to be tested is m×n×p, where m represents the image height, n represents the image width, and p is the number of color channels. In this embodiment, m=n=200, p=3; all i′∈I are normalized to obtain I′, so that its pixel value is within a uniform range; the image defect detection model f * Perform feature extraction on the normalized image data I′ to obtain the feature vector f * (I′), and input it into the classification layer to obtain the predicted probability distribution y′ of the steel surface image to be tested I , and then obtain the defect type Y of the surface image of the steel to be tested I .
[0086] Step S5, setting the granularity η, dividing the surface image of the industrial product to be tested into η×η blocks; calculating the contribution value of each block to the classification result of the image defect detection model through an interpretable algorithm, and locating the surface defects of the industrial product according to the contribution value of each block to the classification result;
[0087] In order to generate a defect location heat map with visual positioning, the granularity η (η≤200) is set, and the surface image of the steel to be tested is divided into η×η blocks. The contribution value of each block to the classification result of the image defect detection model is calculated by using the Python interpretable machine learning library shap, that is, the Shapley value. The formula is as follows:
[0088]
[0089] Where P j represents the jth block, f* is the function representation of the image defect detection model, φ j (f * ,P j ) represents the Shapley value of the jth block output to the image defect detection model, S represents the block subset, and f * (S) represents the image defect detection model output of block subset S, N S Represents the set of all blocks, N S / {j} represents the set of all blocks after removing the jth block, S∪{j} represents the addition of block j to the block subset, |S| represents the number of elements in the block subset, and M represents the total number of blocks;
[0090] Create a mask of size η×η and calculate the mask value of each block. The formula is as follows:
[0091]
[0092] Where M j Represents the mask value of the jth block, SHAP j represents the contribution value of the jth block to the classification result of the image defect detection model; l represents the depth value proportional to the Shapley value, which is used to adjust the color depth, that is, l = |SHAP j |;
[0093] The mask is superimposed on the original image to form a defect location heat map; based on the defect location heat map, the surface defects of industrial products are located; Figure 4 As shown in the figure, if there are more dark red areas in the surface image of the steel to be tested, it means that there are defects in the image, and the dark red area is the specific location of the defect, so that production personnel can intuitively and accurately judge whether there are defects on the surface of industrial products and the location of the defects, which improves the interactivity of machine learning applications in the industrial direction and improves the efficiency of industrial production.
[0094] Step S6, preprocessing the production data to be tested corresponding to the surface image of the steel material to be tested, including:
[0095] Let D be the production data set to be tested, and define its dimension as N′×M″; where N′ is the total number of samples in the production data set to be tested, and M″ is the total number of production factors in the production data set to be tested. Its format is:
[0096]
[0097] Among them, x nm It is the data of the mth production factor in the nth sample of the production data set to be tested, and n=1,2,…,N′, m=1,2,…,M″.
[0098] Step S7, inputting the preprocessed production data to be tested into the production data defect detection model to obtain the classification result of the production data to be tested;
[0099] The preprocessed production data set D to be tested is input into the production data defect detection model f, and the predicted defect type distribution y′ is obtained through the model weight. D , whose dimension is k, and dimension k represents the total number of defect types, and then according to the predicted defect type distribution y′ D The largest probability category determines the classification result Y of the production data to be tested corresponding to the surface image of the steel to be tested D ; So far, for a set of steel surface images - production data (i′, d), there is a set of corresponding outputs (Y i′ ,Y d ), where i∈I, d∈D, Y i′ ∈Y I , Y d ∈Y D .
[0100] Step S8: Calculate the contribution value of each production factor to the classification result of the production data defect detection model through an interpretable algorithm; summarize the causes of surface defects of industrial products according to the contribution value of each production factor to the classification result;
[0101] For the production data sample d (d∈D) to be tested, the contribution value of each production factor to the classification result of the production data defect detection model is calculated through the Python interpretable machine learning library shap, that is, the Shapley value. The formula is as follows:
[0102]
[0103] In the formula, x i represents the i-th production factor, f is the function representation of the production data defect detection model, φ i (f,x i ) represents the Shapley value of the output of the production data defect detection model for the i-th production factor, S′ represents the production factor subset, f(S′) represents the output of the production data defect detection model for the production factor subset, N S′ Represents the set of all production factors, N S′ / {i} represents the set of all production factors after removing the i-th production factor, S′∪{i} represents adding factor i to the production factor subset, |S′| represents the number of elements in the production factor subset, and M′ represents the total number of production factors;
[0104] The obtained Shapley values are counted and statistical graphs such as bar graphs and scatter graphs are drawn to facilitate attribution visualization;
[0105] Among them, the bar chart shown in FIG5(a) represents the average contribution value (horizontal axis) of each production factor (vertical axis) for a certain classification (the example focuses on the "dirty" classification), and the positive or negative value reflects the positive or negative influence of each production factor on the "dirty" classification (red represents positive value, and blue represents negative value), that is, a negative value represents that the factor will not lead to the classification result, and its absolute value represents the degree of this negative influence. Correspondingly, a positive value represents that the factor will lead to the classification result, and its absolute value represents the degree of this positive influence. As shown in the example of FIG5(a), the average contribution value of the production factor "TypeOfSteel_A300" is a positive value, which means that the production factor will lead to the "dirty" defect, and its absolute value is 0.38, which represents the degree to which the production factor leads to the dirty defect.
[0106] The scatter plot shown in FIG5(b) reflects the distribution of all samples participating in the test for a certain classification (the example focuses on the "dirty" classification). Each point represents a production data sample to be tested, the horizontal axis represents the contribution value of the sample, and the color of the sample point reflects the value of the production factor (the redder the color, the larger the value, and the bluer the color, the smaller the value). The figure reflects the distribution of sample points for each production factor. If the distribution of sample points is obviously related to their color, it can be reflected in the figure. As shown in the example of FIG5(b), the red sample points of the production factor "TypeOfSteel_A300" are clustered in the area with negative contribution values, and the blue sample points are clustered in the area with positive contribution values, indicating that the higher the value of the production factor, the less likely it is to cause the "dirty" defect, and the lower the value of the production factor, the more likely it is to cause the "dirty" defect.
[0107] According to the detected defect category, the production staff first determines the main production factor causing the defect by the positive and negative and absolute values of the average contribution of each production factor to the defect category in the bar chart, and then increases or decreases the value of the production factor according to the color and distribution of the sample points in the scatter plot, thereby providing guidance for the adjustment of the industrial production line and significantly improving the efficiency of industrial production;
[0108] In addition to attributing the global average production factors, we can also perform attribution analysis on individual samples. As shown in Figure 5(c), the decision diagram provided shows a single production data sample (this sample belongs to the "dirty" category). The horizontal axis represents the contribution value. The contribution values of the first few production factors in the figure are all greater than the contribution mean of this category (1.06, the vertical line in the figure represents the mean), and therefore they have more positive influence in the final classification result.
[0109] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for locating, detecting and attributing surface defects of industrial products, characterized in that: The following steps are involved: Step S1, collecting surface defect images of industrial products on an industrial production line and their corresponding production data, and preprocessing the surface defect images of industrial products and their corresponding production data; Step S2: Use the preprocessed industrial product surface defect image to train the ResNet50 model to obtain an image defect detection model; Step S3: Use the preprocessed production data to train the XGBoost model to obtain a production data defect detection model; Step S4, preprocessing the surface image of the industrial product to be tested, and inputting the preprocessed surface image of the industrial product to be tested into the image defect detection model to obtain the classification result of the surface image of the industrial product to be tested; Step S5, setting the granularity η, dividing the surface image of the industrial product to be tested into η×η blocks; calculating the contribution value of each block to the classification result of the image defect detection model through an interpretable algorithm, and locating the surface defects of the industrial product according to the contribution value of each block to the classification result; Step S6, preprocessing the production data to be tested, including: The dimension of the production data set to be tested is defined as N′×M″; where N′ is the total number of samples in the production data set to be tested, and M″ is the total number of production factors in the production data set to be tested; Step S7, inputting the preprocessed production data to be tested into the production data defect detection model to obtain the classification result of the production data; Step S8: Calculate the contribution value of each production factor to the classification result of the production data defect detection model through an interpretable algorithm; and summarize the causes of surface defects of industrial products based on the contribution value of each production factor to the classification result.
2. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S1 comprises: A random seed is set according to the collected production data; and supplementary production data is obtained through a data generator according to the random seed.
3. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S1 pre-processes the industrial product surface defect image, including: A1. Set the image size; A2. Crop and scale the image so that it only contains the defective part; A3. Classify the images according to defect types and label them with corresponding defect types.
4. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S1 pre-processes the production data corresponding to the industrial product surface defect image, including: B1. Delete the blanks; B2. Define the production data corresponding to the surface defect image of industrial products as: Where data is the production data set corresponding to the surface defect images of industrial products, Α is the total number of samples in the production data set, Β is the total number of production factors in the production data set, and x αβ is the data of the βth production factor in the αth sample, and α=1,2,…,Α,β=1,2,…,Β; B3. Classify the production data corresponding to the industrial product surface defect image and label it with the same defect type label as the industrial product surface defect image.
5. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S5 calculates the contribution value of each block to the classification result of the image defect detection model, specifically including: The Shapley value of each block for the classification result of the image defect detection model is calculated through the shap library. The formula is as follows: Where P j represents the jth block, f * is the function representation of the image defect detection model, φ j (f * ,P j ) represents the Shapley value of the jth block output to the image defect detection model, S represents the block subset, and f * (S) represents the image defect detection model output of block subset S, N S Represents the set of all blocks, N S / {j} represents the set of all blocks after removing the jth block, S∪{j} represents the addition of block j to the block subset, |S| represents the number of elements in the block subset, and M represents the total number of blocks.
6. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S5 of locating the surface defects of the industrial product specifically includes the following steps: C1. Create a mask of size η×η and calculate the mask value of each block. The formula is as follows: Where M j Represents the mask value of the jth block, SHAP j represents the contribution value of the jth block to the classification result of the image defect detection model; l represents the depth value proportional to the Shapley value, which is used to adjust the color depth, that is, l = |SHAP j |; C2, superimpose the mask on the original image to form a defect location heat map; C3. Locate surface defects of industrial products based on defect location heat map.
7. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The step S8 calculates the contribution value of each production factor to the classification result of the production data defect detection model, specifically including: The Shapley value of each production factor for the classification result of the production data defect detection model is calculated through the shap library. The formula is as follows: In the formula, x i represents the i-th production factor, f is the function representation of the production data defect detection model, φ i (f,x i ) represents the Shapley value of the i-th production factor on the output of the production data defect detection model, S ′ represents the subset of production factors, f(S ′ ) represents the output of the production data defect detection model for the production factor subset, N S′ Represents the set of all production factors, N S′ / {i} represents the set of all production factors after removing the i-th production factor, S′∪{i} represents adding factor i to the production factor subset, |S′| represents the number of elements in the production factor subset, and M′ represents the total number of production factors.
8. A method for locating, detecting and attributing surface defects of industrial products as claimed in claim 1, characterized in that: The causes of surface defects of industrial products are summarized in step S8, which specifically includes the following steps: D1. Calculate the Shapley values of all production factors; D2. Visualize the Shapley values of all production factors by drawing statistical graphs; D3. Summarize the causes of surface defects of industrial products based on statistical charts.
Citation Information
Patent Citations
Industrial product defect quality inspection method and device based on deep learning and storage medium
CN113643268A
Industrial product surface defect position detection method based on weak supervision target detection
CN115661123A
Product defect detection method, apparatus and system
WO2021135331A1
Cited By
High polymer material fracture failure type discrimination method and system based on deep learning
CN120411967A
Method and system for distinguishing polymer material fracture failure types based on deep learning
CN120411967B
Industrial product quality detection method, equipment and medium
CN121582166A