MCPcopy Create free account
hub / github.com/AggieSportsAnalytics/CourtCheck / __init__

Method __init__

backend/models/player_tracker.py:76–95  ·  view source on GitHub ↗

Initialize player tracker with a YOLOv8-Pose model. Using a pose model allows extracting 17 body keypoints per player per frame in the same inference pass — no extra compute cost. Args: model_path: Path to the YOLOv8-Pose model (e.g. 'yolov8m-pose.pt').

(self, model_path='yolov8m-pose.pt', device='cuda', imgsz: int = 1280, conf: float = 0.05)

Source from the content-addressed store, hash-verified

74
75class PlayerTracker:
76 def __init__(self, model_path='yolov8m-pose.pt', device='cuda', imgsz: int = 1280, conf: float = 0.05):
77 """
78 Initialize player tracker with a YOLOv8-Pose model.
79
80 Using a pose model allows extracting 17 body keypoints per player
81 per frame in the same inference pass — no extra compute cost.
82
83 Args:
84 model_path: Path to the YOLOv8-Pose model (e.g. 'yolov8m-pose.pt').
85 device: 'cuda' or 'cpu'
86 imgsz: YOLO inference resolution. Should match input video resolution
87 to avoid downscaling small far-player detections below threshold.
88 conf: Detection confidence threshold. Lower values surface more
89 candidates (needed for small far-court players).
90 """
91 self.model = YOLO(model_path)
92 self.imgsz = imgsz
93 self.conf = conf
94 if device == 'cuda':
95 self.model.to(device)
96
97 # Dedicated detector for near-player recovery (predict-only). Kept
98 # separate from self.model so its stateless predict() calls never

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected