Instructions to use ParsaVictor/pcb-component-detection-yolo26 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use ParsaVictor/pcb-component-detection-yolo26 with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("ParsaVictor/pcb-component-detection-yolo26", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
PCB Component Detection (YOLO26s, two-stage)
Two YOLO26s detectors that find and name electronic components on full-resolution PCB photos, plus two Random-Forest refiners for explainable type correction.
Part of the PCB Inspection Suite. Trained on ParsaVictor/pcb-component-detection (458 boards, 108k annotated components, tiled at native resolution β not downscaled to 640px).
Why two stages
Board photos are 2000-4900px wide. Downscaled to 640px, a 0402 resistor is ~6px and undetectable. Tiling at native resolution (1024px tiles) gives ~19px parts instead. Finding where a component is turns out to be far easier than naming it, so:
any_best.ptβ 1-class locator ("component"): finds every element on the board, whatever it is.fine_best.ptβ 13-class typer: names the type, initialised from the locator's weights.tree_rf.joblib/tree_rf_boards.joblibβ Random-Forest classifiers (33 hand-engineered CV features) that refine uncertain type predictions in an explainable way (93% holdout accuracy on isolated photos, 89% at pβ₯0.5 on training-board crops).
Metrics
| Model | Split | P | R | mAP50 | mAP50-95 |
|---|---|---|---|---|---|
| any (locator) | val (best epoch) | 0.773 | 0.771 | 0.809 | 0.427 |
| any (locator) | test (46 unseen boards) | 0.726 | 0.693 | 0.732 | 0.376 |
| fine (13-class typer) | test | 0.488 | 0.470 | 0.432 | 0.263 |
Per-class (fine, test)
| Class | P | R | mAP50 |
|---|---|---|---|
| IC | 0.792 | 0.871 | 0.826 |
| Electrolytic Capacitor | 0.903 | 0.618 | 0.744 |
| LED | 0.887 | 0.477 | 0.652 |
| Connector | 0.502 | 0.665 | 0.538 |
| Switch/Button | 0.158 | 0.545 | 0.520 |
| Capacitor | 0.523 | 0.610 | 0.504 |
| Resistor | 0.499 | 0.467 | 0.426 |
| Marker | 0.597 | 0.312 | 0.381 |
| Transistor | 0.355 | 0.488 | 0.324 |
| Oscillator | 0.431 | 0.381 | 0.299 |
| Other | 0.288 | 0.284 | 0.204 |
| Inductor | 0.226 | 0.201 | 0.125 |
| Diode | 0.182 | 0.189 | 0.067 |
Trained: YOLO26s, imgsz 1024, 80 epochs, Tesla T4.
Usage
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
any_w = hf_hub_download("ParsaVictor/pcb-component-detection-yolo26", "any_best.pt")
fine_w = hf_hub_download("ParsaVictor/pcb-component-detection-yolo26", "fine_best.pt")
locator = YOLO(any_w) # every element, type unknown
typer = YOLO(fine_w) # 13-class type detector
results = typer.predict("your_board_photo.jpg", conf=0.20)
results[0].show()
Board photos are large β tile at 1024px (matching training) rather than resizing the whole image for best results. See the GitHub repo for the full two-stage + Random-Forest refinement pipeline (predict.py).
Related
- Training dataset: pcb-component-detection
- Full pipeline + notebooks: GitHub: pcb-component-detection-yolo26
- Sibling models: pcb-bare-board-defect-detection-yolo26, pcb-solder-defect-detection-yolo26
- Full suite overview: pcb-inspection-suite
License
Research/development use β see the dataset license. Contact the author before commercial use.
- Downloads last month
- 109