Abstract
- ICCV 2023 accepted
- suggest MotionBERT model for 3d single person pose estimation in videos
- 2d, 3d motion data from various sources를 활용한 self-supervised pretraining method 제안
- spatial feature와 temporal feature를 fusion하는 DSTformer의 method는 살펴볼 점이 있음
- https://github.com/Walter0807/MotionBERT
Motivation
기존 human motion과 관련된 방법들은 모두 task-specific하게 디자인되었다. 이를 해결하여 unified human-centric video representation을 만들어 관련 downstream task게 폭넓게 이용 가능하도록 만들고자 한다.
또한 다른 문제는, data resource들의 heterogeneity이다. Motion capture system 하에서 제공된 데이터들은 motion marker가 잘 되어 있으나 indoor activity에 한정되고, action recognition dataset은 human pose label이 없다. 이는 기존 방법론들이 task specific하게 디자인된 것과 밀접한 관련이 있다.
따라서, MotionBERT는 heterogeneous data resources에서 unified manner로 motion representation을 학습하고 이를 unified way로 downstream task에 활용하고자 한다.
전체적인 flow는 다음과 같다:
- motion data source에서 2d skeleton sequence를 추출
- random mask와 noise로 corrupt
- motion encoder로 corrupted 2d skeleton에서 recover
이런 형태의 pretraining은 motion encoder가 underlying 3d human structure를 파악하고, erroneous observation을 recover하는 과정을 학습하며 human movement에 대한 prior knowledge를 학습한다.
여기서 motion encoder는 Dual-stream Spatio-temporal Transformer (DSTformer)를 사용하여 skeleton keypoint의 long-range relationship을 포착한다.
Method
Overview
approach는 두 단계로 구성된다:
- motion encoder가 2d-to-3d lifting task를 수행하도록 training
- pretrained motion encoder와 few new layer를 downstream task에 맞게 finetuning
2d skeleton sequence를 먼저 뽑은 것은, 다양한 motion source에서 좀 더 robust하게 추출될 수 있기 때문이다.
Network Architecture
Fig. 2에서 전체 architecture를 볼 수 있다.
먼저 2D skeleton sequence $\textbf x \in \mathbb R^{T\times J\times C_{in}}$을 구한다.
이때 T는 video sequence의 길이, J는 body joint의 개수, C는 channel으로 (x, y, confidence)를 의미한다.
이를 FC layer를 거쳐 $\textbf F^0 \in \mathbb R^{T\times J\times C_f}$에 mapping하고, learnable spatial positional encoding $\textbf P^S_{pos}\in \mathbb R^{1\times J\times C_f}$와 temporal positional encoding $\textbf P^T_{pos} \in \mathbb R ^{T\times 1\times C_f}$를 더한다.
-> broadcasting으로 더하는 것인지, 하나의 row또는 col에 대해서만 더하는 것인지는 모르겠다.
이후 seq-to-seq DSTformer로 $\textbf F^i \in \mathbb R^{T\times J \times C_f} (i=1,\dots,N)$을 구한다. 이때 $N$는 network depth이다.
이후 linear layer를 거쳐 estimated 3D motion $\hat {\textbf X} \in \mathbb R^{T\times J \times C_{out}}$을 구한다.
Spatial Block
또한 DSTFormer는 spatial-wise하게 한 번, temporal-wise하게 한 번 MHSA(Multi-Head Self Attention)을 수행한다.
일반적인 MHSA block과 같은데, 각각 다른 점은 query, key, value를 spatial block에서는 한 frame 안의 spatial하게 계산한다는 점이다. 즉, per-frame spatial feature $\textbf F_S\in \mathbb R^{J\times C_e}$에 대해서,
$$\textbf Q_S^i=\textbf F_S \textbf W_S^{(Q,i)}, \textbf K_S^i=\textbf F_S \textbf W_S^{(K,i)}, \textbf V_S^i=\textbf F_S \textbf W_S^{(V,i)}$$
로 계산된다.
Temporal Block
예상할 수 있듯이, temporal block은 전체 구조가 spatial block과 동일하나, per-joint temporal feature $\textbf F_T \in \mathbb R^{T\times C_e}$를 가지고 Q, K, V를 계산한다는 차이가 있다.
spatial block이 다른 body joint와의 관계를 통해 위치를 조정하고, temporal block이 전후 sequence를 통해서 한 joint가 시간상 위치를 잡을 수 있도록 조정하는 것으로 생각할 수 있을 것 같다.
Dual-stream Spatio-temporal Transformer
두 stream의 정보가 fuse되며, 각 stream이 다른 형태의 spatio-temporal aspect에 specialize되어야 하기 때문에, dynamic fusion weight를 사용하여 dual-stream architecture를 구성한다.
이는 다음과 같이 구성된다:
$$\textbf F^i = \textbf {α} ^i _{ST} \circ T_1^i (S_1^i (\textbf F^{i-1}))+\textbf α^i _{TS} \circ S_2^i (T_2^i(\textbf F^{i-1})), i\in 1,\dots, N$$
이때 $α$는 adaptive fusion weight로 다음과 같이 정의된다:
$$ α^i_{ST}, α^i_TS = softmax(W(\left[T_1^i(S_1^i(F^{i-1})),S_2^i(T_2^i(F^{i-1}))\right]))$$
여기서 $W$는 learnable linear transformation이고 $\left[,\right]$는 concatenation을 의미한다.
즉, 다른 순서로 얻어진 두 개의 feature에 weight를 element-wise로 곱한 뒤 둘을 더해서 feature를 fusion하는 것이다.
Unified Pretraining
powerful motion representation을 학습하기 위해 2d-to-3d lifting pretext task를 정의한다. 먼저 2D skeleton sequence $x$를 얻은 후 이를 corrupt한다. 그 후 corrupted $x$에서 3D motion $\hat x$를 reconstruct한다. 이를 GT 3D motion $x$와 비교하여 loss를 구한다. 즉, loss는 다음과 같이 주어진다:
$$ L_{3D} = \sum^T_{t=1} \sum^J_{j=1} \| \hat X _{t,j} - X_{y,j}\|_2 $$
$$ L_O = \sum ^T_{t=2} \sum^J_{j=1} \| \hat O _{t,j}-O_{t,j}\|_2 $$
이때 $\hat O_t = \hat X_t - \hat X_{t-1}, O_t = X_t - X_{t-1}$$
즉, 한 시점의 각 joint에 대한 위치에 대한 loss와 해당 joint의 이전 time step에서의 차이에 대한 loss를 구하여 GT와의 차이도 줄이고, 움직임도 smooth하게 만드려는 것이다.
만약 3d annotation이 없는 경우에는 2d-to-3d lifting으로 3d annotation을 만든 후 이를 orthogonal projection하여 얻은 2d motion에 대해 reconstruction loss를 측정했다. 이때 2d skeleton에서 depth는 masking하고, 다른 추가적인 noise와 mask를 추가했다. 따라서 weighted 2D reconstruction loss는 다음과 같다:
$$L_{2D}=\sum^T_{t=1}\sum^J_{j=1} δ_{t,j}\|\hat x_{t,j}-x_{t,j}\|_2$$
이때 $\hat x$는 2D orthogonal projection이고, $δ$는 confindence 등으로 계산되는 weight이다.
따라서 전체 loss는 다음과 같이 계산된다:
이때 $λ_O$는 balancing coefficient로 constant이다.
Result
References
[1] Zhu, W., Ma, X., Liu, Z., Liu, L., Wu, W., & Wang, Y. (2023). Motionbert: A unified perspective on learning human motion representations. In Proceedings of the IEEE/CVF International Conference on Computer Vision (pp. 15085-15099).
Footnotes
'DL·ML > Paper' 카테고리의 다른 글
FutureFoul (0) | 2024.03.27 |
---|---|
TesseTrack (CVPR 2021) (1) | 2024.03.27 |
Grounded SAM (0) | 2024.03.25 |
[task] 3D Pose Estimation (in progress) (0) | 2024.03.25 |
VARS(SoccerNet) (0) | 2024.03.22 |