TrackNet tennis ball tracker (mirror)
Not trained by me. These are the published weights from yastrebksv/TrackNet, mirrored here so a deployment can pull every weight my tennis pipeline needs from one place. All credit for the model and its training belongs to the original author.
What it is
BallTrackerNet, 10.7M parameters. A VGG-style encoder with a deconv decoder -
a CNN, not a transformer. It takes three consecutive frames stacked into 9
channels at 360x640 and outputs a per-pixel classification over 256 intensity
levels; the ball is the argmax.
Three frames is the whole point. A tennis ball in broadcast footage is ~10 px and motion-blurred into a streak, frequently indistinguishable from a line marking in any single frame. Temporal context is what a per-frame detector like YOLO structurally cannot use.
Getting a position out of the heatmap
Taking the brightest pixel is fragile - one hot pixel on a shoe wins outright.
Better: threshold the heatmap, run cv2.HoughCircles, and take the circle
nearest the previous frame's ball. That uses blob shape and the fact that a
ball cannot teleport.
Origin
TrackNet: Huang, Liao, Chen, Ik, Peng (NCTU Taiwan), arXiv:1907.03698, AVSS 2019. The original was Keras; yastrebksv's is the PyTorch reimplementation these weights come from.
Trained on the TrackNet tennis dataset - 81 broadcast clips, 10 matches, 19,835 labelled frames.