Football Player Detection (YOLO)

Ultralytics YOLO PyTorch License: MIT

1. Overview

This repository contains a YOLO object detection model fine-tuned for football (soccer) match analysis. The model localizes football players in broadcast or tactical camera angles.

2. Model Details

  • Architecture: YOLOv8 Nano (yolov8n.pt)
  • Task: Object Detection
  • Framework: PyTorch / Ultralytics
  • Input Resolution: 640x640
  • Epochs Trained: 100

3. Dataset

  • Format: YOLO txt annotations
  • Image Resolution: Resized to 640 pixels on the longest edge during training.
  • Augmentations: Mosaic (1.0), left-right flips (0.5), scaling (0.5), translation (0.1).

4. Training Configuration

Key hyperparameters extracted from args.yaml:

  • Epochs: 100
  • Batch Size: 16
  • Image Size: 640
  • Optimizer: Auto
  • Initial Learning Rate (lr0): 0.01
  • Final Learning Rate Fraction (lrf): 0.01
  • Momentum: 0.937
  • Weight Decay: 0.0005
  • NMS IoU Threshold: 0.7

5. Performance

Evaluation metrics at epoch 100:

  • Precision: 0.799
  • Recall: 0.752
  • mAP50: 0.711
  • mAP50-95: 0.443

6. Training Visualizations

Training Results
Training progression showing box, class, and DFL losses alongside precision, recall, and mAP metrics over 100 epochs.

Normalized Confusion Matrix
Normalized confusion matrix evaluating true positive predictions and background false negatives.

Precision-Recall Curve
Precision-Recall (PR) curve demonstrating the trade-off between precision and recall across confidence thresholds.

F1 Curve
F1-score curve illustrating optimal confidence thresholds.

7. Installation

pip install ultralytics torch torchvision

8. Usage

Python API

from ultralytics import YOLO

model = YOLO("weights/best.pt")
results = model("football.jpg")
results[0].show()

CLI

yolo task=detect mode=predict model=weights/best.pt source=football.jpg

9. Repository Structure

.
β”œβ”€β”€ weights/
β”‚   β”œβ”€β”€ best.pt
β”‚   └── last.pt
β”œβ”€β”€ args.yaml
β”œβ”€β”€ results.csv
β”œβ”€β”€ results.png
β”œβ”€β”€ confusion_matrix.png
β”œβ”€β”€ confusion_matrix_normalized.png
β”œβ”€β”€ BoxPR_curve.png
β”œβ”€β”€ BoxP_curve.png
β”œβ”€β”€ BoxR_curve.png
β”œβ”€β”€ BoxF1_curve.png
β”œβ”€β”€ labels.jpg
β”œβ”€β”€ val_batch0_pred.jpg
β”œβ”€β”€ val_batch1_pred.jpg
└── val_batch2_pred.jpg
Downloads last month
43
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support