Welcome to Football Vision AI! This project is all about bringing the excitement of football to the world of AI. Our system uses cutting-edge computer vision techniques to detect players, referees, goalkeepers, and the ball, providing real-time visualizations and insights into the state of the game. Whether you're a football enthusiast, a data scientist, or just curious about AI, this project has something for you!
-
Player and Referee Detection: Our AI can accurately identify and track all players, referees and the ball on the field using YOLOv8n and BoTSORT.
-
Goalkeeper Identification: Distinguish goalkeepers from other players for specialized analysis.
-
Two teams Identification: Differentiate the two teams for targeted analysis using PCA and KMeans only.
-
Real-time Visualizations: Generate dynamic visual representations of the match state, making it easy to understand the flow of the game.
This project is an implementation based on a YouTube tutorial with some modifications and enhancements. You can watch the original tutorial here. Below are the key differences:
- Improved player and referee detection speed while maintaining accuracy by utilizing YOLOv8n instead of YOLOv8x.
- Enhanced keypoint detection efficiency without compromising accuracy by employing YOLOv8n Pose instead of YOLOv8x Pose.
- Improved players clustering algorithm by using PCA and K-Means on the cropped players without ReID.
- Optimized real-time visualizations.
Many visualization were taken from Supervision Repo.
Tracker used BoTSort
- Python 3.7+
- OpenCV
- NumPy
- scikit-learn
- ONNXRuntime
- Clone the repository:
git clone https://github.com/Supernova1744/Football_Vision_AI.git
- Navigate to the project directory:
cd Football_Vision_AI - Install the required dependencies:
pip install -r requirements.txt
- Prepare your video files.
- Run the main script:
python main.py --video videos\match1.mp4 - View the results in the
outputdirectory.
Check out a demo video of our system in action! Place your video oath in the --video flag for the main script to visualize the analysis.
If you have any questions or suggestions, feel free to open an issue or contact us at ali.samir.1744@gmail.com.