pcb-defect-classification-eval
A PCB Dataset for Defects Detection and Classification — Huang et al. (2019) (arXiv:1901.08204, 2019)
What this evaluates
Evaluates a model's ability to classify six specific types of PCB manufacturing defects from cropped defect images. It probes the model's feature extraction and categorization capabilities on a specialized industrial computer vision dataset.
Datasets
- PCB Defect Dataset — total 5906; splits: train (3597), val (1161), test (1148)
Metrics
classification_precision_rate— range: percent- The ratio of correctly predicted defects of a specific type to the actual number of that defect type, multiplied by 100. Formula: $P_c = (c / a) \times 100%$, where $c$ is correctly predicted count and $a$ is actual count.
average_precision_rate(primary) — range: percent- The mean of the classification precision rates across all 6 defect types. Formula: $AP_c = (1/N) \sum_{i=1}^{N} P_c^i$, where $N=6$.
Input / output format
Input: Cropped 64x64 images of individual PCB defects, extracted using bounding box coordinates and optionally augmented with 5-10 pixel random offsets.
Output: A single class label from 6 categories: missing hole, mouse bite, open circuit, short, spur, spurious copper.
Scoring recipe
def compute_metrics(predictions, gold):
classes = ['missing_hole', 'mouse_bite', 'open_circuit', 'short', 'spur', 'spurious_copper']
precisions = []
for cls in classes:
actual = sum(1 for g in gold if g == cls)
if actual == 0: continue
correct = sum(1 for p, g in zip(predictions, gold) if p == cls and g == cls)
precisions.append(correct / actual * 100)
avg_prec = sum(precisions) / len(precisions)
return {'classification_precision_rate': precisions, 'average_precision_rate': avg_prec}
Common pitfalls
- Images are resized to 64x64 before classification, which may distort aspect ratios and affect feature extraction.
- Data augmentation applies random 5-10 pixel offsets to bounding boxes, meaning test images are not exact crops of the original dataset.
- The dataset contains synthesized/annotated defects, so performance may not generalize to real-world AOI images without domain adaptation.
Evidence (verbatim from paper)
The metrics of defect classification are the classification precision rate ($P_{c}$) of each type of defect and the average precision rate ($AP_{c}$). $P_{c}$ is defined in the following equation: $P_{c}=\frac{c}{a}\times 100%$ in which $c$ is the correctly predicted number of a defect type, and $a$ is the actual number of defects of this type. And the average precision rate ($AP_{c}$) is defined as: $AP_{c}=\frac{1}{N}\sum_{i=1}^{N}P_{c}^{i}$ where $P_{c}^{i}$ is the precision rate of $i^{th}$ defect, $N$ denotes the number of types of defects, which is 6 in this paper.
Citation
@misc{huang2019pcb,
title={A PCB Dataset for Defects Detection and Classification},
author={Huang et al. (2019)},
year={2019},
note={arXiv:1901.08204}
}
- arXiv: 1901.08204