Based on the Improved K-nearest Neighbor Solder Joints Defect Detection

Meiju Liu, Lingyan Li, Wenbo Guo2016 · DOI

Abstract

Automatic Optical Inspection (AOI) systems for Printed Circuit Board (PCB) solder joints often struggle with defect misstatements and omissions. This paper proposes an improved K-nearest neighbor (KNN) method to enhance the testing and classification of solder joint quality. The process involves image pretreatment, template matching for positioning, and the extraction of six key geometric and statistical features. By mapping these features into a high-dimensional kernel space, the improved KNN algorithm achieves significantly higher accuracy and adaptability than traditional neural network approaches, while effectively reducing testing costs.

Introduction

In modern electronics manufacturing, the increasing density of components on PCBs has rendered manual visual inspection obsolete. Human inspectors are prone to subjectivity and fatigue, leading to inconsistent quality control. While Automatic Optical Inspection (AOI) systems have become industry standard, they are frequently plagued by environmental noise and complex lighting conditions, resulting in high false alarm rates ("misstatements") and, more critically, missed defects ("omissions").

Standard machine learning classifiers, such as the basic KNN algorithm, often fail in this domain because the boundaries between "normal" and "defective" solder joints are rarely linear. To address this, we propose an improved KNN algorithm that utilizes kernel-based mapping to handle non-linear complexities in a high-dimensional space.

Methodology

Image Preprocessing and Feature Extraction

The detection pipeline begins with capturing high-resolution images via industrial cameras. To isolate individual solder joints, a template-matching algorithm defines a Region of Interest (ROI) and uses shape-based contours to locate the exact center of each joint.

Example of a raw solder joint image captured for feature analysis.

Once positioned, the system extracts six specific features designed to characterize the joint's physical and statistical properties:

  1. Normalized Area: The total pixel count of the solder joint.
  2. Circumference: Measured using Euclidean metrics and chain codes.
  3. Hydraulic Radius: The ratio of the area to the circumference.
  4. Sphericity: A measure of how closely the joint's shape resembles a perfect circle.
  5. Moment & Central Moment: Statistical measures (mean and variance) of the gray-level distribution within the joint.

The Improved KNN Algorithm

The core innovation lies in mapping these six features into a high-dimensional kernel space ($\phi(x)$). In the original low-dimensional space, categories like "less solder" and "normal" may overlap or have complex boundaries. By transforming the data into a higher dimension, these categories become more linearly separable. The KNN classification is then performed within this transformed space using a distance formula optimized for high-dimensional vectors. This approach provides the flexibility of complex decision boundaries without the heavy computational training requirements of deep learning models.

Datasets and Experimental Setup

The study utilized a custom dataset of 299 solder joint samples. The training set consisted of 90 samples (26 "More solder," 23 "Less solder," and 41 "Normal"). The testing set comprised 209 samples. While the quantitative analysis focused on these three primary states, the system was also designed to recognize more complex defects such as bridging.

A defective solder joint exhibiting bridging (connection welding), a common failure mode in high-density PCBs.

Key Results

The Improved KNN algorithm (with $k=3$) was benchmarked against standard KNN, traditional AOI systems, and Back-Propagation (BP) Neural Networks.

Method Comprehensive Precision Mistake Rate Miss Rate
Improved KNN (Proposed) 99.043% 0.957% 0%
Standard KNN 96.172% 2.392% 0.479%
AOI System 95.694% 3.35% 0.478%
BP Neural Network 97.129% 3.349% 0.957%

The proposed method achieved a 99.043% precision rate and, most importantly, a 0% miss rate. In industrial quality assurance, a 0% miss rate is the gold standard, as it ensures that no defective boards reach the end customer, even if it results in a negligible number of false alarms.

Conclusion

The improved KNN algorithm demonstrates superior performance in solder joint defect detection compared to existing AOI and neural network methods. By leveraging high-dimensional feature mapping, the system provides a robust, cost-effective solution for high-precision electronics manufacturing. Future work will focus on optimizing the selection of the $K$ parameter and expanding the dataset to include a wider variety of complex defect types like matte surfaces and blistery solder.

Summary updated

Abstract

Aiming at the problems such as defect misstatements, omissions are prone to happen when automatic optical inspection (AOI) system detects Printed Circuit Board (PCB) solder joints. The article puts forward a kind of method based on improved K-nearest neighbor to test and classify the quality of solder joints. Firstly, the original images collected by industrial camera should be pretreated, and solder joints should be positioned by using the method of template matching. Secondly, the features of solder joints should be extracted and selected usefully through the experiments. Finally, the improved K-nearest neighbor algorithm based on effective feature is used to test and classify solder joints. Experiments show that the improved K-nearest neighbor algorithm has higher accuracy and stronger adaptability than neural network algorithm used for classification. What's more, the cost of testing is also reduced effectively. So we can conclude that the improved K-nearest neighbor algorithm is useful for solder joints testing.
BibTeX
@misc{liu2016based,
  author = {Meiju Liu and Lingyan Li and Wenbo Guo},
  title = {{Based on the Improved K-nearest Neighbor Solder Joints Defect Detection}},
  year = {2016},
  doi = {10.2991/emim-16.2016.136},
}
Figure