Large model training method for multi-scenario intelligent manufacturing defect detection

Through the large-scale self-supervised training method and the use of unlabeled data for staged pre-training and fine-tuning, the problem of high cost of annotating data for deep neural network models in multi-scenario solar cell defect detection has been solved, and detection accuracy and model understanding capabilities have been improved.

CN118334491BActive Publication Date: 2024-09-03HEBEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410748557.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-03
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Deep neural network models require a large amount of annotated data for training in multi-scenario solar cell defect detection, which is costly and difficult to guarantee model performance.

Method used

Using a method based on large-scale self-supervised training, the backbone and detection head of the defect detection model are pre-trained in stages through unlabeled images, gradually mastering domain prior knowledge, and improving detection accuracy through fine-tuning. Specific steps include mask auto-encoding ViTDeT main intervention training, DINO detection head comparison pre-training and end-to-end fine-tuning of annotated images.

Benefits of technology

Effectively reduce labeling costs, enhance the model's understanding of different scenarios, improve defect detection performance, and achieve efficient feature extraction and feature reasoning capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334491B
    Figure CN118334491B
Patent Text Reader

Abstract

The present invention is a large-scale model training method for multi-scenario intelligent manufacturing defect detection. The method adopts masked self-encoding ViTDeT main intervention training, DINO detection head comparison pre-training, and supervised data annotated image end-to-end fine-tuning; the training task of ViTDeT main intervention training is to generate HOG feature descriptors of the masked part. After the pre-training is completed, the mask decoder part is discarded and the weight of the ViTDeT backbone is retained; the features output by the two DINO detection heads in the twin network composed of the ViTDeT backbone are compared to make them as similar as possible while fitting the position of the pseudo bounding box. This pre-trained defect detection model is fine-tuned using labeled image data. The trained defect detection model is used for defect detection of intelligent manufacturing products in different scenarios. The large model of multi-scenario intelligent manufacturing defect detection is trained in a staged manner, which improves the utilization rate of the large model for large-scale unlabeled data and improves its detection accuracy for defects in different scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent manufacturing defect detection, and specifically is a large model training method for multi-scenario intelligent manufacturing defect detection. Background Art

[0002] Defect detection of industrial products is a key step in the intelligent manufacturing process. Regardless of the type of intelligent manufacturing product, various appearance defects or performance problems may occur during its production process, which will directly affect the quality of the product and user experience. Taking solar cells as an example, defect detection of solar cells is a key step in its production and manufacturing process. Appearance defects such as dirty sheets, broken grids, leakage and electroluminescent defects such as hidden cracks and black spots that appear during the production process will affect its power generation performance.

[0003] At present, the target detection method based on deep neural network is the mainstream defect detection method and has been widely used in the industrial field. Using deep neural network to build a large model for solar cell defect detection for multiple scenarios is an efficient solution. However, deep neural network models require a large amount of labeled data for training to have relatively accurate and robust detection performance. It is extremely costly to obtain large-scale, multi-scene labeled image data, and the model performance is still difficult to guarantee.

[0004] In summary, this application proposes a training method for a large-scale self-supervised training model for multi-scenario intelligent manufacturing defect detection. Taking solar cell defect detection as an example, the backbone and detection head of the defect detection model are pre-trained in stages through a large number of unlabeled images, so that the model gradually masters the prior knowledge in this field, and then improves the detection accuracy of the large solar cell defect detection model in multiple scenarios through fine-tuning. Summary of the invention

[0005] In view of the deficiencies in the prior art, the technical problem that the present invention intends to solve is to provide a large model training method for multi-scenario intelligent manufacturing defect detection.

[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0007] A large model training method for multi-scenario intelligent manufacturing defect detection, the method comprising the following steps:

[0008] Step 1: Obtain multi-scene images of industrial products that need to be inspected for surface defects, partially annotate various defect images in each scene, and divide the annotated images into training sets and test sets. The remaining unannotated images are used as pre-training data.

[0009] Step 2: Build a large defect detection model for multiple scenarios:

[0010] The multi-scenario defect detection large model is composed of a ViTDeT backbone and a DINO detection head. The input image is embedded with positions and then input into the ViTDeT backbone. The ViTDeT backbone outputs a multi-scale feature map of the image. The multi-scale feature map is embedded with positions and then input into the DINO detection head. The DINO detection head outputs the position and category of the target to be detected.

[0011] Step 3: S1 stage - ViTDeT main intervention training of masked self-encoding

[0012] The main intervention training model is used to train the ViTDeT backbone using the pre-training data of the first step. The specific process is: obtain the HOG feature descriptor of the entire image of the pre-training data, and then divide the HOG feature descriptor of the entire image according to the patch level to obtain the HOG feature descriptor of the patch level; the patch level is 14×14 pixels;

[0013] Set the mask probability, mask the patch-level HOG feature descriptors in the entire image with the mask probability, and use the masked image consisting of the remaining patch-level HOG feature descriptors as the input of the ViTDeT backbone;

[0014] The structure of the main intervention training model includes a ViTDeT backbone and a mask decoder. The output of the mask decoder is compared with the HOG feature descriptor at the patch level before masking for feature reconstruction loss. The training task is to losslessly generate the HOG feature descriptor at the patch level of the masked part. After the pre-training is completed, the mask decoder part is discarded, and the weight of the ViTDeT backbone is retained as the initial weight of the ViTDeT backbone in the entire multi-scenario defect detection large model to obtain the pre-trained ViTDeT backbone.

[0015] Step 4: S2 stage - DINO detection head comparison pre-training

[0016] The pre-training data in the first step is used to perform feature enhancement and contrast pre-training on the DINO detection head for the multi-scenario defect detection large model using the detection head pre-training model. The training task is to minimize the contrast loss value of the same pseudo bounding box generated by images enhanced with different data. The specific process is:

[0017] First, a selection search algorithm is used to generate multiple pseudo bounding boxes on the image;

[0018] Secondly, two different image enhancement processes are performed on the image, and two sets of enhanced pseudo bounding boxes are generated accordingly;

[0019] The detection head pre-training model includes the ViTDeT backbone trained in the third step, two DINO detection heads and a multi-layer perceptron, the inputs of the two ViTDeT backbones are the two enhanced images respectively, the two ViTDeT backbones share weights, each ViTDeT backbone is connected in series with a DINO detection head, the structures and parameters of the two DINO detection heads are exactly the same, the output of one DINO detection head is connected to the multi-layer perceptron, and the multi-layer perceptron outputs a predicted pseudo bounding box;

[0020] The outputs of the two DINO detection heads are subjected to contrastive loss calculation to update the weights of the DINO detection head that is not connected to the multi-layer perceptron. At the same time, the pseudo bounding box predicted by the multi-layer perceptron is used to update the weights of the DINO detection head connected to the multi-layer perceptron. After contrastive training, the initialization weights of the DINO detection head are obtained to obtain the pre-trained DINO detection head.

[0021] Step 5: S3 stage - end-to-end fine-tuning of labeled images

[0022] The training set of the first step is used to perform end-to-end fine-tuning training on the entire multi-scenario defect detection model composed of the pre-trained ViTDeT backbone obtained in the third step and the pre-trained DINO detection head obtained in the fourth step. The gradient is calculated according to the deviation between the output of the DINO detection head and the image annotation information, and this gradient is used to update the weights of the entire multi-scenario defect detection model.

[0023] Furthermore, the industrial product requiring surface defect detection is strip steel, aluminum material, wood, cloth or solar cell.

[0024] Furthermore, the industrial product that needs to be inspected for surface defects is a solar cell, and images of the polycrystalline silicon electroluminescence inspection scene, the polycrystalline silicon visible light appearance inspection scene, and the monocrystalline silicon electroluminescence inspection scene are collected. The types of defects include black cores, cracks, broken grids, thick lines, collapsed edges, leaking slurry, dirty wafers, open welds, black cores, hidden cracks, and scratches.

[0025] Furthermore, in the second step, the input image size of the large defect detection model for multiple scenes is 1120×1120 pixels. After adding position embedding, the input image is input into the ViTDeT backbone composed of Vision Transformer to extract multi-scale features of the input image; the DINO detection head is composed of three parts: Transformer Encoder, Transformer Decoder and result output layer. Transformer Encoder performs multi-head self-attention operation on the multi-scale features output by the ViTDeT backbone and outputs fused features; Transformer Decoder performs cross-self-attention operation on the fused features output by the Transformer Encoder and the target detection query, and the result output layer receives the output of Transformer Decoder and gives the position and category of the target to be detected.

[0026] Furthermore, the ViTDeT backbone includes 12 stacked and cascaded Vision Transformers, each of which performs a self-attention operation or a global self-attention operation. A self-attention operation is performed on the input image after adding position embedding. A global self-attention operation is performed every 2 self-attention operations. The entire ViTDeT backbone generates feature maps of four scales.

[0027] Furthermore, in the first step, the proportion of partial annotations is not less than 10% of the total number of images.

[0028] Furthermore, in the third step, the mask probability is set to 60%.

[0029] Furthermore, the mask decoder is composed of a 4-layer 768-dimensional ViT structure.

[0030] The present invention also protects a computer-readable storage medium having a computer program stored thereon, characterized in that the program can implement the steps of the method when executed by a processor.

[0031] Compared with the prior art, the present invention has the following beneficial effects:

[0032] The method of the present invention utilizes a large amount of unlabeled data and sets reasonable self-supervised pre-training tasks to perform phased training on a large defect detection model for multiple scenarios, thereby effectively reducing the labeling cost while enhancing the model's understanding of different scenarios.

[0033] In the S1 stage, the image is converted into multiple patch-level (14×14 pixels) HOG (histogram of oriented gradients) feature descriptors, and then the patch-level HOG feature descriptors with a certain mask probability are masked and self-encoded, so that the backbone of the large defect detection model for multiple scenes can obtain efficient feature extraction capabilities; at the same time, in the S2 stage, a selective search algorithm is used to generate pseudo bounding boxes on unlabeled images, and by enhancing and comparing different data of the same image, the detection head can learn the translation invariance of the image, thereby having efficient feature reasoning capabilities; finally, in the S3 stage, fine-tuning training is performed with the supervisory information provided by a small number of labeled images, so that the large defect detection model for multiple scenes can have excellent defect detection performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a flowchart of the training process of the large model training method for multi-scenario intelligent manufacturing defect detection of the present invention;

[0035] Figure 2 It is a schematic diagram of the structure of a large defect detection model for multiple scenarios in the present invention;

[0036] Figure 3 is a comparison diagram of the training method of the present invention and the pre-training method based on pixel reconstruction in terms of restoration details;

[0037] Figure 4 It is a comparison chart of the detection performance of the training method of the present invention and other pre-training methods; CPDD is the training method of the present invention; COCO is pre-trained using the COCO2017 target detection data set; MAE is pre-trained using the pixel regression method to perform mask self-encoding on the same unlabeled data as the present application; IN1K is pre-trained using the ImageNet1000 classification task; SCRATCH is pre-trained without using any method;

[0038] Figure 5 This is a comparison chart of the final inference results of this application and other pre-training methods. DETAILED DESCRIPTION

[0039] Specific embodiments are given below in conjunction with the accompanying drawings. The specific embodiments are only used to illustrate the technical solutions of the present invention in detail, but are not intended to limit the protection scope of the present application.

[0040] The present invention is a large model training method for multi-scenario intelligent manufacturing defect detection (see Figure 1 ), taking solar cell intelligent manufacturing as an example, the training method includes the following steps:

[0041] Step 1: Obtain solar cell images collected in multiple scenes, including electroluminescence images of monocrystalline silicon cells, visible light images of polycrystalline silicon cells, and electroluminescence images of polycrystalline silicon cells, for a total of three scenes. Label a small number of images (less than 10%) in each scene, and divide the labeled images into training sets and test sets. The remaining large number of unlabeled images are used as pre-training data;

[0042] Step 2: Build a large defect detection model for multiple scenarios;

[0043] The multi-scenario defect detection large model (see Figure 2 ) includes a ViTDeT backbone and a DINO detection head. The input image is embedded in the position and then connected to the input of the ViTDeT backbone. The ViTDeT backbone outputs a multi-scale feature map. The multi-scale feature map is embedded in the position and then enters the DINO detection head to output the position and category of the target to be detected.

[0044] In this embodiment, the image size obtained in the first step is compressed to 1120×1120 pixels, and then the image is input into the ViTDeT backbone composed of Vision Transformer after adding position embedding to extract the multi-scale features of the input image; the DINO detection head is composed of three parts: Transformer Encoder, Transformer Decoder and result output layer. Transformer Encoder performs multi-head self-attention operation on the multi-scale features output by the ViTDeT backbone and outputs the fused features; Transformer Decoder performs cross-self-attention operation on the fused features output by the Transformer Encoder and the target detection query, and the result output layer receives the output of the Transformer Decoder and gives the position and category of the target to be detected.

[0045] Step 3: S1 stage - ViTDeT main intervention training of masked self-encoding

[0046] The main part of ViTDeT is trained using the pre-trained data in the first step using the main intervention training model. Specifically, the multi-scene solar cell images are cropped to 224×224 pixels, and then divided into multiple 8×8 pixel cells, and the statistical calculation results of the pixel gradient size and direction in each cell are converted into HOG feature descriptors with the same number of pixels, thereby generating the HOG feature descriptor of the entire image, and then the HOG feature descriptor of the entire image is divided according to the patch level to obtain the HOG feature descriptor at the patch level. The patch level is 14×14 pixels.

[0047] The mask probability is set to 60%, and the patch-level HOG feature descriptors in the entire image are masked with a mask probability of 60%, and the image composed of the remaining patch-level HOG feature descriptors after masking is used as the input of the ViTDeT backbone.

[0048] At this stage, the structure of the main intervention training model consists of two parts: the ViTDeT backbone and the mask decoder. Its training task is to generate the patch-level HOG feature descriptor of the masked part as losslessly as possible. The pre-training at this stage enables the ViTDeT backbone to learn the prior knowledge of the image by generating the masked part. After the pre-training is completed, the mask decoder part is discarded, and the weight of the ViTDeT backbone is retained as the initial weight of the ViTDeT backbone in the entire multi-scenario defect detection model to obtain the pre-trained ViTDeT backbone.

[0049] Step 4: S2 stage - DINO detection head comparison pre-training

[0050] The pre-trained data in the first step is used to perform feature enhancement and contrast pre-training on the DINO detection head of the large defect detection model for multiple scenes using the detection head pre-training model. The training task is to minimize the contrast loss value of the same pseudo bounding box generated by images enhanced with different data. Specifically, a selection search algorithm is first used to generate multiple pseudo bounding boxes on the image (1120×1120 pixels). Secondly, two different image enhancement processes (such as affine transformation, brightness change, etc.) are performed on the same image, and pseudo bounding boxes of the two enhanced images are generated accordingly; the two enhanced images are input into the detection head pre-training model.

[0051] At this stage, the detection head pre-training model consists of the ViTDeT backbone trained in the third step, two DINO detection heads and a multi-layer perceptron. The structures and parameters of the two DINO detection heads are exactly the same. The inputs of the two ViTDeT backbones are the two enhanced images, and the two ViTDeT backbones share weights. Each ViTDeT backbone is connected in series with a DINO detection head, the output of one DINO detection head is connected to the multi-layer perceptron, and the other detection head is not connected to the multi-layer perceptron, and the multi-layer perceptron outputs the predicted pseudo bounding box.

[0052] The features extracted from the two images by the same two ViTDeT backbones are input into two DINO detection heads for comparative training. The training task is to minimize the comparative loss value of the same pseudo bounding box generated by images with different data augmentation. In this stage of training, the DINO detection head can learn the translation invariance of image representation through pseudo bounding box detection and feature comparison. After comparative training, the initialization weights of the DINO detection head are obtained, and the pre-trained DINO detection head is obtained. The parameters of the ViTDeT backbone are not updated at this stage.

[0053] The contrastive loss is calculated on the outputs of the two DINO detection heads to update the weights of the DINO detection head that is not connected to the multilayer perceptron. At the same time, the pseudo bounding box predicted by the multilayer perceptron is used to update the weights of the DINO detection head connected to the multilayer perceptron.

[0054] Step 5: S3 stage - end-to-end fine-tuning of labeled images

[0055] The training set of the first step is used to perform end-to-end fine-tuning training on the entire large defect detection model for multiple scenarios, which is composed of the pre-trained ViTDeT backbone obtained in the third step and the pre-trained DINO detection head obtained in the fourth step. The gradient is calculated according to the deviation between the output of the DINO detection head and the image annotation information, and this gradient is used for backpropagation to update the weights of the entire large defect detection model for multiple scenarios, thereby achieving fast and efficient training of the large model.

[0056] Specifically, the labeled multi-scene solar cell images are scaled to a fixed size (1120×1120), and the images are input into the ViTDeT backbone trained in the third step, and position embedding is added. The ViTDeT backbone extracts input image features and adds the extracted multi-scale features to the position embedding and then inputs them into the DINO detection head trained in the fourth step. After training, the test set is used for testing, and finally the training of the large model is completed.

[0057] Embodiment 1: This embodiment is a large model training method for multi-scenario intelligent manufacturing defect detection, comprising the following steps:

[0058] Step 1: Acquisition and division of data sets

[0059] This example uses the solar cell manufacturing industry as an example and collects 386,913 images from polycrystalline silicon electroluminescence detection scenes (D1), polycrystalline silicon visible light appearance detection scenes (D2), and monocrystalline silicon electroluminescence detection scenes (D3). 10,913 of these images are annotated in the form of target detection frames.

[0060] 4488 images are annotated in the D1 scene, of which 2788 are used for training and 1700 are used for testing.

[0061] There are 2683 annotated images in the D2 scene, of which 1530 are used for training and 1153 are used for testing.

[0062] 3742 images are annotated in the D3 scene, of which 2291 are used for training and 1451 are used for testing.

[0063] The S1 and S2 stages use unlabeled images for training, and the S3 stage uses labeled images for training, as shown in Table 1, where S represents different stages of training.

[0064]

[0065] The image data in each scenario corresponds to different types of defects, as shown in Table 2; the data in the three scenarios contain a total of 13 types of defects (of which broken gates are common to the three scenarios).

[0066]

[0067] Step 2: Build a large defect detection model for multiple scenarios

[0068] like Figure 2 As shown in the figure, the large defect detection model for multiple scenarios consists of two parts: the ViTDeT backbone and the DINO detection head. The ViTDeT backbone includes 12 stacked and cascaded Vision Transformers. Each Vision Transformer can perform self-attention operations or global self-attention operations. After adding position embedding to the input image, self-attention operations are performed. Global self-attention operations are performed every two self-attention operations. The entire ViTDeT backbone generates feature maps of four scales. The multi-scale feature maps are input to the DINO detection head after adding position embedding. The DINO detection head consists of three parts, namely Transformer Encoder, Transformer Decoder, and result output layer. Transformer Encoder receives multi-scale features and performs feature enhancement through self-attention. Transformer Decoder performs cross-attention operations on the output of Transformer Encoder and the initial object detection query. The result output layer consists of a lightweight feedforward neural network, which receives the output of Transformer Decoder and generates prediction results.

[0069] Step 3: S1 stage - ViTDeT main intervention training of masked self-encoding

[0070] First, the input image is converted into a grayscale image and its color space is normalized; the image is divided into cells with 64 pixels, and then the Sobel operator is used to calculate the gradient of the pixels in the image. The number of gradient directions is set to 9, and the gradient histogram in each cell is calculated and L2 normalized. The statistical calculation results of the pixel gradient size and direction in each cell are converted into HOG feature descriptors with the same number of pixels to obtain the HOG feature descriptor of the entire image.

[0071] Then divide the HOG feature descriptor of the entire image according to the patch level (14×14 pixels) to obtain the HOG feature descriptor at the patch level.

[0072] The patch-level HOG feature descriptors in the entire image are masked with a mask probability of 60%, and the image consisting of the remaining patch-level HOG feature descriptors after masking is used as the input of the ViTDeT backbone.

[0073] At this stage, the structure of the main intervention training model consists of two parts: the ViTDeT backbone and the mask decoder. The ViTDeT backbone is a 12-layer 768-dimensional Vision Transformer structure that receives the image composed of the remaining patch-level HOG feature descriptors after masking and generates feature embeddings; the mask decoder is composed of a 4-layer 768-dimensional ViT structure, in which the ViT structure uses self-attention operations to implement the ViT Transformer. The ViT structure reconstructs the masked patch-level HOG feature descriptors based on the feature embeddings generated by the ViTDeT backbone. The reconstruction loss is the mean square error.

[0074] After pre-training, the mask decoder part is discarded, and the weight of the ViTDeT backbone is retained as the initial weight of the ViTDeT backbone in the entire multi-scenario defect detection model. Since the ViTDeT backbone has learned the basic feature representation of images in the same source data domain (the same source as the supervised fine-tuning images), it has better feature extraction capabilities.

[0075] like Figure 3 As shown in the figure, using the HOG feature descriptor as the reconstruction task makes the model highlight the detailed texture features rather than the pixel values ​​after reconstruction, which is in line with the characteristics of the defect detection task that pays more attention to details.

[0076] Step 4: S2 stage - DINO detection head comparison pre-training

[0077] First, we use the selective search algorithm to generate 900 pseudo bounding box proposals on image X. Secondly, perform any two different random data augmentation methods on image X to construct two transformed views of X , ,correspond , Two sets of one-to-one corresponding pseudo bounding box proposals are also generated , , and Constitute a proposal pair.

[0078] Then, a simple Siamese network is formed by combining the ViTDeT backbone trained in the S1 stage and two DINO detection heads with the same random initialization parameters.

[0079] Twin Network A multi-layer perceptron is used to predict pseudo bounding boxes after the DINO detection head. , and based on the predicted bounding box With pseudo bounding box Update the difference between The weights of the DINO detection head and the multilayer perceptron. Regression loss function as follows:

[0080] ,

[0081] in is the IoU loss function, yes The corresponding k-th pseudo bounding box, is the corresponding k-th pseudo bounding box predicted by the multilayer perceptron, is a hyperparameter set to 1 by default, and n is The number of pseudo bounding boxes in ; , To predict the coordinate position of the upper left corner of the pseudo bounding box, To predict the height and width of the pseudo bounding box.

[0082] Instead of using a multilayer perceptron, the output of the corresponding DINO detection head is with Output before the multilayer perceptron For comparison, compare the loss function as follows:

[0083] ,

[0084] in It calculates the negative cosine similarity between pairs of feature vectors. The DINO detection head is based on the regression loss function And the contrast loss function Weighted sum updates weights, total loss function as follows:

[0085] ,

[0086] in, They are regression loss functions respectively And the contrast loss function The weight of .

[0087] During training The weight of the side DINO head is given by The sliding exponential average update of the side DINO detection head weight is obtained. Changes in the weight of the side DINO detector head will update The output of the DINO detection head is used to update the contrast loss function. The side DINO detection head weight is the initial weight of the DINO detection head in the entire multi-scenario defect detection model.

[0088] The data augmentation for X includes basic resizing and affine transformation, since , Due to different data augmentation methods, the multi-scale features obtained after passing through the same backbone are bound to be different. In this stage, contrast training is used to minimize the differences between feature pairs and maximize the similarities between proposal pairs, thereby capturing the inductive bias and making the DINO detection head robust to changing features.

[0089] Step 5: S3 stage - end-to-end fine-tuning of labeled images

[0090] In order to enable the multi-scenario defect detection large model to further learn the knowledge required to complete multi-scenario solar cell defect detection tasks, the labeled training set in the first step is used for end-to-end fine-tuning training; at this stage, the weights of the ViTDeT backbone and the weights of the DINO detection head are updated simultaneously, and the labeled information is used to supervise the training of the multi-scenario defect detection large model to achieve the training of the large model.

[0091] Step 6: Model testing

[0092] The following table verifies that the method of this application enables the large model to learn prior knowledge in related fields. That is, the model composed of the pre-trained ViTDeT backbone and the pre-trained DINO detection head of this application converges fastest when fine-tuning training with the same supervised data, and has the highest data utilization rate under the same number of fine-tuning training rounds. The visualization results are as follows: Figure 4 shown.

[0093] Among them, no pre-training (randomly initialized backbone network) corresponds to Figure 4 SCRATCH, IN1K classification pre-training corresponding Figure 4 IN1K in, masked self-encoder pre-training corresponds to Figure 4 MAE in COCO object detection pre-training Figure 4 In COCO, this method corresponds to Figure 4 CPDD in. It can be seen that on the basis of the same backbone network, compared with other pre-training methods, the large defect detection model for multiple scenarios using the method of this application has a relatively faster convergence speed and higher detection accuracy when fine-tuning with the same data. In addition, when fine-tuning with less data, since the pre-training data used by this method comes from the same quality inspection scenario and has corresponding prior knowledge, the detection performance has a greater advantage than other pre-training methods.

[0094]

[0095] At the same time, in order to verify the effectiveness of the method of the present invention, the method of the present invention is compared with other pre-training methods, and the test results are Figure 5 As shown. From the results, it can be seen that the inference result of the model obtained by pre-training using the method of the present application is closest to the true value. Compared with the model obtained by the pixel reconstruction pre-training method and the model without pre-training, this method can detect smaller defects and effectively filter out irrelevant parts.

[0096] In addition, for industrial products such as strip steel, aluminum, wood, and cloth that require surface defect detection, the two-stage pre-training method described in this application can be used for images of the same product in different detection scenarios, or images of different industrial products under the same detection conditions, so that the model can obtain prior knowledge related to the detection scenario or detection conditions. Then, high-precision defect detection can be achieved through fine-tuning training.

[0097] The large defect detection model for multiple scenarios in this embodiment is composed of a ViTDeT backbone and a DINO detection head. Both the backbone and the detection head are built based on the Vision Transformer module. In the S1 stage, the input image is divided into 224×224 pixel sub-images before entering the VisionTransformer, and each sub-image is divided into 196 14×14 pixel patches, which can complete the training task more effectively than the structure based on the convolutional neural network; in the S3 stage, the ViTDet backbone input images are all large images, which can decouple the pre-training and fine-tuning requirements and maintain the independence of upstream and downstream tasks. The DINO detection head can perform end-to-end defect target detection, simplify the post-processing process, improve the reasoning efficiency, and thus improve the training efficiency and training accuracy.

[0098] Any matters not described in the present invention are applicable to the prior art.

Claims

1. A large model training method for multi-scenario intelligent manufacturing defect detection, characterized in that: The method comprises the following steps: Step 1: Obtain multi-scene images of industrial products that need to be inspected for surface defects, partially annotate various defect images in each scene, and divide the annotated images into training sets and test sets. The remaining unannotated images are used as pre-training data. Step 2: Build a large defect detection model for multiple scenarios: The multi-scenario defect detection large model is composed of a ViTDeT backbone and a DINO detection head. The input image is embedded with positions and then input into the ViTDeT backbone. The ViTDeT backbone outputs a multi-scale feature map of the image. The multi-scale feature map is embedded with positions and then input into the DINO detection head. The DINO detection head outputs the position and category of the target to be detected. Step 3: S1 stage - ViTDeT main intervention training of masked self-encoding The main intervention training model is used to train the ViTDeT backbone using the pre-training data of the first step. The specific process is: obtain the HOG feature descriptor of the entire image of the pre-training data, and then divide the HOG feature descriptor of the entire image according to the patch level to obtain the HOG feature descriptor of the patch level; the patch level is 14×14 pixels; Set the mask probability, mask the patch-level HOG feature descriptors in the entire image with the mask probability, and use the masked image consisting of the remaining patch-level HOG feature descriptors as the input of the ViTDeT backbone; The structure of the main intervention training model includes a ViTDeT backbone and a mask decoder. The output of the mask decoder is compared with the HOG feature descriptor at the patch level before masking for feature reconstruction loss. The training task is to losslessly generate the HOG feature descriptor at the patch level of the masked part. After the pre-training is completed, the mask decoder part is discarded, and the weight of the ViTDeT backbone is retained as the initial weight of the ViTDeT backbone in the entire multi-scenario defect detection large model to obtain the pre-trained ViTDeT backbone. Step 4: S2 stage - DINO detection head comparison pre-training The pre-training data in the first step is used to perform feature enhancement and contrast pre-training on the DINO detection head for the multi-scenario defect detection large model using the detection head pre-training model. The training task is to minimize the contrast loss value of the same pseudo bounding box generated by images enhanced with different data. The specific process is: First, a selection search algorithm is used to generate multiple pseudo bounding boxes on the image; Secondly, two different image enhancement processes are performed on the image, and two sets of enhanced pseudo bounding boxes are generated accordingly; The detection head pre-training model includes the ViTDeT backbone trained in the third step, two DINO detection heads and a multi-layer perceptron, the inputs of the two ViTDeT backbones are the two enhanced images respectively, the two ViTDeT backbones share weights, each ViTDeT backbone is connected in series with a DINO detection head, the structures and parameters of the two DINO detection heads are exactly the same, the output of one DINO detection head is connected to the multi-layer perceptron, and the multi-layer perceptron outputs a predicted pseudo bounding box; The outputs of the two DINO detection heads are subjected to contrastive loss calculation to update the weights of the DINO detection head that is not connected to the multi-layer perceptron. At the same time, the pseudo bounding box predicted by the multi-layer perceptron is used to update the weights of the DINO detection head connected to the multi-layer perceptron. After contrastive training, the initialization weights of the DINO detection head are obtained to obtain the pre-trained DINO detection head. Step 5: S3 stage - end-to-end fine-tuning of labeled images The training set of the first step is used to perform end-to-end fine-tuning training on the entire multi-scenario defect detection model composed of the pre-trained ViTDeT backbone obtained in the third step and the pre-trained DINO detection head obtained in the fourth step. The gradient is calculated according to the deviation between the output of the DINO detection head and the image annotation information, and this gradient is used to update the weights of the entire multi-scenario defect detection model.

2. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 1 is characterized in that: The industrial products requiring surface defect detection are strip steel, aluminum, wood, cloth or solar cells.

3. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 2 is characterized in that: The industrial product that needs to be inspected for surface defects is a solar cell. Images of the polycrystalline silicon electroluminescence inspection scene, the polycrystalline silicon visible light appearance inspection scene, and the monocrystalline silicon electroluminescence inspection scene are collected. The types of defects include black cores, cracks, broken grids, thick lines, collapsed edges, leaking slurry, dirty wafers, open welds, black cores, hidden cracks, and scratches.

4. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 1 is characterized in that: In the second step, the input image size of the multi-scenario defect detection large model is 1120×1120 pixels. After adding position embedding, the input image is input into the ViTDeT backbone composed of Vision Transformer to extract the multi-scale features of the input image. The DINO detection head consists of three parts: Transformer Encoder, Transformer Decoder, and result output layer. Transformer Encoder performs multi-head self-attention operation on the multi-scale features output by the ViTDeT backbone and outputs the fused features. Transformer Decoder performs cross self-attention operation on the fused features and target detection query output by Transformer Encoder. The result output layer receives the output of Transformer Decoder and gives the location and category of the target to be detected.

5. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 4 is characterized in that: The ViTDeT backbone consists of 12 stacked and cascaded Vision Transformers, each of which performs a self-attention operation or a global self-attention operation. The input image is positionally embedded and then self-attention is performed. A global self-attention operation is performed every two self-attention operations. The entire ViTDeT backbone generates feature maps of four scales.

6. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 1 is characterized in that: In the first step, the proportion of partial annotations is not less than 10% of the total number of images; in the third step, the mask probability is set to 60%.

7. The large-scale model training method for multi-scenario intelligent manufacturing defect detection according to claim 1 is characterized in that: The mask decoder consists of a 4-layer 768-dimensional ViT structure.