A method for locating, detecting, and attributing surface defects in industrial products

By combining ResNet50 and XGBoost models with interpretable algorithms, the problem of locating and attributing surface defects in industrial products was solved, improving the judgment ability of production personnel and the efficiency of production line adjustments.

CN119722631BActive Publication Date: 2025-10-28SICHUAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411811308.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-10-28
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

Production staff have difficulty intuitively and accurately determining the location and cause of surface defects in industrial products, resulting in an inability to adjust the production line in a timely manner.

Method used

The ResNet50 and XGBoost models are used to preprocess the surface defect images and production data of industrial products. Interpretable algorithms (such as Shapley values) are combined to calculate the contribution value of each block and production factor, locate the defects and summarize the causes.

Benefits of technology

It enables production personnel to intuitively and accurately judge the location of defects and analyze their causes, thereby improving the adjustment efficiency and production efficiency of industrial production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722631B_ABST
    Figure CN119722631B_ABST
Patent Text Reader

Abstract

This invention discloses a method for locating, detecting, and attributing surface defects in industrial products. This method uses a pre-trained image defect detection model and a production data defect detection model to detect defects in the surface image of the industrial product and its corresponding production data. The method obtains the defect categories of the surface image and the corresponding production data, and divides the surface image into η×η blocks. An interpretable algorithm is used to calculate the contribution of each block to the classification result of the image defect detection model, thereby achieving the location detection of surface defects in industrial products. This allows production personnel to intuitively and accurately determine the location of defects. Simultaneously, an interpretable algorithm is used to calculate the contribution of each production factor to the classification result of the production data defect detection model, analyzing and summarizing the causes of surface defects in industrial products. This provides guidance for adjusting industrial production lines and significantly improves the efficiency of industrial production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial product surface defect detection technology, specifically to a method for locating, detecting, and attributing surface defects in industrial products. Background Technology

[0002] With the rapid development of industrial automation and intelligence, product quality control has become a key link in the competitiveness of industrial manufacturing. Production personnel can rely on artificial intelligence technology to achieve fully automated and high-precision production defect detection. At the same time, the direct link between detection results and production processes is also one of the current research hotspots in industrial production.

[0003] Machine learning techniques, such as convolutional neural networks, have been adapted to automated defect detection tasks. Their ability to model complex features makes them more suitable for complex production processes. However, production personnel often cannot directly understand the decision-making process of neural networks, which makes it difficult for them 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, production personnel find it difficult to analyze and summarize the causes of defects, thus making it impossible to make timely adjustments to production lines with defects.

[0004] To address this issue, a method for locating, detecting, and attributing surface defects in industrial products is proposed. Summary of the Invention

[0005] To address the aforementioned problems, the present invention aims to provide a method for locating, detecting, and attributing surface defects in industrial products. This method enables production personnel on industrial production lines to intuitively and accurately determine the location of defects and analyze and summarize the causes of surface defects, thereby providing guidance for adjustments to the industrial production line. The technical solution is as follows:

[0006] Step S1: Collect images of surface defects of industrial products on the industrial production line and their corresponding production data, and preprocess the images of surface defects of industrial products and their corresponding production data.

[0007] Step S2: Train the ResNet50 model using the preprocessed images of surface defects in industrial products to obtain an image defect detection model;

[0008] Step S3: Train the XGBoost model using the preprocessed production data to obtain a production data defect detection model;

[0009] Step S4: Preprocess the surface image of the industrial product to be tested, and input 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: Set the granularity η and divide the surface image of the industrial product to be tested into η×η blocks. Calculate the contribution value of each block to the classification result of the image defect detection model using an interpretable algorithm, and locate the surface defects of the industrial product based on the contribution value of each block to the classification result.

[0011] Step S6: Preprocess the production data to be tested, including:

[0012] Define the dimension of the production dataset to be tested as N′×M″; where N′ is the total number of samples in the production dataset to be tested, and M″ is the total number of production factors in the production dataset to be tested.

[0013] Step S7: Input the preprocessed production data to be tested into the production data defect detection model to obtain the classification results 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 using an interpretable algorithm; based on the contribution value of each production factor to the classification result, summarize the causes of surface defects in industrial products.

[0015] Further, step S1 includes:

[0016] Based on the collected production data, a random seed is set; based on the random seed, supplementary production data is obtained through a data generator.

[0017] Furthermore, the preprocessing of the surface defect image of the industrial product in step S1 includes:

[0018] A1. Set the image size;

[0019] A2. By cropping and scaling the image, the image is made to contain only the defective parts;

[0020] A3. Classify the images according to the defect type and label them with the corresponding defect type.

[0021] Further, in step S1, the production data corresponding to the surface defect images of industrial products is preprocessed, including:

[0022] B1. Delete the blank;

[0023] B2. Define the production data corresponding to surface defect images of industrial products as follows:

[0024]

[0025] Where data represents the production dataset corresponding to the surface defect images of industrial products, A is the total number of samples in the production dataset, B is the total number of production factors in the production dataset, and x αβIt is the data of the β-th production factor in the α-th sample, where α = 1, 2, ..., A, and β = 1, 2, ..., B;

[0026] B3. Classify the production data corresponding to the surface defect images of industrial products and label them with the same defect type as the surface defect images of industrial products.

[0027] Further, in step S5, calculating the contribution value of each block to the classification result of the image defect detection model specifically includes:

[0028] The Shapley value for each block in relation to the image defect detection model's classification result is calculated using the Shapley library, as shown in the following formula:

[0029]

[0030] In the formula, P j f represents the j-th block. * φ is the functional representation of the image defect detection model. j (f * ,P j ) represents the Shapley value output by the image defect detection model for the j-th block, where S represents the subset of blocks, f * (S) represents the image defect detection model output of the block subset S, N S N represents the set consisting of all blocks. S / {j} Let S represent the set of all blocks after removing the j-th 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, locating surface defects in industrial products in step S5 specifically includes the following steps:

[0032] C1. Create a mask of size η×η and calculate the mask value for each block using the following formula:

[0033]

[0034] In the formula, M j SHAP represents the mask value of the j-th block. j represents the contribution of the j-th block to the image defect detection model classification result; l represents the depth value proportional to the Shapley value, used to adjust the color intensity, i.e., l = |SHAP j |;

[0035] C2. Overlay the mask onto the original image to form a heat map of defect location;

[0036] C3. Locate surface defects of industrial products based on the defect location heat map.

[0037] Further, step S8, which calculates the contribution value of each production factor to the classification result of the production data defect detection model, specifically includes:

[0038] The Shapley value for each production factor in relation to the classification results of the production data defect detection model is calculated using the Shapley library, as follows:

[0039]

[0040] In the formula, x i Let f represent the i-th production factor, f be the function representation of the production data defect detection model, and φ be the production factor. i (f,x i ) represents the Shapley value of the production data defect detection model output for the i-th production factor, S′ represents a subset of production factors, and f(S′) represents the production data defect detection model output for the subset of production factors. N s′ N represents the set of all factors of production. S′ / {i} Let S' represent the set of all production factors after removing the i-th production factor, S'∪{i} represent adding factor i to the production factor subset, |S'| represent the number of elements in the production factor subset, and M' represent the total number of production factors.

[0041] Furthermore, the step S8, which summarizes the causes of surface defects in industrial products, specifically includes the following steps:

[0042] D1. Calculate the Shapley values ​​for all production factors;

[0043] D2. Visualize the Shapley values ​​of all production factors by drawing statistical charts;

[0044] D3. Summarize the causes of surface defects in industrial products based on the statistical chart.

[0045] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0046] 1. This invention uses a pre-trained image defect detection model to detect surface images of industrial products under test, obtains the defect category of the surface image of the industrial products under test, and divides the surface image of the industrial products under test 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 location detection of surface defects of industrial products. This enables production personnel to intuitively and accurately determine the location of defects, and improves the interactivity of machine learning applications in the industrial field.

[0047] 2. This invention uses a pre-trained production data defect detection model to detect the production data corresponding to the surface image of the industrial product under test, obtains the defect category of the production data corresponding to the surface image of the industrial product under test, 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. The causes of surface defects of industrial products are analyzed and summarized, thereby providing guidance for the adjustment of industrial production lines and significantly improving the efficiency of industrial production. Attached Figure Description

[0048] Figure 1 This is a flowchart of the overall process for locating, detecting, and attributing surface defects in industrial products.

[0049] Figure 2 This is a schematic diagram illustrating the construction process of the image defect detection model and the production data defect detection model.

[0050] Figure 3(a) is a schematic diagram of surface defects in steel.

[0051] Figure 3(b) is a schematic diagram of production data corresponding to the surface defect image of steel.

[0052] Figure 4 A heat map for locating defects on the surface of the steel to be tested.

[0053] Figure 5(a) is a bar chart showing the average contribution of various production factors to the "dirt" defect on the steel surface.

[0054] Figure 5(b) is a scatter plot showing the distribution of "dirt" defect samples on steel surfaces due to various production factors.

[0055] Figure 5(c) is a decision diagram for a single sample regarding the "dirt" defect on the steel surface. Detailed Implementation

[0056] The technical solutions of the present invention will now be clearly and completely described in conjunction with the accompanying drawings, so as to provide a better understanding of the concept of the present invention, the technical problem solved, the technical features constituting the technical solution, and the technical effects brought about.

[0057] While Explainable Artificial Intelligence (XAI) does not directly participate in the decision-making process of neural networks, it can provide guidance for production line adjustments, making machine learning-based defect detection more practical. Explainable algorithms for neural networks were initially used in mathematics to quantify the rewards in cooperative games, explaining "how game members led to this outcome." This invention combines similar interpretive algorithms with the contribution of quantified classification features, thereby facilitating the understanding of the neural network's decision-making process. Its research and application in industrial defect detection tasks hold great potential.

[0058] Example 1:

[0059] like Figure 1 The diagram shown is an overall flowchart of a method for locating, detecting, and attributing surface defects in industrial products, which specifically includes the following steps:

[0060] Step S1: Collect images of surface defects of industrial products on the industrial production line and their corresponding production data, and preprocess the images of surface defects of industrial products and their corresponding production data.

[0061] First, data is collected from the industrial production line. The collected data mainly includes two parts: images of surface defects in 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 are obtained from the NEU-DET (steel surface defect dataset). Since training a neural network usually requires a sufficient amount of data, supplementary production data is generated using a random seed based on the obtained production data. This data is used to supplement the collected production data, and in the subsequent construction of the production data defect detection model, it will be used to further optimize the training of the production data defect detection model f, so that the model can achieve better classification results.

[0063] Preprocessing of steel surface defect images includes:

[0064] A1. Set the image size;

[0065] The image size of steel surface defects is limited to 200×200 pixels.

[0066] A2. By cropping and scaling the image, the image is made to contain only the defective parts.

[0067] A3. Classify the images according to the defect type and label them with the corresponding defect type.

[0068] The production data corresponding to the above-mentioned steel surface defect images and the acquired supplementary production data are preprocessed, including:

[0069] B1. Delete the blanks.

[0070] B2. Define the production data corresponding to surface defect images of industrial products as follows:

[0071]

[0072] Where, data represents the production dataset corresponding to the surface defect images of industrial products, A is the total number of samples in the production dataset, B is the total number of production factors in the production dataset, and x αβ It is the data of the β-th production factor in the α-th sample, where α = 1, 2, ..., A, and β = 1, 2, ..., B.

[0073] B3. Classify the production data corresponding to the steel surface defect images and label them with the same defect type as the steel surface defect images.

[0074] Step S2: Train the ResNet50 model using the preprocessed images of surface defects in industrial products to obtain the image defect detection model f. * ;

[0075] like Figure 2 As shown, the preprocessed images of steel surface defects are used to train a ResNet-50 pre-trained model to obtain the image defect detection model f. * The ResNet-50 pre-trained model parameters are shown in Table 1 and are used for defect detection of surface images of industrial products under test.

[0076] Table 1. Network parameters for image defect detection

[0077] parameter default value illustrate Input Shape (200,200,3) Input image shape Weights Imagenet Pre-trained weights Include Top True Does it include a fully connected layer? Pooling MaxPooling Pooling methods during 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 theorem Data Augmentation True Data Augmentation Regularization L2 Default regularization method

[0078] This network contains convolutional layers with a kernel size of 1×1, resulting in 64 feature channels and a stride of 2 (s²). Batch Normalization (BN) is used by default, and ReLU is selected as the activation function. Simultaneously, max pooling layers are used to downsample the feature maps with a window size of 3×3 and a stride of 2. After training the network through multiple layers, dimensionality reduction is performed through average pooling layers with a pooling window of 7×7. The final fully connected layer contains 6 neurons, corresponding to 6 categories.

[0079] Step S3: Train the XGBoost model using the preprocessed production data and supplementary production data to obtain the 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 Network Parameters for Production Data Defect Detection

[0082] parameter default value illustrate Booster gbtree Lifter type eta 0.3 Controlling convergence speed Max_depth 6 Maximum depth of tree Min_child_weight 1 Controlling the minimum weight of leaf nodes subsample 1 Data sample ratio used n_estimators 100 Number of base model trees objective reg objective function lambda 1 L2 regularization parameters alpha 0 L1 regularization parameters seed 0 Random Seed eval_metric 'rmse' Evaluation indicators

[0083] Step S4: Preprocess the surface image of the industrial product to be tested, and input 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] The preprocessing of the images of the steel surface to be tested includes cropping, uniform image size, and normalization, so that the neural network can receive images of a uniform format, which facilitates ResNet-50 to extract features and obtain detection results.

[0085] Let be the set of workpiece surface images to be predicted, and let i′∈I be the surface image of the steel to be tested. The dimension of the surface image i′ 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. Normalize all i′∈I to obtain I′, ensuring that its pixel values ​​are within a uniform range. The image defect detection model f... * Feature extraction is performed on the normalized image data I′ to obtain the feature vector f. * (I′) is input into the classification layer to obtain the predicted probability distribution y′ of the surface image of the steel to be tested. I This allows us to obtain the defect type Y of the surface image of the steel to be tested. I .

[0086] Step S5: Set the granularity η and divide the surface image of the industrial product to be tested into η×η blocks. Calculate the contribution value of each block to the classification result of the image defect detection model using an interpretable algorithm, and locate the surface defects of the industrial product based on the contribution value of each block to the classification result.

[0087] To facilitate the generation of a visually localized defect heatmap, a granularity η (η≤200) is set, dividing the surface image of the steel to be tested into η×η blocks. Using Python's interpretable machine learning library Shaple, the contribution value of each block to the image defect detection model's classification result, i.e., the Shaple value, is calculated using the following formula:

[0088]

[0089] In the formula, P j f represents the j-th block.* φ is the functional representation of the image defect detection model. j (f * ,P j ) represents the Shapley value output by the image defect detection model for the j-th block, where S represents the subset of blocks, f * (S) represents the image defect detection model output of the block subset S, N S N represents the set consisting of all blocks. S / {j} S represents the set of all blocks after removing the j-th 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 for each block using the following formula:

[0091]

[0092] In the formula, M j SHAP represents the mask value of the j-th block. j represents the contribution of the j-th block to the image defect detection model classification result; l represents the depth value proportional to the Shapley value, used to adjust the color intensity, i.e., l = |SHAP j |;

[0093] A mask is superimposed on the original image to form a defect location heatmap; based on the defect location heatmap, surface defects of industrial products are located; for example... Figure 4 As shown, if there are many dark red areas in the image of the steel surface to be tested, it means that there is a defect in the image, and the dark red area is the specific location of the defect. This allows production personnel to intuitively and accurately judge whether there are defects on the surface of industrial products and where the defects are located, which improves the interactivity of machine learning in industrial applications and improves the efficiency of industrial production.

[0094] Step S6: Preprocess the production data corresponding to the surface image of the steel to be tested, including:

[0095] Let D be the production dataset to be tested, and define its dimension as N′×M″; where N′ is the total number of samples in the production dataset to be tested, and M″ is the total number of production factors in the production dataset to be tested, in the following format:

[0096]

[0097] Where, x nm It is the data of the m-th production factor in the n-th sample of the production dataset to be tested, and n = 1, 2, ..., N′, m = 1, 2, ..., M″.

[0098] Step S7: Input the preprocessed production data to be tested into the production data defect detection model to obtain the classification results of the production data to be tested;

[0099] The preprocessed production dataset D is input into the production data defect detection model f, and the predicted defect type distribution y′ is obtained through the model weights. D Its dimension is k, where k represents the total number of defect types. Then, based on the predicted defect type distribution y′... D The highest probability category determines the classification result Y of the production data corresponding to the surface image of the steel to be tested. D Thus, for a set of steel surface images and production data (i′, d), there is a corresponding output (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 using an interpretable algorithm; based on the contribution value of each production factor to the classification result, summarize the causes of surface defects in industrial products.

[0101] For a 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 using the interpretable machine learning library Shaple in Python. This contribution value is called the Shaple value, and the formula is as follows:

[0102]

[0103] In the formula, x i Let f represent the i-th production factor, f be the function representation of the production data defect detection model, and φ be the production factor. i (f,x i ) represents the Shapley value of the production data defect detection model output for the i-th production factor, S′ represents a subset of production factors, and f(S′) represents the production data defect detection model output for the subset of production factors. N S′ N represents the set of all factors of production. S′ / {i} Let S′ represent the set of all production factors after removing the i-th production factor, S′∪{i} represent adding factor i to the production factor subset, |S′| represent the number of elements in the production factor subset, and M′ represent the total number of production factors.

[0104] The obtained Shapley values ​​are statistically analyzed, and bar charts, scatter plots, and other statistical graphs are drawn to facilitate attribution visualization.

[0105] As shown in Figure 5(a), the bar chart represents the average contribution value (horizontal axis) of each production factor (vertical axis) for a certain category (the example focuses on the "dirty" category). The positive and negative values ​​reflect the positive or negative influence of each production factor on the "dirty" category (red represents positive values, blue represents negative values). That is, a negative value means that the factor will not lead to the category result, and the magnitude of its absolute value indicates the degree of this negative influence. Conversely, a positive value means that the factor will lead to the category result, and the magnitude of its absolute value indicates the degree of this positive influence. In the example of Figure 5(a), the average contribution value of the production factor "TypeOfSteel_A300" is positive, which means that the production factor will lead to the "dirty" defect. Its absolute value is 0.38, which represents the degree to which the production factor leads to the dirt defect.

[0106] The scatter plot shown in Figure 5(b) reflects the distribution of all test samples for a certain category (the example focuses on the "dirty" category). 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 magnitude of the production factor (the redder the color, the larger the value; the bluer the color, the smaller the value). This plot reflects the distribution of sample points for each production factor. If the distribution of sample points is significantly related to their color, it can be shown through this plot. In the example of Figure 5(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. This indicates 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] Based on the detected defect categories, production personnel first determine the main production factors causing the defects by examining the positive and negative values ​​and absolute values ​​of the average contribution of each production factor to the defect category in the bar chart. Then, based on the color and distribution of the sample points in the scatter plot, they increase or decrease the value of the production factor, 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 average production factors globally, attribution analysis can also be performed on individual samples. As shown in Figure 5(c), the provided decision graph shows a single production data sample (which belongs to the "dirty" category). The horizontal axis represents the contribution value. The contribution values ​​of the first few production factors in the graph are all greater than the average contribution value of this category (1.06, which is represented by the vertical line in the graph), and therefore have a greater 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 in industrial products, characterized in that, Includes the following steps: Step S1: Collect images of surface defects of industrial products on the industrial production line and their corresponding production data, and preprocess the images of surface defects of industrial products and their corresponding production data. Step S2: Train the ResNet50 model using the preprocessed images of surface defects in industrial products to obtain an image defect detection model; Step S3: Train the XGBoost model using the preprocessed production data to obtain a production data defect detection model; Step S4: Preprocess the surface image of the industrial product to be tested, and input 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: Set the granularity η and divide the surface image of the industrial product to be tested into η×η blocks. Calculate the contribution value of each block to the classification result of the image defect detection model using an interpretable algorithm, and locate the surface defects of the industrial product based on the contribution value of each block to the classification result. Step S5, which calculates the contribution of each block to the classification result of the image defect detection model, specifically includes: The Shapley value for each block in relation to the image defect detection model's classification result is calculated using the Shapley library, as shown in the following formula: In the formula, P j f represents the j-th block. * φ is the functional representation of the image defect detection model. j (f * ,P j ) represents the Shapley value output by the image defect detection model for the j-th block, where S represents the subset of blocks, f * (S) represents the image defect detection model output of the block subset S, N S N represents the set consisting of all blocks. S / {j} S represents the set of all blocks after removing the j-th 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; The step S5, which involves locating surface defects in industrial products, specifically includes the following steps: C1. Create a mask of size η×η and calculate the mask value for each block using the following formula: In the formula, M j SHAP represents the mask value of the j-th block. j represents the contribution of the j-th block to the image defect detection model classification result; l represents the depth value proportional to the Shapley value, used to adjust the color intensity, i.e., l = |SHAP j |; C2. Overlay the mask onto the original image to form a heat map of defect location; C3. Locate surface defects of industrial products based on the defect location heat map; Step S6: Preprocess the production data to be tested, including: Define the dimension of the production dataset to be tested as N. ′ ×M "" ; where N ′ M represents the total number of samples in the production dataset to be tested. "" The total number of production factors in the production dataset to be tested; Step S7: Input the preprocessed production data to be tested into the production data defect detection model to obtain the classification results 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 using an interpretable algorithm; based on the contribution value of each production factor to the classification result, summarize the causes of surface defects in industrial products. Step S8 involves calculating the contribution of each production factor to the classification result of the production data defect detection model. Specifically, this includes calculating the Shapley value of each production factor to the classification result of the production data defect detection model using the Shapley library, as shown in the following formula: In the formula, x i Let f represent the i-th production factor, f be the function representation of the production data defect detection model, and φ be the production factor. i (f,x i ) represents the Shapley value of the production data defect detection model output for the i-th production factor, S′ represents a subset of production factors, and f(S′) represents the production data defect detection model output for the subset of production factors. N S′ N represents the set of all factors of production. S′ / {i} Let S' represent the set of all production factors after removing the i-th production factor, S'∪{i} represent adding factor i to the production factor subset, |S'| represent the number of elements in the production factor subset, and M' represent the total number of production factors.

2. The method for locating, detecting, and attributing surface defects in industrial products as described in claim 1, characterized in that, Step S1 includes: A random seed is set based on the collected production data; supplementary production data is obtained through a data generator based on the random seed.

3. The method for locating, detecting, and attributing surface defects in industrial products as described in claim 1, characterized in that, The preprocessing of the surface defect image of the industrial product in step S1 includes: A1. Set the image size; A2. By cropping and scaling the image, the image is made to contain only the defective parts; A3. Classify the images according to the defect type and label them with the corresponding defect type.

4. The method for locating, detecting, and attributing surface defects in industrial products as described in claim 1, characterized in that, Step S1 involves preprocessing the production data corresponding to the surface defect images of industrial products, including: B1. Delete the blank; B2. Define the production data corresponding to surface defect images of industrial products as follows: Where data represents the production dataset corresponding to the surface defect images of industrial products, A is the total number of samples in the production dataset, B is the total number of production factors in the production dataset, and x αβ It is the data of the β-th production factor in the α-th sample, where α = 1, 2, ..., A, and β = 1, 2, ..., B; B3. Classify the production data corresponding to the surface defect images of industrial products and label them with the same defect type as the surface defect images of industrial products.

5. The method for locating, detecting, and attributing surface defects in industrial products as described in claim 1, characterized in that, Step S8, which summarizes the causes of surface defects in industrial products, specifically includes the following steps: D1. Calculate the Shapley values ​​for all production factors; D2. Visualize the Shapley values ​​of all production factors by drawing statistical charts; D3. Summarize the causes of surface defects in industrial products based on the statistical chart.

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