Skip to content

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿˆ The Playmakers

Real-Time NFL Player Position Classification

A deep learning framework for identifying player positions from pre-snap formations using contextual object detection

John Michael Slezak, Atif Khan, Chenhao Lu, Ruida Zeng

Department of Computer Science, Brown University

Paper Python YOLOv8 License

Overview | Features | Installation | Project Structure | Results | Citation


Overview

Playmakers is a computer vision framework for classifying NFL player positions from pre-snap formations using YOLOv8. The unique challenge is that all players appear visually similarโ€”the model must learn from spatial context and positioning rather than individual features.

  • โœ… Context-Aware Detection โ€” Leverages player positioning and formation patterns
  • โœ… Real-Time Performance โ€” Optimized for live game footage analysis
  • โœ… Custom Dataset โ€” 503 annotated images from NFL championship games
  • โœ… 8 Position Classes โ€” WR, CB, Safety, LB, RB, QB, TE, Fullback

Features

๐ŸŽฏ End-to-End Pipeline

From data preprocessing to real-time inference, all components are production-ready.

๐Ÿ“Š Custom Dataset

Processed NFL footage from 2024 Super Bowl + AFC/NFC Championships with 500+ annotated images.

โšก Real-Time Inference

YOLOv8 architecture enables blazing fast predictions suitable for live analysis.

๐Ÿ“ˆ Comprehensive Evaluation

Detailed metrics including confusion matrices, F1 curves, and precision-recall analysis.


Installation

Prerequisites

  • Python 3.8+
  • CUDA-capable GPU (recommended for training)

Setup

# Clone the repository
git clone https://github.com/yourusername/the-playmakers.git
cd the-playmakers

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Download Dataset

The dataset can be downloaded from Roboflow or extracted from the zip files in WR/datasets/:

# Option 1: From Roboflow
from roboflow import Roboflow
rf = Roboflow(api_key="YOUR_API_KEY")
project = rf.workspace("cs-1430").project("wr-finder")
version = project.version(3)
dataset = version.download("yolov8")

# Option 2: Extract from included zip files
# Unzip WR/datasets/NewWRData.zip

Project Structure

the-playmakers/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ README.md                    # Project documentation
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt             # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore                   # Git ignore rules
โ”œโ”€โ”€ ๐Ÿ“„ Final Report.pdf             # Academic paper (PDF)
โ”œโ”€โ”€ ๐Ÿ“„ Final Poster.pptx            # Project poster presentation
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ WR/                     # Main project data and code
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ notebooks/               # Jupyter notebooks
โ”‚   โ”‚   โ”œโ”€โ”€ main.ipynb              # Data loading + color matching + YOLO detection
โ”‚   โ”‚   โ”œโ”€โ”€ WRYOLOCUSTOM.ipynb      # YOLOv8 training via Roboflow (primary)
โ”‚   โ”‚   โ”œโ”€โ”€ player_detection.ipynb  # YOLOv5 training pipeline
โ”‚   โ”‚   โ”œโ”€โ”€ test_vis.ipynb          # Model evaluation & visualization (Colab)
โ”‚   โ”‚   โ”œโ”€โ”€ newwr_test_vis.ipynb    # Model evaluation (local Windows)
โ”‚   โ”‚   โ””โ”€โ”€ field_filter.ipynb      # Field preprocessing experiments
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ images/                  # Sample images
โ”‚   โ”‚   โ”œโ”€โ”€ afc_championship_2024.jpg           # Input image (2024 AFC Championship)
โ”‚   โ”‚   โ”œโ”€โ”€ afc_championship_2024_processed.jpg # Processed output after filtering
โ”‚   โ”‚   โ”œโ”€โ”€ superbowl_lviii_detection_1.png     # Detection example (Super Bowl LVIII)
โ”‚   โ”‚   โ””โ”€โ”€ superbowl_lviii_detection_2.png     # Detection example (Super Bowl LVIII)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ datasets/                # Dataset archives
โ”‚   โ”‚   โ”œโ”€โ”€ NewWRData.zip           # Main dataset (train/val/test splits)
โ”‚   โ”‚   โ”œโ”€โ”€ runs.zip                # Training runs (weights, logs, metrics)
โ”‚   โ”‚   โ”œโ”€โ”€ WR Finder.v1i.yolov8.zip      # Roboflow YOLOv8 format
โ”‚   โ”‚   โ””โ”€โ”€ WR Finder.v1i.tensorflow.zip  # Roboflow TensorFlow format
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ scripts/                 # Python scripts
โ”‚   โ”‚   โ””โ”€โ”€ filter_field.py         # Standalone field filtering script
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ ๐Ÿ“ docs/                    # Additional documentation
โ”‚       โ””โ”€โ”€ color matching poster stuff.docx
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ Final Report/                # LaTeX source for academic paper
โ”‚   โ”œโ”€โ”€ main.tex                    # Main LaTeX document
โ”‚   โ”œโ”€โ”€ ProjectFinal_ProjectReportTemplate.bib    # Bibliography
โ”‚   โ”œโ”€โ”€ ProjectFinal_ProjectReportTemplate.pdf    # Compiled PDF
โ”‚   โ”œโ”€โ”€ architecture.png            # YOLOv8 architecture diagram
โ”‚   โ”œโ”€โ”€ confusion_matrix.png        # Classification confusion matrix
โ”‚   โ”œโ”€โ”€ confidence_curve.png        # F1-confidence curve
โ”‚   โ”œโ”€โ”€ precison_curve.png          # Precision-recall curve
โ”‚   โ”œโ”€โ”€ color_matching_1.png        # Color matching result example
โ”‚   โ”œโ”€โ”€ color_matching_2.png        # Color matching result example
โ”‚   โ”œโ”€โ”€ matches_1.png               # Correct detection example
โ”‚   โ”œโ”€โ”€ matches_2.png               # Correct detection example
โ”‚   โ”œโ”€โ”€ mismatch_1.jpg              # Incorrect detection example
โ”‚   โ”œโ”€โ”€ mismatch_2.jpg              # Incorrect detection example
โ”‚   โ”œโ”€โ”€ LabelingExample.png         # Roboflow labeling screenshot
โ”‚   โ””โ”€โ”€ [LaTeX style files]         # cvpr.cls, cvpr.sty, etc.
โ”‚
โ””โ”€โ”€ ๐Ÿ“ Templates/                   # Course templates (CS 1430)
    โ”œโ”€โ”€ README.md                   # Template instructions
    โ”œโ”€โ”€ ProjectFinal_ProposalTemplate.tex
    โ”œโ”€โ”€ ProjectFinal_ProgressReportTemplate.tex
    โ”œโ”€โ”€ ProjectFinal_ProgressReportTemplate.pdf
    โ”œโ”€โ”€ ProjectFinal_PosterTemplate.pptx
    โ”œโ”€โ”€ ProjectFinal_PresentationTemplate.pptx
    โ””โ”€โ”€ ProjectFinal_ProjectReportTemplate/

Notebooks Guide

Notebook Purpose Platform
main.ipynb Data exploration, color matching algorithm, base YOLO detection Colab
WRYOLOCUSTOM.ipynb Primary training notebook - YOLOv8 with Roboflow Colab
player_detection.ipynb Alternative YOLOv5 training (50 epochs) Colab
test_vis.ipynb Model evaluation with NMS + visualization Colab
newwr_test_vis.ipynb Same as above, configured for local execution Local
field_filter.ipynb Field preprocessing to remove logos/end zones Colab

Quick Start with Notebooks

# For Google Colab notebooks, upload to Colab and run
# For local notebooks:
cd "WR/notebooks"
jupyter notebook newwr_test_vis.ipynb

Note: Notebooks contain hardcoded paths for Google Drive or local directories. Update the base_dir and data_dir variables to match your setup.


Dataset Details

Archive Contents
NewWRData.zip 503 labeled images split into train/val/test in YOLO format
runs.zip Training outputs: model weights (best.pt), logs, metrics plots
WR Finder.v1i.yolov8.zip Roboflow export in YOLOv8 format
WR Finder.v1i.tensorflow.zip Roboflow export in TensorFlow format

Position Classes (8 total)

ID Position Description
0 Corner Back Defensive backs covering receivers
1 Fullback Offensive blocker/runner
2 Linebacker Middle defensive players
3 Quarterback Offensive play caller
4 Running Back Primary ball carrier
5 Safety Deep defensive backs
6 Tight End Offensive lineman/receiver hybrid
7 Wide Receiver Primary pass catchers

Results

Sample Detections

Performance Metrics

Metric Value
mAP@0.5 0.759
F1 Score 0.62 @ conf 0.229
Best Class (WR) 94.2% precision
Corner Back 88.5% precision
Safety 87.9% precision
๐Ÿ“Š View Detailed Evaluation Charts

F1-Confidence Curve

Precision-Recall Curve

Confusion Matrix


Methodology

Two Detection Approaches

1. Color Matching (Experimental)

Located in WR/notebooks/main.ipynb:

  • Converts images to LAB color space
  • Detects players by team jersey colors
  • Identifies offense by formation width
  • Finds WRs by edge positioning
  • Limitation: Sensitive to lighting, logos, end zones

2. YOLOv8 Object Detection (Primary)

Located in WR/notebooks/WRYOLOCUSTOM.ipynb:

  • Single-pass detection for real-time performance
  • Grid-based localization with non-max suppression
  • Trained on 503 custom-labeled images
  • 8 position classes

Team Contributions

Member Contribution
John Michael Slezak Dataset creation, 503 image labels, YOLO training, report writing
Atif Khan YOLO research & implementation, model training, technical docs
Chenhao Lu Detection research, pre-trained YOLO testing, color matching
Ruida Zeng Field filters, new dataset testing, results analysis, visualization

Future Directions

  • ๐Ÿ”„ Expanded Dataset โ€” More diverse formations and player setups
  • ๐Ÿค– Alternative Models โ€” Experiment with DETR or Swin Transformer
  • ๐Ÿ“น Player Tracking โ€” In-play movement analysis across frames
  • ๐ŸŽฎ Live Integration โ€” Real-time broadcast overlay support

Citation

@project{playmakers2024,
  title={The Playmakers: NFL Position Classification Through YOLO},
  author={Slezak, John Michael and Khan, Atif and Lu, Chenhao and Zeng, Ruida},
  institution={Brown University},
  course={CS 1430 Computer Vision},
  year={2024}
}

TA Mentor: Joel Manasseh | Professor: Srinath Sridhar

Brown University CS 1430 โ€” Computer Vision Final Project

For questions or suggestions, please reach out via GitHub Issues

About

A computer vision project that uses image recognition to identify wide-receivers.

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages