PCB Defect Detection Using Image Processing and CNN

Automated optical inspection (AOI) of bare printed circuit boards compares the scan of a produced board with a defect-free template (golden board). On the real DeepPCB data set (Tang et al. 2019: 1,500 template / test image pairs of 640 x 640 px, 10,013 annotated defects of six types - open, short, mousebite, spur, spurious copper and pin-hole) this project finds every defect with classical image processing (binarisation, template differencing, morphological opening, connected components) and then names its type with hand-written rules, hand-crafted features with Random Forest or gradient boosting, or a small convolutional neural network (CNN) that sees the test patch alone or together with the template patch. Unlike whole-image classification projects (E11 wafer maps, E10 traffic signs, C1 concrete cracks), E12 works on reference / test PAIRS and LOCALISES each defect with a box. Split by board design, on the held-out test groups the deployed two-channel CNN reaches an end-to-end F1 of 0.9157 [0.904, 0.927] and the feature + Random Forest model 0.9144 [0.903, 0.925] - a tie within the confidence intervals. A FastAPI web application with five interchangeable databases inspects boards, stores every defect and lets an operator review it; GNU Octave and OpenCV reproduce the image processing, and MATLAB and KiCad versions are included.

Category: Electronics and Communication Engineering

Electronics & Communication Engineering Project E12 from ProTechSC Academy, with graphical abstract, video demonstration and project guidance.