YOLOv8l Gymnastic Ball Detector

It's a specialized computer vision model for detecting balls in rhythmic gymnastics, additionally trained on a custom dataset. The model is based on YOLOv8l and is optimized for accurate detection of gymnastic balls in various conditions.

How to Use

The YOLOv8s model can be used via Python code using the Ultralytics library.

The final weights are available in the main directory of the repository:

Python Code

  • Dependencies
pip install ultralytics supervision huggingface_hub
  • Inference

Ensure the paths to the image and model files are correct.

from huggingface_hub import hf_hub_download
from ultralytics import YOLO

model_path = hf_hub_download(
  repo_id="fanoval7/yolo8l-gym-ball-detection", 
  filename="best.pt"
)
model = YOLO(model_path)

image_path = "your_image"

results = model.predict(image_path)
  • Visualization (Google Colab)
import cv2
from google.colab.patches import cv2_imshow
import numpy as np
from PIL import Image

for r in results:
    im_array = r.plot()
    im = Image.fromarray(im_array[..., ::-1])
    
    im_cv = cv2.cvtColor(np.array(im), cv2.COLOR_RGB2BGR)
    
    cv2_imshow(im_cv)
    
    for box in r.boxes:
        class_id = int(box.cls)
        confidence = float(box.conf)
        print(f"Обнаружен спортивный мяч с уверенностью {confidence:.2f}")

Author

Developer: Gilfanova Diana

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support