Ice hockey player identification via transformers

Kanav Vats, William J. McNally, Pascale Walters, David A. Clausi, John S. Zelek

Abstract

Identifying individual players in broadcast ice hockey footage is a fundamental challenge for automated sports analytics. This paper presents a transformer-based approach that leverages temporal context from player tracklets and external play-by-play data. By combining a ResNet-Transformer architecture with a multi-task learning objective and a novel "shift vector" prior derived from official NHL records, the system achieves a significant improvement in jersey number identification accuracy.

Introduction

In professional sports analytics, player identification is the prerequisite for downstream tasks such as tracking, fatigue analysis, and event recognition. However, the ice hockey environment presents unique difficulties: high player velocity, frequent occlusions, and varying camera angles that often render jersey numbers illegible in individual frames. Traditional methods relying on static images or recurrent neural networks often fail to capture the necessary temporal nuances or struggle with the high proportion of "empty" frames where no number is visible.

Methodology

Transformer-based Architecture

The core of the proposed system is a temporal feature extractor. As shown in Figure 1, the model processes a sequence of frames (a tracklet). Each frame is passed through a ResNet18 backbone to extract spatial features F. These features, augmented with position embeddings and a learnable class embedding, are fed into a Transformer Encoder. This architecture allows the model to selectively attend to frames where the jersey number is most prominent.

Figure 1: The transformer-based architecture for player identification, featuring a ResNet18 backbone and three MLP heads for holistic and digit-wise classification.

Multi-Task Learning and Weak Supervision

To improve the robustness of number recognition, the model employs three distinct MLP heads:

  1. $p_0$: Predicts the holistic jersey number (e.g., "97").
  2. $p_1$: Predicts the first digit.
  3. $p_2$: Predicts the second digit.

Furthermore, a weakly-supervised training strategy is used to address the data imbalance. A secondary, lightweight network pre-screens frames to identify those likely to contain a visible number, allowing for more efficient sampling during the training of the main transformer model.

Incorporating Player Shift Priors

A key innovation is the integration of external "cheat sheets" from official NHL play-by-play data. By using Optical Character Recognition (OCR) to extract the game clock from the broadcast, the system identifies the specific window of time. It then queries the NHL database to determine the subset of players (typically 5-6 per team) legally on the ice. This information is encoded into a "shift vector" $v_a$, which is used to mask the model's raw probability distribution $p_{jn}$, effectively eliminating impossible candidates.

Experimental Setup

The model was evaluated on a player identification tracklet dataset comprising 3,510 manually annotated tracklets from 84 broadcast NHL videos. The dataset includes 86 jersey number classes and a "null" class for frames without visible numbers. Notably, the "null" class accounts for over 50% of the data, highlighting the necessity of the temporal attention mechanism.

Results and Discussion

The integration of temporal context and external priors yielded substantial performance gains. The transformer model outperformed baseline 1D CNN architectures by 10.1%. The addition of the shift vector prior provided an additional 6% boost, resulting in a final mean accuracy of 87.97%.

Figure 3: Visualization of the effect of the shift vector prior. The raw probability $p_{jn}$ (blue) shows multiple peaks, while the filtered distribution $p_{jn} \odot v_a$ (orange) correctly isolates the true jersey number by zeroing out players not currently on the ice.

As illustrated in Figure 3, the shift vector acts as a powerful filter. In scenarios where visual evidence is ambiguous (leading to multiple peaks in the raw prediction), the external data provides the necessary context to disambiguate the player's identity.

Conclusion

This work demonstrates that player identification in challenging broadcast environments can be significantly improved by moving beyond pure computer vision. By combining the temporal modeling capabilities of transformers with domain-specific external data, we can overcome visual ambiguities. Future research will explore the inclusion of player positional roles (e.g., defenseman vs. forward) as additional spatial priors to further refine identification in cases of total occlusion.

Summary updated

Abstract

Identifying players in video is a foundational step in computer vision-based sports analytics. Obtaining player identities is essential for analyzing the game and is used in downstream tasks such as game event recognition. Transformers are the existing standard in Natural Language Processing (NLP) and are swiftly gaining traction in computer vision. Motivated by the increasing success of transformers in computer vision, in this paper, we introduce a transformer network for recognizing players through their jersey numbers in broadcast National Hockey League (NHL) videos. The transformer takes temporal sequences of player frames (also called player tracklets) as input and outputs the probabilities of jersey numbers present in the frames. The proposed network performs better than the previous benchmark on the dataset used. We implement a weakly-supervised training approach by generating approximate frame-level labels for jersey number presence and use the frame-level labels for faster training. We also utilize player shifts available in the NHL play-by-play data by reading the game time using optical character recognition (OCR) to get the players on the ice rink at a certain game time. Using player shifts improved the player identification accuracy by 6%.
BibTeX
@inproceedings{vats2022ice,
  author = {Kanav Vats and William J. McNally and Pascale Walters and David A. Clausi and John S. Zelek},
  title = {{Ice hockey player identification via transformers}},
  booktitle = {Workshops @ CVPR},
  year = {2022},
  doi = {10.1109/cvprw56347.2022.00389},
}
Figure