Day 51: Ultralytics YOLO: setup, pretrained inference
YOLO in practice, in ten minutes
Ultralytics packages YOLO into a clean Python/CLI API. A pretrained YOLO model already detects 80 COCO classes — including 'person' — so you get useful person detection for FitXpert *before training anything*. Start here: confirm the tooling works and see real detections on your own photos.
from ultralytics import YOLO
model = YOLO("yolov8n.pt") # nano: small, fast, pretrained on COCO
results = model("customer_photo.jpg")
for r in results:
for box in r.boxes:
cls = model.names[int(box.cls)] # e.g. "person"
conf = float(box.conf)
xyxy = box.xyxy[0].tolist() # [x1, y1, x2, y2]
print(cls, round(conf, 3), xyxy)Model sizes: n / s / m / l / x
YOLO ships in sizes from nano (n, fastest, least accurate) to extra-large (x). Prototype with nano for speed, then pick the smallest size that meets your accuracy bar — the same speed/accuracy trade-off that runs through the whole roadmap. On the CPU droplet, nano or small is realistic; the bigger sizes want a GPU.
Key terms
- Ultralytics
- The library providing a high-level API and CLI for training and running YOLO models.
- COCO classes
- The 80 common object categories (including "person") that off-the-shelf detectors are pretrained on.
- Model size variants
- YOLO sizes n/s/m/l/x trading inference speed against accuracy.
Why can a pretrained YOLO model detect people in FitXpert photos before you train anything?