Downloads · 30 days
27
23% of all-time downloads
kjfk/tennis-ball-detector-yolov8
tennis-ball-detector-yolov8 is a object detection model from kjfk. Use it when you need objects located in an image. It is set up for ultralytics. The card lists the license as agpl-3.0.
Detects the tennis ball in broadcast footage. Fine-tuned from YOLOv8m.
Downloads · 30 days
27
23% of all-time downloads
All-time downloads
115
Public
Repo size
52 MB
Likes
0
Public
Click a slice to open those files.
.pt52 MB · 100%
From the Hugging Face model README
Detects the tennis ball in broadcast footage. Fine-tuned from YOLOv8m.
Same held-out validation set, before and after fine-tuning, at imgsz=960:
| metric | baseline | fine-tuned |
|---|---|---|
| mAP50 | 0.5878 | 0.8996 |
| mAP50-95 | 0.2212 | 0.4581 |
| precision | 0.633 | 0.925 |
| recall | 0.581 | 0.871 |
A tennis ball is ~15 px in a 1080p frame. YOLO's default imgsz=640 letterboxes
it to ~5 px. Raising inference resolution to 960 took detection from 47% to
95.6% with no retraining at all. This 26M-parameter model then beat an
86M-parameter baseline, largely by being trained at the resolution it is served
at.
The optimum tracks apparent ball size, not image size: 960 suits a tight amateur clip, while a wide broadcast shot wants 1600. Sweep it for your footage.
from ultralytics import YOLO
model = YOLO("ball_finetuned.pt")
results = model.predict(frame, imgsz=1600, conf=0.02)
Use a low confidence floor and resolve which candidate is the ball from the whole trajectory rather than per frame - a per-frame argmax picks line markings and shoes.
AGPL-3.0, inherited from Ultralytics YOLOv8.