TokenPose: Learning Keypoint Tokens for Human Pose Estimation

Yanjie Li, Shoukui Zhang, Zhicheng Wang, Sen Yang, Wankou Yang, Shu-Tao Xia, Erjin Zhou

Abstract

TokenPose reimagines human pose estimation by treating each anatomical keypoint (like an elbow or ankle) as a learnable "token" within a Transformer architecture. By allowing these keypoint tokens to interact with image patches and each other, the model explicitly learns both visual cues and anatomical constraints, achieving state-of-the-art accuracy with up to 80% fewer parameters than traditional CNN-based models.

Introduction

In 2D human pose estimation, the goal is to locate specific joints (keypoints) on a human body. Traditionally, this is done using Convolutional Neural Networks (CNNs) that output heatmaps. While CNNs are excellent at capturing local visual patterns, they have a "locality bias"—they struggle to explicitly model the global anatomical relationships between parts, such as the inherent symmetry between left and right shoulders or the proximity of a foot to a knee.

Most CNN-based methods lack concrete variables to represent these keypoint entities during intermediate processing. TokenPose addresses this by using the Transformer's self-attention mechanism to capture long-range dependencies and explicit part-to-part constraints through a novel token-based representation.

Methodology

The core innovation of TokenPose is the Token-based Keypoint Representation. The architecture consists of three main components:

  1. Tokenization: The model utilizes two distinct types of tokens. Visual Tokens are derived by splitting the input image (or a feature map from a CNN "stem") into patches, which are then flattened and projected into embeddings. Keypoint Tokens consist of a set of $N$ learnable embeddings, where each token represents a specific joint (e.g., "nose," "left hip").
  2. Transformer Encoder: Both visual and keypoint tokens are fed into a standard Transformer. Through self-attention, keypoint tokens "attend" to visual tokens to find appearance cues and to other keypoint tokens to learn anatomical constraints.
  3. Heatmap Estimation: The output keypoint tokens from the final Transformer layer are projected and reshaped into 2D heatmaps to determine the final coordinates.
The TokenPose architecture, illustrating the flow from image patches and keypoint tokens through Transformer layers to final heatmap prediction.

The authors explore both Pure Transformer variants, which take raw image patches, and Hybrid variants, which use a lightweight CNN backbone (like HRNet or a simple "stem-net") to extract initial features before tokenization.

Key Insights: Visual and Constraint Cues

TokenPose's performance stems from its ability to learn two types of cues simultaneously:

  • Explicit Constraint Learning: By visualizing the attention maps, the authors demonstrate that the model naturally learns "adjacency" (e.g., the ankle token attends to the knee) and "symmetry" (e.g., the left ankle attends to the right ankle). This mimics human reasoning when estimating pose for obscured joints.
  • Global-to-Local Convergence: In early Transformer layers, keypoint tokens look at the entire body to establish context. As the network goes deeper, the attention "converges" onto specific local regions to pinpoint the exact joint location.
Visualization of visual cues (attention maps across layers) and constraint cues (interactions between keypoint tokens).

Experimental Results

The models were evaluated on the COCO Keypoint Detection and MPII Human Pose datasets. TokenPose demonstrates an impressive trade-off between performance and efficiency:

  • Efficiency: TokenPose-S (Small) achieves 72.5 AP on COCO, comparable to a ResNet-50 baseline, but with an 80.6% reduction in parameters and a 75.3% reduction in GFLOPs.
  • Accuracy: TokenPose-L (Large) reaches 75.8 AP on COCO, putting it on par with state-of-the-art CNN models while remaining significantly more lightweight.
  • Pure Transformer Success: Even the "Pure" variant (TokenPose-T), which uses no convolution and is trained from scratch, achieves a respectable 65.6 AP, proving the viability of the token-based approach.

Conclusion and Future Work

TokenPose successfully bridges the gap between local visual processing and global anatomical reasoning. While highly efficient, future work remains in scaling small models more effectively and extending the representation to 3D pose estimation or video-based tracking. Additionally, optimizing the quadratic scaling of self-attention for higher resolutions remains a key area for improvement.

Summary updated

BibTeX
@inproceedings{li2021tokenpose,
  author = {Yanjie Li and Shoukui Zhang and Zhicheng Wang and Sen Yang and Wankou Yang and Shu-Tao Xia and Erjin Zhou},
  title = {{TokenPose: Learning Keypoint Tokens for Human Pose Estimation}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.01112},
}
Figure