Downloads · 30 days
32
27% of all-time downloads
steven0226/pcb-defect-detection
pcb-defect-detection is a object detection model from steven0226. Use it when you need objects located in an image. It is set up for ultralytics. The card lists the license as agpl-3.0.
Ultralytics YOLO26 (NMS-free, end-to-end detection head) fine-tuned to detect 6 classes of bare printed-circuit-board defects: missinghole, mousebite, opencircuit, short, spur, spuriouscopper.
Downloads · 30 days
32
27% of all-time downloads
All-time downloads
117
Public
Repo size
58.6 MB
Likes
0
Public
Click a slice to open those files.
.onnx38.2 MB · 65%
From the Hugging Face model README
Ultralytics YOLO26 (NMS-free, end-to-end detection head) fine-tuned to detect 6 classes of
bare printed-circuit-board defects: missing_hole, mouse_bite, open_circuit, short, spur,
spurious_copper.
kuotunyu and Hugging Face steven0226 are the same author.Per-class recall approximates an inspection line's escape rate (missed defects that reach the next stage); precision approximates the false-kill rate that drives manual re-inspection cost. YOLO26's NMS-free head means the exported ONNX/TensorRT graph needs only a confidence-threshold filter at inference time - no separate NMS step to tune or maintain.
This model was trained with a board-grouped split (8 boards train / 1 val / 1 test - the test board's images never appear in training) rather than a random split, specifically to avoid the background leakage that inflates numbers when a random split lets the same physical board's background appear in both train and test.
| split strategy | mAP50 | mAP50-95 | test images | test instances |
|---|---|---|---|---|
| board-grouped (this model) | 0.8390 | 0.3881 | 120 | 358 |
| random (leakage control, separate model) | 0.9603 | 0.5082 | 72 | 284 |
The random-split control model scores 12.1 mAP50 points higher - that gap is background leakage, not a better model. The board-grouped numbers above are the honest ones to cite for this model's real-world generalization.
| class | AP50 | AP50-95 | precision | recall |
|---|---|---|---|---|
| missing_hole | 0.9806 | 0.5825 | 0.9072 | 0.9667 |
| mouse_bite | 0.9362 | 0.4563 | 0.9821 | 0.9141 |
| open_circuit | 0.8963 | 0.4960 | 0.9584 | 0.7802 |
| short | 0.5649 | 0.1282 | 0.7245 | 0.6271 |
| spur | 0.8632 | 0.3982 | 0.9335 | 0.7024 |
| spurious_copper | 0.7929 | 0.2677 | 0.8896 | 0.6717 |
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
path = hf_hub_download(repo_id="steven0226/pcb-defect-detection", filename="best.pt")
model = YOLO(path)
results = model.predict("your_pcb_image.jpg", conf=0.25)
An ONNX export (best.onnx, NMS-free e2e graph, (1, 300, 6) output = [x1, y1, x2, y2, conf, class_id] in letterboxed 640x640 coordinates) is also included for torch-free deployment - see
the GitHub repo's src/pcb_defect/e2e_onnx.py for a minimal ONNX Runtime inference pipeline
(this is also what the Space above runs).
HRIPCB / PKU-Market-PCB (693 images, 2,953 annotated defects, 10 template boards). The Kaggle mirror used to obtain this data lists its license as "Unknown" - cite the original paper:
Huang, W., & Wei, P. (2019). A PCB Dataset for Defects Detection and Classification. arXiv:1901.08204 (https://arxiv.org/abs/1901.08204).
short and spurious_copper are the weakest classes (see per-class table above) even after
full training - this is a real, repeatable finding (confirmed independently in a separate SAHI
slicing-inference ablation), not measurement noise.Code and weights are released under AGPL-3.0 (required by Ultralytics' YOLO26 license). Commercial use requires an Ultralytics Enterprise License.