This is a command-line tool used to draw bounding boxes around players, basketballs, and referees.
- Clone the repo:
git clone https://github.com/yourusername/basketball-tracker.git cd basketball-tracker
- Create a virtual environment
python3 -m venv venv source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
python detector.py \ --source /path/to/game.mp4 \ --model /path/to/basketball_tracker.pt \ --output_dir /path/to/annotated_videos \ --confidence 0.5
- --source (-s): Path to the input video file
- --model (-m): Path to model weights
- --output_dir (-o): Directory to save annotated videos
- --confidence (-c): Minimum confidence threshold required to draw bounding boxes (0 - 1)
The aim of this project was to analyze the effects of downscaling and background subtraction on the inference accuracy of YOLOv8. 1408 frames at 1080p were annotated and used in training. The experiment looked at two values of 'imgsz' parameter: 640 (default) and 1920. It also looked at training with and without a Gaussian Mixed Model subtraction mask applied to the images. Overall four pair groups:
- 640 w/o mask
- 640 w/ mask
- 1920 w/o mask
- 1920 w/ mask
GMM Background Subtraction Mask Applied:
![]()
At lower resolutions, the mask helped improve performance metrics across the board. However, at higher resolutions, the mask had no statistically significant effect. Moreover, the models that did not downscale the images performed better. Therefore, the model used for this tool is the one with no downscaling and no mask, i.e., model 3.
Luis Angeles Feel free to open issues or pull requests.