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.
Once positioned, the system extracts six specific features designed to characterize the joint's physical and statistical properties:
- Normalized Area: The total pixel count of the solder joint.
- Circumference: Measured using Euclidean metrics and chain codes.
- Hydraulic Radius: The ratio of the area to the circumference.
- Sphericity: A measure of how closely the joint's shape resembles a perfect circle.
- 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.
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