Views
No views yet
1from ultralytics import YOLO
2import math
3
4model = YOLO("callumtilbury/bobnet-yolov26n/best.pt")
5results = model.predict("image.png", conf=0.34, max_det=300)
6
7# Convert bbox to diameter
8PIXEL_SIZE_UM = 0.0825
9for r in results:
10 for box in r.boxes.xywh.cpu().numpy():
11 w, h = box[2], box[3]
12 d_px = (min(w, h) + math.sqrt(w * h)) / 2
13 d_um = d_px * PIXEL_SIZE_UM
14 print(f"diameter = {d_um:.2f} um")| Metric | Value |
|---|---|
| diameter_mape | 1.10% |
| count_pct_diff | 4.25% |
| best_conf | 0.34 |
| model | yolo26n |
| n_train_images | 81 |
| epochs | 200 |
d_px = (min(w,h) + sqrt(w*h)) / 2, then d_um = d_px * 0.0825.callumtilbury/bobnet-bubbles (81 train images, 20 val images)