Views
No views yet
| Metric | Value |
|---|---|
| mAP@0.5 | 0.978 |
| False Positives (on test set) | 30 |
| Recall | 0.987 |
| Inference time (CPU) | 31 ms (baseline) / 628 ms (MCD) |
1from ultralytics import YOLO
2
3model = YOLO("oborxel/noBSPCB")
4results = model("path/to/pcb_image.jpg")1from ultralytics import YOLO
2import torch
3import numpy as np
4
5def enable_dropout(model):
6 for m in model.model.modules():
7 if isinstance(m, torch.nn.Dropout):
8 m.train()
9
10model = YOLO("oborxel/noBSPCB")
11model.model.eval()
12enable_dropout(model.model)
13
14num_passes = 30
15all_confs = []
16
17for _ in range(num_passes):
18 results = model("image.jpg", verbose=False)
19 if results[0].boxes is not None:
20 confs = results[0].boxes.conf.cpu().numpy()
21 all_confs.extend(confs)
22
23variance = np.var(all_confs) if all_confs else 0.0
24print(f"Uncertainty (variance): {variance:.4f}")
25print(f"Verdict: {'defect' if variance < 0.02 else 'uncertain'}")@software{noBSPCB,
author = {Chukhlov, Alexander},
title = {noBSPCB: PCB Defect Detection with Monte Carlo Dropout},
year = {2026},
url = {https://github.com/ex-alander/noBSPCB}
}