Instructions to use RodrigoQuelhas/hyrox-wallballs-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use RodrigoQuelhas/hyrox-wallballs-detection with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("RodrigoQuelhas/hyrox-wallballs-detection", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
HYROX wall balls detection
Detects the medicine ball and the wall target in footage of HYROX wall balls. Built for a phone app that counts reps.
Not affiliated with or endorsed by HYROX.
detector-416.onnx on throws from four of our recordings, at their own speed. A ball is boxed in orange from a score of 0.3, a target in blue from 0.7. The four recordings are in the training data. A target the ball covers by half or more has no box, as in the training labels.
Labels
| id | name | what it is |
|---|---|---|
| 0 | ball |
the medicine ball, in the hands or in the air |
| 1 | target |
the mark or plate on the wall the ball must hit |
Files
The same model at three input sizes, and its weights. This is revision v10, trained on 14 November 2026.
| file | input | use |
|---|---|---|
detector-320.onnx |
320 | fastest, for a window around the target or tiles of the frame: the whole frame at 320 shows each object at half the size the model learnt |
detector-416.onnx |
416 | faster, for every frame of a video |
detector-640.onnx |
640 | more detail, for small or distant targets |
detector.pt |
640 | the trained weights, to fine-tune or to export at another size with Ultralytics |
Usage
With Ultralytics:
from ultralytics import YOLO
model = YOLO("detector-416.onnx", task="detect")
model.predict("frame.jpg", imgsz=416, conf=0.8, iou=0.1, save=True) # writes runs/detect/predict/frame.jpg
Without it, with numpy, onnxruntime and opencv-python, python detect.py frame.jpg writes boxed.jpg:
import sys
import cv2
import numpy as np
import onnxruntime as ort
SIZE = 416 # 640 for detector-640.onnx
LABELS = ["ball", "target"]
image = cv2.imread(sys.argv[1])
# Shrink a picture wider than 640 pixels to 640 across, the width of the training frames.
if image.shape[1] > 640:
image = cv2.resize(image, (640, round(image.shape[0] * 640 / image.shape[1])))
# Fit the picture into a grey square, without stretching it.
scale = SIZE / max(image.shape[:2])
h, w = round(image.shape[0] * scale), round(image.shape[1] * scale)
dx, dy = (SIZE - w) // 2, (SIZE - h) // 2
square = np.full((SIZE, SIZE, 3), 114, np.uint8)
square[dy : dy + h, dx : dx + w] = cv2.resize(image, (w, h))
pixels = square[:, :, ::-1].transpose(2, 0, 1)[None].astype(np.float32) / 255
# Each column is a candidate: centre x, centre y, width, height, then a score per label.
out = ort.InferenceSession(f"detector-{SIZE}.onnx").run(None, {"images": pixels})[0][0]
label, score = out[4:].argmax(0), out[4:].max(0)
boxes = np.stack([out[0] - out[2] / 2 - dx, out[1] - out[3] / 2 - dy, out[2], out[3]], 1) / scale
# Keep the candidates scoring 0.8 or more, and the best of those covering one object.
for i in cv2.dnn.NMSBoxesBatched(boxes, score, label, 0.8, 0.1):
x, y, bw, bh = map(int, boxes[i].round())
cv2.rectangle(image, (x, y), (x + bw, y + bh), (0, 200, 255), 2)
cv2.putText(image, f"{LABELS[label[i]]} {score[i]:.2f}", (x, max(y - 5, 15)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 200, 255), 2)
cv2.imwrite("boxed.jpg", image)
Training
Fine-tuned from Ultralytics' YOLO11n COCO weights, on wall-ball frames checked by hand and frames labelled with SAM 3. The training frames are not published.
Licence
AGPL-3.0, inherited from the Ultralytics YOLO11 weights.
- Downloads last month
- 21
Model tree for RodrigoQuelhas/hyrox-wallballs-detection
Base model
Ultralytics/YOLO11