TW202144766A - Two-dimensional PCB appearance defect real-time automatic detection technology based on deep learning - Google Patents

Two-dimensional PCB appearance defect real-time automatic detection technology based on deep learning Download PDF

Info

Publication number
TW202144766A
TW202144766A TW110115716A TW110115716A TW202144766A TW 202144766 A TW202144766 A TW 202144766A TW 110115716 A TW110115716 A TW 110115716A TW 110115716 A TW110115716 A TW 110115716A TW 202144766 A TW202144766 A TW 202144766A
Authority
TW
Taiwan
Prior art keywords
pcb
defect
dimensional
picture
image
Prior art date
Application number
TW110115716A
Other languages
Chinese (zh)
Other versions
TWI796681B (en
Inventor
羅貴明
何悅
Original Assignee
清華大學
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 清華大學 filed Critical 清華大學
Publication of TW202144766A publication Critical patent/TW202144766A/en
Application granted granted Critical
Publication of TWI796681B publication Critical patent/TWI796681B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30141Printed circuit board [PCB]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Biophysics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Investigating Or Analyzing Materials By The Use Of Ultrasonic Waves (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a two-dimensional PCB appearance defect real-time automatic detection technology based on deep learning. The PCB defect detection method comprises three PCB defect detection modes of CNN detection depending on standard PCB comparison, CNN detection (unsupervised learning detection) without standard PCB comparison and hybrid CNN detection, and comprises the following steps: training each type of defect in a PCB defect picture library, and segmenting a PCB picture to be detected into a plurality of picture blocks; utilizing the PCB defect characteristics to search defect blocks to identify defects in the PCB picture to be detected and marking suspected defect blocks; carrying out defect classification by utilizing PCB defect category characteristics, judging defect categories, judging whether suspected defects which are not in the categories are false defects or new categories of defects, and supplementing the new categories of defects to a defect picture library; and judging suspected defects by utilizing PCB defect level characteristics, if the suspected defects are false defects, deleting the corresponding defects and analyzing reasons, and if the suspected defects are true defects, marking the suspected defects in defect records. The method is high in PCB defect detection speed and high in precision.

Description

基於深度學習的二維PCB外觀缺陷實時自動檢測之方法Real-time automatic detection method of two-dimensional PCB appearance defects based on deep learning

本發明關於一種缺陷檢測技術領域,特別涉及一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法。The invention relates to the technical field of defect detection, in particular to a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning.

二維(2D)印刷電路板(PCB)是各種微電路版、主板製作的基礎,其正確性是其它後續工序正確的保障。由於現代技術和精細工藝的不斷發展,PCB的製作也越來越複雜、越來越精密。傳統的外觀檢測已不適應複雜的PCB檢測。Two-dimensional (2D) printed circuit board (PCB) is the basis for the production of various microcircuit boards and motherboards, and its correctness is the guarantee for the correctness of other subsequent processes. Due to the continuous development of modern technology and fine craftsmanship, the production of PCBs is becoming more and more complex and sophisticated. Traditional appearance inspection is not suitable for complex PCB inspection.

本發明旨在至少在一定程度上解决相關技術中的技術問題之一。The present invention aims to solve one of the technical problems in the related art at least to a certain extent.

為此,本發明的目的在於提出一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法,該方法具有速度快、精度高、泛化能力强,結構清晰等優點。Therefore, the purpose of the present invention is to propose a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning, which has the advantages of high speed, high precision, strong generalization ability, and clear structure.

為達到上述目的,本發明實施例提出了一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法,包括:In order to achieve the above purpose, an embodiment of the present invention proposes a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning, including:

步驟S1,通過搜集和標記PCB缺陷塊圖片,建立二維PCB缺陷塊圖片庫,所述二維PCB缺陷塊圖片庫包括二維PCB缺陷數據對圖片庫和二維PCB缺陷單數據圖片庫;In step S1, a two-dimensional PCB defect block picture library is established by collecting and marking PCB defect block pictures, and the two-dimensional PCB defect block picture library includes a two-dimensional PCB defect data pair picture library and a two-dimensional PCB defect sheet data picture library;

步驟S2,對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,利用卷積神經網路(Convolutional neural network;CNN)進行訓練,提取PCB缺陷類別特徵;Step S2, utilizes the convolutional neural network (Convolutional neural network; CNN) to carry out training to each type of PCB defect in the described two-dimensional PCB defect block picture library, and extracts the PCB defect category feature;

步驟S3,對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷的級別,利用卷積神經網路進行訓練,提取PCB缺陷級別特徵;Step S3, using the convolutional neural network to train the level of each type of PCB defect in the two-dimensional PCB defect block picture library, and extracting the level of PCB defect;

步驟S4,通過PCB生產流水線提取二維PCB圖片,所述二維PCB圖片包括二維標準PCB圖片和二維待測PCB圖片;Step S4, extracting a two-dimensional PCB picture through the PCB production line, where the two-dimensional PCB picture includes a two-dimensional standard PCB picture and a two-dimensional PCB to be tested picture;

步驟S5,通過濾波去噪塊,對所述二維PCB圖片進行去噪處理;Step S5, performing denoising processing on the two-dimensional PCB picture by filtering the denoising block;

步驟S6,通過圖像配準塊,對所述二維待測PCB圖片與所述二維標準PCB圖片配準;Step S6, through the image registration block, the two-dimensional PCB picture to be tested and the two-dimensional standard PCB picture are registered;

步驟S7,通過圖像灰度值比對塊,對所述二維標準PCB圖片和所述二維待測PCB圖片灰度值進行比對分析,得到二維PCB殘差圖片;Step S7, through the image gray value comparison block, compare and analyze the gray value of the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested to obtain a two-dimensional PCB residual picture;

步驟S8,通過圖像分割定位塊,對所述二維標準PCB圖片、所述二維待測PCB圖片和所述二維PCB殘差圖片進行分割定位,得到多個圖片的圖片塊和對應的坐標;Step S8, through the image segmentation and positioning block, the two-dimensional standard PCB picture, the two-dimensional PCB to be tested picture and the two-dimensional PCB residual picture are divided and positioned to obtain the picture blocks of multiple pictures and corresponding coordinate;

步驟S9,通過殘差濾波塊,對所述二維PCB殘差圖片的圖片塊過濾,消去因配準及其它因素產生比對誤差;Step S9, filter the picture block of the two-dimensional PCB residual picture through the residual filter block to eliminate the comparison error caused by registration and other factors;

步驟S10,缺陷搜索匹配塊,通過卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中搜索缺陷塊,並進行缺陷塊匹配;Step S10, the defect search matching block, through the PCB defect feature trained by the convolutional neural network, search for the defect block in the plurality of picture blocks, and perform the defect block matching;

步驟S11,CNN缺陷識別塊,通過卷積神經網路對所述二維待測PCB圖片中的缺陷進行識別;Step S11, the CNN defect identification block identifies defects in the two-dimensional PCB image to be tested through a convolutional neural network;

步驟S12,PCB缺陷分類塊,通過卷積神經網路訓練的PCB缺陷類別特徵對對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷塊圖片庫;Step S12, the PCB defect classification block, classifies the defects marked in the two-dimensional PCB image to be tested by using the PCB defect category features trained by the convolutional neural network, and judges the defects that are not in the category to determine whether they are false or not. If the defect is still a defect of a new category, add the defect of the new category to the defect block picture library;

步驟S13,通過PCB缺陷疑似塊,對所述二維待測PCB圖片中每一類缺陷標記為疑似缺陷;Step S13, through the PCB defect suspected block, mark each type of defect in the two-dimensional PCB image to be tested as a suspected defect;

步驟S14,PCB缺陷驗證塊,通過卷積神經網路訓練的PCB缺陷級別特徵和分類訊息,判斷疑似缺陷塊的真假性,若缺陷為假缺陷,則删除對應缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。Step S14, the PCB defect verification block, through the PCB defect level features and classification information trained by the convolutional neural network, to determine the authenticity of the suspected defect block, if the defect is a false defect, delete the corresponding defect, and analyze the false defect. The reason, if the defect is a true defect, is marked in the defect record.

本發明實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法,利用PCB圖像和標準PCB圖像以及卷積神經網路對PCB進行缺陷檢測,通過PCB檢測缺陷的工具,在裝配工藝過程的早期查找和消除錯誤,可以避免將含有缺陷的PCB板送到後續的裝配階段,同時會減少修理成本將避免報廢不可修理的電路板。利用卷積神經網路具有速度快、精度高、泛化能力强,結構清晰等優點。The deep learning-based real-time automatic detection method for two-dimensional PCB appearance defects according to the embodiment of the present invention utilizes PCB images, standard PCB images and convolutional neural networks to perform defect detection on PCBs. Finding and eliminating errors early in the process can avoid sending defective PCB boards to subsequent assembly stages, while reducing repair costs will avoid scrapping unrepairable boards. The use of convolutional neural networks has the advantages of high speed, high accuracy, strong generalization ability, and clear structure.

另外,根據本發明上述實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法還可以具有以下附加的技術特徵:In addition, the real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to the above-mentioned embodiments of the present invention may also have the following additional technical features:

進一步地,在本發明的一個實施例中,所述二維PCB缺陷塊圖片庫分為兩類,一類為二維PCB缺陷塊和對應無缺陷標準PCB塊圖片組成的數據對圖片庫,另一類為只有單個二維PCB缺陷塊的數據圖片庫。Further, in an embodiment of the present invention, the two-dimensional PCB defect block picture library is divided into two categories, one is a data pair picture library composed of two-dimensional PCB defect blocks and corresponding defect-free standard PCB block pictures, and the other is a data pair picture library. A data picture library for only a single 2D PCB defect block.

進一步地,在本發明的一個實施例中,所述步驟S1還包括:Further, in an embodiment of the present invention, the step S1 further includes:

建立二維PCB缺陷塊圖片庫。兩類二維PCB缺陷塊圖片庫包含PCB的多種已標記且分類和分級的PCB缺陷塊圖片,所述PCB缺陷塊圖片包括多尺度圖片。Build a two-dimensional PCB defect block picture library. The two-dimensional two-dimensional PCB defect block picture library contains a variety of labeled and classified and graded PCB defect block pictures of the PCB, the PCB defect block pictures including multi-scale pictures.

進一步地,在本發明的一個實施例中,所述步驟S2和步驟S3還包括:Further, in an embodiment of the present invention, the step S2 and the step S3 further include:

對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,用卷積神經網路進行訓練,提取PCB缺陷類別特徵;For each type of PCB defect in the two-dimensional PCB defect block image library, a convolutional neural network is used for training, and the characteristics of the PCB defect category are extracted;

對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷的級別,用卷積神經網路進行訓練,提取PCB缺陷級別特徵。For the level of each type of PCB defect in the two-dimensional PCB defect block image library, a convolutional neural network is used for training to extract the PCB defect level feature.

進一步地,在本發明的一個實施例中,在步驟S4中,通過PCB圖片提取塊提取的二維PCB圖片包括兩種:一種為提取二維標準PCB圖片和二維待測PCB圖片;另一種為只提取二維待測PCB圖片。Further, in an embodiment of the present invention, in step S4, the two-dimensional PCB pictures extracted by the PCB picture extraction block include two types: one is to extract two-dimensional standard PCB pictures and two-dimensional PCB pictures to be tested; In order to extract only the two-dimensional PCB image to be tested.

進一步地,在本發明的一個實施例中,所述步驟S4還包括:Further, in an embodiment of the present invention, the step S4 further includes:

在比對標準PCB的檢測方法和PCB混合檢測方法中,提取二維待測PCB圖片和對應的二維標準PCB圖片;In comparing the standard PCB detection method and the PCB hybrid detection method, extract the two-dimensional PCB image to be tested and the corresponding two-dimensional standard PCB image;

在無標準板比對PCB檢測方法中,只提取二維待測PCB圖片。In the non-standard board comparison PCB detection method, only the two-dimensional PCB picture to be tested is extracted.

進一步地,在本發明的一個實施例中,所述步驟S5中,濾波去噪塊對所述二維PCB圖片進行去噪處理,包括:Further, in an embodiment of the present invention, in the step S5, the filtering and denoising block performs denoising processing on the two-dimensional PCB picture, including:

利用算法對所述二維標準PCB圖片和所述二維待測PCB圖片進行去噪,在比對標準PCB的檢測方法和PCB混合檢測方法中,對所述二維標準PCB圖片和所述二維待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得標準PCB圖片、待測PCB圖片、缺陷庫中圖片的底板顔色一致;The two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested are denoised by using an algorithm, and in the comparison of the standard PCB detection method and the PCB hybrid detection method, the two-dimensional standard PCB picture and the two-dimensional PCB picture are denoised. De-noise the PCB image to be tested, remove the noise in the image, and correct the influence of the color of the backplane on the image, so that the color of the backplane in the standard PCB image, the PCB image to be tested, and the image in the defect library is the same;

在無標準板比對PCB檢測方法中,只對所述二維待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得待測PCB圖片、缺陷庫中圖片的底板顔色一致。In the non-standard board comparison PCB detection method, only the two-dimensional PCB image to be tested is denoised, the noise in the image is removed, and the influence of the color of the bottom plate on the image is corrected, so that the image of the PCB to be tested and the bottom plate of the image in the defect library are Consistent color.

進一步地,在本發明的一個實施例中,對所述二維標準PCB圖片和所述二維待測PCB圖片進行配準、灰度值比對、圖像分割,進一步包括:Further, in an embodiment of the present invention, performing registration, gray value comparison, and image segmentation on the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested, further comprising:

在比對標準PCB的檢測方法和PCB混合檢測方法中,所述步驟S6、步驟S7和步驟S8,包括:In the detection method for comparing the standard PCB and the PCB hybrid detection method, the step S6, the step S7 and the step S8 include:

在比對標準PCB的檢測方法和PCB混合檢測方法中,將所述二維標準PCB圖片和所述二維待測PCB圖片配準,根據去噪處理後的二維標準PCB圖片對所述二維待測PCB圖片進行矯正,將所述二維標準PCB圖片和所述二維待測PCB圖片對比灰度值,計算圖片殘差得到二維PCB殘差圖片;將所述二維標準PCB圖片、所述二維待測PCB圖片和所述二維PCB殘差圖片進行分割得到多個圖片塊和對應的坐標;In the detection method for comparing the standard PCB and the PCB hybrid detection method, the two-dimensional standard PCB picture and the two-dimensional PCB to be tested picture are registered, and the two-dimensional standard PCB picture after denoising is processed. Correcting the PCB picture to be measured, comparing the gray value of the two-dimensional standard PCB picture and the two-dimensional PCB picture to be measured, and calculating the residuals of the pictures to obtain a two-dimensional PCB residual picture; comparing the two-dimensional standard PCB picture , the two-dimensional PCB picture to be tested and the two-dimensional PCB residual picture are divided to obtain a plurality of picture blocks and corresponding coordinates;

對所述二維標準PCB圖片進行配準,檢測所述二維標準PCB圖片是否存在旋轉、形變、光線不均和光線反射,若存在,則利用算法進行矯正;The two-dimensional standard PCB picture is registered to detect whether the two-dimensional standard PCB picture has rotation, deformation, uneven light and light reflection, and if there is, use an algorithm to correct it;

將所述二維待測PCB圖片與處理後的二維標準PCB圖片進行對比,判斷位置、光線和顔色是否一致,若不一致,則通過算法對所述二維待測PCB圖片進行矯正。The two-dimensional PCB image to be tested is compared with the processed two-dimensional standard PCB image to determine whether the position, light and color are consistent. If they are inconsistent, the two-dimensional PCB image to be tested is corrected by an algorithm.

進一步地,在本發明的一個實施例中,在非比對參考的檢測方法中,步驟S8進一步包括:對所述二維待測PCB圖片進行分割得到多個圖片塊和對應的坐標。Further, in an embodiment of the present invention, in the non-comparison reference detection method, step S8 further includes: segmenting the two-dimensional PCB picture to be tested to obtain a plurality of picture blocks and corresponding coordinates.

進一步地,在本發明的一個實施例中,所述步驟S9中,對所述二維PCB殘差圖片的圖片塊過濾,消去因配準及其它因素產生比對誤差,删除所述二維PCB殘差圖片中沒有殘差的圖片塊;Further, in an embodiment of the present invention, in the step S9, the picture block of the two-dimensional PCB residual picture is filtered, the comparison error caused by registration and other factors is eliminated, and the two-dimensional PCB is deleted. The image block without residual in the residual image;

所述步驟S10和步驟S12進一步包括:The steps S10 and S12 further include:

在無標準板比對PCB的檢測方法中,採用所述二維PCB缺陷單數據圖片庫;In the detection method for comparing PCBs without standard boards, the two-dimensional PCB defect single data picture library is used;

在無標準板比對PCB的檢測方法和PCB混合檢測方法中,對所述二維PCB缺陷圖片庫和所述二維PCB缺陷圖片庫中的每一種類PCB缺陷,用卷積神經網路訓練,提取PCB缺陷特徵和PCB缺陷類別特徵;In the non-standard board comparison PCB detection method and the PCB hybrid detection method, the two-dimensional PCB defect image library and each type of PCB defect in the two-dimensional PCB defect image library are trained with a convolutional neural network , extract PCB defect features and PCB defect category features;

步驟S10通過卷積神經網路訓練的PCB缺陷特徵,所述步驟S8在多個圖片塊中進行PCB缺陷搜索判別,採用單個二維PCB缺陷圖片庫卷積神經網路訓練PCB缺陷的類別特徵,步驟S12對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。Step S10 uses the PCB defect feature trained by the convolutional neural network, and the step S8 performs PCB defect search and discrimination in a plurality of picture blocks, and uses a single two-dimensional PCB defect picture library convolutional neural network to train the category features of PCB defects, Step S12 classifies the defects marked in the two-dimensional PCB image to be tested, judges the defects that are not in the category, determines whether it is a false defect or a defect of a new category, and supplements the defect of the new category to the defect Photo gallery.

進一步地,在本發明的一個實施例中,在比對標準PCB的檢測方法和PCB混合檢測方法中,分別對所述二維PCB缺陷圖片庫和所述二維PCB缺陷圖片庫中的每一種類PCB缺陷,用卷積神經網路訓練,提取PCB缺陷特徵和PCB缺陷類別特徵。步驟S11和步驟S12還包括:Further, in an embodiment of the present invention, in the detection method for comparing the standard PCB and the PCB hybrid detection method, each of the two-dimensional PCB defect picture library and the two-dimensional PCB defect picture library is respectively analyzed. Type PCB defects, using convolutional neural network training to extract PCB defect features and PCB defect category features. Step S11 and step S12 also include:

採用二維PCB缺陷塊和對應無缺陷的標準PCB塊圖片組成的二維PCB缺陷數據對圖片庫,步驟S11通過卷積神經網路訓練的PCB缺陷特徵對,步驟S9對殘差圖片作缺陷識別,採用二維PCB缺陷圖片庫卷積神經網路訓練PCB缺陷的類別特徵對,步驟S12對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。A two-dimensional PCB defect data pair image library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures is used. Step S11 uses the PCB defect feature pairs trained by the convolutional neural network, and step S9 performs defect identification on the residual image. , using the two-dimensional PCB defect image library convolutional neural network to train the category feature pairs of PCB defects, step S12 to classify the defects marked in the two-dimensional PCB image to be tested, to judge the defects that are not in the category, and to determine whether Whether a false defect or a new category of defects is added, the new category of defects is added to the defect picture library.

進一步地,在本發明的一個實施例中,在PCB混合檢測方法中,步驟S12之後還包括:Further, in an embodiment of the present invention, in the PCB hybrid detection method, after step S12, the method further includes:

利用卷積神經網路訓練的所述二維PCB缺陷圖片庫的PCB缺陷特徵對標記的疑似缺陷塊進行搜索匹配,删除其中的假缺陷,提高識別精度;Use the PCB defect feature of the two-dimensional PCB defect image library trained by the convolutional neural network to search and match the marked suspected defect blocks, delete the false defects therein, and improve the recognition accuracy;

在步驟S13之後,通過卷積神經網路訓練的PCB缺陷特徵,對疑似缺陷在所述缺陷圖片中搜索匹配。After step S13 , searching and matching the defect pictures for the suspected defects through the PCB defect features trained by the convolutional neural network.

進一步地,在本發明的一個實施例中,對PCB缺陷驗證,通過步驟S3卷積神經網路訓練的PCB缺陷級別特徵訊息,判斷PCB缺陷的真假性,若缺陷為假缺陷,則删除該假缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。Further, in one embodiment of the present invention, for PCB defect verification, the PCB defect level feature information trained by the convolutional neural network in step S3 is used to judge the authenticity of the PCB defect, and if the defect is a false defect, delete the defect. False defects, and analyze the cause of false defects, if the defect is a true defect, it will be marked in the defect record.

進一步地,在本發明的一個實施例中,在搜索和判斷缺陷過程中,通過多次識別迭代,對缺陷進行逐次排除。Further, in an embodiment of the present invention, in the process of searching and judging defects, the defects are eliminated one by one through multiple identification iterations.

本發明附加的方面和優點將在下面的描述中部分給出,部分將從下面的描述中變得明顯,或通過本發明的實踐瞭解到。Additional aspects and advantages of the present invention will be set forth, in part, from the following description, and in part will be apparent from the following description, or may be learned by practice of the invention.

下面詳細描述本發明的實施例,所述實施例的示例在圖式中示出,其中自始至終相同或類似的標號表示相同或類似的元件或具有相同或類似功能的元件。下面通過參考圖式描述的實施例是示例性的,旨在用於解釋本發明,而不能理解為對本發明的限制。The following describes in detail the embodiments of the present invention, examples of which are illustrated in the drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary, and are intended to explain the present invention and should not be construed as limiting the present invention.

下面參照圖式描述根據本發明實施例提出的基於深度學習的二維PCB外觀缺陷實時自動檢測方法。The following describes a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to an embodiment of the present invention with reference to the drawings.

隨著工藝的發展,PCB的製作越來越複雜和精密,現有的缺陷檢測方法效率不高,精度很低。本發明實施例提出了一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法,具體包括三種缺陷檢測的方法的實施例進行PCB缺陷檢測。其中,一種是依賴於標準PCB板作比對的CNN檢測方法(稱為方法一),第二種是沒有標準板比對的CNN檢測方法(稱為方法二),第三種是前兩種方法混合CNN的PCB檢測方法(稱為方法三)。With the development of the process, the fabrication of PCBs is becoming more and more complex and precise, and the existing defect detection methods are not efficient and have low precision. The embodiment of the present invention proposes a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning, which specifically includes three embodiments of defect detection methods for PCB defect detection. Among them, one is a CNN detection method that relies on standard PCB board comparison (called method 1), the second is a CNN detection method without standard board comparison (called method 2), and the third is the first two. Method Hybrid CNN's PCB detection method (called method three).

如圖1所示,本發明實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法,包括:As shown in Figure 1, the deep learning-based real-time automatic detection method for two-dimensional PCB appearance defects according to an embodiment of the present invention includes:

步驟S1,PCB缺陷塊圖片庫,建立二維PCB缺陷塊(patch)圖片庫,分別有二維PCB缺陷數據對圖片庫和二維PCB缺陷單數據圖片庫;Step S1, a picture library of PCB defect blocks is established, a two-dimensional PCB defect block (patch) picture library is established, and there are respectively a two-dimensional PCB defect data pair picture library and a two-dimensional PCB defect sheet data picture library;

步驟S2,CNN缺陷特徵訓練塊,對二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,用卷積神經網路(CNN)訓練,提取PCB缺陷類別特徵;Step S2, CNN defect feature training block, for each type of PCB defect in the two-dimensional PCB defect block image library, use convolutional neural network (CNN) training to extract PCB defect category features;

步驟S3,CNN缺陷級別特徵訓練塊,對二維PCB缺陷塊圖片庫中的每一種類PCB缺陷的級別,用卷積神經網路訓練,提取PCB缺陷級別特徵;Step S3, the CNN defect level feature training block, for each type of PCB defect level in the two-dimensional PCB defect block image library, is trained with a convolutional neural network to extract the PCB defect level feature;

步驟S4,PCB圖片提取塊,提取二維PCB圖片,分別有二維標準PCB圖片和二維待測PCB圖片;Step S4, the PCB image extraction block, extracts a two-dimensional PCB image, which includes a two-dimensional standard PCB image and a two-dimensional PCB image to be tested;

步驟S5,濾波去噪塊,對二維PCB圖片進行去噪處理;Step S5, filter the denoising block, and perform denoising processing on the two-dimensional PCB image;

步驟S6,圖像配準塊,對二維標準PCB圖片和二維待測PCB圖片配準,使得二維標準PCB圖片和二維待測PCB圖片對齊;Step S6, the image registration block registers the two-dimensional standard PCB image and the two-dimensional PCB image to be tested, so that the two-dimensional standard PCB image and the two-dimensional PCB image to be tested are aligned;

步驟S7,圖像灰度值比對塊,對二維標準PCB圖片和二維待測PCB圖片灰度值進行比對分析,得到二維PCB殘差圖片;Step S7, the image gray value comparison block, compares and analyzes the gray value of the two-dimensional standard PCB image and the two-dimensional PCB image to be tested, and obtains a two-dimensional PCB residual image;

步驟S8,圖像分割定位塊,對二維標準PCB圖片、二維待測PCB圖片和二維PCB殘差圖片進行分割定位,得到多個圖片的塊(patch)和對應的坐標;Step S8, image segmentation and positioning block, the two-dimensional standard PCB picture, the two-dimensional PCB picture to be tested and the two-dimensional PCB residual picture are divided and positioned to obtain patches of multiple pictures and corresponding coordinates;

步驟S9,殘差濾波塊,對二維PCB殘差圖片的patch過濾,消去因配準及其它因素產生比對誤差;Step S9, the residual filter block, filters the patch of the two-dimensional PCB residual image, and eliminates the comparison error due to registration and other factors;

步驟S10,缺陷搜索匹配塊,通過卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中搜索缺陷塊,並進行缺陷塊匹配;Step S10, the defect search matching block, through the PCB defect feature trained by the convolutional neural network, search for the defect block in the plurality of picture blocks, and perform the defect block matching;

步驟S11,CNN缺陷識別塊,通過卷積神經網路對待測PCB圖片中缺陷進行識別;Step S11, the CNN defect identification block identifies defects in the PCB image to be tested through a convolutional neural network;

步驟S12,PCB缺陷分類塊,通過卷積神經網路訓練的PCB缺陷類別特徵對對待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將新的類別的缺陷補充至缺陷圖片庫;Step S12, the PCB defect classification block, classifies the defects marked in the PCB image to be tested through the PCB defect category features trained by the convolutional neural network, and judges the defects that are not in the category to determine whether it is a false defect or a new category. defects, and add new categories of defects to the defect picture library;

步驟S13,PCB缺陷疑似塊,對二維待測PCB圖片中每一類缺陷標記為疑似缺陷;Step S13, the PCB defect suspected block, marks each type of defect in the two-dimensional PCB image to be tested as a suspected defect;

步驟S14,PCB缺陷驗證塊,通過卷積神經網路訓練的PCB缺陷級別特徵和分類訊息,判斷疑似缺陷塊的真假性,若缺陷為假缺陷,則删除對應缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。Step S14, the PCB defect verification block, through the PCB defect level features and classification information trained by the convolutional neural network, to determine the authenticity of the suspected defect block, if the defect is a false defect, delete the corresponding defect, and analyze the false defect. The reason, if the defect is a true defect, is marked in the defect record.

在本發明的實施例中,二維PCB缺陷塊圖片庫分為兩類,一類為二維PCB缺陷塊和對應無缺陷標準PCB塊圖片組成的數據對圖片庫,另一類只有單個二維PCB缺陷塊數據圖片庫。In the embodiment of the present invention, the two-dimensional PCB defect block picture library is divided into two categories, one is a data pair picture library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures, and the other type has only a single two-dimensional PCB defect Block data picture library.

在本發明的實施例中,在上述實施例的基礎上,步驟S1還包括:In the embodiment of the present invention, on the basis of the above-mentioned embodiment, step S1 further includes:

兩類二維PCB缺陷塊圖片庫包含PCB的多種已標記且分類和分級的PCB缺陷塊圖片,PCB缺陷塊圖片包括多尺度圖片。Two types of two-dimensional PCB defect block image libraries contain a variety of marked, classified and graded PCB defect block images of PCBs, and PCB defect block images include multi-scale images.

在本發明的實施例中,步驟S2和步驟S3還包括:In the embodiment of the present invention, step S2 and step S3 further include:

對二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,用卷積神經網路(CNN)訓練,提取PCB缺陷類別特徵;For each type of PCB defect in the two-dimensional PCB defect block image library, use convolutional neural network (CNN) training to extract PCB defect category features;

對二維PCB缺陷塊圖片庫中的每一種類PCB缺陷的級別,用卷積神經網路訓練,提取PCB缺陷級別特徵。For the level of each type of PCB defect in the two-dimensional PCB defect block image library, the convolutional neural network is used to train and extract the PCB defect level features.

在本發明的實施例中,其特徵在於,步驟S4包含提取二維PCB圖片。分兩種情形,提取二維標準PCB圖片和二維待測PCB圖片以及只提取待測PCB圖片。In the embodiment of the present invention, it is characterized in that step S4 includes extracting a two-dimensional PCB picture. There are two cases, extracting two-dimensional standard PCB pictures and two-dimensional PCB pictures to be tested, and extracting only the PCB pictures to be tested.

步驟S4還包括:Step S4 also includes:

對需要比對技術的檢測方法一和方法三,需要提取二維待測PCB圖片和對應的標準PCB圖片。對非監督學習檢測(也就是非比對參考學習檢測方法)方法二,只需要提取二維待測PCB圖片。For detection method 1 and method 3 that require comparison technology, it is necessary to extract the two-dimensional PCB image to be tested and the corresponding standard PCB image. For the second method of unsupervised learning detection (that is, the non-comparison reference learning detection method), it is only necessary to extract the two-dimensional PCB image to be tested.

在本發明的實施例中,步驟S5濾波去噪塊對二維PCB圖片進行去噪處理。In the embodiment of the present invention, the filtering and denoising block in step S5 performs denoising processing on the two-dimensional PCB picture.

利用算法對標準PCB圖片和待測PCB圖片進行去噪。方法一和方法三,需要對二維標準PCB圖片和待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得標準PCB圖片、待測PCB圖片、缺陷庫中圖片的底板顔色一致;方法二只需對待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得待測PCB圖片、缺陷庫中圖片的底板顔色一致。The algorithm is used to denoise the standard PCB image and the PCB image to be tested. Method 1 and method 3 need to denoise the two-dimensional standard PCB picture and the PCB picture to be tested, remove the noise in the picture, and correct the influence of the color of the bottom plate on the picture, so that the standard PCB picture, the PCB picture to be tested, and the pictures in the defect library are The color of the bottom plate is the same; the second method only needs to denoise the PCB image to be tested, remove the noise in the image, and correct the impact of the color of the bottom plate on the image, so that the color of the PCB to be tested and the image in the defect library are the same.

對標準PCB圖片和待測PCB圖片進行配準、灰度值比對、圖像分割。Registration, gray value comparison, and image segmentation are performed on the standard PCB image and the PCB image to be tested.

對步驟S6、步驟S7和步驟S8,用於方法一和方法三。將標準PCB圖片和待測PCB圖片配準,根據處理後的標準PCB圖片對待測PCB圖片進行矯正。將標準PCB圖片和待測PCB圖片對比灰度值,計算圖片殘差得到殘差圖片;然後將標準PCB圖片、待測PCB圖片和殘差圖片進行分割得到多個圖片塊和坐標。For step S6, step S7 and step S8, method 1 and method 3 are used. The standard PCB picture and the PCB picture to be tested are registered, and the picture of the PCB to be tested is corrected according to the processed standard PCB picture. Compare the gray value of the standard PCB image and the PCB image to be tested, and calculate the residual image to obtain the residual image; then divide the standard PCB image, the PCB image to be tested, and the residual image to obtain multiple image blocks and coordinates.

對標準PCB圖片進行配準,檢測標準PCB圖片是否存在旋轉、形變、光線不均和光線反射,若存在,則利用算法進行矯正。The standard PCB picture is registered to detect whether the standard PCB picture has rotation, deformation, uneven light and light reflection. If there is, use the algorithm to correct it.

將待測PCB圖片與處理後的標準PCB圖片進行對比,判斷位置、光線和顔色是否一致,若不一致,則通過算法對待測PCB圖片進行矯正。Compare the PCB image to be tested with the processed standard PCB image to determine whether the position, light and color are consistent. If they are inconsistent, correct the PCB image to be tested through an algorithm.

圖像分割定位步驟S8用於方法二,對待測PCB圖片進行分割得到多個圖片塊和坐標。The image segmentation and positioning step S8 is used in the second method, and the PCB image to be tested is segmented to obtain a plurality of image blocks and coordinates.

在本發明的實施例中,步驟S9對二維PCB殘差圖片的patch過濾,消去因配準及其它因素產生比對誤差,删除殘差圖片中沒有殘差的圖片塊;In the embodiment of the present invention, step S9 filters the patch of the two-dimensional PCB residual picture, eliminates the comparison error caused by registration and other factors, and deletes the picture block without residual in the residual picture;

對二維PCB缺陷圖片庫和二維PCB缺陷圖片庫中的每一種類PCB缺陷,用卷積神經網路訓練,提取PCB缺陷特徵、PCB缺陷類別特徵。步驟S10和步驟S12還包括:For each type of PCB defect in the two-dimensional PCB defect image library and the two-dimensional PCB defect image library, use convolutional neural network training to extract PCB defect features and PCB defect category features. Step S10 and step S12 also include:

方法二採用只有單個二維PCB缺陷塊數據圖片庫。步驟S10通過CNN訓練的PCB缺陷特徵,步驟S8進行PCB缺陷搜索判別。然後採用單個二維PCB缺陷圖片庫CNN訓練PCB缺陷的類別特徵,步驟S12對待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將新的類別的缺陷補充至缺陷圖片庫。Method 2 uses only a single two-dimensional PCB defect block data image library. Step S10 uses the PCB defect features trained by CNN, and step S8 performs PCB defect search and discrimination. Then, a single two-dimensional PCB defect image library CNN is used to train the category features of PCB defects. Step S12 is to classify the defects marked in the PCB image to be tested, and judge the defects that are not in the category to determine whether it is a false defect or a new category of defects. , add the new category of defects to the defect image library.

在本發明的實施例中,其特徵在於,分別對二維PCB缺陷圖片庫和二維PCB缺陷圖片庫中的每一種類PCB缺陷,用卷積神經網路訓練,提取PCB缺陷特徵、PCB缺陷類別特徵。步驟S11和步驟S12還包括:In the embodiment of the present invention, it is characterized in that, for each type of PCB defect in the two-dimensional PCB defect image library and the two-dimensional PCB defect image library, convolutional neural network training is used to extract PCB defect features and PCB defects. Category features. Step S11 and step S12 also include:

方法一和方法三採用二維PCB缺陷塊和對應無缺陷標準PCB塊圖片組成的數據對圖片庫,步驟S11通過CNN訓練的PCB缺陷特徵,對步驟S9對殘差圖片作缺陷識別。然後採用二維PCB缺陷圖片庫CNN訓練PCB缺陷的類別特徵,對步驟S12對待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將新的類別的缺陷補充至缺陷圖片庫。Method 1 and method 3 use a data pair image library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures, step S11 uses the PCB defect features trained by CNN, and performs defect identification on the residual image in step S9. Then use the two-dimensional PCB defect image library CNN to train the category features of PCB defects, classify the defects marked in the PCB image to be tested in step S12, judge the defects that are not in the category, and judge whether it is a false defect or a new category of defects. , add the new category of defects to the defect image library.

在步驟S12之後方法三還包括:After step S12, the third method further includes:

利用卷積神經網路訓練的二維PCB缺陷圖片庫的PCB缺陷特徵對標記的疑似缺陷塊進行搜索匹配,删除其中的假缺陷,提高識別精度。Using the PCB defect features of the two-dimensional PCB defect image library trained by the convolutional neural network to search and match the marked suspected defect blocks, delete the false defects and improve the recognition accuracy.

在步驟S13之後,通過卷積神經網路訓練的PCB缺陷特徵,對疑似缺陷在缺陷圖片中搜索匹配。After step S13 , a defect image is searched and matched for the suspected defect through the PCB defect feature trained by the convolutional neural network.

在本發明的實施例中,對PCB缺陷驗證,通過步驟S3卷積神經網路訓練的PCB缺陷級別特徵訊息,判斷PCB缺陷的真假性,若缺陷為假缺陷,則删除該假缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。In the embodiment of the present invention, for PCB defect verification, the PCB defect level feature information trained by the convolutional neural network in step S3 is used to judge the authenticity of the PCB defect, if the defect is a false defect, the false defect is deleted, and Analyze the cause of the false defect, and mark it in the defect record if the defect is a true defect.

在本發明的實施例中,其特徵在於,在搜索和判斷缺陷過程中,通過多次識別迭代,對缺陷進行逐次排除。In the embodiment of the present invention, it is characterized in that, in the process of searching and judging defects, the defects are eliminated one by one through multiple identification iterations.

綜上,本發明實施例提出了三種缺陷檢測的方法,下面通過圖式對三種檢測方法進行詳細描述。To sum up, the embodiment of the present invention proposes three defect detection methods, and the three detection methods are described in detail below with reference to the drawings.

方法一:method one:

基於深度學習檢測,如圖2所示,包括以下步驟:Detection based on deep learning, as shown in Figure 2, includes the following steps:

1-1)建立二維PCB缺陷圖片庫的步驟S1。該缺陷庫包含了PCB各種已標記且分類和分級的缺陷圖片。缺陷圖片可以是多尺度圖片。缺陷圖片以標準圖片(正例)和缺陷圖片(反例)構成的圖片數據對。1-1) Step S1 of establishing a two-dimensional PCB defect image library. The defect library contains various marked, classified and graded defect pictures of PCBs. Defect pictures can be multi-scale pictures. The defective picture is a picture data pair composed of a standard picture (positive example) and a defective picture (negative example).

1-2)CNN缺陷特徵訓練的步驟S2與步驟S1連接。對每一種類PCB缺陷數據對,用CNN訓練,提取PCB缺陷特徵和缺陷類別特徵。1-2) Step S2 of CNN defect feature training is connected with step S1. For each type of PCB defect data pair, use CNN training to extract PCB defect features and defect category features.

1-3)CNN缺陷級別訓練的步驟S3與步驟S1連接。對每個級別PCB缺陷數據對,利用CNN訓練,提取PCB缺陷級別特徵。1-3) Step S3 of CNN defect level training is connected with step S1. For each level of PCB defect data pair, use CNN training to extract PCB defect level features.

1-4)讀取標準PCB圖片的步驟S4,分別讀取標準PCB圖像和待測PCB圖像。1-4) Step S4 of reading the standard PCB picture, respectively reading the standard PCB image and the PCB image to be tested.

1-5)濾波去噪的步驟S5與步驟S4連接,分別對標準PCB圖像和待測PCB濾波去噪。圖片中不可避免有多種噪聲,以及底板顔色,這對缺陷識別造成很大影響。需要採用多種算法和技術過濾噪聲。1-5) The step S5 of filtering and denoising is connected with step S4, and the standard PCB image and the PCB to be tested are filtered and denoised respectively. There are inevitably many kinds of noise in the picture, as well as the color of the bottom plate, which has a great impact on defect identification. Various algorithms and techniques are required to filter the noise.

1-6)圖像配準的步驟S6與步驟S5連接,分別對標準PCB和待測PCB圖像配準。1-6) Step S6 of image registration is connected with step S5, and the images of the standard PCB and the PCB to be tested are registered respectively.

1-6-1)檢測標準PCB圖片是否端正。是否有旋轉、形變等改變。如果發生改變,需要矯正;檢測標準PCB圖片光線是否異常,是否有光線不均、反射等情形。如果出現光線異常,需要算法矯正。1-6-1) Check whether the standard PCB picture is correct. Whether there are changes such as rotation, deformation, etc. If there is a change, it needs to be corrected; check whether the light of the standard PCB picture is abnormal, whether there is uneven light, reflection, etc. If there is an abnormal light, algorithm correction is required.

1-6-2)除了與濾波去噪的步驟S5連接外,待測PCB圖片還要與配準的標準PCB圖片連接。檢測待測PCB圖片是否端正、是否與標準PCB位置一致,檢查與標準圖片的位置、光線、顔色是否一致。如果不一致,利用算法矯正。1-6-2) In addition to the connection with the step S5 of filtering and denoising, the PCB image to be tested should also be connected with the registered standard PCB image. Check whether the PCB picture to be tested is correct and consistent with the standard PCB position, and check whether the position, light and color of the standard picture are consistent. If not, use algorithm to correct.

1-7)比對圖像灰度值的步驟S7與圖像配準的步驟S6連接,將待測PCB圖片與標準PCB圖片比對圖片灰度值,計算圖片的殘差。1-7) The step S7 of comparing the gray value of the image is connected with the step S6 of image registration, and the gray value of the image is compared between the PCB image to be tested and the standard PCB image, and the residual of the image is calculated.

1-8)圖像分割的步驟S8與步驟S7連接,對PCB的標準圖片、待測圖片、殘差圖片進行適當的相同分割,分割成小塊(patch),為缺陷塊定位和標記準備。1-8) The step S8 of image segmentation is connected with step S7, and the standard image, the image to be tested, and the residual image of the PCB are appropriately and identically segmented, and divided into small patches (patches) to prepare for the location and marking of defective blocks.

1-9)殘差濾波的步驟S9與圖像分割的步驟S8連接,過濾殘差中因配準誤差和干擾造成的比對殘差。删除殘差圖片中沒有殘差的patch,待檢測和分析有殘差的patch。1-9) The step S9 of residual filtering is connected with the step S8 of image segmentation, and the comparison residual caused by the registration error and interference in the residual is filtered. Delete the patch without residual in the residual image, and the patch with residual to be detected and analyzed.

1-10)PCB缺陷判別的步驟S11與殘差濾波的步驟S9和PCB缺陷特徵訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷特徵,識別殘差patch。識別哪些patch是待測PCB的缺陷,標記出疑似缺陷patch。該步驟可以多次識別迭代,對疑似缺陷patch進行逐步剔除。1-10) Step S11 of PCB defect identification is connected with step S9 of residual filtering and step S2 of PCB defect feature training. Use the PCB defect features trained by the CNN in step S2 to identify residual patches. Identify which patches are defects of the PCB under test, and mark the suspected defect patches. In this step, multiple identification iterations can be performed to gradually eliminate suspected defect patches.

1-11)PCB缺陷分類的步驟S12與缺陷判別的步驟S11和缺陷訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷類別特徵,對缺陷判別的步驟S11中標記的缺陷patch進行分類,判斷標記的缺陷屬於哪一種缺陷。1-11) Step S12 of PCB defect classification is connected to step S11 of defect identification and step S2 of defect training. Using the PCB defect category features trained by the CNN in step S2, classify the defect patches marked in step S11 of defect discrimination, and determine which defect the marked defect belongs to.

1-12)PCB缺陷驗證S14與缺陷分類S12和缺陷級別特徵的步驟S3連接。利用的步驟S3中CNN訓練的PCB缺陷級別特徵,檢查由步驟S12得到的疑似PCB缺陷是否是真缺陷,删除假缺陷,提高檢測精度。如果是真缺陷,進行標記。同時對那些不在類別中的缺陷進行甄別,當檢測的真缺陷又是新的類型的缺陷,則將該新的缺陷標記,並添加到缺陷庫中。如果是假缺陷,分析產生假缺陷的原因,為後續檢測提供參考。1-12) PCB defect verification S14 is connected with step S3 of defect classification S12 and defect level characterization. Using the PCB defect level features trained by the CNN in step S3, check whether the suspected PCB defects obtained in step S12 are true defects, delete false defects, and improve detection accuracy. If it is a true defect, mark it. At the same time, the defects that are not in the category are screened. When the detected real defect is a new type of defect, the new defect is marked and added to the defect library. If it is a false defect, analyze the cause of the false defect and provide a reference for subsequent inspection.

方法二:Method Two:

第二種缺陷檢測方法相比第一種檢測方法,為非參考學習檢測,不需要和標準的PCB作參考和對比。如圖3所示,具體步驟為:Compared with the first detection method, the second defect detection method is non-reference learning detection and does not need to be referenced and compared with the standard PCB. As shown in Figure 3, the specific steps are:

2-1)建立PCB缺陷圖片庫的步驟S1。缺陷庫包含了PCB各種已標記且分類和分級的缺陷圖片。缺陷圖片可以是多尺度圖片。該缺陷庫不同於第一種檢測方法中圖片庫,不是圖片數據對,只是單個缺陷圖片。2-1) Step S1 of establishing a PCB defect picture library. The defect library contains a variety of marked, classified and graded defect pictures of the PCB. Defect pictures can be multi-scale pictures. This defect library is different from the picture library in the first detection method, it is not a picture data pair, but a single defect picture.

2-2)CNN缺陷特徵訓練步驟S2與步驟S1連接。對每一種類PCB缺陷,用CNN訓練,提取PCB缺陷特徵和缺陷類別特徵。2-2) CNN defect feature training step S2 is connected with step S1. For each type of PCB defect, use CNN training to extract PCB defect features and defect category features.

2-3)CNN缺陷級別訓練的步驟S3與步驟S1連接。對每個級別PCB缺陷,利用CNN訓練,提取PCB缺陷級別特徵。2-3) Step S3 of CNN defect level training is connected with step S1. For each level of PCB defect, use CNN training to extract PCB defect level features.

2-4)讀取標準PCB圖片的步驟S4,讀取待測PCB圖像。2-4) Step S4 of reading the standard PCB picture, reading the PCB image to be tested.

2-5)濾波去噪的步驟S5與步驟S4連接,對待測PCB濾波去噪。圖片中不可避免有多種噪聲,以及底板顔色,這對缺陷識別造成很大影響。需要採用多種算法和技術過濾噪聲。2-5) The step S5 of filtering and denoising is connected with step S4, and the PCB to be tested is filtered and denoised. There are inevitably many kinds of noise in the picture, as well as the color of the bottom plate, which has a great impact on defect identification. Various algorithms and techniques are required to filter the noise.

2-6)圖像分割的步驟S8與濾波去噪的步驟S5連接,對PCB的待測圖片進行分割,分割成小塊(patch),為缺陷塊定位和標記準備。2-6) The step S8 of image segmentation is connected with the step S5 of filtering and denoising, and the picture to be tested of the PCB is segmented and divided into patches, which are prepared for the location and marking of defective blocks.

2-7)缺陷匹配搜索的步驟S10與步驟S8和缺陷特徵訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷特徵,搜索缺陷patch。識別哪些patch是待測PCB的缺陷,標記出疑似缺陷patch。該步驟可以多次識別迭代,對疑似缺陷patch進行逐步剔除。2-7) Step S10 of defect matching search is connected with step S8 and step S2 of defect feature training. Use the PCB defect features trained by the CNN in step S2 to search for defect patches. Identify which patches are defects of the PCB under test, and mark the suspected defect patches. In this step, multiple identification iterations can be performed to gradually eliminate suspected defect patches.

2-8)PCB缺陷分類的步驟S12與缺陷匹配搜索的步驟S10和缺陷訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷類別特徵,對缺陷搜索步驟S10中標記的缺陷patch進行分類,判斷標記的缺陷屬於哪一種缺陷,同時對那些不在類別中的缺陷進行甄別,判斷是否是假缺陷還是新的類型的缺陷;如果是新類型的缺陷,將該缺陷擴充到缺陷庫中。2-8) Step S12 of PCB defect classification is connected with step S10 of defect matching search and step S2 of defect training. Using the PCB defect category features trained by the CNN in step S2, classify the defect patches marked in the defect search step S10, determine which defect the marked defect belongs to, and at the same time screen those defects that are not in the category to determine whether they are false defects. Or a new type of defect; if it is a new type of defect, expand the defect into the defect library.

2-9)PCB缺陷驗證的步驟S14與缺陷分類的步驟S12和缺陷級別特徵的步驟S3連接。利用步驟S3中CNN訓練的PCB缺陷級別特徵,檢查由步驟S12得到的疑似PCB缺陷是否是真缺陷,删除假缺陷,提高檢測精度。如果是真缺陷,進行標記。當檢測的真缺陷又是新的類型的缺陷,則將該新的缺陷標記,並添加到缺陷庫中。如果是假缺陷,分析產生假缺陷的原因,為後續檢測提供參考。2-9) The step S14 of PCB defect verification is connected with the step S12 of defect classification and the step S3 of defect level characterization. Using the PCB defect level feature trained by the CNN in step S3, check whether the suspected PCB defect obtained in step S12 is a real defect, delete the false defect, and improve the detection accuracy. If it is a true defect, mark it. When the detected true defect is a new type of defect, the new defect is marked and added to the defect library. If it is a false defect, analyze the cause of the false defect and provide a reference for subsequent inspection.

方法三:Method three:

第三種檢測方法是對上面介紹的兩種檢測方法的結合,稱為混合檢測方法,可以更精確的識別PCB中的缺陷,如圖4所示,具體步驟為:The third detection method is a combination of the two detection methods described above, called a hybrid detection method, which can more accurately identify defects in the PCB, as shown in Figure 4. The specific steps are:

3-1)建立二維PCB缺陷圖片庫的步驟S1。該缺陷庫包含了PCB各種已標記且分類和分級的缺陷圖片。缺陷圖片可以是多尺度圖片。3-1) Step S1 of establishing a two-dimensional PCB defect image library. The defect library contains various marked, classified and graded defect pictures of PCBs. Defect pictures can be multi-scale pictures.

PCB缺陷庫分為兩類缺陷圖片庫。一類是缺陷圖片以標準圖片(正例)和缺陷圖片(反例)構成的圖片數據對,第二類只是缺陷圖片構成的圖片庫。The PCB defect library is divided into two types of defect image libraries. One is a picture data pair composed of standard pictures (positive examples) and defective pictures (negative examples), and the second category is only a picture library composed of defective pictures.

3-2)CNN缺陷特徵訓練的步驟S2與步驟S1連接。對第一類缺陷庫中每一種類PCB缺陷數據對,用CNN訓練,提取PCB缺陷特徵和缺陷類別特徵。對第二類缺陷庫中每一種類PCB缺陷,用CNN訓練,提取PCB缺陷特徵和缺陷類別特徵。3-2) Step S2 of CNN defect feature training is connected with step S1. For each type of PCB defect data pair in the first type of defect library, use CNN to train to extract PCB defect features and defect category features. For each type of PCB defect in the second type of defect library, use CNN to train to extract PCB defect features and defect category features.

3-3)CNN缺陷級別訓練的步驟S3與步驟S1連接。對第一類缺陷庫中每個級別PCB缺陷數據對,利用CNN訓練,提取PCB缺陷級別特徵。對第二類缺陷庫中每個級別PCB缺陷,利用CNN訓練,提取PCB缺陷級別特徵。3-3) Step S3 of CNN defect level training is connected with step S1. For each level of PCB defect data pair in the first type of defect library, use CNN training to extract PCB defect level features. For each level of PCB defect in the second type of defect library, use CNN training to extract PCB defect level features.

3-4)讀取標準PCB圖片的步驟S4,分別讀取標準PCB圖像和待測PCB圖像。3-4) Step S4 of reading the standard PCB picture, respectively reading the standard PCB image and the PCB image to be tested.

3-5)濾波去噪的步驟S5與步驟S4連接,分別對標準PCB圖像和待測PCB濾波去噪。圖片中不可避免有多種噪聲,以及底板顔色,這對缺陷識別造成很大影響。需要採用多種算法和技術過濾噪聲。3-5) The step S5 of filtering and denoising is connected with step S4, and the standard PCB image and the PCB to be tested are filtered and denoised respectively. There are inevitably many kinds of noise in the picture, as well as the color of the bottom plate, which has a great impact on defect identification. Various algorithms and techniques are required to filter the noise.

3-6)圖像配準的步驟S6與步驟S5連接,分別對標準PCB和待測PCB圖像配準。3-6) Step S6 of image registration is connected with step S5, and the images of the standard PCB and the PCB to be tested are registered respectively.

3-6-1)檢測標準PCB圖片是否端正。是否有旋轉、形變等改變。如果發生改變,需要矯正;檢測標準PCB圖片光線是否異常,是否有光線不均、反射等情形。如果出現光線異常,需要算法矯正。3-6-1) Check whether the standard PCB picture is correct. Whether there are changes such as rotation, deformation, etc. If there is a change, it needs to be corrected; check whether the light of the standard PCB picture is abnormal, whether there is uneven light, reflection, etc. If there is an abnormal light, algorithm correction is required.

3-6-2)除了與濾波去噪步驟S5連接外,待測PCB圖像還要與配準的標準PCB圖像連接。檢測待測PCB圖片是否端正、是否與標準PCB位置一致,檢查與標準圖片的位置、光線、顔色是否一致。如果不一致,利用算法矯正。3-6-2) In addition to the connection with the filtering and denoising step S5, the PCB image to be tested should also be connected with the registered standard PCB image. Check whether the PCB picture to be tested is correct and consistent with the standard PCB position, and check whether the position, light and color of the standard picture are consistent. If not, use algorithm to correct.

3-7)比對圖像灰度值的步驟S7與圖像配準的步驟S6連接,將待測PCB圖片與標準PCB圖片比對圖片灰度值,計算圖片的殘差。3-7) The step S7 of comparing the gray value of the image is connected with the step S6 of image registration, and the gray value of the image is compared between the PCB picture to be tested and the standard PCB picture, and the residual of the picture is calculated.

3-8)圖像分割的步驟S8與步驟S7連接,對PCB的標準圖片、待測圖片、殘差圖片進行適當的相同分割,分割成小塊(patch),為缺陷塊定位和標記準備。3-8) The step S8 of image segmentation is connected with step S7, and the standard image, the image to be tested, and the residual image of the PCB are appropriately and identically segmented, and divided into small patches (patches) to prepare for the location and marking of defective blocks.

3-9)殘差濾波的步驟S9與圖像分割的步驟S8連接,過濾殘差中因配準誤差和干擾造成的比對殘差。删除殘差圖片中沒有殘差的patch,待檢測和分析有殘差的patch。3-9) The step S9 of residual filtering is connected with the step S8 of image segmentation, and the comparison residual caused by the registration error and interference in the residual is filtered. Delete the patch without residual in the residual image, and the patch with residual to be detected and analyzed.

3-10)PCB缺陷判別的步驟S11與殘差濾波的步驟S9和PCB缺陷特徵訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷特徵,識別殘差patch。識別哪些patch是待測PCB的缺陷,標記出疑似缺陷patch。該步驟可以多次識別迭代,對疑似缺陷patch進行逐步剔除。3-10) Step S11 of PCB defect identification is connected with step S9 of residual filtering and step S2 of PCB defect feature training. Use the PCB defect features trained by the CNN in step S2 to identify residual patches. Identify which patches are defects of the PCB under test, and mark the suspected defect patches. In this step, multiple identification iterations can be performed to gradually eliminate suspected defect patches.

3-11)PCB缺陷分類的步驟S12與缺陷判別的步驟S11和缺陷訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷類別特徵,對缺陷判別的步驟S11中標記的缺陷patch進行分類。3-11) Step S12 of PCB defect classification is connected with step S11 of defect identification and step S2 of defect training. The defect patch marked in step S11 of defect discrimination is classified by using the PCB defect category feature trained by CNN in step S2.

3-12)疑似缺陷的步驟S13與步驟S12連接,標記待測PCB疑似缺陷,判斷標記的疑似缺陷屬於哪一種缺陷。3-12) The step S13 of the suspected defect is connected with the step S12 to mark the suspected defect of the PCB to be tested, and determine which kind of defect the marked suspected defect belongs to.

3-13)缺陷搜索匹配的步驟S10與PCB疑似缺陷的步驟S13和CNN缺陷特徵訓練的步驟S2連接。對PCB疑似缺陷的步驟S13,利用步驟S2中第二類缺陷庫CNN訓練的PCB缺陷特徵和類別特徵搜索匹配。過濾疑似缺陷中的假缺陷。3-13) The step S10 of defect search and matching is connected with the step S13 of the suspected PCB defect and the step S2 of the CNN defect feature training. For step S13 of suspected PCB defects, use the PCB defect features and category features trained by the second-type defect library CNN in step S2 to search for matching. Filter false defects from suspected defects.

3-14)PCB缺陷驗證的步驟S14與缺陷搜索匹配的步驟S10和缺陷級別特徵訓練的步驟S3連接。對步驟S10篩選的缺陷進一步過濾。利用步驟S3中第二類缺陷庫CNN訓練的PCB缺陷級別特徵,檢查由步驟S10得到的疑似PCB缺陷是否是真缺陷,删除假缺陷,提高檢測精度。如果是真缺陷,進行標記。同時對那些不在類別中的缺陷進行甄別,當檢測的真缺陷又是新的類型的缺陷,則將該新的缺陷標記,並添加到缺陷庫中。如果是假缺陷,分析產生假缺陷的原因,為後續檢測提供參考。3-14) Step S14 of PCB defect verification is connected with step S10 of defect search and matching and step S3 of defect level feature training. The defects screened in step S10 are further filtered. Using the PCB defect level features trained by the second type of defect library CNN in step S3, check whether the suspected PCB defect obtained in step S10 is a real defect, delete false defects, and improve detection accuracy. If it is a true defect, mark it. At the same time, the defects that are not in the category are screened. When the detected real defect is a new type of defect, the new defect is marked and added to the defect library. If it is a false defect, analyze the cause of the false defect and provide a reference for subsequent inspection.

根據本發明實施例提出的基於深度學習的二維PCB外觀缺陷實時自動檢測方法,利用PCB圖像和標準PCB圖像以及卷積神經網路對PCB進行缺陷檢測,通過PCB檢測缺陷的工具,在裝配工藝過程的早期查找和消除錯誤,可以避免將壞板送到後續的裝配階段,同時會減少修理成本將避免報廢不可修理的電路板。利用卷積神經網路具有速度快、精度高、泛化能力强,結構清晰等優點。According to the deep learning-based real-time automatic detection method for two-dimensional PCB appearance defects proposed in the embodiment of the present invention, PCB images, standard PCB images and convolutional neural networks are used to detect defects on PCBs. Finding and eliminating errors early in the assembly process can avoid sending bad boards to subsequent assembly stages, while reducing repair costs will avoid scrapping unrepairable boards. The use of convolutional neural networks has the advantages of high speed, high accuracy, strong generalization ability, and clear structure.

此外,術語“第一”、“第二”僅用於描述目的,而不能理解為指示或暗示相對重要性或者隱含指明所指示的技術特徵的數量。由此,限定有“第一”、“第二”的特徵可以明示或者隱含地包括至少一個該特徵。在本發明的描述中,“多個”的含義是至少兩個,例如兩個,三個等,除非另有明確具體的限定。In addition, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implying the number of indicated technical features. Thus, a feature delimited with "first", "second" may expressly or implicitly include at least one of that feature. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise expressly and specifically defined.

在本說明書的描述中,參考術語“一個實施例”、“一些實施例”、“示例”、“具體示例”、或“一些示例”等的描述意指結合該實施例或示例描述的具體特徵、結構、材料或者特點包含於本發明的至少一個實施例或示例中。在本說明書中,對上述術語的示意性表述不必須針對的是相同的實施例或示例。而且,描述的具體特徵、結構、材料或者特點可以在任一個或多個實施例或示例中以合適的方式結合。此外,在不相互矛盾的情况下,本領域的技術人員可以將本說明書中描述的不同實施例或示例以及不同實施例或示例的特徵進行結合和組合。In the description of this specification, description with reference to the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples", etc., mean specific features described in connection with the embodiment or example , structure, material or feature is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and combine the different embodiments or examples described in this specification, as well as the features of the different embodiments or examples, without conflicting each other.

儘管上面已經示出和描述了本發明的實施例,可以理解的是,上述實施例是示例性的,不能理解為對本發明的限制,本領域的普通技術人員在本發明的範圍內可以對上述實施例進行變化、修改、替換和變型。Although the embodiments of the present invention have been shown and described above, it should be understood that the above-mentioned embodiments are exemplary and should not be construed as limiting the present invention. Embodiments are subject to variations, modifications, substitutions and variations.

S1~S14:步驟S1~S14: Steps

本發明上述的和/或附加的方面和優點從下面結合附圖對實施例的描述中將變得明顯和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of embodiments taken in conjunction with the accompanying drawings, wherein:

圖1為根據本發明一個實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法流程框圖。FIG. 1 is a flowchart of a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to an embodiment of the present invention.

圖2為根據本發明一個具體實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法流程框圖。FIG. 2 is a flowchart of a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to a specific embodiment of the present invention.

圖3為根據本發明另一個具體實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法流程框圖。FIG. 3 is a flowchart of a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to another specific embodiment of the present invention.

圖4為根據本發明再一個具體實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法流程框圖。FIG. 4 is a flow chart of a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning according to yet another specific embodiment of the present invention.

S1~S14:步驟S1~S14: Steps

Claims (10)

一種基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,所述方法包括以下步驟: 步驟S1,通過PCB缺陷塊圖片庫建立二維PCB缺陷塊圖片庫,所述二維PCB缺陷塊圖片庫包括二維PCB缺陷數據對圖片庫和二維PCB缺陷單數據圖片庫; 其中,所述二維PCB缺陷塊圖片庫分為兩類,一類為二維PCB缺陷塊和對應無缺陷標準PCB塊圖片組成的數據對圖片庫,另一類為只有單個二維PCB缺陷塊的數據圖片庫; 所述步驟S1還包括: 建立所述二維PCB缺陷塊圖片庫,兩類所述二維PCB缺陷塊圖片庫包含PCB的多種已標記且分類和分級的PCB缺陷塊圖片,所述PCB缺陷塊圖片包括多尺度圖片; 步驟S2,通過CNN缺陷特徵訓練塊,對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,利用卷積神經網路進行訓練,提取PCB缺陷類別特徵; 步驟S3,通過CNN缺陷級別特徵訓練塊,對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷的級別,利用所述卷積神經網路進行訓練,提取PCB缺陷級別特徵; 步驟S4,通過PCB圖片提取塊提取二維PCB圖片,所述二維PCB圖片包括二維標準PCB圖片和二維待測PCB圖片; 步驟S5,通過濾波去噪塊,對所述二維PCB圖片進行去噪處理; 步驟S6,通過圖像配準塊,對所述二維待測PCB圖片與所述二維標準PCB圖片配準; 步驟S7,通過圖像灰度值比對塊,對所述二維標準PCB圖片和所述二維待測PCB圖片灰度值進行比對分析,得到二維PCB殘差圖片; 步驟S8,通過圖像分割定位塊,對所述二維標準PCB圖片、所述二維待測PCB圖片和所述二維PCB殘差圖片進行分割定位,得到多個圖片的圖片塊和對應的坐標; 步驟S9,通過殘差濾波塊,對所述二維PCB殘差圖片的圖片塊過濾,消去因配準及其它因素產生的比對誤差; 步驟S10,缺陷搜索匹配塊通過所述卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中搜索缺陷塊,並進行缺陷塊匹配; 步驟S11,CNN缺陷識別塊通過所述卷積神經網路對所述二維待測PCB圖片中的缺陷進行識別; 步驟S12,PCB缺陷分類塊通過所述卷積神經網路訓練的PCB缺陷類別特徵,對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至所述二維PCB缺陷塊圖片庫; 步驟S13,通過PCB缺陷疑似塊,對所述二維待測PCB圖片中每一類缺陷標記為疑似缺陷;以及 步驟S14,PCB缺陷驗證塊通過所述卷積神經網路訓練的PCB缺陷級別特徵和分類訊息,判斷疑似缺陷塊的真假性,若缺陷為假缺陷,則删除對應缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning, the method comprises the following steps: Step S1, establishing a two-dimensional PCB defect block image library through a PCB defect block image library, where the two-dimensional PCB defect block image library includes a two-dimensional PCB defect data pair image library and a two-dimensional PCB defect sheet data image library; Among them, the two-dimensional PCB defect block picture library is divided into two categories, one is a data pair picture library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures, and the other is only a single two-dimensional PCB defect block data. image library; The step S1 also includes: establishing the two-dimensional PCB defect block picture library, the two types of the two-dimensional PCB defect block picture library include a variety of marked, classified and graded PCB defect block pictures of the PCB, and the PCB defect block pictures include multi-scale pictures; Step S2, through the CNN defect feature training block, for each type of PCB defect in the two-dimensional PCB defect block image library, use a convolutional neural network for training to extract PCB defect category features; Step S3, through the CNN defect level feature training block, the level of each type of PCB defect in the two-dimensional PCB defect block picture library is trained by using the convolutional neural network, and the PCB defect level feature is extracted; Step S4, extracting a two-dimensional PCB picture through a PCB picture extraction block, where the two-dimensional PCB picture includes a two-dimensional standard PCB picture and a two-dimensional PCB picture to be tested; Step S5, performing denoising processing on the two-dimensional PCB picture by filtering the denoising block; Step S6, through the image registration block, the two-dimensional PCB picture to be tested and the two-dimensional standard PCB picture are registered; Step S7, through the image gray value comparison block, compare and analyze the gray value of the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested to obtain a two-dimensional PCB residual picture; Step S8, through the image segmentation and positioning block, the two-dimensional standard PCB picture, the two-dimensional PCB to be tested picture and the two-dimensional PCB residual picture are divided and positioned to obtain the picture blocks of multiple pictures and corresponding coordinate; Step S9, filter the picture block of the two-dimensional PCB residual picture through the residual filter block to eliminate the comparison error caused by registration and other factors; Step S10, the defect search matching block searches for defect blocks in a plurality of picture blocks through the PCB defect feature trained by the convolutional neural network, and performs defect block matching; Step S11, the CNN defect identification block identifies the defects in the two-dimensional PCB picture to be tested through the convolutional neural network; Step S12, the PCB defect classification block classifies the defects marked in the two-dimensional PCB image to be tested by using the PCB defect category features trained by the convolutional neural network, and judges the defects that are not in the category to determine whether they are If the false defect is still a defect of a new category, the defect of the new category is supplemented to the two-dimensional PCB defect block picture library; Step S13, through the PCB defect suspected block, mark each type of defect in the two-dimensional PCB image to be tested as a suspected defect; and Step S14, the PCB defect verification block judges the authenticity of the suspected defect block through the PCB defect level features and classification information trained by the convolutional neural network, if the defect is a false defect, delete the corresponding defect, and analyze and generate a false defect If the defect is a true defect, it will be marked in the defect record. 如請求項1所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,在所述步驟S4中,通過所述PCB圖片提取塊提取的所述二維PCB圖片包括兩種:一種為提取所述二維標準PCB圖片和所述二維待測PCB圖片;另一種為只提取所述二維待測PCB圖片; 所述步驟S4還包括: 在比對標準PCB的檢測方法和PCB混合檢測方法中,提取所述二維待測PCB圖片和對應的二維標準PCB圖片;以及 在無標準板比對PCB檢測方法中,只提取所述二維待測PCB圖片。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 1, wherein, in the step S4, the two-dimensional PCB pictures extracted by the PCB picture extraction block include two types: One is to extract the two-dimensional standard PCB picture and the two-dimensional to-be-tested PCB picture; the other is to extract only the two-dimensional to-be-tested PCB picture; The step S4 also includes: In the detection method of comparing the standard PCB and the PCB hybrid detection method, extract the two-dimensional PCB image to be tested and the corresponding two-dimensional standard PCB image; and In the non-standard board comparison PCB detection method, only the two-dimensional PCB picture to be tested is extracted. 如請求項2所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,所述步驟S5中,通過濾波去噪塊,對所述二維PCB圖片進行去噪處理,包括: 利用算法對所述二維標準PCB圖片和所述二維待測PCB圖片進行去噪,在所述比對標準PCB的檢測方法和PCB混合檢測方法中,對所述二維標準PCB圖片和所述二維待測PCB圖片去噪、去除圖片中的噪聲、修正底板顔色對圖片的影響,使得所述二維標準PCB圖片、所述二維待測PCB圖片、缺陷庫中圖片的底板顔色一致; 在所述無標準板比對PCB檢測方法中,只對所述二維待測PCB圖片去噪、去除圖片中的噪聲、修正底板顔色對圖片的影響,使得所述二維待測PCB圖片、缺陷庫中圖片的底板顔色一致。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 2, wherein, in the step S5, denoising is performed on the two-dimensional PCB picture by filtering and denoising blocks, including: The two-dimensional standard PCB picture and the two-dimensional PCB to be tested picture are denoised by using an algorithm. In the detection method for comparing the standard PCB and the PCB hybrid detection method, the two-dimensional standard PCB picture and the all The two-dimensional PCB image to be tested is denoised, the noise in the image is removed, and the influence of the color of the bottom plate on the image is corrected, so that the color of the bottom plate of the two-dimensional standard PCB image, the two-dimensional PCB image to be tested, and the image in the defect library are consistent ; In the non-standard board comparison PCB detection method, only the two-dimensional PCB image to be tested is denoised, the noise in the image is removed, and the influence of the color of the bottom plate on the image is corrected, so that the two-dimensional PCB image to be tested, The color of the bottom plate of the pictures in the defect library is the same. 如請求項3所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,對所述二維標準PCB圖片和所述二維待測PCB圖片進行配準、灰度值比對、圖像分割,所述方法進一步包括以下步驟: 在所述比對標準PCB的檢測方法和PCB混合檢測方法中,所述步驟S6、所述步驟S7和所述步驟S8,包括: 在所述比對標準PCB的檢測方法和PCB混合檢測方法中,將所述二維標準PCB圖片和所述二維待測PCB圖片配準,根據去噪處理後的所述二維標準PCB圖片對所述二維待測PCB圖片進行矯正,將所述二維標準PCB圖片和所述二維待測PCB圖片對比灰度值,計算圖片殘差得到二維PCB殘差圖片; 將所述二維標準PCB圖片、所述二維待測PCB圖片和所述二維PCB殘差圖片進行分割得到多個圖片塊和對應的坐標; 對所述二維標準PCB圖片進行配準,檢測所述二維標準PCB圖片是否存在旋轉、形變、光線不均和光線反射,若存在,則利用算法進行矯正; 將所述二維待測PCB圖片與處理後的二維標準PCB圖片進行對比,判斷位置、光線和顔色是否一致,若不一致,則通過算法對所述二維待測PCB圖片進行矯正。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 3, wherein the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested are registered and compared with gray values , image segmentation, the method further comprises the following steps: In the detection method for comparing standard PCBs and the PCB hybrid detection method, the step S6, the step S7 and the step S8 include: In the detection method for comparing standard PCBs and the PCB hybrid detection method, the two-dimensional standard PCB picture and the two-dimensional PCB to be tested picture are registered, and the two-dimensional standard PCB picture after denoising is processed. Correcting the two-dimensional PCB picture to be measured, comparing the gray value of the two-dimensional standard PCB picture and the two-dimensional PCB to be measured picture, and calculating the residuals of the pictures to obtain a two-dimensional PCB residual picture; The two-dimensional standard PCB picture, the two-dimensional PCB to be tested picture and the two-dimensional PCB residual picture are divided to obtain a plurality of picture blocks and corresponding coordinates; The two-dimensional standard PCB picture is registered to detect whether the two-dimensional standard PCB picture has rotation, deformation, uneven light and light reflection, and if there is, use an algorithm to correct it; The two-dimensional PCB image to be tested is compared with the processed two-dimensional standard PCB image to determine whether the position, light and color are consistent. If they are inconsistent, the two-dimensional PCB image to be tested is corrected by an algorithm. 如請求項3所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,在非比對參考的檢測方法中,所述步驟S8進一步包括:對所述二維待測PCB圖片進行分割得到多個圖片塊和對應的坐標。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 3, wherein, in the non-comparison reference detection method, the step S8 further comprises: analyzing the two-dimensional PCB picture to be tested Perform segmentation to obtain multiple image blocks and corresponding coordinates. 如請求項5所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,所述步驟S9中,對所述二維PCB殘差圖片的圖片塊過濾,消去比對誤差,删除所述二維PCB殘差圖片中沒有殘差的圖片塊; 所述步驟S10和所述步驟S12進一步包括: 在無標準板比對PCB的檢測方法中,採用所述二維PCB缺陷單數據圖片庫; 在無標準板比對PCB的檢測方法和PCB混合檢測方法中,對所述二維PCB缺陷圖片庫和所述二維PCB缺陷圖片庫中的每一種類PCB缺陷,用所述卷積神經網路訓練,提取PCB缺陷特徵和PCB缺陷類別特徵; 所述步驟S10通過所述卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中進行PCB缺陷搜索判別,採用單個二維PCB缺陷圖片庫卷積神經網路訓練PCB缺陷的類別特徵,所述步驟S12對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 5, wherein, in the step S9, the picture blocks of the two-dimensional PCB residual pictures are filtered, the comparison errors are eliminated, and the deletion There is no residual picture block in the two-dimensional PCB residual picture; The step S10 and the step S12 further include: In the detection method for comparing PCBs without standard boards, the two-dimensional PCB defect single data picture library is used; In the non-standard board comparison PCB detection method and the PCB hybrid detection method, the convolutional neural network is used for each type of PCB defect in the two-dimensional PCB defect image library and the two-dimensional PCB defect image library. Road training, extracting PCB defect features and PCB defect category features; The step S10 uses the PCB defect features trained by the convolutional neural network to search and discriminate the PCB defects in a plurality of picture blocks, and use a single two-dimensional PCB defect picture library convolutional neural network to train the category features of the PCB defects, The step S12 classifies the defects marked in the two-dimensional PCB image to be tested, judges the defects that are not in the category, determines whether it is a false defect or a defect of a new category, and supplements the defect of the new category to the Defect Gallery. 如請求項5或6所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中, 在所述比對標準PCB的檢測方法和PCB混合檢測方法中,分別對所述二維PCB缺陷圖片庫和所述二維PCB缺陷圖片庫中的每一種類PCB缺陷,用所述卷積神經網路訓練,提取PCB缺陷特徵和PCB缺陷類別特徵; 所述步驟S11和所述步驟S12還包括: 採用二維PCB缺陷塊和對應無缺陷的標準PCB塊圖片組成的二維PCB缺陷數據對圖片庫,所述步驟S11通過所述卷積神經網路訓練的PCB缺陷特徵,對所述步驟S9對殘差圖片作缺陷識別;採用二維PCB缺陷圖片庫卷積神經網路訓練PCB缺陷的類別特徵,對所述步驟S12對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 5 or 6, wherein, In the detection method for comparing standard PCBs and the PCB hybrid detection method, the convolutional neural Network training to extract PCB defect features and PCB defect category features; The step S11 and the step S12 further include: Using a two-dimensional PCB defect data pair image library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures, the step S11 uses the PCB defect features trained by the convolutional neural network, and the step S9 pairs The residual image is used for defect identification; the two-dimensional PCB defect image library convolutional neural network is used to train the category features of PCB defects, and the step S12 is to classify the defects marked in the two-dimensional PCB image to be tested, and the defects that are not in the category are classified. The defect in the defect is judged to determine whether it is a false defect or a defect of a new type, and the defect of the new type is added to the defect picture library. 如請求項7所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中, 在PCB混合檢測方法中,所述步驟S12之後還包括: 利用所述卷積神經網路訓練的所述二維PCB缺陷圖片庫的PCB缺陷特徵對標記的疑似缺陷塊進行搜索匹配,删除其中的假缺陷,提高識別精度;以及 在所述步驟S13之後,通過所述卷積神經網路訓練的PCB缺陷特徵,對疑似缺陷在所述缺陷圖片中搜索匹配。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claim 7, wherein, In the PCB hybrid detection method, after the step S12, the method further includes: Use the PCB defect feature of the two-dimensional PCB defect image library trained by the convolutional neural network to search and match the marked suspected defect blocks, delete the false defects therein, and improve the recognition accuracy; and After the step S13, search and match the suspected defect in the defect picture by using the PCB defect feature trained by the convolutional neural network. 如請求項1或8所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中, 對PCB缺陷驗證,通過所述步驟S3中所述卷積神經網路訓練的PCB缺陷級別特徵訊息,判斷PCB缺陷的真假性,若缺陷為假缺陷,則删除所述假缺陷,並分析產生所述假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning as described in claim 1 or 8, wherein, For PCB defect verification, judge the authenticity of the PCB defect through the PCB defect level feature information trained by the convolutional neural network in the step S3, if the defect is a false defect, delete the false defect, and analyze and generate The cause of the false defect, if the defect is a true defect, is marked in the defect record. 如請求項1至9所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,在搜索和判斷缺陷過程中,通過多次識別迭代,對缺陷進行逐次排除。The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to claims 1 to 9, wherein, in the process of searching and judging defects, the defects are successively eliminated through multiple identification iterations.
TW110115716A 2020-05-15 2021-04-30 A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning TWI796681B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010412967.6 2020-05-15
CN202010412967.6A CN111754456B (en) 2020-05-15 2020-05-15 Two-dimensional PCB appearance defect real-time automatic detection technology based on deep learning

Publications (2)

Publication Number Publication Date
TW202144766A true TW202144766A (en) 2021-12-01
TWI796681B TWI796681B (en) 2023-03-21

Family

ID=72674531

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110115716A TWI796681B (en) 2020-05-15 2021-04-30 A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning

Country Status (3)

Country Link
JP (1) JP7347836B2 (en)
CN (1) CN111754456B (en)
TW (1) TWI796681B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114216915A (en) * 2021-12-15 2022-03-22 江门市浩远科技有限公司 Method for detecting and classifying types of stains and defects of circuit board based on class level
CN117078674A (en) * 2023-10-14 2023-11-17 中电鹏程智能装备有限公司 Intelligent PCBA appearance defect detection method and detection system

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113838015B (en) * 2021-09-15 2023-09-22 上海电器科学研究所(集团)有限公司 Electrical product appearance defect detection method based on network cooperation
KR20230089583A (en) * 2021-12-13 2023-06-21 한국기계연구원 Method of inspecting device and device inspection apparatus for performing the same
CN114494131A (en) * 2021-12-24 2022-05-13 深圳英博达智能科技有限公司 Method for detecting defects of salient points on ink surface of PCB
CN115035081B (en) * 2022-06-23 2024-03-01 西安交通大学 Industrial CT-based metal internal defect dangerous source positioning method and system
CN115239712B (en) * 2022-09-21 2023-01-31 季华实验室 Circuit board surface defect detection method and device, electronic equipment and storage medium
CN116168021B (en) * 2023-04-21 2023-08-29 中江立江电子有限公司 Fault part identification system and method
CN117309873A (en) * 2023-09-04 2023-12-29 淮安特创科技有限公司 Efficient PCB appearance detection system and method
CN117689646A (en) * 2023-12-18 2024-03-12 华中科技大学 High-precision defect detection method, system and medium for positive and negative sample fusion
CN117455917B (en) * 2023-12-25 2024-03-26 深圳市睿阳精视科技有限公司 Establishment of false alarm library of etched lead frame and false alarm on-line judging and screening method

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI653605B (en) * 2017-12-25 2019-03-11 由田新技股份有限公司 Automatic optical detection method, device, computer program, computer readable recording medium and deep learning system using deep learning
KR102175286B1 (en) * 2018-10-11 2020-11-06 라온피플 주식회사 Apparatus and method for inspecting for defects
CN110455822A (en) * 2019-07-10 2019-11-15 苏州卓融新能源科技有限公司 A kind of detection method of pcb board defect
CN110910353B (en) * 2019-11-06 2022-06-10 成都数之联科技股份有限公司 Industrial false failure detection method and system
CN111103307A (en) * 2019-11-19 2020-05-05 佛山市南海区广工大数控装备协同创新研究院 Pcb defect detection method based on deep learning

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114216915A (en) * 2021-12-15 2022-03-22 江门市浩远科技有限公司 Method for detecting and classifying types of stains and defects of circuit board based on class level
CN114216915B (en) * 2021-12-15 2024-03-29 江门市浩远科技有限公司 Method for detecting and classifying class levels based on stains and defect types of circuit board
CN117078674A (en) * 2023-10-14 2023-11-17 中电鹏程智能装备有限公司 Intelligent PCBA appearance defect detection method and detection system
CN117078674B (en) * 2023-10-14 2024-01-05 中电鹏程智能装备有限公司 Intelligent PCBA appearance defect detection method and detection system

Also Published As

Publication number Publication date
TWI796681B (en) 2023-03-21
CN111754456A (en) 2020-10-09
JP2021180309A (en) 2021-11-18
JP7347836B2 (en) 2023-09-20
CN111754456B (en) 2022-10-14

Similar Documents

Publication Publication Date Title
TWI796681B (en) A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning
CN110349126B (en) Convolutional neural network-based marked steel plate surface defect detection method
CN115601364B (en) Golden finger circuit board detection method based on image analysis
KR100830523B1 (en) Image processing system for use with inspection systems
CN101995223B (en) Chip appearance detection method and system
WO2017181724A1 (en) Inspection method and system for missing electronic component
CN111899241B (en) Quantitative on-line detection method and system for defects of PCB (printed Circuit Board) patches in front of furnace
TWI669519B (en) Board defect filtering method and device thereof and computer-readabel recording medium
CN113850749B (en) Method for training defect detector
CN113870257B (en) Method and device for detecting and classifying defects of printed circuit board and computer storage medium
CN113706490B (en) Wafer defect detection method
CN115131596A (en) Defect classification device, method, and program
CN116168218A (en) Circuit board fault diagnosis method based on image recognition technology
KR101782364B1 (en) Vision inspection method based on learning data
CN114078109A (en) Image processing method, electronic device, and storage medium
US20230342937A1 (en) Vehicle image analysis
CN115170501A (en) Defect detection method, system, electronic device and storage medium
CN114549414A (en) Abnormal change detection method and system for track data
CN111460198B (en) Picture timestamp auditing method and device
CN116523922A (en) Bearing surface defect identification method
CN116664540A (en) Rubber sealing ring surface defect detection method based on Gaussian line detection
JP4814116B2 (en) Mounting board appearance inspection method
KR101782366B1 (en) Vision inspection method based on learning data using normalization of sample scale
KR20190119801A (en) Vehicle Headlight Alignment Calibration and Classification, Inspection of Vehicle Headlight Defects
CN113780488A (en) Scratching and scratching defect detection method based on position polymerization degree