Search

CN-121981970-A - Efficient unsupervised defect detection method and system for fusing reference images

CN121981970ACN 121981970 ACN121981970 ACN 121981970ACN-121981970-A

Abstract

The invention discloses a high-efficiency unsupervised defect detection method and system for fusing reference images, which comprise the steps of collecting appearance images of products to be detected and paired defect-free reference images, generating defect images and labels for self-supervision training by utilizing the images to be detected, respectively extracting characteristics of the defect images and the reference images by using a teacher student model to obtain multi-layer characteristics, respectively obtaining cosine characteristic distances of the multi-layer characteristics, fusing the cosine characteristic distances to obtain detection results, training the models by utilizing corresponding labels, respectively extracting the multi-layer characteristics of the images to be detected and the reference images by using the trained models, simplifying the characteristics of the multi-layer characteristics, and fusing the multi-layer characteristic distances to obtain the detection results. According to the invention, by introducing the reference image information and constructing the simplified model, the interference of the background of the complex PCB product can be reduced, the accuracy of model identification can be improved, and the dependence on a defect image training set can be avoided on the premise of no additional reasoning expense.

Inventors

  • LIU YANXIA
  • CHEN HUIQI
  • Luo Kunting

Assignees

  • 华南理工大学

Dates

Publication Date
20260505
Application Date
20251231

Claims (10)

  1. 1. The efficient unsupervised defect detection method for fusing the reference image is characterized by comprising the following steps of: Inputting the image to be detected into a trained teacher student model for detection, and outputting a detection result; Training and reasoning of the teacher student model comprises the following steps: S1, acquiring an image to be detected and a matched defect-free reference image; S2, generating a defect image and a label for self-supervision training by using the image to be detected; S3, in a training stage, respectively extracting the defect image and the reference image features by using a teacher student model to obtain multi-layer features, respectively solving cosine feature distances of the multi-layer features, fusing the cosine feature distances to obtain a detection result, and training the teacher student model by using corresponding labels; And S4, in the reasoning stage, respectively extracting the multi-layer features of the image to be detected and the reference image by using a trained teacher student model, carrying out feature reduction on the multi-layer features, and fusing and simplifying multi-layer feature distances to obtain a detection result.
  2. 2. The method according to claim 1, wherein in step S1, the non-defective reference image is acquired by the acquisition device as a product image identical to the product to be detected and having no defects, and the same reference image can be used for the same type of product to be detected.
  3. 3. The method for efficiently detecting the unsupervised defect by fusing the reference image according to claim 1, wherein in the step S2, a defect image and a label for self-supervision training are generated, and the method comprises the steps of firstly randomly selecting a texture image, then randomly generating two-dimensional Berlin noise by the texture image, converting the two-dimensional Berlin noise into a binary mask, obtaining a texture defect by multiplying the mask and the texture image, and finally generating the defect image by fusing a defect-free image to be detected and the texture defect with random transparency, wherein the binary mask is the defect label for model training.
  4. 4. The method according to claim 1, wherein in step S3, the teacher model and the student model of the teacher student model are ResNet of fixed parameters pre-trained in ImageNet and ResNet of random initialization parameters to be trained, respectively.
  5. 5. The method for efficiently detecting the unsupervised defect by fusing the reference images according to claim 1, wherein in step S3, the defect image and the reference image are respectively input into a teacher model and a student model, wherein after the defect image and the reference image respectively pass through a plurality of convolution layers, a defect feature map of the teacher model and a reference feature map of the student model of a corresponding layer are output, and then cosine similarity is calculated on the defect feature map of the teacher model and the reference feature map of the student model of the corresponding layer respectively in a channel dimension to obtain the feature distance of the corresponding layer.
  6. 6. The method for efficiently detecting the unsupervised defect fused with the reference image according to claim 1, wherein in the step S4, the multi-layer features are extracted by using a teacher model, the multi-layer features of the image to be detected are counted in channel dimension, the multi-layer features are ranked according to variance, and a feature channel with the highest rank is selected.
  7. 7. The method for efficient unsupervised defect detection of a fused reference image according to claim 1, wherein the defect score is calculated by taking the maximum K scores in the defect score map as the final image level defect score, wherein the defect score map is: Wherein, the In the case of a two-dimensional defect score map, Is the feature distance.
  8. 8. A system for implementing a high-efficiency unsupervised defect detection method for fusing reference images as set forth in claim 1, comprising: the image coding module is used for extracting the characteristics of the defect image and the reference image to obtain multi-layer characteristics; the effective feature screening module is used for simplifying the multi-layer features through variance; and the defect identification module is used for fusing the simplified multi-layer characteristic distances, calculating to obtain defect scores and judging whether the image has defects or not.
  9. 9. A computer device comprising a memory and a processor, the memory being electrically connected to the processor, the memory storing a computer program, wherein the computer program, when executed by the processor, causes the processor to implement the method as claimed in any one of claims 1 to 7.
  10. 10. A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor, the processor implementing the method according to any one of claims 1 to 7.

Description

Efficient unsupervised defect detection method and system for fusing reference images Technical Field The invention relates to the field of industrial vision detection and the field of image anomaly detection, in particular to a high-efficiency unsupervised defect detection method and system for fusing reference images. Background PCBs are key components of modern electronics manufacturing, the quality of which directly determines the reliability of electronic products. The missing PCB defect is light, so that economic loss and progress delay are caused, and the serious accident and brand disaster are caused. Typical methods of unsupervised defect detection for PCBs mainly include a method based on defect synthesis, a method based on image reconstruction, and a method based on feature embedding. The defect synthesis image is generated through data enhancement based on the defect synthesis method, a training mode of supervised learning can be maintained, however, the distribution deviation exists between the synthesized defects and the real defects all the time, and the model is easy to be fitted to the synthesized defects. The method based on image reconstruction reconstructs normal samples through a training model, positions defects according to reconstruction differences of defect areas, but easily generates pixel-level errors and requires more calculation cost. The method based on feature embedding uses a depth network to extract high-dimensional semantic features, defines feature space distance measurement and quantifies the degree of sample deviation. The method adopts a teacher student model, and supposes that the characteristic extraction capability of the student model in normal image distillation can not extract defect characteristics, and defect detection is realized by comparing characteristic differences of a teacher encoder and a student encoder, such as a method (Adibhatla, V.A.; Chih, H.-C.; Hsu, C.-C.; Cheng, J.; Abbod, M.F.; Shieh, J.-S. Unsupervised Anomaly Detection in Printed Circuit Boards through Student–Teacher Feature Pyramid Matching[J]. Electronics, 2021, 10(14): 1654.). for carrying out PCB unsupervised anomaly detection through teacher-student characteristic pyramid matching, however, due to the field deviation of a PCB image and a general data set, part of characteristic dimensions extracted by the teacher encoder are not only irrelevant to PCB defect detection, but also influence reasoning speed and detection effect. The reference image is a normal and non-defective physical image of the same PCB component as the test image, and can provide true and correct state information of the PCB. The defect-free reference images are used for comparison detection, and the difference between the defect image and the normal image can be mined on the premise of eliminating background interference. The method has the core advantages that the defect detection with high accuracy can be realized by directly comparing the image to be detected with the reference image without depending on a large amount of marked defect data. In summary, how to overcome the field deviation problem of the general pre-training model and realize more accurate and efficient PCB defect detection becomes a technical problem to be solved in the art. And the defect-free reference images of the same PCB model are utilized for comparison, so that the possibility of directly acquiring the special characteristics of the field and eliminating irrelevant noise is provided. Disclosure of Invention The invention aims to provide a high-efficiency unsupervised defect detection method for fusing reference images, which aims to solve the problems in the existing PCB defect detection field. The invention is realized at least by one of the following technical schemes. An efficient unsupervised defect detection method for fusing reference images comprises the following steps: Inputting the image to be detected into a trained teacher student model for detection, and outputting a detection result; Training and reasoning of the teacher student model comprises the following steps: S1, acquiring an image to be detected and a matched defect-free reference image; S2, generating a defect image and a label for self-supervision training by using the image to be detected; s3, in a training stage, respectively extracting the defect image and the reference image features by using a teacher student model to obtain multi-layer features, respectively solving cosine feature distances of the multi-layer features, fusing the cosine feature distances to obtain a detection result, and training the teacher student model by using corresponding labels; And S4, in the reasoning stage, respectively extracting the multi-layer features of the image to be detected and the reference image by using a trained teacher student model, carrying out feature reduction on the multi-layer features, and fusing and simplifying multi-layer feature distances to obtain a detection