Walter0807/MotionBERT

[ICCV 2023] PyTorch Implementation of "MotionBERT: A Unified Perspective on Learning Human Motion Representations"

Python

1,455

30 commits

updated Mar 14, 2026

See the code

README

MotionBERT: A Unified Perspective on Learning Human Motion Representations

PyTorch arXiv Project Demo Hugging Face Models

PWC PWC PWC

This is the official PyTorch implementation of the paper "MotionBERT: A Unified Perspective on Learning Human Motion Representations" (ICCV 2023).

Installation

conda create -n motionbert python=3.7 anaconda
conda activate motionbert
# Please install PyTorch according to your CUDA version.
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
pip install -r requirements.txt

Getting Started

TaskDocument
Pretraindocs/pretrain.md
3D human pose estimationdocs/pose3d.md
Skeleton-based action recognitiondocs/action.md
Mesh recoverydocs/mesh.md

Applications

In-the-wild inference (for custom videos)

Please refer to docs/inference.md.

Using MotionBERT for human-centric video representations

'''	    
  x: 2D skeletons 
    type = <class 'torch.Tensor'>
    shape = [batch size * frames * joints(17) * channels(3)]
    
  MotionBERT: pretrained human motion encoder
    type = <class 'lib.model.DSTformer.DSTformer'>
    
  E: encoded motion representation
    type = <class 'torch.Tensor'>
    shape = [batch size * frames * joints(17) * channels(512)]
'''
E = MotionBERT.get_representation(x)

Hints

  1. The model could handle different input lengths (no more than 243 frames). No need to explicitly specify the input length elsewhere.
  2. The model uses 17 body keypoints (H36M format). If you are using other formats, please convert them before feeding to MotionBERT.
  3. Please refer to model_action.py and model_mesh.py for examples of (easily) adapting MotionBERT to different downstream tasks.
  4. For RGB videos, you need to extract 2D poses (inference.md), convert the keypoint format (dataset_wild.py), and then feed to MotionBERT (infer_wild.py).

Model Zoo

ModelDownload LinkConfigPerformance
MotionBERT (162MB)OneDrivepretrain/MB_pretrain.yaml-
MotionBERT-Lite (61MB)OneDrivepretrain/MB_lite.yaml-
3D Pose (H36M-SH, scratch)OneDrivepose3d/MB_train_h36m.yaml39.2mm (MPJPE)
3D Pose (H36M-SH, ft)OneDrivepose3d/MB_ft_h36m.yaml37.2mm (MPJPE)
Action Recognition (x-sub, ft)OneDriveaction/MB_ft_NTU60_xsub.yaml97.2% (Top1 Acc)
Action Recognition (x-view, ft)OneDriveaction/MB_ft_NTU60_xview.yaml93.0% (Top1 Acc)
Mesh (with 3DPW, ft)OneDrivemesh/MB_ft_pw3d.yaml88.1mm (MPVE)

In most use cases (especially with finetuning), MotionBERT-Lite gives a similar performance with lower computation overhead.

TODO

  • Scripts and docs for pretraining

  • Demo for custom videos

Citation

If you find our work useful for your project, please consider citing the paper:

@inproceedings{motionbert2022,
  title     =   {MotionBERT: A Unified Perspective on Learning Human Motion Representations}, 
  author    =   {Zhu, Wentao and Ma, Xiaoxuan and Liu, Zhaoyang and Liu, Libin and Wu, Wayne and Wang, Yizhou},
  booktitle =   {Proceedings of the IEEE/CVF International Conference on Computer Vision},
  year      =   {2023},
}
3d-pose-estimation
iccv2023
mesh-recovery
skeleton-based-action-recognition

Walter0807/MotionBERT

[ICCV 2023] PyTorch Implementation of "MotionBERT: A Unified Perspective on Learning Human Motion Representations"

Python

1,455

30 commits

updated Mar 14, 2026

See the code

README

MotionBERT: A Unified Perspective on Learning Human Motion Representations

PyTorch arXiv Project Demo Hugging Face Models

PWC PWC PWC

This is the official PyTorch implementation of the paper "MotionBERT: A Unified Perspective on Learning Human Motion Representations" (ICCV 2023).

Installation

conda create -n motionbert python=3.7 anaconda
conda activate motionbert
# Please install PyTorch according to your CUDA version.
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
pip install -r requirements.txt

Getting Started

TaskDocument
Pretraindocs/pretrain.md
3D human pose estimationdocs/pose3d.md
Skeleton-based action recognitiondocs/action.md
Mesh recoverydocs/mesh.md

Applications

In-the-wild inference (for custom videos)

Please refer to docs/inference.md.

Using MotionBERT for human-centric video representations

'''	    
  x: 2D skeletons 
    type = <class 'torch.Tensor'>
    shape = [batch size * frames * joints(17) * channels(3)]
    
  MotionBERT: pretrained human motion encoder
    type = <class 'lib.model.DSTformer.DSTformer'>
    
  E: encoded motion representation
    type = <class 'torch.Tensor'>
    shape = [batch size * frames * joints(17) * channels(512)]
'''
E = MotionBERT.get_representation(x)

Hints

  1. The model could handle different input lengths (no more than 243 frames). No need to explicitly specify the input length elsewhere.
  2. The model uses 17 body keypoints (H36M format). If you are using other formats, please convert them before feeding to MotionBERT.
  3. Please refer to model_action.py and model_mesh.py for examples of (easily) adapting MotionBERT to different downstream tasks.
  4. For RGB videos, you need to extract 2D poses (inference.md), convert the keypoint format (dataset_wild.py), and then feed to MotionBERT (infer_wild.py).

Model Zoo

ModelDownload LinkConfigPerformance
MotionBERT (162MB)OneDrivepretrain/MB_pretrain.yaml-
MotionBERT-Lite (61MB)OneDrivepretrain/MB_lite.yaml-
3D Pose (H36M-SH, scratch)OneDrivepose3d/MB_train_h36m.yaml39.2mm (MPJPE)
3D Pose (H36M-SH, ft)OneDrivepose3d/MB_ft_h36m.yaml37.2mm (MPJPE)
Action Recognition (x-sub, ft)OneDriveaction/MB_ft_NTU60_xsub.yaml97.2% (Top1 Acc)
Action Recognition (x-view, ft)OneDriveaction/MB_ft_NTU60_xview.yaml93.0% (Top1 Acc)
Mesh (with 3DPW, ft)OneDrivemesh/MB_ft_pw3d.yaml88.1mm (MPVE)

In most use cases (especially with finetuning), MotionBERT-Lite gives a similar performance with lower computation overhead.

TODO

  • Scripts and docs for pretraining

  • Demo for custom videos

Citation

If you find our work useful for your project, please consider citing the paper:

@inproceedings{motionbert2022,
  title     =   {MotionBERT: A Unified Perspective on Learning Human Motion Representations}, 
  author    =   {Zhu, Wentao and Ma, Xiaoxuan and Liu, Zhaoyang and Liu, Libin and Wu, Wayne and Wang, Yizhou},
  booktitle =   {Proceedings of the IEEE/CVF International Conference on Computer Vision},
  year      =   {2023},
}
3d-pose-estimation
iccv2023
mesh-recovery
skeleton-based-action-recognition

Significant stargazers

Haodong Duan

411 followers · starred Dec 2022

黄云龙

20 followers · starred Sep 2023

Xu Huisheng

269 followers · starred Aug 2025

Lin Song

89 followers · starred Feb 2024