Skip to content

padex

Top-level API for running the Padex pipeline.

padex.pipeline.Padex

Top-level pipeline: video -> tracking -> bounces -> shots.

Parameters:

Name Type Description Default
video_path str | Path

Path to the input video file.

required
calibration CourtCalibration | str | Path | None

Court calibration — a CourtCalibration object, a Path to a calibration JSON, or None for auto-detection. If None, looks for <video_stem>_calibration.json next to the video.

None
enable_pose bool

Whether to run pose estimation (needed for shot classification). Defaults to True.

True
cache_tracking bool

Whether to cache tracking results as pickle for faster re-runs. Defaults to True.

True
cache_dir str | Path | None

Directory for tracking cache files. Defaults to output/ under the project root.

None

run()

Run the full pipeline: tracking -> bounce detection -> shot classification.

export_video(result, output_path, shot_display_ms=1500.0)

Export annotated video with shot labels overlaid.

Parameters:

Name Type Description Default
result PadexResult

PadexResult from run().

required
output_path str | Path

Path for the output video file.

required
shot_display_ms float

How long to display each shot label (ms).

1500.0

Returns:

Type Description
Path

Path to the exported video file.

padex.pipeline.PadexResult dataclass

Output of the full Padex pipeline.

padex.pipeline.process(video_path, calibration=None, event_model_path=None, **kwargs)

Convenience function: run the full Padex pipeline.

Parameters:

Name Type Description Default
video_path str | Path

Path to the input video file.

required
calibration CourtCalibration | str | Path | None

Court calibration (CourtCalibration, JSON path, or None).

None
**kwargs

Additional arguments passed to Padex().

{}

Returns:

Type Description
PadexResult

PadexResult with tracking, bounces, and shots.

padex.pipeline.export_video(result, video_path, output_path, **kwargs)

Convenience function: export annotated video.

Parameters:

Name Type Description Default
result PadexResult

PadexResult from process().

required
video_path str | Path

Path to the original video (for frame data).

required
output_path str | Path

Path for the output video file.

required
**kwargs

Additional arguments passed to Padex.export_video().

{}

Returns:

Type Description
Path

Path to the exported video file.