Cricket ball detection (YOLOv8)

Fine-tuned YOLOv8 model for detecting cricket balls in video frames. Single class: ball (class id 0).

Training

Trained with model-finetuning/scripts/train_ball_detector_yolo.py on the Cricket Ball Dataset for YOLO (Kaggle).

Usage

With Ultralytics

from ultralytics import YOLO
model = YOLO("ashishgimekar/cricket-ball-yolo", trust_remote_code=True)  # or download and use path to best.pt
results = model("frame.jpg")

With this project's ball detector

Download the weight file first, or use the direct URL:

from scripts.ball_detector_yolo import run_ball_detection_on_video

# Option A: use HF URL (Ultralytics will download)
result = run_ball_detection_on_video(
    "clip.mp4",
    model_name="https://huggingface.co/ashishgimekar/cricket-ball-yolo/resolve/main/best.pt",
    ball_class_id=0,
)
# Option B: download then use local path
# huggingface-cli download ashishgimekar/cricket-ball-yolo best.pt --local-dir ./ball_model
# result = run_ball_detection_on_video("clip.mp4", model_name="./ball_model/best.pt", ball_class_id=0)
# result["ball_length"], result["ball_line"], result["detections_per_frame"]

Download only

huggingface-cli download ashishgimekar/cricket-ball-yolo best.pt --local-dir ./local_ball_model
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support