CN114429445B - A PCB defect detection and identification method based on MAIRNet - Google Patents
A PCB defect detection and identification method based on MAIRNet Download PDFInfo
- Publication number
- CN114429445B CN114429445B CN202111318512.9A CN202111318512A CN114429445B CN 114429445 B CN114429445 B CN 114429445B CN 202111318512 A CN202111318512 A CN 202111318512A CN 114429445 B CN114429445 B CN 114429445B
- Authority
- CN
- China
- Prior art keywords
- image
- pcb
- component
- polarity
- detected
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/30—Determination of transform parameters for the alignment of images, i.e. image registration
- G06T7/33—Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20036—Morphological image processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30141—Printed circuit board [PCB]
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method for detecting and identifying PCB defects based on MAIRNet, which comprises the steps of collecting PCB template images and images to be detected, constructing a data set, dividing the data set into test set images and training set images, detecting whether the situation of missing components exists, finally outputting missing component positioning information and marking the missing component positioning information in the images to be detected, outputting positioning conditions, color ring resistance types and positioning information of polar components, welding spot defect types and positioning information of the polar components, outputting the cut PCB polar component images to be detected and template images, constructing a PCB component polarity judging method, outputting component polarity plugging conditions, and summarizing and displaying the obtained information. The invention can detect and identify the common problems of component deficiency, component polarity connection error, welding spot defect and the like on the surface of the PCB, output the position information and the category information of the defect area, and detect and identify the color ring resistance category, thereby having remarkable advantages compared with a manual detection mode.
Description
Technical Field
The invention relates to the technical field of machine vision and deep learning, in particular to a MAIRNet-based PCB defect detection and identification method.
Background
With the rapid development of machine vision and artificial intelligence technology, deep learning, neural networks and other technologies are gradually applied to the process of industrial detection. The PCB has the characteristics of high density, light weight, high integration level and the like, so that the PCB defect detection process also faces the problems of diversification of target components, small size of detection objects and difficult identification.
The main modes of PCB detection are mainly divided into three types of manual visual inspection, contact detection and non-contact detection. The problem of low efficiency exists in manual visual inspection, contact detection is extremely vulnerable to damage to components on the surface of the PCB, along with the development of an image processing technology and a visual sensor, visual-based PCB detection is gradually applied to actual production, but a conventional visual detection mode cannot simultaneously identify and detect various components, and still needs a relatively complex manual operation process, so that the method has limitations.
The detection and identification method based on the traditional image processing technology does not need complex and expensive hardware, but has certain limitation, has lower detection and identification precision on the complex background of PCBs with various target types, and can not accurately judge the types of components and defects. The current target detection and recognition technology based on deep learning does not have a specific neural network model built for PCB defects, and the detection and recognition technology for the common defects of the PCB, such as welding spot continuous welding, cold joint, component deficiency, polarity reverse connection and the like, is relatively not mature enough, and is difficult to detect and recognize the defects of the PCB in a targeted manner, and meanwhile, the deep neural network is complicated in model, occupies increased computing resources and is difficult to be transplanted to an embedded development board to be applied to industrial production detection due to the fact that the network structure is complex and the number of layers is deepened.
Therefore, a new solution is needed to solve these problems.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, provides a method for detecting and identifying PCB defects based on MAIRNet, adopts a detection method based on deep learning and machine vision to replace the traditional detection mode, has relatively low cost in an actual application scene, does not need an expensive automatic optical detection (AOI) system, greatly improves the efficiency compared with manual detection and contact detection, is not easy to cause damage to PCB surface components, is built based on a neural network model, has lower complexity, is convenient to be transplanted to an embedded development board to be applied to actual industrial production detection, can realize the detection function of various defect targets in single detection operation, improves the production efficiency and reliability, meets the production requirements of high-performance and high-complexity products, can greatly improve the overall detection level of the PCB on a plate production assembly line of intelligent power grid equipment, and has important practical application value.
The invention provides a MAIRNet-based PCB defect detection and identification method for achieving the purposes, which comprises the following steps:
s1, respectively collecting template images and images to be detected on the front surface and the back surface of a PCB, constructing a data set, dividing the data set into a test set image and a training set image, marking the training set image with component categories and defect conditions, and generating a corresponding label file;
S2, inputting the images to be detected and the template images in the training set into a component existence detection module, detecting whether the condition of component missing exists, and finally outputting the missing component positioning information and marking in the images to be detected;
S3, inputting the PCB image in the testing set into a built and trained MAIRNet-based PCB defect detection and identification model to perform detection and identification operation, and outputting positioning conditions, color ring resistance types and positioning information, welding spot defect types and positioning information for the polar components;
S4, cutting and screening the image to be detected and the template image by utilizing the positioning condition of the polar component output in the step S3, outputting the cut image to be detected of the PCB polar component and the cut template image, constructing a method for judging the polarity of the PCB component, operating by utilizing the component existence detection module, independently comparing the polar component areas of the image to be detected and the template image by dividing the polar component existence area, inputting the comparison condition into the polarity detection module for judging, and finally outputting the polarity plugging condition of the component;
and S5, summarizing and displaying the obtained positioning information of the missing component, the labeling condition on the PCB image, the polarity plugging condition of the component, the resistance type and positioning information of the color ring, the defect type and positioning information of the welding spot.
Further, the detecting method of the component existence detecting module in the step S2 is as follows:
preprocessing an input image to be detected, performing image registration operation on the image to be detected and an original image by using ORB characteristics, and ensuring that the relative characteristics contained in the image to be detected and the template image are as close as possible;
D2, performing image graying operation on the image to be detected and the template image after image registration to generate a gray level image to be detected and a template gray level image;
d3, carrying out image difference on the gray level image to be detected and the template gray level image;
D4, performing image binarization processing on the differential gray level image obtained in the step D3 to obtain a differential binary level image, performing image morphology processing, and further reducing noise and influence on the positioning of the missing area of the component caused by the PCB background environment by adopting corrosion expansion operation;
D5, carrying out pixel screening on the differential binary image subjected to the image morphology processing in the step D4, and screening out the maximum connected region in the image;
and D6, marking the rectangular frame of the largest connected region screened in the step D5, mapping the rectangular frame of the missing region of the marked component into the input image to be detected, and further outputting the locating information of the missing component and realizing marking.
Further, the method for building the PCB defect detection and identification model based on MAIRNet in the step S3 includes the following steps:
A1, constructing a feature map based on MAIRNet for extracting the features of the PCB image in the training set, outputting feature maps with various scales, wherein MAIRNet is a multidimensional attention mechanism inverse residual error network (Multidimensional Attention Inverse Residual Network);
A2, detecting and identifying the targets of the PCB components on the feature graphs with various scales, wherein the category information corresponds to the position information targets of the bounding boxes of the targets, and the category information comprises specific categories and defect conditions of the target components.
Further, the step A1 specifically includes the following steps:
MAIRNet is composed of an inverse residual error network and a multidimensional attention module, and a multiscale feature fusion mechanism is used in the network construction process;
b2, adding a multi-dimensional attention module on the basis of an inverse residual error network, and optimizing each inverse residual error module in the inverse residual error network by using the multi-dimensional attention module to obtain an inverse residual error module optimized by the multi-dimensional attention module;
and B3, constructing MAIRNet according to a multi-scale feature fusion mechanism.
Further, the step A2 specifically includes the following steps:
Inputting the 5-layer feature images output by the multidimensional attention-enhancing neural network into a PCB component target detection and identification module to respectively perform three types of operations of polar component positioning, chromatic circle resistance identification and welding spot detection, wherein the 5-layer feature images in each type of operation pass through 4 groups of convolutional neural networks, each group of convolutional neural networks comprises convolution with a convolution kernel of 3 multiplied by 3 and a step length of 1, and the group normalization operation is performed, and finally, a ReLU activation function is used for activation;
In each type of operation, carrying out bounding box regression on the feature images output through the convolution of 4 groups of convolution neural networks, determining the area where the component targets are located, and using a generalized cross-over comparison function GIoU (Generalized Intersection over Union) as a bounding box regression loss function;
and C3, classifying the feature images output through the convolution of the 4 groups of convolution neural networks in each type of operation, determining the types and defect types of the targets of the components and the devices, and using a focus loss function FocalLoss as a classification loss function.
Further, the specific calculation process of the generalized cross ratio function GIoU in the step C2 is as follows:
LGIoU=1-GIoU (1)
Where A represents a prediction bounding box, B represents a real bounding box, C represents a minimum closure rectangular region of the prediction bounding box and the real bounding box, L GIoU represents a bounding box regression loss function, ioU represents an intersection ratio function between the prediction bounding box and the real bounding box, and GIoU represents a generalized intersection ratio function between the prediction bounding box and the real bounding box.
Further, the specific calculation process of the focus loss function FocalLoss in the step C3 is:
FL(p,y)=-y(1-p)γlog(p)-(1-y)pγlog(1-p) (4)
Where p is a predicted value predicted as a certain type label, and between 0 and 1, y is an actual type label, and is 0 or 1, and γ is a constant set by man.
Further, the method for discriminating the polarity of the PCB component in the step S4 includes the following steps:
E1, preprocessing an input PCB polarity component to-be-detected image, performing image registration operation on the to-be-detected image and an original image by using ORB characteristics, and ensuring that the relative characteristics contained in the PCB polarity component to-be-detected image and the PCB polarity component template image are as close as possible;
E2, performing image graying operation on the PCB polarity component to-be-detected image and the PCB polarity component template image obtained after image registration to generate a PCB polarity component to-be-detected gray level image and a PCB polarity component template gray level image;
e3, carrying out image difference on the gray level image to be detected of the PCB polarity component and the gray level image of the PCB polarity component template;
e4, performing image binarization processing on the PCB polarity component differential gray level image obtained in the step E3 to obtain a PCB polarity component differential binary level image, performing image morphology processing, and adopting corrosion expansion operation to further reduce noise and influence of the PCB background environment on the positioning of the polarity component differential region;
E5, carrying out pixel screening on the differential binary image subjected to the image morphology processing in the step E4, and screening out the maximum communication area in the differential binary image of the PCB polar component;
and E6, inputting the maximum communication area screened in the step E5 into a polarity detection module to further judge, setting a threshold S t, if the maximum communication area is larger than the set threshold S t, indicating that the polarity is wrong, and if the maximum communication area is not larger than the set threshold S t, indicating that the polarity is correct.
Further, the main body of MAIRNet in the step B1 is an inverse residual network constructed by 17 inverse residual modules, the head end of each inverse residual module is 1×1 convolution, the 1×1 convolution is used for expanding the feature matrix channel, the feature quantity is enriched, the middle part of the inverse residual module is composed of a convolution kernel which is 3×3 and is used for generating a feature matrix consistent with the input feature matrix channel quantity, so that the parameter quantity and the operation cost are reduced, and the expression capability of the network is finally enhanced by using a ReLU6 activation function;
The specific operation of the multidimensional attention module in the step B2 is that the characteristic matrix of each inverse residual module is divided into two channels for carrying out average pooling operation, the characteristic matrices of the two channels after average pooling are respectively connected and convolved by 1 multiplied by 1, the Batch Norm normalization operation is used, the activated characteristic matrix is activated by Swish activation functions, the activated characteristic matrix is decomposed into the characteristic matrices of the two channels again, the characteristic matrices of the two channels are activated by 1 multiplied by 1 convolution and Sigmoid activation functions respectively, the obtained characteristic matrices of the two channels are combined with the original characteristic matrix output by the inverse residual module, so that a multidimensional attention-enhanced characteristic diagram is obtained, and the enhanced characteristic diagram can more effectively express information in an original image;
The step B3 specifically comprises dividing 17 multi-dimensional attention module optimized inverse residual modules into 7 layers of networks, wherein each layer comprises 1,2,3,4,3,3,1 multi-dimensional attention optimized inverse residual modules in sequence, respectively defining characteristic graphs processed by the 2 nd layer, the 3 rd layer, the 5 th layer and the 7 th layer of networks as C 2、C3、C5、C7 to carry out 1X 1 convolution to obtain F 2、F3、F5、F7, carrying out step length 2 convolution on F 7 again to obtain F 7 ', fusing characteristic graphs with different scales, and finally fusing and outputting 5 layers of characteristic graphs F 2、F3、F5、F7、F7'.
Further, in the step S5, a user software system interface is set up for summary display.
Compared with the prior art, the invention has the following advantages:
1. According to the invention, the PCB image in industrial production is collected, the image to be detected and the template image are marked, a data set is constructed, the image is collected through the industrial camera, the software running environment can be detected and identified after configuration, expensive detection equipment and fixtures are not needed, meanwhile, the damage to the PCB components caused by contact detection is avoided, the cost is lower, less manual auxiliary work is needed, the implementation mode is quick and convenient, and the operation is easy.
2. The invention adopts the neural network based on multidimensional attention enhancement to detect, and has better detection and identification effects on defects of small targets such as welding spots and the like.
3. The invention can detect and identify various common PCB defects at one time without complex manual operation and repeated detection, and simultaneously constructs the interactive interface to output defect detection and identification results, and has the advantages of high identification precision, high detection speed, simple and convenient operation and visual display result.
Drawings
FIG. 1 is a flow chart of the method of the present invention;
FIG. 2 is a diagram of a PCB defect detection and identification model based on MAIRNet in the present invention;
FIG. 3 is a block diagram of the inverse residual module of the multidimensional attention module optimization used in the present invention;
FIG. 4 is a schematic diagram of a generalized cross-ratio function GIoU;
FIG. 5 is a graph of detection and identification results of common defects of a PCB based on MAIRNet;
FIG. 6 is a diagram of detecting missing components from the component presence detection module of the present invention;
FIG. 7 is a diagram showing the result of judging the polarity of the component output by the polarity detection module;
FIG. 8 is a schematic diagram of a user software system interface constructed in accordance with the present invention.
Detailed Description
The present application is further illustrated in the accompanying drawings and detailed description which are to be understood as being merely illustrative of the application and not limiting of its scope, and various modifications of the application, which are equivalent to those skilled in the art upon reading the application, will fall within the scope of the application as defined in the appended claims.
The invention provides a PCB defect detection and identification method based on a multidimensional attention-enhancing neural network (MAIRNet), which is shown in figure 1 and comprises the following steps:
S1, collecting images to be detected on the front side and the back side of a PCB and template images, wherein the images to be detected have the conditions of component missing, component polarity connection error, chromatic circle resistance connection error and welding spot defect. Dividing a test set image and a training set image according to the ratio of 3:7, marking the component category and the defect condition of the training set image, and generating a corresponding label file;
S2, constructing a MAIRNet-based PCB defect detection and identification model;
and S3, inputting the images to be detected and the template image in the training set into a component existence detection module, detecting whether the condition of component deletion exists, and finally outputting the component deletion positioning information and marking in the images to be detected.
S4, inputting the PCB image in the test set into a trained MAIRNet-based PCB defect detection and identification model for detection and identification operation, and outputting positioning conditions, color ring resistance types and positioning information, welding spot defect types and positioning information for the polar components;
And S5, cutting and screening the image to be detected and the template image by utilizing the positioning condition of the polar component output in the step S4, and outputting the cut PCB polar component image to be detected and the template image. Constructing a polarity judging method of the PCB component, utilizing the operation in the component existence detecting module in the step S3, independently comparing the polar component areas of the image to be detected and the template image by dividing the polar component existence areas, inputting the comparison condition into the polarity detecting module for judging, and finally outputting the polarity plugging condition of the component;
And S6, constructing a user software system interface, and summarizing and displaying the missing component positioning information output in the step S3 and the labeling condition, the component polarity plugging condition, the color ring resistance type and positioning information, the welding spot defect type and the positioning information on the PCB image in the user software system interface.
The specific process of step S2 in this embodiment is as follows:
A1, constructing a feature map based on MAIRNet for extracting the features of the PCB image in the training set, outputting feature maps with various scales, wherein MAIRNet is a multidimensional attention mechanism inverse residual error network (Multidimensional Attention Inverse Residual Network);
a2, carrying out target detection and identification on the PCB components of the feature graphs with various different scales, wherein the category information corresponds to the bounding box position information target of the bounding box where the target is located, and the category information comprises specific categories and defect conditions of the target components;
the specific process of step A1 in this embodiment is as follows:
B1: MAIRNet is composed of an inverse residual error network and a multidimensional attention module, and a multiscale feature fusion mechanism is used in the network construction process. The main body of MAIRNet is an inverse residual network constructed by 17 inverse residual modules, the head end of each inverse residual module is 1 multiplied by 1 convolution, the 1 multiplied by 1 convolution is used for expanding characteristic matrix channels and enriching the characteristic quantity, the middle part of the inverse residual module is composed of a convolution kernel which is 3 multiplied by 3 and is used for generating a characteristic matrix consistent with the input characteristic matrix channels, so that the parameter quantity and the operation cost are reduced, and the expression capacity of the network is finally enhanced by using a ReLU6 activation function;
And B2, adding a multi-dimensional attention module on the basis of the inverse residual error network, and optimizing each inverse residual error module in the inverse residual error network by using the multi-dimensional attention module to obtain an inverse residual error module optimized by the multi-dimensional attention module. The specific operation of the multidimensional attention module is shown as follows, the characteristic matrix of each inverse residual module is divided into two channels for carrying out average pooling operation, the characteristic matrices of the two channels after average pooling are respectively connected and subjected to 1X 1 convolution, the Batch Norm normalization operation is used for activating through Swish activation functions, the activated characteristic matrix is decomposed into the characteristic matrices of the two channels again, the characteristic matrices of the two channels are respectively activated through 1X 1 convolution and Sigmoid activation functions, the obtained characteristic matrices of the two channels are combined with the original characteristic matrix output by the inverse residual module, so that a multidimensional attention-enhanced characteristic diagram is obtained, and the enhanced characteristic diagram can more effectively express information in the original image;
and B3, constructing MAIRNet according to a multi-scale feature fusion mechanism. The 17 multi-dimensional attention module optimized inverse residual modules are divided into 7 layers of networks, wherein each layer from 1 st layer to 7 th layer sequentially comprises 1,2,3,4,3,3,1 multi-dimensional attention optimized inverse residual modules, feature images processed by the 2 nd layer, 3 rd layer, 5 th layer and 7 th layer networks are respectively defined as C 2、C3、C5、C7 to be subjected to 1X 1 convolution to obtain F 2、F3、F5、F7, F 7 is subjected to convolution with a step length of 2 again to obtain F 7 ', feature images with different scales are fused, and finally 5 layers of feature images F 2、F3、F5、F7、F7' are fused and output.
The specific process of step A2 in this embodiment is as follows:
And C1, inputting the 5-layer feature images output by the multidimensional attention-enhancing neural network into a target detection and identification module of the PCB component to respectively perform three types of operations of polar component positioning, chromatic circle resistance identification and welding spot detection, wherein the 5-layer feature images in each type of operation pass through 4 groups of convolutional neural networks. Each group of convolution neural network comprises convolution with convolution kernel of 3 multiplied by 3 and step length of 1, and group normalization operation is carried out, and a ReLU activation function is finally used for activation;
In each type of operation, carrying out bounding box regression on the feature images output through the convolution of 4 groups of convolution neural networks, determining the area where the component targets are located, and using a generalized cross-over comparison function GIoU (Generalized Intersection over Union) as a bounding box regression loss function;
And C3, classifying the feature images output through the convolution of the 4 groups of convolution neural networks in each type of operation, determining the types and defect types of the targets of the components and the devices, and using a Focal Loss function Focal Loss as a classification Loss function.
It should be noted that, the schematic diagram of GIoU functions in step C2 is shown in fig. 4, and it can be seen specifically that:
LGIoU=1-GIoU (1)
Where A represents a prediction bounding box, B represents a real bounding box, C represents a minimum closure rectangular region of the prediction bounding box and the real bounding box, L GIoU represents a bounding box regression loss function, ioU represents an intersection ratio function between the prediction bounding box and the real bounding box, and GIoU represents a generalized intersection ratio function between the prediction bounding box and the real bounding box.
It should be noted that, in the step C3, the calculation process of the focus loss function FocalLoss is specifically as follows:
FL(p,y)=-y(1-p)γlog(p)-(1-y)pγlog(1-p) (4)
Where p is a predicted value predicted as a certain type label, and between 0 and 1, y is an actual type label, and is 0 or 1, and γ is a constant set by man.
The specific process of step S3 in this embodiment is as follows:
preprocessing an input image to be detected, performing image registration operation on the image to be detected and an original image by using ORB characteristics, and ensuring that the relative characteristics contained in the image to be detected and the template image are as close as possible;
D2, performing image graying operation on the image to be detected and the template image after image registration to generate a gray level image to be detected and a template gray level image;
d3, carrying out image difference on the gray level image to be detected and the template gray level image;
d4, performing image binarization processing on the differential gray level image obtained in the step D3 to obtain a differential binary level image, performing image morphology processing, and adopting corrosion expansion operation to further reduce noise and influence on the positioning of the missing region of the component caused by the PCB background environment;
D5, carrying out pixel screening on the differential binary image subjected to the image morphology processing in the step D4, and screening out the maximum connected region in the image;
and D6, marking the rectangular frame of the largest connected region screened in the step D5, mapping the rectangular frame of the missing region of the marked component into the input image to be detected, and further outputting the locating information of the missing component and realizing marking.
The specific process of step S5 in this embodiment is as follows:
E1, preprocessing an input PCB polarity component to-be-detected image, performing image registration operation on the to-be-detected image and an original image by using ORB characteristics, and ensuring that the relative characteristics contained in the PCB polarity component to-be-detected image and the PCB polarity component template image are as close as possible;
E2, performing image graying operation on the PCB polarity component to-be-detected image and the PCB polarity component template image obtained after image registration to generate a PCB polarity component to-be-detected gray level image and a PCB polarity component template gray level image;
e3, carrying out image difference on the gray level image to be detected of the PCB polarity component and the gray level image of the PCB polarity component template;
E4, performing image binarization processing on the PCB polarity component differential gray level image obtained in the step F3 to obtain a PCB polarity component differential binary level image, performing image morphology processing, and adopting corrosion expansion operation to further reduce noise and influence of the PCB background environment on the positioning of the polarity component differential area;
E5, performing pixel screening on the differential binary image subjected to the image morphology processing in the step F4, and screening out the maximum communication area in the differential binary image of the PCB polar component;
And E6, inputting the maximum communication area screened in the step F5 into a polarity detection module to further judge, setting a threshold S t, if the maximum communication area is larger than the set threshold S t, indicating that the polarity is wrong, and if the maximum communication area is not larger than the set threshold S t, indicating that the polarity is correct.
In this embodiment, in order to verify the actual effect of the method of the present invention, the actual detection and identification conditions of the PCB defect detection and identification model based on MAIRNet on the resistor and the solder joint are shown in fig. 5 (a) and fig. b), respectively, it can be seen that the type of the resistor target and the region where the solder joint has a defect can be clearly and efficiently identified in fig. 5 (a) and fig. b), the result of the component presence detection module on the common component is shown in fig. 6, the component presence detection module can accurately locate the region where the component is missing, the result of the judgment on the plugging condition of the polar component is shown in fig. 7, and finally the judgment result is output on the interface of the user software system, and the result of the detection and identification of fig. 5, fig. 6 and fig. 7 can verify the actual effect of the method of the present invention, and the interface of the user software system is shown in fig. 8.
The invention can detect and identify the common problems of missing components, wrong polarity connection of components, welding spot defects and the like on the surface of the PCB, output the position information and the category information of the defect area, detect and identify the color ring resistance category, and has the detection precision up to 95 percent, and the average detection and identification speed of a single image is not more than 2 seconds, thus having remarkable advantages compared with the manual detection mode.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111318512.9A CN114429445B (en) | 2021-11-09 | 2021-11-09 | A PCB defect detection and identification method based on MAIRNet |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111318512.9A CN114429445B (en) | 2021-11-09 | 2021-11-09 | A PCB defect detection and identification method based on MAIRNet |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114429445A CN114429445A (en) | 2022-05-03 |
CN114429445B true CN114429445B (en) | 2025-05-23 |
Family
ID=81311239
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111318512.9A Active CN114429445B (en) | 2021-11-09 | 2021-11-09 | A PCB defect detection and identification method based on MAIRNet |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114429445B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116703926B (en) * | 2023-08-08 | 2023-11-03 | 苏州思谋智能科技有限公司 | Defect detection method, defect detection device, computer equipment and computer readable storage medium |
CN117409261B (en) * | 2023-12-14 | 2024-02-20 | 成都数之联科技股份有限公司 | Element angle classification method and system based on classification model |
CN118226236B (en) * | 2024-05-23 | 2024-08-06 | 联觉(深圳)科技有限公司 | Intelligent recognition method and device for PCB defects |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108921846A (en) * | 2018-07-17 | 2018-11-30 | 北京航空航天大学 | A kind of rail tread defect identification method combined based on gray level image and depth image |
CN111738994A (en) * | 2020-06-10 | 2020-10-02 | 南京航空航天大学 | A Lightweight PCB Defect Detection Method |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108846841A (en) * | 2018-07-02 | 2018-11-20 | 北京百度网讯科技有限公司 | Display screen quality determining method, device, electronic equipment and storage medium |
CN110766011B (en) * | 2019-12-26 | 2020-04-28 | 南京智莲森信息技术有限公司 | Contact net nut abnormity identification method based on deep multistage optimization |
CN112232240B (en) * | 2020-10-21 | 2024-08-27 | 南京师范大学 | Road casting object detection and identification method based on optimized cross-over ratio function |
CN112766195B (en) * | 2021-01-26 | 2022-03-29 | 西南交通大学 | Electrified railway bow net arcing visual detection method |
CN112818871B (en) * | 2021-02-04 | 2024-03-29 | 南京师范大学 | Target detection method of full fusion neural network based on half-packet convolution |
CN113469177B (en) * | 2021-06-30 | 2024-04-26 | 河海大学 | Deep learning-based drainage pipeline defect detection method and system |
-
2021
- 2021-11-09 CN CN202111318512.9A patent/CN114429445B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108921846A (en) * | 2018-07-17 | 2018-11-30 | 北京航空航天大学 | A kind of rail tread defect identification method combined based on gray level image and depth image |
CN111738994A (en) * | 2020-06-10 | 2020-10-02 | 南京航空航天大学 | A Lightweight PCB Defect Detection Method |
Also Published As
Publication number | Publication date |
---|---|
CN114429445A (en) | 2022-05-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114429445B (en) | A PCB defect detection and identification method based on MAIRNet | |
CN111179251B (en) | Defect detection system and method using template comparison based on Siamese neural network | |
CN111862064B (en) | Silver wire surface flaw identification method based on deep learning | |
CN111368690B (en) | Deep learning-based video image ship detection method and system under influence of sea waves | |
CN101915769B (en) | An automatic optical inspection method for resistive components in printed circuit boards | |
CN111738994B (en) | Lightweight PCB defect detection method | |
CN109285139A (en) | A deep learning-based X-ray imaging weld inspection method | |
CN113222913B (en) | Circuit board defect detection positioning method, device and storage medium | |
CN105574550A (en) | Vehicle identification method and device | |
CN112037219A (en) | Metal surface defect detection method based on two-stage convolution neural network | |
CN109117836A (en) | Text detection localization method and device under a kind of natural scene based on focal loss function | |
CN110929795B (en) | Method for quickly identifying and positioning welding spot of high-speed wire welding machine | |
CN113344041B (en) | A PCB defect image recognition method based on multi-model fusion convolutional neural network | |
CN112183639B (en) | A Mineral Image Recognition and Classification Method | |
CN115456955A (en) | A method for detecting internal burr defects of ball cage dust cover | |
CN117036243A (en) | Method, device, equipment and storage medium for detecting surface defects of shaving board | |
CN116071315A (en) | Product visual defect detection method and system based on machine vision | |
CN111680691B (en) | Text detection method, text detection device, electronic equipment and computer readable storage medium | |
CN117152080A (en) | A PCB defect image detection method that combines GAM and SimAM attention mechanisms to improve YOLOv5 | |
Chen et al. | EEE-Net: Efficient edge enhanced network for surface defect detection of glass | |
CN113642473A (en) | Mining coal machine state identification method based on computer vision | |
CN113762162A (en) | Fire early warning method and system based on semantic segmentation and recognition | |
CN118297926A (en) | Online detection method and system for metal processing multi-mode defects | |
CN112529835A (en) | Image splicing tampering detection and positioning method based on source camera identification | |
CN111738264A (en) | An intelligent collection method of display panel data of equipment room equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |