A workpiece defect detection method and system based on image invariance score
By training a residual flow model and a fine segmentation network using a dataset containing normal samples, and combining this with an image invariance scoring method, the problems of high manual costs and weak model generalization ability in existing technologies are solved, achieving efficient and accurate workpiece defect detection.
Patent Information
- Application Number
- CN202311796598.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2043-12-25
AI Technical Summary
Existing methods for detecting workpiece defects suffer from high labor costs and weak model generalization ability.
By training a residual flow model and a fine segmentation network using a dataset containing normal samples, data augmentation and self-supervised learning are performed. Combined with an image invariance scoring method, the cost of manual annotation is reduced and the model's generalization ability is improved.
It effectively reduces labor costs, improves the generalization ability of the workpiece defect detection model, and can more accurately identify workpiece defects.
Smart Images

Figure CN118115430B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning technology, and in particular to a method and system for detecting workpiece defects based on image invariance scoring. Background Technology
[0002] During the casting process on industrial production lines, some workpieces may develop surface defects such as breakage and scratches due to manufacturing processes and other issues. Using these defective workpieces can lead to product malfunctions, property damage, and even personal injury. Therefore, defect detection is an essential part of modern large-scale production. While existing technologies have proposed many methods for detecting workpiece defects, most of these methods require manual annotation to train the detection model, resulting in high labor costs. Furthermore, some methods do not process the training samples before training the model, leading to poor generalization ability of the trained model.
[0003] In the prior art, Chinese Patent Publication No. CN115705642A discloses a method for detecting defects in sanitary ware ceramics based on an improved YOLOv3, including the following steps: batch photography of finished sanitary ware ceramic workpieces to collect original defect image data of the sanitary ware ceramic surface; data augmentation technology to expand the data volume of the original defect image data of the sanitary ware ceramic surface, followed by defect feature annotation of all expanded defect image data, and the annotated defect image data to form a dataset; the dataset is fed into an improved YOLOv3 network model in batches for iterative training to obtain a sanitary ware ceramic surface defect detection model; the surface image of the sanitary ware ceramic to be detected is input into the sanitary ware ceramic surface defect detection model, and the category and location information of defects in the surface image of the sanitary ware ceramic to be detected are output. This method requires defect feature annotation of all expanded defect image data, which has high manual costs; and the defect localization capability of the detection model is weak.
[0004] Chinese Patent Publication No. CN113822885A discloses a method and apparatus for detecting workpiece defects by integrating multiple attention mechanisms. The method includes the following steps: constructing a multi-attention defect detection model, which includes a pyramid segmentation attention mechanism module, a channel attention mechanism module, a spatial self-attention mechanism module, and... The method involves: acquiring a target detection image of the workpiece to be detected; annotating and augmenting the target detection image to obtain a secondary target detection image; dividing the secondary target detection image into a training set and a validation set; training the multi-attention defect detection model based on the training set and the validation set; and using the trained multi-attention defect detection model to detect defects in the workpiece. This method ensures the defect segmentation accuracy of the detection model by extracting more fine-grained multi-scale spatial information, but it does not perform data augmentation processing on the training model's data, resulting in weak generalization ability of the detection model.
[0005] In summary, the existing technologies have the following problems: high labor costs and weak generalization ability of defect detection models. Summary of the Invention
[0006] The primary objective of this invention is to overcome the problems existing in the prior art and provide a workpiece defect detection method and system based on image invariance scoring. This invention can reduce labor costs and enhance the generalization ability of the defect detection model.
[0007] As another objective of the present invention, a system adapted to the method based on the aforementioned objective is also provided.
[0008] As another object of the present invention, a non-volatile storage medium suitable for storing a computer program implemented according to the method is provided.
[0009] To achieve the above objectives, the present invention provides a workpiece defect detection method based on image invariance scoring, comprising:
[0010] Step S1: Obtain the dataset;
[0011] Step S2: Perform a first data augmentation process on the dataset to obtain the augmented dataset;
[0012] Step S3: Train the residual flow model using the augmented dataset to obtain the trained residual flow model;
[0013] Step S4: Generate pseudo-defect images based on the dataset, and train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network. The specific process includes:
[0014] Step S4.1: Obtain pseudo-labels by cutting out the masked regions of the images in the dataset, where the pseudo-labels are the masked regions of the images;
[0015] Step S4.2: Sample from the random texture image dataset to generate anomaly regions of random color and shape, and overlay the anomaly regions onto the pseudo-label to obtain a pseudo-defect image;
[0016] Step S4.3: Construct a fine-segmentation network;
[0017] Step S4.4: Using the pseudo-defect image as a pseudo-defect label, train the fine segmentation network using a self-supervised method. The pseudo-defect label serves as pixel regression supervision information to train the fine segmentation network to identify local irregularities.
[0018] Step S4.5: Update the weights of the fine-segmentation network, with the training loss constrained by... loss function and The loss function is used to obtain the trained fine-segmentation network. The loss function is determined by the following formula:
[0019]
[0020] The The loss function is determined by the following formula:
[0021]
[0022] in, This represents the number of samples in the same batch, where m is a constant and m 0, This represents the intersection operation, where i represents the image index selected sequentially within the range [1, N]. This represents the pseudo-label of the i-th input image. This represents the segmentation result output by the network;
[0023] Step S5: Perform a second data augmentation process on the workpiece image to be detected to obtain an augmented workpiece image. Input the augmented workpiece image into the trained residual flow model to obtain an anomaly scoring map. The specific process includes:
[0024] Step S5.1: Perform horizontal and vertical flipping on the image of the workpiece to be inspected to obtain an augmented image of the workpiece;
[0025] Step S5.2: Input the augmented workpiece image into the trained residual flow model to obtain multiple anomaly score maps;
[0026] Step S6: Input the anomaly scoring map into the trained fine-segmentation mesh to obtain the defect segmentation result. The specific process includes:
[0027] Step S6.1: Calculate the density estimation score of the anomaly scoring map to obtain the density estimation score result;
[0028] Step S6.2: Calculate the reconstruction error score of the anomaly score map to obtain the reconstruction error score result;
[0029] Step S6.3: Calculate the final invariance anomaly score of the anomaly scoring map based on the density estimation score and the reconstruction error score. The final invariance anomaly score Determined by the following formula:
[0030]
[0031] Where α is a constant coefficient in the range [0.8, 1]. It is a density estimation score. Indicates the density invariance score. Indicates the score for reconstruction invariance;
[0032] Step S6.4: Input the image of the workpiece to be inspected. A pre-trained model is used to obtain the image features of the workpiece image;
[0033] Step S6.5: Concatenate and fuse the anomaly scoring map and the image features to obtain fused features, and upsample the fused features to obtain a prediction map. ;
[0034] Step S6.6: Combine the anomaly scoring map and the prediction map. Linear multiplication is performed to obtain a predicted value. The predicted value is then used to fine-tune the anomaly scoring map to obtain the segmentation result.
[0035] Furthermore, in step S2, the first data augmentation process is a random flipping process.
[0036] Furthermore, the specific process of step S3 includes:
[0037] Step S3.1: Input the augmented dataset The pre-trained model obtains the image features corresponding to each image in the augmented dataset. ;
[0038] Step S3.2: Construct a residual flow model, which is composed of multiple layers of residual affine coupling layers stacked in series;
[0039] Step S3.3: Train the residual flow model, the image features obey Distribution, to distribute the image features As parameters of the backpropagation residual flow model as the loss function This makes image features Mapping projection onto the baseline distribution To obtain the trained residual flow model, use the following formula to calculate the residual flow from... Image feature log-likelihood:
[0040]
[0041] in , It is the Jacobian matrix of the residual flow model.
[0042] Further, the density estimation score result described in step S6.1 is determined by the following formula:
[0043]
[0044] in, This represents the density estimation score, where C represents all feature dimensions. Indicates the output distribution. Represents the baseline distribution. Let T denote the Jacobian matrix of the residual flow model, and T denotes taking the transpose of the matrix.
[0045] The reconstruction error score in step S6.2 is determined by the following formula:
[0046]
[0047] in, Represents the reconstructed features, Represents image features.
[0048] To achieve another objective of the present invention, the present invention also provides a workpiece defect detection system based on image invariance scoring, comprising:
[0049] First acquisition module: used to acquire the dataset;
[0050] Augmentation module: used to perform a first data augmentation process on the dataset to obtain an augmented dataset;
[0051] The first training module is used to train the residual flow model using the augmented dataset to obtain the trained residual flow model.
[0052] The second training module is used to generate pseudo-defect images based on the dataset, and to train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network.
[0053] The second acquisition module is used to perform second data augmentation processing on the workpiece image to be detected, obtain the augmented workpiece image, and input the augmented workpiece image into the trained residual flow model to obtain the anomaly score map.
[0054] Detection module: used to input the anomaly scoring map into the trained fine-segmentation grid to obtain defect segmentation results.
[0055] To achieve another objective of the present invention, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements a workpiece defect detection method based on image invariance scoring.
[0056] Compared with the prior art, the advantages of this invention are as follows:
[0057] This invention trains the residual flow model and fine segmentation network using a dataset containing easily obtainable normal samples, avoiding the use of manually labeled samples to train the model and effectively reducing labor costs. Furthermore, by inputting the workpiece image to be detected sequentially into the trained residual flow model and the trained fine segmentation network, and combining characteristics such as image invariance, the invention improves the distinction between normal and abnormal samples, thereby enhancing the generalization ability of the residual flow model and the fine segmentation network. Attached Figure Description
[0058] Figure 1 This is a flowchart of a workpiece defect detection method based on image invariance scoring according to an embodiment of the present invention;
[0059] Figure 2 This is a block diagram of a workpiece defect detection system based on image invariance scoring according to an embodiment of the present invention;
[0060] Figure 3 This is the result of abnormal region localization in a workpiece defect detection method based on image invariance scoring according to an embodiment of the present invention.
[0061] Figure 4 This is a residual flow model structure diagram of a workpiece defect detection method based on image invariance scoring according to an embodiment of the present invention;
[0062] Figure 5 This is a fine-segmentation network structure diagram of a workpiece defect detection method based on image invariance scoring according to an embodiment of the present invention. Detailed Implementation
[0063] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0064] Example 1
[0065] like Figure 1 As shown, a preferred embodiment of the present invention provides a workpiece defect detection method based on image invariance scoring, comprising:
[0066] Step S1: Obtain the dataset;
[0067] Step S2: Perform the first data augmentation process on the dataset to obtain the augmented dataset;
[0068] Step S3: Train the residual flow model using the augmented dataset to obtain the trained residual flow model;
[0069] Step S4: Generate pseudo-defect images based on the dataset, and train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network;
[0070] Step S5: Perform a second data augmentation process on the workpiece image to be detected to obtain an augmented workpiece image. Input the augmented workpiece image into the trained residual flow model to obtain an anomaly scoring map.
[0071] Step S6: Input the anomaly scoring map into the trained fine-segmentation grid to obtain the defect segmentation result.
[0072] This embodiment trains the residual flow model and fine segmentation network using a dataset containing easily obtainable normal samples, avoiding the use of manually labeled samples to train the model and effectively reducing labor costs. Furthermore, by inputting the workpiece image to be detected sequentially into the trained residual flow model and the trained fine segmentation network, and combining characteristics such as image invariance, the distinction between normal and abnormal samples is improved, thereby enhancing the generalization ability of the residual flow model and the fine segmentation network.
[0073] Example 2
[0074] like Figure 1 , 5 As shown in Figures 6 and 7, an embodiment of the present invention provides a workpiece defect detection method based on image invariance scoring, comprising:
[0075] Step S1: Obtain the dataset;
[0076] In this embodiment, the dataset contains only normal samples, which are samples without defects. Using easily obtainable normal samples to train the model can effectively reduce manual labor costs.
[0077] Step S2: Perform the first data augmentation process on the dataset to obtain the augmented dataset;
[0078] In this embodiment, the first data augmentation process is random flipping.
[0079] Step S3: Train the residual flow model using the augmented dataset to obtain the trained residual flow model;
[0080] In this embodiment, step S3 specifically includes:
[0081] Step S3.1: Input the augmented dataset The pre-trained model obtains the image features corresponding to each image in the augmented dataset. ;
[0082] Step S3.2: Construct the residual flow model. The residual flow model consists of multiple layers of residual affine coupling layers stacked in series. The residual affine coupling layers increase the fitting ability by composing multiple simple transformations. For a given input x, k invertible transformation blocks are stacked in the form of... It forms an invertible mapping; at the same time, it uses residual blocks as sub-networks of invertible transformation blocks. Each residual block is connected to a convolutional layer in a residual manner. After each residual connection, layer normalization is performed. The convolutional layers use alternating 3×3 and 1×1 convolutions to reduce model parameters and computational cost.
[0083] Step S3.3: Train the residual flow model, image features obey Distribution, image features As parameters of the backpropagation residual flow model as the loss function This makes image features Mapping projection onto the baseline distribution To obtain the trained residual flow model, use the following formula to calculate the residual flow from... Image feature log-likelihood:
[0084]
[0085] in , It is the Jacobian matrix of the residual flow model.
[0086] Step S4: Generate pseudo-defect images based on the dataset, and train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network;
[0087] In this embodiment, the specific process of step S4 includes:
[0088] Step S4.1: Obtain pseudo-labels by cutting out the masked regions of the images in the dataset. The pseudo-labels are the masked regions of the images. Use the pseudo-defect labels as pixel regression supervision information to train the fine segmentation model to identify local irregularities.
[0089] Step S4.2: Sample from the random texture image dataset to generate anomaly regions of random color and shape, and overlay the anomaly regions onto the pseudo-labels to obtain pseudo-defect images. The random texture images are sampled from the Describable Textures Dataset (DTD), which contains 5640 texture images in 47 categories. Each image contains surface textures of the corresponding category attributes covering more than 90% of its area.
[0090] Step S4.3: Construct a fine-segmentation network and introduce... The structure uses a multi-scale encoder and decoder to build a fine-segmentation network, in order to The pre-trained model serves as the encoder, the decoder fuses multi-scale feature encoding upsampling, and the obtained anomaly score map is added to the model as spatial prior information;
[0091] Step S4.4: Use the pseudo-defect image as a pseudo-defect label to train the fine segmentation network using a self-supervised method. Use the pseudo-defect label as pixel regression supervision information to train the fine segmentation network to identify local irregularities.
[0092] Step S4.5: Update the weights of the fine-segment network, and constrain the training loss to rely on... loss function and The loss function is used to obtain the trained fine-segmentation network. The loss function is determined by the following formula:
[0093]
[0094] The The loss function is determined by the following formula:
[0095]
[0096] in, This represents the number of samples in the same batch, where m is a constant and m 0, This represents the intersection operation, where i represents the image index selected sequentially within the range [1, N]. This represents the pseudo-label of the i-th input image. This represents the segmentation result output by the network. Adding a constant m prevents the denominator from being zero (m This prevents gradient explosion. Combining the two loss functions, the total loss is... .
[0097] Step S5: Perform a second data augmentation process on the workpiece image to be detected to obtain an augmented workpiece image. Input the augmented workpiece image into the trained residual flow model to obtain an anomaly scoring map.
[0098] In this embodiment, the specific process of step S5 includes:
[0099] Step S5.1: Perform horizontal and vertical flipping on the image of the workpiece to be inspected to obtain an augmented image of the workpiece;
[0100] Step S5.2: Input the augmented workpiece image into the trained residual flow model to obtain multiple anomaly score maps.
[0101] Step S6: Input the anomaly scoring map into the trained fine-segmentation grid to obtain the defect segmentation result.
[0102] In this embodiment, step S6 specifically includes:
[0103] Step S6.1: Calculate the density estimation score of the anomaly rating map to obtain the density estimation score result, which is determined by the following formula:
[0104]
[0105] in, This represents the density estimation score, where C represents all feature dimensions. Indicates the output distribution. Represents the baseline distribution. Let represent the Jacobian matrix of the residual flow model, and T denote the matrix transpose. The final density estimation score is obtained by summing the density estimation probabilities for each channel C. ;
[0106] Step S6.2: Calculate the reconstruction error score of the anomaly score map, obtain the reconstruction error score result, and obtain the reconstruction features through inverse mapping of the flow model. Calculate the original feature using the L1 norm. The reconstruction error before and after the inverse mapping is summed into the absolute values within each channel as the anomaly score. The reconstruction error score is determined by the following formula:
[0107]
[0108] in, Represents the reconstructed features, Representing image features;
[0109] Image-level reconstruction error scoring Depends on the maximum response value of the scoring graph:
[0110]
[0111] Step S6.3: Calculate the final invariance anomaly score of the anomaly score map based on the density estimation score and the reconstruction error score. Final invariance anomaly score Determined by the following formula:
[0112]
[0113] Where α is a constant coefficient in the range [0.8, 1]. It is a density estimation score. Indicates the density invariance score. The reconstruction invariance score is represented by a comprehensive score calculated based on density estimation and reconstruction error. Anomaly score maps are compared in terms of contrast and structure; differences between anomaly score maps are quantified based on image invariance, and the similarity between anomaly score maps is calculated as outlier values. The local mean of the anomaly score maps within the convolutional window is statistically analyzed. Standard deviation and skew variance The window moves pixel by pixel within the image. A Gaussian weighting function is applied to the window. The unbiased estimation parameters are corrected, and uniform weighting is applied by default, as shown in the following formula:
[0114]
[0115]
[0116]
[0117] in and This represents different anomaly scoring charts. The calculation formula is the same.
[0118] The error sensitivity of the anomaly scoring map is determined from the perspectives of contrast and structure, and this is used as the invariance score for anomaly detection. The formula is as follows:
[0119] ;
[0120] Anomaly score graph set obtained by augmentation through invariance testing Calculate the contrast and structural similarity between pairwise combinations, and sum the error sensitivity values to obtain an invariance score. , The constant is given by the following formula:
[0121] ;
[0122] in This represents the number of anomaly rating maps. The density estimation rating map set... and reconstruction error score map set Add to the invariance score to obtain the density invariance score. and Reconstruction Invariance Score The advantages and disadvantages of each scoring method are considered in terms of their correlation with each other.
[0123] Step S6.4: Input the image of the workpiece to be inspected. A pre-trained model is used to obtain the image features of the workpiece image;
[0124] Step S6.5: Concatenate and fuse the anomaly scoring map and image features to obtain fused features, and upsample the fused features to obtain a prediction map. ;
[0125] Step S6.6: Combine the anomaly scoring map and the prediction map. Linear multiplication is performed to obtain a predicted value. This predicted value is then used to fine-tune the anomaly scoring map, resulting in a segmentation result, an anomaly scoring map, and a predicted map. Linear multiplication is determined by the following formula:
[0126]
[0127] in, As the activation function, Limited to The numerical range meets the training requirements. The correction range is limited to By fine-tuning the anomaly scoring map based on the predicted values, the final segmentation result of the anomaly region is obtained, achieving pixel-level anomaly localization.
[0128] Example 3
[0129] like Figure 2 As shown, an embodiment of the present invention provides a workpiece defect detection system based on image invariance scoring, comprising:
[0130] First acquisition module: used to acquire the dataset;
[0131] Augmentation module: Used to perform the first data augmentation process on the dataset to obtain the augmented dataset;
[0132] The first training module is used to train the residual flow model using the augmented dataset to obtain the trained residual flow model.
[0133] The second training module is used to generate pseudo-defect images based on the dataset, and then use a self-supervised method to train a fine segmentation network using the pseudo-defect images to obtain the trained fine segmentation network.
[0134] The second acquisition module is used to perform second data augmentation processing on the workpiece image to be detected, obtain the augmented workpiece image, and input the augmented workpiece image into the trained residual flow model to obtain the anomaly score map.
[0135] Detection module: Used to input the anomaly scoring map into the trained fine-segmentation grid to obtain the defect segmentation result.
[0136] This embodiment trains the residual flow model and fine segmentation network using a dataset containing easily obtainable normal samples, avoiding the use of manually labeled samples to train the model and effectively reducing labor costs. Furthermore, by inputting the workpiece image to be detected sequentially into the trained residual flow model and the trained fine segmentation network, and combining characteristics such as image invariance, the distinction between normal and abnormal samples is improved, thereby enhancing the generalization ability of the residual flow model and the fine segmentation network.
[0137] Example 4
[0138] In a preferred embodiment of the present invention, a computer-readable storage medium is provided on which a computer program for a workpiece defect detection method based on image invariance scoring is stored. When the computer program for the workpiece defect detection method based on image invariance scoring is processed, it implements the steps of the pedestrian identification method.
[0139] In summary, the embodiments of the present invention provide a workpiece defect detection method and system based on image invariance scoring. It trains the residual flow model and fine segmentation network using a dataset containing easily obtainable normal samples, avoiding the use of manually labeled samples to train the model, thus effectively reducing labor costs. Furthermore, by inputting the workpiece image to be detected sequentially into the trained residual flow model and the trained fine segmentation network, the distinction between normal and abnormal samples is improved by combining image invariance and other characteristics, thereby enhancing the generalization ability of the residual flow model and the fine segmentation network.
[0140] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and substitutions can be made without departing from the technical principles of the present invention, and these improvements and substitutions should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting workpiece defects based on image invariance scoring, characterized in that, include: Step S1: Obtain the dataset; Step S2: Perform a first data augmentation process on the dataset to obtain the augmented dataset; Step S3: Train the residual flow model using the augmented dataset to obtain the trained residual flow model; Step S4: Generate pseudo-defect images based on the dataset, and train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network. The specific process includes: Step S4.1: Obtain pseudo-labels by cutting out the masked regions of the images in the dataset, where the pseudo-labels are the masked regions of the images; Step S4.2: Sample from the random texture image dataset to generate anomaly regions of random color and shape, and overlay the anomaly regions onto the pseudo-label to obtain a pseudo-defect image; Step S4.3: Construct a fine-segmentation network; Step S4.4: Using the pseudo-defect image as a pseudo-defect label, train the fine segmentation network using a self-supervised method. The pseudo-defect label serves as pixel regression supervision information to train the fine segmentation network to identify local irregularities. Step S4.5: Update the weights of the fine-segmentation network, with the training loss constrained by... loss function and The loss function is used to obtain the trained fine-segmentation network. The loss function is determined by the following formula: The The loss function is determined by the following formula: in, This represents the number of samples in the same batch, where m is a constant and m 0, This represents the intersection operation, where i represents the image index selected sequentially within the range [1, N]. This represents the pseudo-label of the i-th input image. This represents the segmentation result output by the network; Step S5: Perform a second data augmentation process on the workpiece image to be detected to obtain an augmented workpiece image. Input the augmented workpiece image into the trained residual flow model to obtain an anomaly scoring map. The specific process includes: Step S5.1: Perform horizontal and vertical flipping on the image of the workpiece to be inspected to obtain an augmented image of the workpiece; Step S5.2: Input the augmented workpiece image into the trained residual flow model to obtain multiple anomaly score maps; Step S6: Input the anomaly scoring map into the trained fine-segmentation mesh to obtain the defect segmentation result. The specific process includes: Step S6.1: Calculate the density estimation score of the anomaly scoring map to obtain the density estimation score result; Step S6.2: Calculate the reconstruction error score of the anomaly score map to obtain the reconstruction error score result; Step S6.3: Calculate the final invariance anomaly score of the anomaly scoring map based on the density estimation score and the reconstruction error score. The final invariance anomaly score Determined by the following formula: Where α is a constant coefficient in the range [0.8, 1]. It is a density estimation score. Indicates the density invariance score. Indicates the score for reconstruction invariance; Step S6.4: Input the image of the workpiece to be inspected. A pre-trained model is used to obtain the image features of the workpiece image; Step S6.5: Concatenate and fuse the anomaly scoring map and the image features to obtain fused features, and upsample the fused features to obtain a prediction map. ; Step S6.6: Combine the anomaly scoring map and the prediction map. Linear multiplication is performed to obtain a predicted value. The predicted value is then used to fine-tune the anomaly scoring map to obtain the segmentation result.
2. The workpiece defect detection method based on image invariance scoring according to claim 1, characterized in that, In step S2, the first data augmentation process is random flipping.
3. The workpiece defect detection method based on image invariance scoring according to claim 1, characterized in that, The specific process of step S3 includes: Step S3.1: Input the augmented dataset The pre-trained model obtains the image features corresponding to each image in the augmented dataset. ; Step S3.2: Construct a residual flow model, which is composed of multiple layers of residual affine coupling layers stacked in series; Step S3.3: Train the residual flow model, the image features obey Distribution, to distribute the image features As parameters of the backpropagation residual flow model as the loss function This makes image features Mapping projection onto the baseline distribution To obtain the trained residual flow model, use the following formula to calculate the residual flow from... Image feature log-likelihood: in , It is the Jacobian matrix of the residual flow model.
4. The workpiece defect detection method based on image invariance scoring according to claim 3, wherein... The characteristic is that the density estimation score result in step S6.1 is determined by the following formula: in, This represents the density estimation score, where C represents all feature dimensions. Indicates the output distribution. Represents the baseline distribution. Let T denote the Jacobian matrix of the residual flow model, and T denote taking the transpose of the matrix. The reconstruction error score in step S6.2 is determined by the following formula: in, Represents the reconstructed features, Represents image features.
5. A workpiece defect detection system based on image invariance scoring, characterized in that, The system, based on the method according to any one of claims 1-4, includes: First acquisition module: used to acquire the dataset; Augmentation module: used to perform a first data augmentation process on the dataset to obtain an augmented dataset; The first training module is used to train the residual flow model using the augmented dataset to obtain the trained residual flow model. The second training module is used to generate pseudo-defect images based on the dataset, and to train a fine segmentation network using a self-supervised method on the pseudo-defect images to obtain the trained fine segmentation network. The second acquisition module is used to perform second data augmentation processing on the workpiece image to be detected, obtain the augmented workpiece image, and input the augmented workpiece image into the trained residual flow model to obtain the anomaly score map. Detection module: used to input the anomaly scoring map into the trained fine-segmentation grid to obtain defect segmentation results.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer stored program is executed by the processor, it implements the workpiece defect detection method based on image invariance scoring as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Workpiece defect detection method and device fusing multi-attention mechanism
CN113822885A
Improved YOLOv3-based bathroom ceramic defect detection method
CN115705642A
Deep learning algorithm for detecting anomaly and segmenting abnormal region in image
CN112907589A
Unsupervised defect detection and positioning method based on multilevel feature reconstruction
CN114332008A