Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition
2018-01-28 15:45:13
研究背景和動機:
行人動作識別(Human Action Recognition)主要從多個模態的角度來進行研究,即:appearance,depth,optical-flow,以及 body skeletons。這其中,動態的人類骨骼點 通常是最具有信息量的,且能夠和其他模態進行互補。但是最近研究這個東西的工作,卻很少,我們系統的分析了這個模態,目標就是想開發一種 principle and effective 的方法來建模動態的骨骼點,並且將其用於行為識別。
動態的骨骼模態,可以自然地表達為時間序列的 human joint locations,行人的動作,就可以看做是分析這些運動模式就可以了。當前的方法主要是簡單的將 the joint coordinates 構成特征向量,然后應用 temporal analysis thereon。這些方法的能力是有限的,因為他們並沒有顯示的探索這些 joints 之間的空間關系,然而這對於理解 human actions 來說,是非常重要的。最近也有些方法將這些連接考慮到他們的模型中,但是,這些方法嚴重的依賴於手工設計的 parts 或者 rules。這就使得他們的方法很難應用到其他問題上。
為了克服這些困難,我們需要一種新的方法可以自動的捕獲 the patterns embedded in the spatial configuration of the joints, 以及 their temporal dynamics。這是深度神經網絡的優勢,但是,骨骼點的數據是一種 graph 的結構,而不是 2D 或者 3D 的網格,所以,很難利用當前的 CNN 來直接處理這些數據。最近,graph convolutional networks(GCNs),將 CNN 拓展到了 任意結構的 graphs 上來,已經得到了很大的關注,並且得到了廣泛的應用,如:image classification, document classification, and semi-supervised learning. 但是,這些方法都是基於一種 fixed graph 作為輸入。將 GCNs 在大型數據集上來建模 dynamic graphs,如:human skeleton sequence,還沒有被研究。
本文通過將 GCN 拓展到 spatial-temporal graph model,稱為:ST-GCN。如上圖所示,這個模型是在 一個骨骼圖的序列上 構建的,每個節點對應了 a joint of the human body。有兩種 edges,即:spatial edges 和 temporal edges。
本文的創新點:
1). We propose ST-GCN, a generic graph-based formulation for modeling dynamic skeletons, which is the first that applies graph-based neural networks for this task.
2). We propose several principles in designing convolution kernels in ST-GCN to meet the specific demands in skeleton modeling.
3). On two large scale datasets for skeleton-based action recognition, the proposed model achieves superior performance as compared to previous methods using hand-crafted parts or traversal rules, with considerably less effort in manual design.
The code and models of ST-GCN are made publicly available https://github.com/yysijie/st-gcn.
將 GCNs 拓展到 graph 上主要有如下兩大類方法:
1). the spectral perspective, where the locality of graph convolution is considered in the form of spectral analysis;
2). the spatial perspective, where the convolutioan filter are applied directly on the graph nodes and their neighbors.
3 Spatial Temporal Graph ConvNet
3.1. Pipeline Overview:
基於骨骼的數據可以通過捕獲運動的設備,或者 視頻中姿態估計的算法得到。通常,這些數據是序列的視頻幀,每一幀都有關節點坐標的結合。給定 2D 或者 3D 坐標的形式,關節點的序列,我們構建一個時空圖(spatial temporal graph),其中,關節點是 graph nodes,人體結構 以及 時間 的自然連接作為 graph 的 nodes。ST-GCN 的輸入是 graph nodes 的的聯合坐標向量。這個可以類比 基於圖像的 CNNs ,其輸入是 pixel intensity vectors residing on the 2D image grid。時空圖卷積操作的多層,將會用來處理這些數據,然后在 graph 上,產生高層的 feature maps。然后用標准的 SoftMax 分類器來進行分類。整個模型是 end to end trained,並可以用 BP 算法進行優化。
3.2. Skeleton Graph Construction:
我們構建一個無向圖 G = {V, E},其有 N 個節點,T frame是 featuring both intra-body and inter-frame connection。
在一個 graph 中,節點的集合 $ V = {vti|t=1,..,T} $ includes the all the joints in a skeleton sequence。作為 ST-GCN's 的輸入,節點 F(vti) 的特征向量是由 坐標向量 以及 預測的置信度構成的。我們在骨骼序列上構建 spatial-temporal graph 是有兩個步驟:
首先,在一幀上的節點,我們按照人體結構的連接性,用 edge 將其連接起來;
然后,每一個節點,會在連續視頻幀上,會被連接到相同的節點。
正式的來說,the edge set E 是有兩種子集合的:
the first subset depicts the intra-skeletion connection at each frame;
the second subset contains the inter-frame edges,which connect the same joints in consecutive frames。
3.3. Spatial Graph Convolutional Neural Network:
在我們進入完全的 ST-GCN 之前,我們首先看單幀上的 graph CNN model。在這種情況下,在時刻 t ,單張視頻幀的情況下,將會有 N 個骨骼節點 $V_t$,並且有骨骼邊界(the skeleton edges)。我們回憶在 2D 自然圖像或者 feature maps 上的卷積操作,卷積操作的輸出仍然是 2D 的網格。當步長為1,並且設置合適的 padding 時,輸出的 feature maps 可以和輸入擁有相同的大小。我們在接下來的討論中,都是基於這個假設。給定一個 kernel size 為 K*K 的卷積操作,通道個數為 c 的輸入 feature maps,在位置 x 處的單個通道的輸出值為:
其中, P 是 采樣函數(the sampling function p),列舉了位置 x 的近鄰(enumerates the neighbors of location x)。在圖像卷積中,也可以表示為:$p(x, h, w) = x + p' (h, w)$。加權函數(the weight function w)提供了一個權重向量,來計算其與采樣的輸入向量的內積(provides a weight vector in c-dimensional real space for computing the inner product with the sampled output feature vectors of dimension c)。由於加權函數與位置 x 無關,所以,濾波器的權重可以在圖像中進行共享。在圖像領域,標准的卷積在圖像領域可以通過編碼矩形網格(rectangle grid)。更加細節的解釋和應用可以參考 Dai et al. 2017 的文章。
在 graph 上的卷積操作可以定義為:將上述定義拓展到存在於 spatial graph $V_t$ 的輸入特征圖上,即:the feature map has a vector on each node of the graph(在 graph 上的每個節點都有一個向量)。下一步的拓展,就是重新定義采樣函數 p 和 加權函數 w。
Sampling function. 在圖像中,采樣函數 p(h, w) 是定義在中心位置為 x 的近鄰像素上的。在 graph 中,我們可以類似的定義采樣函數在一個節點 $v_{ti}$ 的近鄰集合 $B(v_{ti})$ 。所以采樣函數 p 可以寫為:
在本文當中,我們對於所有的情況,都設置 D = 1,即:1-neighbor set of joint nodes. 更多數量的 D 留作未來工作。
Weight function. 相對於采樣函數,加權函數的定義更加 trickier。在 2D 卷積中,一個固定的 grid 自然的存在於中心位置(naturally exists around the center location)。所以,相鄰像素點擁有一個固定的空間次序(pixles within the nighbor can have a fixed spatial order)。The weight function can then be implemented by indexing a tensor of (c, K, K) dimensions according to the spatial order. 像我們剛剛創建的那種 general 的 graph,並沒有這樣的潛在的排列(there is no such implicit arrangement)。該問題首先被 Niepert et al. 研究,the order 定義為:a graph labeling process in the neighbor graph around the root node. 我們跟隨這個 idea 來構建我們的權重函數。並非給定每一個近鄰節點一個特定的 labeling,我們簡單的將骨骼節點的近鄰集合划分為固定個數的 K 個子集,每一個子集有一個 label。於是,我們有了一個映射,即:maps a node in the neighborhood to its subset label. 加權函數 w 可以索引一個 tensor (c, K) dimension 來執行:
Spatial Graph Convolution. 有了優化的采樣函數和加權函數,我們可以重新定義公式(1)為:
其中,the normalizing term Z 等於對應子集的基數。用公式(2)(3)代替公式(4)中的各項,我們可以得到:
值得注意的是,這個表達形式也可以看做是標准的 2D convolution,如果我們將 image 看做 常規的 2D grid(this formulation can resemble the standard 2D convolution if we treat a image as a regular 2D grid)。
Spatial Temporal Modeling. 在上述 Spatial graph CNN 的基礎上,我們現在開始將其拓展都 時空結構上。在構建 graph 的時候,graph 的 temporal aspect 我們是直接時序上相同的節點連接起來的。這確保我們可以定義一種非常簡單的策略將 Spatial graph CNN 拓展到 spatial temporal domain。我們將近鄰節點拓展到包含時序連接的節點(we extend the concept of neighborhood to also include temporally connected joints):
為了完成在 spatial temporal graph 上的卷積操作,我們也需要 the sampling function,and the weight function. 因為 temporal axis 的次序是顯然的,我們直接將 label map $l_{ST}$ 定義為:
3.4. Partition Strategies .
給定 spatial temporal graph convolution 的高層定義,設計一種 partitioning strategy 來執行 the label map l.
Uni-labeling.
Distance partitioning.
Spatial configuration partitioning.
3.5. Learnable edge importance weighting.
3.6. Implementing ST-GCN.
基於 graph 的卷積操作不如 2D 或者 3D 卷積那么直觀,這里我們采取類似 Kipf 在 ICLR 2017年發表的文章中所用的 graph convolution 操作。同一幀的 Body 內部的關節點的連接可以表示為:a adjcency matrix A,然后用 identity matrix I 用來表示 self-connections。在 single-frame 的情況下,用第一種分割策略的 st-gcn 可以用下面的公式進行表達:
其中,多個輸出通道的權重向量堆疊起來構成了權重矩陣(the weight matrix W)。實際上,在時空的情況下,我們可以將 input feature map 表示為:a tensor of (C, V, T) dimension. graph convolution 可以通過執行 1 × Γ standard 2D convolution and multiplies the resulting tensor with the normalized adjacency matrix on the second dimension.
對於多個子集的划分策略(for partitioning strategies with multiple subsets),即:distance partitioning and spatial configuration partitioning,我們也這么執行。 但注意到,鄰接矩陣被分解為多個矩陣 Aj,即: $A+I = \sum_{j} A_j$。
執行 learnable edge importance weighting 是很直觀的。對於每一個鄰接矩陣,我們給其配置一個可學習的 weight matrix M。
Experiments: