Skip to content

🌀 [FEATURE] Add NBA tracking data support #5

@UnravelSports

Description

@UnravelSports

🏀 Add NBA tracking data support

See this Jupyter Notebook in my feat/nba-dataset branch for my current progress.


The NBA-Player-Movements repository contains a full seasons' worth of NBA tracking data.

The general outline of this implementation should follow the existing American Football (BigDataBowl) implementation, because it has a Polars back-end.

  • Create a basketball folder in unravel
  • Create a BasketballDataset class that supports both a string parameter to directly load a single 7zip file from the specified url, and a game identifier (in the repository they use Celtics@Lakers for example, not sure if this is optimal if we want to load all games, one by one).
  • This dataset class should help us load the data with Polars (see BigDataBowlDataset) and internally convert it to the correct format, and field dimensions. This requires a BasketballPitchDimensions class.
  • It also requires a row-wise Polars dataframe with a similar structure to the BigDataBowl data (ie, 1 row per player, per frame with game_id, frame_id, team, player, x, y at a minimum).
    I'm not exactly sure what variables are available in the existing dataset, so we might need to add speed, vx, vy or direction of travel, team in possession or a way to infer the closest player to the ball as we do in the soccer converter etc. It doesn't have to follow the exact formatting of the BigDataBowl dataset, but it's a good reference point.
  • We'll also need a BasketballGraphSettings class to store any settings.
  • Finally we'd need a BasketballGraphConverter class to help us convert into Graphs. Again, this requires a similar approach as the AmericanFootballGraphConverter. Perhaps some parts can be refactored into a parent class.
  • Add the relevant imports to the relevant __init__.py files
  • Add tests for all functionality see the tests folder for reference.

This implementation requires some research into the existing code, because I don't know if the data has on-ball events that might be useful for label creation, an attacking team flag etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions