PCB-Fire Automated Classification and Fault
PCB-Fire Automated Classification and Fault
Detection in PCB
Tejas Khare1 Vaibhav Bahel1 Anuradha C. Phadke1
School of Electronics and Communication School of Electronics and Communication School of Electronics and Communication
Engineering Engineering Engineering
MIT World Peace University MIT World Peace University MIT World Peace University
Pune, India Pune, India Pune, India
[email protected] [email protected] [email protected]
123
978-1-6654-1987-1/20/$31.00 ©2020 IEEE
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.
B. Literature Survey algorithm. The classifier modelwas trained on a DSLR dataset
of 530 PCB images [10]. The detection of missing
An Assembled PCB has the components assembled and
components is carried out by image subtraction and pixel
soldered by following the design provided to the assembler.
manipulation.
Pallavi.M.Taralkar, et al [2] provide a solution for PCB fault
detection with the help of image subtraction. The subtracted A. YOLOv3
image is compared to the original PCB design and computes It is a neural network used for detection and classification
the location of the missing component by classifying it as which has free open access [11]. You Only Look Once
missing. (YOLO) is a Fully Convolutional Neural Network (FCNN).
Jinay Nahar, et al [3], propose an algorithm to inspect faults in An input image of t x t size is fed to be classified or detected
assembled PCBs by using image subtraction. The subtracted by the network Fig. 3. The image is split into n x n grids and
image is converted to a grayscale image and is passed to an each box in the grid is visited once by striding. The algorithm
algorithm that determines the faulty regions and classifies produces multiple bounding boxes for a single detection. The
them accordingly. The algorithm indicates the position of the best bounding box is selected by Non-Maximum Suppression
fault by drawing a bounding circle.Vikas KrishnajiSalunkhe, [12] and others are eliminated. The YOLOv3 does not softmax
et al [4] present a solution to detect faults in PCB by using the class because of the limitation of assuming the classes to
linear Charged Coupled Device (CCD) PCB images. The be mutually exclusive. Hence, it uses logistic regression and
features are extracted using pattern recognition techniques, thresholding to predict the classes.
and the faults are identified. S.Sridevi, et al [5] propose a
solution to inspect the tracks and layout of a PCB. Their
method uses image processing and compares the reference
image which has the ground truth design and the test image. If
there is a difference between the images, the algorithm
classifies it as faulty.Manasa H. R., et al [6] propose a solution
to detect a faulty PCB by using the Lab-VIEW tool. The
original PCB image and the test image are captured in color
format. Furthermore, the captured images are then converted
to arrays and compared with each other in a tabular format.
The paper uses a binary classification technique to classify the
test images as ‘failed’ or ‘passed’. S.H.InderaPutera, et al [7]
propose a method to classify bare single layer PCBs as under
etch, over etch, short, open circuit, etc. The algorithm uses
morphological techniques, image subtraction, image Fig. 3. YOLO algorithm working
segmentation, and logic gates to find the defects and classify
them accordingly. The solution classified 13 defects but with a The model was trained by specifying the number of filters of
drawback of generating false-positive images due to noise. the final convolutional layer by the formulae (1). The network
The solution can be optimized to classify 14 defects by adding consists of a total of 106 CNN layers. There are 75
the pin-hole defect as it was ignored due to the morphological convolutional layers, 23 shortcut layers, 1 upsample layer, 4
image segmentation process.Jithendra P R Nayak, et al [8] route layers, and finally 3 detection layers that is yolo layers.
present an inspection model to detect faults in a PCB using TABLE I. represents the parameters which were set for the
image processing techniques. The paper uses edge detection, training of the network.
Hough transforms for detecting the faults on single-layer
PCBs. The inspection model detects ‘cut’ in tracks and extra =( + 5) × 3 (1)
Dry Film Photo Resist (DFPR). The algorithm uses binary
TABLE I. Parameter setting of network
conversion to count 0’s and 1’s to find the region where a fault
is present.Yih-Lon Lin, et al [9] present a method for capacitor Parameter Value
detection in a PCB using YOLO. The authors trained the Input size x Channel (608 x 608) x 3
YOLOv2 network with 9 different kinds of capacitors.
Batch 24
II. PROPOSED METHOD Subdivisions 8
The paper aims to solve the problem of missing Max Epochs 5000
components in PCB.A novel solution was presentedbased on Optimizer ‘SGD’
object detection, image subtraction, and pixel manipulation. Learning Rate 0.001
The authors name this proposed system as PCB-Fire. In
Momentum 0.9
addition to detecting the missing components, the algorithm
also finds its location and its class that is the type of Decay 0.0005
component. The detection and classification of componentsare
achieved byusingthe YOLO (You Only Look Once)
124
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.
B. Dataset Generation the data of only those boxes are sent to display, whose pixels
The object detection model was trained using the open- are matched, i.e. the missing components. The coordinates of
source DSLR dataset of 530 PCB images [8]. 20 PCB images the bounding boxes and the class of objects are used to draw
were taken out for testing. A total of 510 PCB images were the box and display the classification. The authors have named
used to train the network in which the dataset was split as 90% this system as PCB-Fire.
training samples which are 459 and 10% validating samples
which are 51. Table 1. provides the number of individual
components used to train the network. The components were
labeled using an open-source labeling tool labelImg [13].The
components considered for training the network are Capacitor,
Inductor, IC, and Resistor. TABLE II. represents the number
of each component considered for training the network.
C. Algorithm
The design PCB and the test PCB are loaded in binary
mode. The images which are loaded in binary are subtracted
as shown in Fig. 4 and the subtracted image is thresholded.
The pixels which have a color value of 255 are considered and
saved temporarily. The original PCB image is sent to the
trained object detection model to detect and classify the
components using a bounding box. While classifying the
components, the data of each bounding box which includes the
coordinates of it and the class of the component detected is
saved.
125
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.
sub_img_b = des_img_b - tst_img_b as shown in Fig. these results, yellow coloured bounding rectangle is used to
4 represent integrated circuits (IC), green colour is used for
Threshold (sub_img_b, 255 where pixel value greater capacitor, pink for the inductor, and red for the resistor.
than average pixel value). Paintbrush tool is usedto generate PCB images with missing
3. Store all pixel coordinates (x, y) in color_pix as sub components which are needed for testing this method. With
lists from sub_img_b, where sub_img_b[x][y] == the paintbrush tool, the bare PCB area from the PCB image is
255. color_pix = [[x1, y1], [x2, y2], [x3, y3], [xn, added on a component of the original PCB to create a PCB
yn]]. image with the missing component. Using this technique, the
4. Pass des_img, tst_img, color_pix to predict function following three sets of Test PCBs were created:
shown in Fig. 5.
5. The data obtained after the detections and 1. Test Set1: PCBs with one missing component
classifications in des_imgis saved in idx (idxcontains 2. Test Set2: PCBs with two missing components
coordinates of each detections) and classIDs (all the 3. Test Set3: PCBs with three missing components
labels). An example of PCB image from Test Set1, Test Set2 and Test
6. Flatten idx, iterate over all boxes using x,y,w,h for Set3 is given in Fig. 8 a), Fig. 8 b), and Fig. 8 c), respectively.
each box. Note: The output images are cropped and enlarged to
Check each pixel residing inside a bounding box with showcase the predictions clearly.
the color_pix to check any presence of colour pixels.
If any pixel coordinates inside the box are matched
with the colour pixel coordinate, set flag equal to 1.
for Nth box:
Flag = 0
[y_idx, x_idx] = [iterated y coordinate for Nth box,
iterated x coordinate for Nth box]
[x_pix, y_pix] = [iterated sub list from color_pix]
If for any [y_idx, x_idx] == [x_pix, y_pix]:
Set Flag = 1
The coordinate axis is inverted with respect to the
pixel axis, hence the syntax followed here is (y, x) as
shown in Fig. 6
Fig. 7. a) Output 1
III. RESULTS
The following results were obtained after testing the system
where some of the test cases are shown below. The resultant
output images have the detected and classified components as
shown in Fig. 7 (a) to Fig. 7 (d) from the yolov3 model. In
126
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.
Fig.7. c) Output 3 Fig. 8. c) 3 missing components
Fig. 8. Fault detection on test PCB image (missing indicated by a red circle)
IV. OBSERVATIONS
The algorithm was tested using 20 PCB images in which
the set was divided into 1 missing, 2 missing and 3 missing
component(s). The validation was also done with PCB images
which had different orientations, one of which is shown in Fig.
7 c). The component(s) which are absent, are accurately
detected and classified after obtaining the detections and
classifications from the object detection model. The algorithm
responsible for the detection and classification of the missing
component is dependent on the trained object(component)
Fig. 7. d) Output 4
detection model. Moreover, the algorithm correctly displays
Fig. 7. Output of YOLOv3 the missing components and their location as shown in Fig. 8
a) to Fig. 8 c). From Fig. 9, it is observed that the loss at epoch
number 4000 was the least, and hence, weights obtained at
4000 epochs were chosen. However, the model was trained up
to 5000 epochs, but overfitting was observed after 4000. The
loss in Yolo is calculated by using sum of squared errors as
shown in (2).
= ∑ !( ̅ ) (2)
Fig. 8. b) 2 missing components TABLE III. represents the results obtained from the validation
of PCB-Fireusinga confusion matrix. Where, TP, FP, and FN
represent True Positives, False Positives, and False Negatives,
respectively.
127
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.
problems like misorientation of components, inspecting single
TABLE III. Results from Test Set layer PCB faults, misplacement of components, i.e. if a wrong
component is soldered instead of the actual required one. The
Components TP FP FN Total Accuracy
inspection of the single layer PCB would involve inspection of
Capacitor 105 4 18 127 82.67% tracks which has multiple classes like short, open, and pin-
Resistor 39 3 14 56 69.64% hole defect. Furthermore, the accuracy and speed of
component detection can be increased by using YOLOv4
Inductor 7 3 3 13 53.84%
instead of YOLOv3 (which has been used in our method).
IC 139 2 4 145 95.8%
REFERENCES
The overall accuracy of the algorithm obtained by testing
[1] PR Newswire, July 2019 [online], Available:
20 PCB images is 75.48%.
https://www.prnewswire.com/news-releases/global-printed-circuit-
board-pcb-market-expected-to-reach-an-estimated-89-7-billion-by-
A. Comparison with existing solutions 2024--with-a-cagr-of-4-3-from-2019-to-2024--300879227.html
[2] Pallavi.M.Taralkar, Swati.D.Patil “Image Processing based PCB
The current techniques used for finding missing Component Detection”, International Journal of Scientific
components only use image-processing. Many researchers [2, Research and Review (IJSRR) – Volume 07 Issue 02 - 2018.
3, 6] present solutionsthat use image subtraction to carry out [3] Jinay Nahar, Anuradha C. Phadke, “Computer Aided System for
missing component detection along with some other image- Inspection of Assembled PCB”, Third International Conference on
processing techniques. Whereas, PCB-Fire detects the missing Intelligent Computing and Control System (ICICCS 2019)
components and classifies them using a combination of deep [4] Vikas KrishnajiSalunkhe, Babasaheb Gopal Patil, Suryakant R
learning, image subtraction and pixel manipulation as its Dodmise, Neeraj Raavsaheb Patil, “A Review on Study of Fault
foundation as compared to the method proposed by Y. Lin, et Detection System for Assembled PCB”, International Journal of
al [9], where only the types of capacitor is being detected. Engineering Trends and Technology (IJETT) – Volume 34
Number 3- April 2016.
[5] S.Sridevi, G.Muralidharan, C.Nandha Kumar, “Online Inspection
PCB-Fire presents a novel solution as it optimizes the
of Printed Circuit Board Using Machine Vision”, 2014
object detection model trained on full board images to work International Conference on Innovations in Engineering and
with subtracted images. As the training was done on limited Technology (ICIET’14).
open source images, it lags behind with the detection problem, [6] Manasa H R, Anitha D B, “Fault Detection of Assembled PCB
which the authors solved by pixel manipulation and through Image Processing using LABVIEW”, International
comparison. The algorithm provides a new insight into the Journal of Engineering Research and Technology (IJERT) –
currently used techniques and provides a base to future Volume 05 Issue 05 – May 2016.
research projects pertaining to object detection. [7] S.H.InderaPutera, Z.Ibrahim, “Printed Circuit Board Defect
Detection Using Mathematical Morphology and MAT LAB Image
V. CONCLUSION Processing Tools”, 2010 2nd International Conference on
Education Technology and Computer (ICETC).
In this paper, a sublime solution to facilitate the inspection [8] Jithendra P R Nayak, Parameshachari B D, K M SunjivSoyjaudah,
of faulty PCBs was introduced. Furthermore, a novel “Identification of PCB Faults using Image Processing”, IEEE 2017
algorithm using image subtraction and pixel manipulation for International Conference on Electrical, Electronics,
detecting and classifying the missing componentswas Communication, Computer and Optimization Techniques
proposed. The algorithm was validated by testing multiple (ICEECCOT)
images by manually adding bare components on the original [9] Y. Lin, Y. Chiang and H. Hsu, "Capacitor Detection in PCB Using
PCBs. Considering the long-term losses of machinery and YOLO Algorithm," 2018 International Conference on System
electronics after installing a faulty/unfinished PCB, this Science and Engineering (ICSSE), New Taipei, 2018, pp. 1-4, doi:
solution aims to reduce the loss of capital and time incurred 10.1109/ICSSE.2018.8520170
while identifying the fault. The model is giving an accuracy of [10] PCB DSLR Dataset [online] Available:
https://cvl.tuwien.ac.at/research/cvl-databases/pcb-dslr-dataset/
75.48%.
[11] Joseph Redmon, Ali Farhadi “YOLOv3: An Incremental
Improvement”
VI. FUTURE SCOPE [online] Available: https://pjreddie.com/darknet/yolo/
[12] Sambasivarao. K, ‘Non-Maximum Suppression’, 2019, [online],
This paper intends to present the solution of a frequent day Available:
to day problem faced by the PCB manufacturing industry. https://towardsdatascience.com/non-maximum-suppression-nms-
However, the reach of the method is not limited to just 93ce178e177c
inspecting the missing components and classifying them. The [13] Tzutalin, Labelimg, [online], Available:
https://github.com/tzutalin/labelImg
algorithm can be further optimized and extended to inspect
128
Authorized licensed use limited to: UNIVERSITY OF NEW MEXICO. Downloaded on May 15,2021 at 12:33:10 UTC from IEEE Xplore. Restrictions apply.