PCB defect detection: YOLO11n / YOLO11s, FP32 and INT8

Weights for the pcb-defect-optimization project: YOLO11 trained on PKU-Market-PCB (6 defect classes) at 1280Γ—1280, exported to ONNX and statically quantized to INT8 with ONNX Runtime.

Demo: https://huggingface.co/spaces/michaelandrew35/pcb-defect-detection
Code, method, full results and failure analysis: https://gitlab.com/michael.sucahyo/pcb-defect-optimization

Files

File Format Size Test mAP@0.5 Test mAP@0.5:0.95 CPU ms/img*
yolo11n_img1280.pt PyTorch (Ultralytics) 5.4 MB 0.967 0.557 282
yolo11n_img1280_fp32.onnx ONNX FP32 10.6 MB 0.965 0.556 261
yolo11n_img1280_int8_mixed.onnx ONNX INT8, detection head FP32 4.7 MB 0.967 0.555 217
yolo11s_img1280.pt PyTorch (Ultralytics) 18.4 MB 0.984 0.587 649
yolo11s_img1280_fp32.onnx ONNX FP32 36.6 MB 0.984 0.586 620
yolo11s_img1280_int8_mixed.onnx ONNX INT8, detection head FP32 12.4 MB 0.982 0.583 484

* Median forward-pass latency, 4 threads, AMD Ryzen 7 4700U, ONNX Runtime 1.20.1. Test split: 102 images.

Classes: missing_hole, mouse_bite, open_circuit, short, spur, spurious_copper. Input: 1Γ—3Γ—1280Γ—1280 RGB, letterboxed, scaled to 0–1. Output: 1Γ—10Γ—33600 (box xywh in input pixels + 6 class scores); apply NMS yourself or load with Ultralytics.

Usage

from ultralytics import YOLO
model = YOLO("yolo11n_img1280_int8_mixed.onnx", task="detect")
results = model.predict("board.jpg", imgsz=1280, conf=0.25)

A dependency-free ONNX Runtime + OpenCV version (letterbox, decode, NMS) is in the demo's app.py.

Why "head FP32"

Quantizing the whole graph scores 0 mAP: the final output concatenates box coordinates (0–1280 px) with class scores (0–1), and a single INT8 scale rounds every score to zero. Keeping the Detect head in FP32 fixes this at a cost of 0.07 (YOLO11n) / 0.37 (YOLO11s) mAP@0.5:0.95.

Limitations

Trained on PKU-Market-PCB, a public research dataset (no explicit license found; used for non-commercial research only). Not validated on production factory images. Weakest on very small spurs and on shorts / spurious copper that resemble normal traces.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using michaelandrew35/pcb-defect-yolo11 1