TWI796681B - A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning - Google Patents

A method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning Download PDF

Info

Publication number
TWI796681B
TWI796681B TW110115716A TW110115716A TWI796681B TW I796681 B TWI796681 B TW I796681B TW 110115716 A TW110115716 A TW 110115716A TW 110115716 A TW110115716 A TW 110115716A TW I796681 B TWI796681 B TW I796681B
Authority
TW
Taiwan
Prior art keywords
pcb
defect
dimensional
image
picture
Prior art date
Application number
TW110115716A
Other languages
Chinese (zh)
Other versions
TW202144766A (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

本發明提出了一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法,包括:訓練PCB缺陷圖片庫的每一種類缺陷,將待測PCB圖片分割成多個圖片塊;利用PCB缺陷特徵搜索缺陷塊識別待測PCB圖片中的缺陷並標記疑似缺陷塊;利用PCB缺陷類別特徵進行缺陷分類,判斷缺陷類別,判斷不在類別中的疑似缺陷是假缺陷還是新類別的缺陷,將新類別缺陷補充至缺陷圖片庫;利用PCB缺陷級別特徵判斷疑似缺陷,若為假缺陷,則删除對應缺陷並分析原因,若為真缺陷,則標記在缺陷記錄中。該方法檢測PCB缺陷速度快、精度高。The present invention proposes a real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning, including: training each type of defect in the PCB defect image library, dividing the PCB image to be tested into multiple image blocks; using PCB defect features to search for defects Identify the defects in the PCB picture to be tested and mark the suspected defective blocks; use the PCB defect category feature to classify the defects, judge the defect category, judge whether the suspected defects that are not in the category are false defects or defects of a new category, and add the new category of defects to Defect image library; use PCB defect level features to judge suspected defects. If it is a false defect, delete the corresponding defect and analyze the cause. If it is a true defect, mark it in the defect record. The method detects PCB defects with high speed and high precision.

Description

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

本發明關於一種缺陷檢測技術領域,特別涉及一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法。The present 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 PCB is becoming more and more complex and precise. Traditional visual inspection is no longer 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外觀缺陷實時自動檢測方法,該方法具有速度快、精度高、泛化能力强,結構清晰等優點。For this reason, the object 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 fast speed, high precision, strong generalization ability, and clear structure.

為達到上述目的,本發明實施例提出了一種基於深度學習的二維PCB外觀缺陷實時自動檢測方法,包括:In order to achieve the above purpose, the 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缺陷單數據圖片庫;Step S1, establishing a two-dimensional PCB defect block image library by collecting and marking PCB defect block images, the two-dimensional PCB defect block image library includes a two-dimensional PCB defect data pair image library and a two-dimensional PCB defect single data image library;

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

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

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

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

步驟S6,通過圖像配準塊,對所述二維待測PCB圖片與所述二維標準PCB圖片配準;Step S6, registering the two-dimensional standard PCB image with the two-dimensional standard PCB image through the image registration block;

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

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

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

步驟S10,缺陷搜索匹配塊,通過卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中搜索缺陷塊,並進行缺陷塊匹配;Step S10, defect searching and matching blocks, using the PCB defect features trained by the convolutional neural network, searching for defect blocks in multiple image blocks, and performing defect block matching;

步驟S11,CNN缺陷識別塊,通過卷積神經網路對所述二維待測PCB圖片中的缺陷進行識別;Step S11, the CNN defect identification block identifies the 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 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 false The defect is a defect of a new category, and the defect of the new category is added to the defect block picture library;

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

步驟S14,PCB缺陷驗證塊,通過卷積神經網路訓練的PCB缺陷級別特徵和分類訊息,判斷疑似缺陷塊的真假性,若缺陷為假缺陷,則删除對應缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。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 the cause of 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 real-time automatic detection method for two-dimensional PCB appearance defects based on deep learning in the embodiment of the present invention uses PCB images, standard PCB images and convolutional neural networks to detect defects on PCBs, and uses PCB detection tools to detect defects in the assembly process Finding and eliminating errors early in the process can avoid sending defective PCB boards to subsequent assembly stages, while reducing repair costs and avoiding scrapping non-repairable boards. The use of convolutional neural networks has the advantages of fast speed, high precision, 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 one embodiment of the present invention, the two-dimensional PCB defect block image library is divided into two categories, one is a data pair image library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block images, and the other is A data image library for only a single 2D PCB defect block.

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

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

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

對所述二維PCB缺陷塊圖片庫中的每一種類PCB缺陷,用卷積神經網路進行訓練,提取PCB缺陷類別特徵;For each type of PCB defect in the two-dimensional PCB defect block image library, train with a convolutional neural network 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, a convolutional neural network is used to train and extract PCB defect level features.

進一步地,在本發明的一個實施例中,在步驟S4中,通過PCB圖片提取塊提取的二維PCB圖片包括兩種:一種為提取二維標準PCB圖片和二維待測PCB圖片;另一種為只提取二維待測PCB圖片。Further, in one 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; the other is To extract only two-dimensional PCB pictures to be tested.

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

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

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

進一步地,在本發明的一個實施例中,所述步驟S5中,濾波去噪塊對所述二維PCB圖片進行去噪處理,包括:Further, in one 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圖片、缺陷庫中圖片的底板顔色一致;Using an algorithm to denoise the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested, 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 standard PCB picture are denoised. Dimensional denoising of the PCB image to be tested, removing the noise in the image, and correcting the influence of the color of the bottom plate on the image, so that the color of the bottom plate of the standard PCB image, the PCB image to be tested, and the pictures in the defect library are consistent;

在無標準板比對PCB檢測方法中,只對所述二維待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得待測PCB圖片、缺陷庫中圖片的底板顔色一致。In the non-standard board comparison PCB inspection method, only the two-dimensional image of the PCB 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 bottom plate of the picture of the PCB to be tested and the picture in the defect library The color is consistent.

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

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

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

對所述二維標準PCB圖片進行配準,檢測所述二維標準PCB圖片是否存在旋轉、形變、光線不均和光線反射,若存在,則利用算法進行矯正;Registering the two-dimensional standard PCB picture, detecting whether there is rotation, deformation, light unevenness and light reflection in the two-dimensional standard PCB picture, and if there is, using 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, and if not, the algorithm is used to correct the two-dimensional PCB image to be tested.

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

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

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

在無標準板比對PCB的檢測方法中,採用所述二維PCB缺陷單數據圖片庫;In the non-standard board comparison PCB detection method, 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, 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 , extracting PCB defect features and PCB defect category features;

步驟S10通過卷積神經網路訓練的PCB缺陷特徵,所述步驟S8在多個圖片塊中進行PCB缺陷搜索判別,採用單個二維PCB缺陷圖片庫卷積神經網路訓練PCB缺陷的類別特徵,步驟S12對所述二維待測PCB圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。Step S10 uses the PCB defect features trained by the convolutional neural network, and the step S8 performs PCB defect search and discrimination in multiple image blocks, and uses a single two-dimensional PCB defect image 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, judges whether it is a false defect or a defect of a new category, and adds the defects of the new category to the defect photo gallery.

進一步地,在本發明的一個實施例中,在比對標準PCB的檢測方法和PCB混合檢測方法中,分別對所述二維PCB缺陷圖片庫和所述二維PCB缺陷圖片庫中的每一種類PCB缺陷,用卷積神經網路訓練,提取PCB缺陷特徵和PCB缺陷類別特徵。步驟S11和步驟S12還包括:Further, in one embodiment of the present invention, in comparing the standard PCB detection method and the PCB hybrid detection method, each of the two-dimensional PCB defect image library and the two-dimensional PCB defect image library Types of PCB defects, trained with convolutional neural networks, 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圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將所述新的類別的缺陷補充至缺陷圖片庫。Using the two-dimensional PCB defect data pair picture library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block pictures, step S11 uses the PCB defect feature pairs trained by the convolutional neural network, and step S9 performs defect identification on the residual images , using the two-dimensional PCB defect picture library convolutional neural network to train the category feature pairs of PCB defects, step S12 classifies the defects marked in the two-dimensional PCB picture to be tested, and judges the defects that are not in the category, and judges whether Whether it is a false defect or a defect of a new category, the defect of the new category is added to the defect image library.

進一步地,在本發明的一個實施例中,在PCB混合檢測方法中,步驟S12之後還包括:Further, in one embodiment of the present invention, in the PCB hybrid detection method, after step S12, it also 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 false defects therein, and improve recognition accuracy;

在步驟S13之後,通過卷積神經網路訓練的PCB缺陷特徵,對疑似缺陷在所述缺陷圖片中搜索匹配。After step S13, the suspected defect is searched for a match in the defect picture through the PCB defect feature 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.

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

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

下面詳細描述本發明的實施例,所述實施例的示例在圖式中示出,其中自始至終相同或類似的標號表示相同或類似的元件或具有相同或類似功能的元件。下面通過參考圖式描述的實施例是示例性的,旨在用於解釋本發明,而不能理解為對本發明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the drawings, wherein the same or similar reference numerals designate the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures 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 technology, the production of PCB is becoming more and more complex and precise. 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 (referred to as method three).

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

步驟S1,PCB缺陷塊圖片庫,建立二維PCB缺陷塊(patch)圖片庫,分別有二維PCB缺陷數據對圖片庫和二維PCB缺陷單數據圖片庫;Step S1, the PCB defect block image library, establishes a two-dimensional PCB defect block (patch) image library, which respectively has a two-dimensional PCB defect data pair image library and a two-dimensional PCB defect single data image 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, CNN defect level feature training block, for each type of PCB defect level in the two-dimensional PCB defect block image library, use convolutional neural network training to extract PCB defect level features;

步驟S4,PCB圖片提取塊,提取二維PCB圖片,分別有二維標準PCB圖片和二維待測PCB圖片;Step S4, the PCB image extraction block extracts two-dimensional PCB images, which respectively include 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, registering 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, image gray value comparison block, compare and analyze the gray value of the two-dimensional standard PCB image and the two-dimensional PCB image to be tested to obtain the two-dimensional PCB residual image;

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

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

步驟S10,缺陷搜索匹配塊,通過卷積神經網路訓練的PCB缺陷特徵,在多個圖片塊中搜索缺陷塊,並進行缺陷塊匹配;Step S10, defect searching and matching blocks, using the PCB defect features trained by the convolutional neural network, searching for defect blocks in multiple image blocks, and performing 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 picture 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 of new categories are added to the defect image library;

步驟S13,PCB缺陷疑似塊,對二維待測PCB圖片中每一類缺陷標記為疑似缺陷;Step S13, PCB defect suspected block, marking 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, 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 the cause of 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 image library is divided into two categories, one is a data pair image library composed of two-dimensional PCB defect blocks and corresponding non-defective standard PCB block images, and the other is only a single two-dimensional PCB defect Block data image library.

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

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

在本發明的實施例中,步驟S2和步驟S3還包括:In an embodiment of the present invention, step S2 and step S3 also 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, use convolutional neural network training to extract PCB defect level features.

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

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

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

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

利用算法對標準PCB圖片和待測PCB圖片進行去噪。方法一和方法三,需要對二維標準PCB圖片和待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得標準PCB圖片、待測PCB圖片、缺陷庫中圖片的底板顔色一致;方法二只需對待測PCB圖片去噪,去除圖片中的噪聲,修正底板顔色對圖片的影響,使得待測PCB圖片、缺陷庫中圖片的底板顔色一致。Use the algorithm to denoise the standard PCB picture and the PCB picture 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 The color of the bottom plate is consistent; the second method only needs to denoise the picture of the PCB 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 color of the bottom plate of the picture of the PCB to be tested and the picture in the defect library is consistent.

對標準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圖片和殘差圖片進行分割得到多個圖片塊和坐標。Step S6, step S7 and step S8 are used for method one and method three. Register the standard PCB picture and the PCB picture to be tested, and correct the PCB picture to be tested according to the processed standard PCB picture. Compare the gray value of the standard PCB picture and the PCB picture to be tested, and calculate the picture residual to obtain the residual picture; then divide the standard PCB picture, the PCB picture to be tested and the residual picture to obtain multiple picture blocks and coordinates.

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

將待測PCB圖片與處理後的標準PCB圖片進行對比,判斷位置、光線和顔色是否一致,若不一致,則通過算法對待測PCB圖片進行矯正。Compare the picture of the PCB to be tested with the processed standard PCB picture to judge whether the position, light and color are consistent. If not, the picture of the PCB to be tested is corrected by the 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 multiple image blocks and coordinates.

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

對二維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圖片中標記的缺陷進行分類,對不在類別中的缺陷進行判斷,判斷是否為假缺陷還是新的類別的缺陷,將新的類別的缺陷補充至缺陷圖片庫。The second method 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 use a single two-dimensional PCB defect picture library CNN to train the category features of PCB defects, and step S12 classifies the defects marked in the PCB picture to be tested, and judges the defects that are not in the category to determine whether it is a false defect or a new type of defect. , adding defects of a new category 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, use convolutional neural network training to extract PCB defect features, PCB defect 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 images, 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 picture library CNN to train the category characteristics of PCB defects, classify the defects marked in the PCB picture to be tested in step S12, and judge the defects that are not in the category, and judge whether it is a false defect or a new type of defect , adding defects of a new category to the defect image library.

在步驟S12之後方法三還包括:After step S12, method three also includes:

利用卷積神經網路訓練的二維PCB缺陷圖片庫的PCB缺陷特徵對標記的疑似缺陷塊進行搜索匹配,删除其中的假缺陷,提高識別精度。Use 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, the suspected defect is searched for a match in the defect picture through the PCB defect feature trained by the convolutional neural network.

在本發明的實施例中,對PCB缺陷驗證,通過步驟S3卷積神經網路訓練的PCB缺陷級別特徵訊息,判斷PCB缺陷的真假性,若缺陷為假缺陷,則删除該假缺陷,並分析產生假缺陷的原因,若缺陷為真缺陷,則標記在缺陷記錄中。In an 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, then delete the false defect, and Analyze the cause of the false defect, if the defect is a true defect, mark it in the defect record.

在本發明的實施例中,其特徵在於,在搜索和判斷缺陷過程中,通過多次識別迭代,對缺陷進行逐次排除。In the embodiment of the present invention, it is characterized in that, in the process of searching and judging defects, the defects are eliminated successively 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 through diagrams.

方法一: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 picture library. The defect library contains a variety of labeled, classified and graded defect images for PCBs. The defect picture may be a multi-scale picture. The defect picture is a picture data pair composed of a standard picture (positive example) and a defect 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) The step S4 of reading the standard PCB image reads the standard PCB image and the PCB image to be tested respectively.

1-5)濾波去噪的步驟S5與步驟S4連接,分別對標準PCB圖像和待測PCB濾波去噪。圖片中不可避免有多種噪聲,以及底板顔色,這對缺陷識別造成很大影響。需要採用多種算法和技術過濾噪聲。1-5) Step S5 of filtering and denoising is connected with step S4, respectively filtering and denoising the standard PCB image and the PCB to be tested. 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 recognition. 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, respectively registering images of the standard PCB and the PCB to be tested.

1-6-1)檢測標準PCB圖片是否端正。是否有旋轉、形變等改變。如果發生改變,需要矯正;檢測標準PCB圖片光線是否異常,是否有光線不均、反射等情形。如果出現光線異常,需要算法矯正。1-6-1) Check whether the standard PCB picture is correct. Whether there are changes such as rotation and deformation. 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 connecting with the step S5 of filtering and denoising, the picture of the PCB to be tested is also connected with the registered standard PCB picture. Check whether the picture of the PCB to be tested is correct and consistent with the position of the standard PCB, and check whether the position, light, and color of the standard picture are consistent. If inconsistent, use the 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 the image registration, comparing the gray value of the picture of the PCB to be tested with the picture of the standard PCB, and calculating the residual error of the picture.

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 into small patches (patch), which are prepared for defect block positioning and marking.

1-9)殘差濾波的步驟S9與圖像分割的步驟S8連接,過濾殘差中因配準誤差和干擾造成的比對殘差。删除殘差圖片中沒有殘差的patch,待檢測和分析有殘差的patch。1-9) The step S9 of residual filtering is connected with the step S8 of image segmentation to filter the comparison residual caused by registration error and interference in the residual. Delete the patch without residual in the residual image, and the patch with residual is 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 discrimination is connected with step S9 of residual filtering and step S2 of PCB defect feature training. Using the PCB defect features trained by the CNN in step S2, identify the residual patch. Identify which patches are defects of the PCB to be tested, and mark suspected defective patches. This step can be identified multiple times, and the suspected defect patch can be gradually eliminated.

1-11)PCB缺陷分類的步驟S12與缺陷判別的步驟S11和缺陷訓練的步驟S2連接。利用步驟S2中CNN訓練的PCB缺陷類別特徵,對缺陷判別的步驟S11中標記的缺陷patch進行分類,判斷標記的缺陷屬於哪一種缺陷。1-11) Step S12 of PCB defect classification is connected with step S11 of defect discrimination and step S2 of defect training. Using the PCB defect category feature trained by the CNN in step S2, classify the defect patch 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 feature. Using the PCB defect level feature trained by CNN in step S3, check whether the suspected PCB defect obtained in step S12 is a real defect, delete false defects, and improve detection accuracy. If it is a true defect, flag it. At the same time, those defects that are not in the category are screened, and 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 inspections.

方法二:Method Two:

第二種缺陷檢測方法相比第一種檢測方法,為非參考學習檢測,不需要和標準的PCB作參考和對比。如圖3所示,具體步驟為:Compared with the first detection method, the second defect detection method is a non-reference learning detection, and does not need to be referenced and compared with a 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 various marked, classified and graded defect pictures of PCBs. The defect picture may be a multi-scale picture. This defect library is different from the image library in the first detection method, it is not an image data pair, but a single defect image.

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 defects, use CNN training to extract PCB defect level features.

2-4)讀取標準PCB圖片的步驟S4,讀取待測PCB圖像。2-4) Step S4 of reading the standard PCB image, reading the image of the PCB 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 recognition. 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 image of the PCB to be tested is segmented into small patches, which are prepared for defect block positioning and marking.

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. Using the PCB defect features trained by the CNN in step S2, search for a defect patch. Identify which patches are defects of the PCB to be tested, and mark suspected defective patches. This step can be identified multiple times, and the suspected defect patch can be gradually eliminated.

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. Use the PCB defect category feature trained by CNN in step S2 to classify the defect patch marked in defect search step S10, determine which defect the marked defect belongs to, and screen out those defects that are not in the category to determine whether it is a false defect It is still 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) Step S14 of PCB defect verification is connected with step S12 of defect classification and step S3 of defect level characterization. Using the PCB defect level feature trained by CNN in step S3, check whether the suspected PCB defect obtained in step S12 is a real defect, delete false defects, and improve detection accuracy. If it is a true defect, flag 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 inspections.

方法三:Method three:

第三種檢測方法是對上面介紹的兩種檢測方法的結合,稱為混合檢測方法,可以更精確的識別PCB中的缺陷,如圖4所示,具體步驟為:The third detection method is a combination of the two detection methods described above, called the 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 picture library. The defect library contains a variety of labeled, classified and graded defect images for PCBs. The defect picture may be a multi-scale picture.

PCB缺陷庫分為兩類缺陷圖片庫。一類是缺陷圖片以標準圖片(正例)和缺陷圖片(反例)構成的圖片數據對,第二類只是缺陷圖片構成的圖片庫。The PCB defect library is divided into two types of defect image libraries. One type is a picture data pair composed of standard pictures (positive examples) and defective pictures (negative examples) for defect pictures, and the second type is just a picture library composed of defect 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 training to extract PCB defect features and defect category features. For each type of PCB defect in the second type of defect library, use CNN training 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 pairs in the first type of defect library, use CNN training to extract PCB defect level features. For each level of PCB defects in the second type of defect library, use CNN training to extract PCB defect level features.

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

3-5)濾波去噪的步驟S5與步驟S4連接,分別對標準PCB圖像和待測PCB濾波去噪。圖片中不可避免有多種噪聲,以及底板顔色,這對缺陷識別造成很大影響。需要採用多種算法和技術過濾噪聲。3-5) Step S5 of filtering and denoising is connected with step S4, respectively filtering and denoising the standard PCB image and the PCB to be tested. 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 recognition. 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, respectively registering images of the standard PCB and the PCB to be tested.

3-6-1)檢測標準PCB圖片是否端正。是否有旋轉、形變等改變。如果發生改變,需要矯正;檢測標準PCB圖片光線是否異常,是否有光線不均、反射等情形。如果出現光線異常,需要算法矯正。3-6-1) Check whether the standard PCB picture is correct. Whether there are changes such as rotation and deformation. 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 being connected with the filtering and denoising step S5, the PCB image to be tested is also connected with the registered standard PCB image. Check whether the picture of the PCB to be tested is correct and consistent with the position of the standard PCB, and check whether the position, light, and color of the standard picture are consistent. If inconsistent, use the 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 the image registration, comparing the gray value of the picture of the PCB to be tested with the standard PCB picture, and calculating the residual error of the picture.

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

3-9)殘差濾波的步驟S9與圖像分割的步驟S8連接,過濾殘差中因配準誤差和干擾造成的比對殘差。删除殘差圖片中沒有殘差的patch,待檢測和分析有殘差的patch。3-9) The step S9 of residual filtering is connected with the step S8 of image segmentation to filter the comparison residual caused by registration error and interference in the residual. Delete the patch without residual in the residual image, and the patch with residual is 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 discrimination is connected with step S9 of residual filtering and step S2 of PCB defect feature training. Using the PCB defect features trained by the CNN in step S2, identify the residual patch. Identify which patches are defects of the PCB to be tested, and mark suspected defective patches. This step can be identified multiple times, and the suspected defect patch can be gradually eliminated.

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 discrimination and step S2 of defect training. Using the PCB defect category feature trained by CNN in step S2, classify the defect patch marked in step S11 of defect discrimination.

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

3-13)缺陷搜索匹配的步驟S10與PCB疑似缺陷的步驟S13和CNN缺陷特徵訓練的步驟S2連接。對PCB疑似缺陷的步驟S13,利用步驟S2中第二類缺陷庫CNN訓練的PCB缺陷特徵和類別特徵搜索匹配。過濾疑似缺陷中的假缺陷。3-13) Step S10 of defect search and matching is connected with step S13 of PCB suspected defect and step S2 of CNN defect feature training. For the step S13 of the suspected PCB defect, use the PCB defect features and category features trained by the second type of defect library CNN in step S2 to search and match. 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 feature 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, flag it. At the same time, those defects that are not in the category are screened, and 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 inspections.

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

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

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

儘管上面已經示出和描述了本發明的實施例,可以理解的是,上述實施例是示例性的,不能理解為對本發明的限制,本領域的普通技術人員在本發明的範圍內可以對上述實施例進行變化、修改、替換和變型。Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, those skilled in the art can make the above-mentioned The embodiments are subject to changes, 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 easy to understand from the following description of the embodiments in conjunction with the accompanying drawings, wherein:

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

圖3為根據本發明另一個具體實施例的基於深度學習的二維PCB外觀缺陷實時自動檢測方法流程框圖。Fig. 3 is a block diagram 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 flowchart of a method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning according to 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, said method comprising the following steps: Step S1, establishing a two-dimensional PCB defect block image library through a PCB defect block image library, said two-dimensional PCB defect block image library It includes a two-dimensional PCB defect data pair image library and a two-dimensional PCB defect single data image library; wherein, the two-dimensional PCB defect block image library is divided into two categories, one is a two-dimensional PCB defect block and a corresponding defect-free standard PCB block image The formed data pair picture library, another kind is only the data picture library of single two-dimensional PCB defect block; Said step S1 also includes: setting up said two-dimensional PCB defect block picture library, two types of described two-dimensional PCB defect block pictures The library contains a variety of PCB defect block pictures that have been marked and classified and graded, and the PCB defect block pictures include multi-scale pictures; Step S2, through CNN defect feature training blocks, for the two-dimensional PCB defect block picture library. Each type of PCB defect is trained by using a convolutional neural network to extract PCB defect category features; step S3, through the CNN defect level feature training block, for each type of PCB defect in the two-dimensional PCB defect block picture library Level, using the convolutional neural network for training, extracting PCB defect level features; step S4, extracting two-dimensional PCB images through the PCB image extraction block, the two-dimensional PCB images include two-dimensional standard PCB images and two-dimensional to-be-tested PCB image; step S5, denoising the two-dimensional PCB image through the filter denoising block; step S6, through the image registration block, the two-dimensional PCB image to be tested and the two-dimensional standard PCB Image registration; step S7, by image gray value comparison block, the two-dimensional standard PCB image and the described The gray value of the two-dimensional PCB image to be tested is compared and analyzed to obtain a two-dimensional PCB residual image; step S8, through image segmentation and positioning blocks, the two-dimensional standard PCB image, the two-dimensional PCB image to be tested and The two-dimensional PCB residual picture is segmented and positioned to obtain picture blocks and corresponding coordinates of a plurality of pictures; Step S9, through the residual filtering block, the picture block of the two-dimensional PCB residual picture is filtered to eliminate the The comparison error produced by accuracy and other factors; step S10, defect search and match block through the PCB defect features trained by the convolutional neural network, search for defect blocks in multiple picture blocks, and perform defect block matching; step S11, The CNN defect identification block identifies defects in the two-dimensional PCB image to be tested through the convolutional neural network; step S12, the PCB defect classification block uses the PCB defect category features trained by the convolutional neural network to Classify the defects marked in the two-dimensional PCB picture to be tested, judge the defects that are not in the category, judge whether it is a false defect or a defect of a new category, and supplement the defects of the new category 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 is trained through the convolutional neural network PCB defect level features and classification information to judge the authenticity of the suspected defective block. If the defect is a false defect, delete the corresponding defect and analyze the cause of the false defect. If the defect is a true defect, mark it 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 as described in 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 PCB picture to be tested; the other is to only extract the two-dimensional PCB picture to be tested; the step S4 also includes: In the detection method of comparing the standard PCB and the PCB mixed detection method, extract the two-dimensional PCB picture to be tested and the corresponding two-dimensional standard PCB picture; and in the non-standard board comparison PCB detection method, only extract the two A picture of the PCB to be tested. 如請求項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 as described in claim 2, wherein, in the step S5, the denoising process is performed on the two-dimensional PCB image by filtering the denoising block, including: Using an algorithm to denoise the two-dimensional standard PCB picture and the two-dimensional PCB picture to be tested, in the comparison standard PCB detection method and PCB hybrid detection method, the two-dimensional standard PCB picture and the two-dimensional standard PCB picture and the tested PCB picture are denoised. Denoise the two-dimensional PCB image to be tested, remove the noise in the image, and correct the influence of the color of the bottom plate on the image, 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 pictures in the defect library are consistent ; In the non-standard board comparison PCB detection method, only denoise the two-dimensional 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 two-dimensional PCB image to be tested , The color of the bottom plate of the picture 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 as described in claim 3, wherein registration and gray value comparison are performed on the two-dimensional standard PCB image and the two-dimensional PCB image to be tested , image segmentation, the method further includes the following steps: in the detection method of the comparison standard PCB and the mixed detection method of PCB, the step S6, the step S7 and the step S8 include: in the In comparing the detection method of the standard PCB and the mixed detection method of the PCB, the two-dimensional standard PCB picture is registered with the two-dimensional PCB picture to be tested, and the two-dimensional standard PCB picture after the denoising process is used for the registration of the two-dimensional standard PCB picture. The two-dimensional PCB image to be tested is corrected, and the two-dimensional standard PCB image and the two-dimensional PCB image to be tested are compared to the gray value, and the image residual is calculated to obtain the two-dimensional PCB residual image; the two-dimensional standard PCB picture, the two-dimensional PCB to be tested picture and the two-dimensional The PCB residual image is segmented to obtain multiple image blocks and corresponding coordinates; the two-dimensional standard PCB image is registered to detect whether there is rotation, deformation, uneven light and light reflection in the two-dimensional standard PCB image, if If it exists, then use the algorithm to correct it; compare the two-dimensional standard PCB picture to be tested with the processed two-dimensional standard PCB picture, and judge whether the position, light and color are consistent. Measure the PCB picture for correction. 如請求項3所述的基於深度學習的二維PCB外觀缺陷實時自動檢測之方法,其中,在非比對參考的檢測方法中,所述步驟S8進一步包括:對所述二維待測PCB圖片進行分割得到多個圖片塊和對應的坐標。 The method for real-time automatic detection of two-dimensional PCB appearance defects based on deep learning as described in claim 3, wherein, in the non-comparison reference detection method, the step S8 further includes: the two-dimensional to-be-tested PCB picture Segmentation is performed to obtain multiple picture 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 as described in claim item 5, wherein, in the step S9, the image blocks of the two-dimensional PCB residual image are filtered to eliminate comparison errors and delete There is no residual image block in the two-dimensional PCB residual image; the step S10 and the step S12 further include: in the non-standard board comparison PCB detection method, using the two-dimensional PCB defect single data image library; in the non-standard board comparison PCB detection method and the PCB hybrid detection method, for each type of PCB defect in the two-dimensional PCB defect image library and the two-dimensional PCB defect image library, use the convolution Neural network 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 perform PCB defect search and discrimination in multiple image blocks, using a single two-dimensional PCB Defect picture library convolutional neural network trains the category characteristics of PCB defects, and the step S12 classifies the defects marked in the two-dimensional PCB image to be tested, judges the defects not in the category, and judges whether it is a false defect or a defect. Defects of a new category are added to the defect image library. 如請求項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 as described in claim 5 or 6, wherein, in the detection method of comparing the standard PCB and the mixed detection method of PCB, the two-dimensional PCB is respectively detected Each kind of PCB defect in the defect picture library and the two-dimensional PCB defect picture library is trained with the convolutional neural network to extract PCB defect features and PCB defect category features; said step S11 and said step S12 also Including: using a two-dimensional PCB defect data pair picture 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 steps S9 performs defect recognition on the residual image; adopts the two-dimensional PCB defect image library convolutional neural network to train the category characteristics of PCB defects, and classifies the defects marked in the two-dimensional PCB image to be tested in the step S12, and Defects that are not in the category are judged, whether it is a false defect or a defect of a new category is judged, and the defect of the new category is added to the defect image 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 as described in claim item 7, wherein, in the PCB hybrid detection method, after the step S12, it also includes: using the convolutional neural network trained The PCB defect features of the two-dimensional PCB defect image library search and match the marked suspected defect blocks, delete the false defects in it, and improve the recognition accuracy; and after the step S13, the PCB trained by the convolutional neural network Defect features, searching for matches in the defect pictures for suspected defects. 如請求項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, the PCB defect level features trained by the convolutional neural network described in step S3 message to judge the authenticity of the PCB defect, if the defect is a false defect, delete all Describe the false defect, and analyze the cause of the false defect, if the defect is a true defect, it will be marked in the defect record. 如請求項1或8所述的基於深度學習的二維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, in the process of searching and judging defects, the defects are eliminated successively 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.6A CN111754456B (en) 2020-05-15 2020-05-15 Two-dimensional PCB appearance defect real-time automatic detection technology based on deep learning
CN202010412967.6 2020-05-15

Publications (2)

Publication Number Publication Date
TW202144766A TW202144766A (en) 2021-12-01
TWI796681B true 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)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112669272B (en) * 2020-12-22 2024-09-06 广州广合科技股份有限公司 AOI rapid detection method and rapid detection system
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
CN114216915B (en) * 2021-12-15 2024-03-29 江门市浩远科技有限公司 Method for detecting and classifying class levels based on stains and defect types of circuit board
CN114494131A (en) * 2021-12-24 2022-05-13 深圳英博达智能科技有限公司 Method for detecting defects of salient points on ink surface of PCB
CN115015264A (en) * 2022-05-05 2022-09-06 阿里巴巴达摩院(杭州)科技有限公司 Video processing method, pipeline defect information display method and corresponding device
CN114897845A (en) * 2022-05-20 2022-08-12 南京理工大学 PCB defect detection method based on model compression
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
CN117309873B (en) * 2023-09-04 2024-08-06 淮安特创科技有限公司 Efficient PCB appearance detection system and method
CN117078674B (en) * 2023-10-14 2024-01-05 中电鹏程智能装备有限公司 Intelligent PCBA appearance defect detection method and detection system
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
CN117893513A (en) * 2024-01-19 2024-04-16 桂林诗宇电子科技有限公司 PCB detection method and system based on visual neural network algorithm
CN118464914B (en) * 2024-07-12 2024-09-13 常州华旋传感技术有限公司 Product quality detection equipment and detection method based on visual detection

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109916906A (en) * 2018-10-11 2019-06-21 乐人株式会社 Defect detecting device and method
CN109959661A (en) * 2017-12-25 2019-07-02 由田新技股份有限公司 Automatic optical detection method, equipment and its deep learning system
CN110455822A (en) * 2019-07-10 2019-11-15 苏州卓融新能源科技有限公司 A kind of detection method of pcb board defect

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109959661A (en) * 2017-12-25 2019-07-02 由田新技股份有限公司 Automatic optical detection method, equipment and its deep learning system
CN109916906A (en) * 2018-10-11 2019-06-21 乐人株式会社 Defect detecting device and method
CN110455822A (en) * 2019-07-10 2019-11-15 苏州卓融新能源科技有限公司 A kind of detection method of pcb board defect

Also Published As

Publication number Publication date
JP7347836B2 (en) 2023-09-20
TW202144766A (en) 2021-12-01
CN111754456B (en) 2022-10-14
CN111754456A (en) 2020-10-09
JP2021180309A (en) 2021-11-18

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
CN101995223B (en) Chip appearance detection method and system
KR100830523B1 (en) Image processing system for use with inspection systems
WO2017181724A1 (en) Inspection method and system for missing electronic component
WO2017020559A1 (en) Multi-type bga chip visual identification method based on row and column linear clustering
CN115601364A (en) Golden finger circuit board detection method based on image analysis
CN113870257B (en) Method and device for detecting and classifying defects of printed circuit board and computer storage medium
CN113706490B (en) Wafer defect detection method
TWI669519B (en) Board defect filtering method and device thereof and computer-readabel recording medium
CN109462999B (en) Visual inspection method based on learning through data balance and visual inspection device using same
CN111369516A (en) Transformer bushing heating defect detection method based on infrared image recognition
CN107895362A (en) A kind of machine vision method of miniature binding post quality testing
CN116168218A (en) Circuit board fault diagnosis method based on image recognition technology
WO2014103617A1 (en) Alignment device, defect inspection device, alignment method, and control program
CN115170501A (en) Defect detection method, system, electronic device and storage medium
CN112288782A (en) PCB defect detection method based on boundary segment number value
KR101782364B1 (en) Vision inspection method based on learning data
CN114078109A (en) Image processing method, electronic device, and storage medium
US20230342937A1 (en) Vehicle image analysis
CN114549414A (en) Abnormal change detection method and system for track data
CN111460198B (en) Picture timestamp auditing method and device
CN112200799A (en) Gerber file-based PCB electronic component defect detection method
KR101782366B1 (en) Vision inspection method based on learning data using normalization of sample scale
CN113780488A (en) Scratching and scratching defect detection method based on position polymerization degree