YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
YOLOv11 Soccer Detection & Keypoints
Inference pipeline for soccer match images using two YOLOv11 models:
- Player / Ball / Referee detection β
yolov11_sahi_1280 - Field keypoint detection β
yolov11_keypoints_29(29 pitch keypoints)
Project Structure
yolo26_ball_player_keypoint_detection/
βββ inference.py
βββ original.jpg # default input image
βββ output.jpg # annotated output (generated)
βββ yolov11_sahi_1280/
β βββ Model/weights/best.pt
βββ yolov11_keypoints_29/
βββ Model/weights/best.pt
Requirements
- Python 3.8+
- Ultralytics
- OpenCV
pip install ultralytics opencv-python
Usage
Place your input image in the project folder (or update INPUT_IMAGE in inference.py), then run:
python inference.py
The script will:
- Run object detection at 1280px resolution (Player, Ball, Referee)
- Run keypoint detection (29 field keypoints)
- Draw both results on the image
- Save the annotated image to
output.jpg
Example output:
Input: .../original.jpg
Output: .../output.jpg
Detections: {'Referee': 2, 'Player': 14, 'Ball': 1}
Keypoint sets: 1
Keypoints per set: 29
Configuration
Edit the constants at the top of inference.py:
| Constant | Default | Description |
|---|---|---|
INPUT_IMAGE |
original.jpg |
Path to the input image |
OUTPUT_IMAGE |
output.jpg |
Path to save the annotated output |
PLAYER_CONF |
0.57 |
Minimum confidence for player detections |
DEFAULT_CONF |
0.25 |
Minimum confidence for ball and referee |
Models
Detection (yolov11_sahi_1280)
| Class | ID |
|---|---|
| Player | 0 |
| Ball | 1 |
| Referee | 2 |
Trained with SAHI-style slicing at 1280px resolution for better small-object detection (e.g. the ball).
Keypoints (yolov11_keypoints_29)
Pose model that detects 29 field keypoints per image (pitch lines, corners, penalty areas, etc.).
Goldenboy
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support