Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition
- Publication
- AAAI 2018Conference
- First submitted to arXiv
- arXiv:1801.07455
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{actionrecognitionstgcn2018,
title = {{Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition}},
author = {Sijie Yan and Yuanjun Xiong and Dahua Lin},
year = {2018},
eprint = {1801.07455},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1801.07455}
}
To recognize what someone is doing in a video, we can look at the images—or just the skeleton.
A skeleton is a sequence of joint coordinates. A pose estimator marks the head, shoulders, elbows, wrists, hips, knees and ankles in each frame. A ten-second video becomes a sequence of hundreds of frames with a dozen or so points each. The data is compact and unaffected by backgrounds and lighting; for bodily actions such as dancing, waving or falling, the skeleton alone provides many clues.
The skeleton is itself a graph: joints are nodes, bones are edges. Sijie Yan, Yuanjun Xiong and Dahua Lin at the Chinese University of Hong Kong bring GCN onto this graph, handling space and time together. They call it ST-GCN.
Defining the Problem
Earlier skeleton-based action recognition roughly followed two approaches.
One relied on handcrafted designs: divide the body into parts and manually define their relations, or compute features on joint trajectories. Changing datasets meant rewriting rules.
The other used RNNs or temporal convolutions, concatenating all joint coordinates in each frame into a long vector and processing it over time. This discards skeletal connectivity: the model must infer from data that the right elbow connects to the right wrist but not the left knee.
The desired model should use skeletal connections directly, learn spatial and temporal patterns together, and require no handcrafted body parts. GCN supplies a framework for graph convolution, but was designed for graphs such as citation networks. Applying it to skeletons raises another problem first.
Solving the Problem
A Spatiotemporal Graph
For a sequence of frames with joints each, the authors build an undirected spatiotemporal graph. Every joint in every frame is a node, totaling ; its features are coordinates plus pose-estimation confidence.
Edges come in two kinds. Within a frame, joints follow natural bodily connections; between adjacent frames, the same joint is connected over time. Kinetics uses 18 2D joints estimated by OpenPose, while NTU-RGB+D uses 25 3D joints tracked by Kinect. Connectivity comes from the data, without manually grouping body parts.

On Kinetics, one video's input tensor is . The 3 channels are , 18 is the joint count, and 2 means taking at most the two highest-confidence people per video. Each video is repeated to fill frames.
Who Gets Which Graph Weights?
Return first to ordinary 2D convolution. For a 3×3 convolution, output at position is:
The authors split this into two functions. Sampling function selects positions—the surrounding 9 pixels on an image. Weight function assigns weights to each position. A fixed image grid gives nine positions—upper left, directly above, upper right, and so on—each with its own weights, simply indexed from a tensor.
On a graph, sampling is easy: take neighbors within distance 1. Weight assignment is harder, because neighbors lack a fixed upper-left or directly-above order.
The solution is to partition neighbors into a fixed groups, label them, and share weights within each group:
maps each neighbor to a group, and is the group's node count, balancing contributions across groups. In this view, a 3×3 convolution partitions nine pixels into nine groups of one.
Time is simpler because it already has an order. Further indexing spatial groups by previous or following frames defines convolution over a spatiotemporal neighborhood. Temporal range is the temporal kernel size, set to 9 in the paper.
Three Partitions
The partition determines what the model can distinguish. The authors try three:

- Uni-labeling (panel b): the whole neighborhood is one group, . The authors identify this with Kipf and Welling's GCN propagation rule. Sharing weights across all neighbors amounts to averaging their features before an inner product, losing relative joint relationships.
- Distance partition (panel c): self forms one group and distance-1 neighbors another, . Separate weights can represent local differences such as self minus neighbors, including relative joint displacement.
- Spatial configuration partition (panel d): . Self forms one group; neighbors nearer the skeleton's center of gravity are centripetal; farther neighbors are centrifugal. The center is the mean joint coordinate in a frame, and is joint 's average distance to it over the training set. The motivation is that limb movements roughly divide into inward contraction and outward extension.
Partition a simplified six-joint skeleton by spatial configuration:
import numpy as np
np.set_printoptions(precision=2, suppress=True)
# Simplified skeleton: 0 neck, 1 right shoulder, 2 right elbow, 3 left shoulder, 4 left elbow, 5 pelvis
names = ["neck", "right shoulder", "right elbow", "left shoulder", "left elbow", "pelvis"]
xy = np.array([[0.0, 1.0], [-0.4, 0.9], [-0.6, 0.5], [0.4, 0.9], [0.6, 0.5], [0.0, 0.2]])
bones = [(0, 1), (1, 2), (0, 3), (3, 4), (0, 5)]
V = len(xy)
A = np.zeros((V, V))
for i, j in bones:
A[i, j] = A[j, i] = 1
center = xy.mean(0) # Skeleton centroid: mean of all joint coordinates
r = np.linalg.norm(xy - center, axis=1) # Distance from each joint to the centroid
A_root, A_in, A_out = np.eye(V), np.zeros((V, V)), np.zeros((V, V))
for i in range(V):
for j in np.nonzero(A[i])[0]:
if r[j] < r[i]:
A_in[i, j] = 1 # Centripetal: neighbor is nearer the centroid than self
else:
A_out[i, j] = 1 # Centrifugal: neighbor is farther from the centroid
print("Distance to centroid:", r)
for i in (0, 1, 2):
print(f"{names[i]}: centripetal {[names[j] for j in A_in[i].nonzero()[0]]}, "
f"centrifugal {[names[j] for j in A_out[i].nonzero()[0]]}")
Distance to centroid: [0.33 0.46 0.62 0.46 0.62 0.47]
neck: centripetal [], centrifugal ['right shoulder', 'left shoulder', 'pelvis']
right shoulder: centripetal ['neck'], centrifugal ['right elbow']
right elbow: centripetal ['right shoulder'], centrifugal []
The example uses one frame; the paper averages distances over the training set. The right shoulder's two neighbors fall into different groups: toward the neck is centripetal, toward the elbow centrifugal. Uni-labeling would average them together.
Matrix-Multiplication Implementation
The implementation follows GCN. Under uni-labeling, one layer is:
For multiple groups, split into matrices, , normalize and weight each separately, then sum:
For distance partitioning, and . Some groups can have entirely zero rows—for example, the neck above has no centripetal neighbor—so normalization adds to degrees.
Using the same skeleton and an input tensor , run one spatial graph convolution:
def normalize(Aj, alpha=0.001):
d = Aj.sum(1) + alpha # The paper adds alpha to handle all-zero rows
return Aj / np.sqrt(np.outer(d, d))
C_in, C_out, T = 3, 8, 4
x = np.random.default_rng(0).random((C_in, T, V)) # (channels, frames, joints)
Ws = [np.random.default_rng(k).normal(size=(C_out, C_in)) for k in range(3)]
out = sum(np.einsum("oc,ctv,wv->otw", Wk, x, normalize(Ak)) # Normalize and weight each group separately
for Wk, Ak in zip(Ws, [A_root, A_in, A_out]))
print("Input:", x.shape, "→ Output:", out.shape)
Input: (3, 4, 6) → Output: (8, 4, 6)
A real ST-GCN unit follows this with a temporal convolution, connecting the same joint across nearby frames.
Edge Importance
A joint may belong to multiple body parts and have different importance within each. Each adjacency matrix in each layer is multiplied elementwise by a learnable mask , initialized to all ones. The authors also suggest replacing this with data-dependent attention in future work.
The Full Network
Input first passes through BatchNorm to align joint-coordinate scales, important because graph convolution shares weights over all nodes. Nine ST-GCN units follow, with output channels 64, 64, 64, 128, 128, 128, 256, 256, 256 and temporal kernel size 9. Each unit has a residual connection, followed by dropout 0.5. Units 4 and 7 use temporal stride 2 for pooling. Global pooling produces a 256-dimensional vector, then softmax classifies it.
Training uses SGD, learning rate 0.01, multiplied by 0.1 every 10 epochs. On Kinetics, two augmentations replace dropout: random affine transformations interpolated across frames to mimic camera movement, and random temporal crops during training, with full sequences at test time.
Discussion
Datasets
Kinetics contains around 300,000 YouTube videos, 400 action classes and roughly 10 seconds per clip, with 240,000 training and 20,000 validation clips. Videos are resized to 340×256 at 30 FPS, and OpenPose extracts skeletons, the only model input.
NTU-RGB+D is recorded in a laboratory: 40 subjects, three cameras recording simultaneously, around 56,000 clips and 60 classes. Kinect tracks 25 3D joints per person. X-Sub splits by subject, while X-View splits by camera viewpoint.
Partition Ablations
Top-1 and top-5 accuracies on Kinetics:
| Setting | Top-1 | Top-5 |
|---|---|---|
| Temporal-convolution baseline (TCN) | 20.3% | 40.0% |
| Sparse skeleton graph, unshared weights | 22.0% | 43.2% |
| Uni-labeling | 19.3% | 37.4% |
| Distance partition, weights tied with opposite signs | 23.9% | 44.9% |
| Distance partition | 29.1% | 51.3% |
| Spatial configuration partition | 29.9% | 52.2% |
| Spatial configuration + edge importance | 30.7% | 52.8% |
Several points stand out.
First, uni-labeling—GCN-style propagation—scores below even the temporal baseline that ignores graph structure. The explanation is the loss of local difference information through averaging.
Second, separating self and neighbors jumps from 19.3% to 29.1%. Even tying the two groups' weights to differ only by sign beats uni-labeling, which the authors take as evidence for partitioning itself.
Third, three spatial groups improve further on two, and edge importance adds nearly another percentage point.
The temporal baseline is actually equivalent to spatiotemporal graph convolution on a fully connected joint graph with unshared weights. ST-GCN differs in using sparse natural connections and shared weights.
Comparison with Other Methods
| Method | Kinetics Top-1 | NTU X-Sub | NTU X-View |
|---|---|---|---|
| Deep LSTM | 16.4% | 60.7% | 67.3% |
| Temporal ConvNet | 20.3% | 74.3% | 83.1% |
| C-CNN + MTLN | — | 79.6% | 84.8% |
| ST-GCN | 30.7% | 81.5% | 88.3% |
ST-GCN is the best skeleton-based method of the time on both datasets.
On Kinetics, skeletons remain far behind images: RGB reaches 57.0% and optical flow 49.5%. Many Kinetics actions, the authors explain, require seeing held objects or surroundings. On a selected subset of 30 classes closely tied to bodily movement, ST-GCN's mean class accuracy is 72.4%, versus 70.4% for RGB and 72.8% for optical flow—roughly comparable.
Combined with an RGB two-stream model, ST-GCN helps more than optical flow. Without ImageNet pretraining, RGB alone reaches 70.3%, adding optical flow 71.1%, adding ST-GCN 71.2%, and using all three 71.7%.
Conclusion
ST-GCN builds skeleton sequences into a spatiotemporal graph and convolves over it using GCN's form. Neighbor partitioning is its most important design: without it, the model cannot beat a graph-free baseline; splitting into two groups adds nearly 10 percentage points.
This also gives a practical answer to GCN's collapse into an averaging kernel on image grids. On graphs with spatial structure, separating weights by neighbors' roles makes a large difference.
Many later skeleton action-recognition models build on ST-GCN; 2s-AGCN, for example, learns a data-dependent adjacency matrix. When implementing your own, first check how many joints your pose estimator outputs and which joint is the center. The partition depends on it.