Skip to content

Antares5/MotionFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MotionFlow: Text-Driven Emotion-Controllable Human Motion Generation via Conditional Flow Matching

Tuo Hao  Puyuan Guo  Bingsong Bai  Keqin Tang  Wenxin Fu 
Yingming Gao  Ya Li+
Beijing University of Posts and Telecommunications
+corresponding author
the man throws out a ball angrily. a person is walking happily forward. a person jogs clockwise in a circle. a person spins quickly and takes off running.

This repository contains the official implementation of MotionFlow: Text-Driven Emotion-Controllable Human Motion Generation via Conditional Flow Matching.


Updates

[10/2025] Code will release for text-driven motion generation.

[18/9/2025] Paper submitted to ICASSP 2026.

Text-driven Motion Generation

Installation

Requirements

  • Linux
  • Python 3.9
  • PyTorch .
  • CUDA 10.2+
  • GCC 5+
  • MMCV (Please install mmcv-full>=1.3.17,<1.6.0 for GPU)

Prepare environment

a. Create a conda virtual environment and activate it.

conda create -n motionflow python=3.9 -y
conda activate motionflow

b. Install PyTorch and torchvision following the official instructions.

conda install pytorch={torch_version} torchvision cudatoolkit={cu_version} -c pytorch

Please replace {cu_version} and {torch_version} in the url to your desired one.

c. Build mmcv-full

pip install "mmcv-full>=1.3.17,<=1.5.3" -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

Please replace {cu_version} and {torch_version} in the url to your desired one.

See here for different versions of MMCV compatible to different PyTorch and CUDA versions. For more version download link, refer to openmmlab-download.

d. Install other requirements

pip install -r requirements.txt

Data Preparation

a. Download datasets

For both the HumanML3D dataset and the [EmotionalT2M] dataset, you could find the details as well as download link.

b. Download pretrained weights for evaluation

We use the same evaluation protocol as this repo. You should download pretrained weights of the contrastive models in t2m for calculating FID and precisions. To dynamically estimate the length of the target motion, length_est_bigru and Glove data are required.

c. Download pretrained weights for MotionFlow

The pretrained weights for our proposed MotionFlow can be downloaded from here

Download the above resources and arrange them in the following file structure:

MotionFlow
├── checkpoints
│   ├── emot2m
│   │   └── emot2m_motionflow
│   │       ├── meta
│   │       │   ├── mean.npy
│   │       │   └── std.npy
│   │       ├── model
│   │       │   └── latest.tar
│   │       └── opt.txt
│   └── t2m
│       └── t2m_motionflow
│           ├── meta
│           │   ├── mean.npy
│           │   └── std.npy
│           ├── model
│           │   └── latest.tar
│           └── opt.txt
└── data
    ├── glove
    │   ├── our_vab_data.npy
    │   ├── our_vab_idx.pkl
    │   └── out_vab_words.pkl
    ├── pretrained_models
    │   ├── kit
    │   │   └── text_mot_match
    │   │       └── model
    │   │           └── finest.tar
    │   └── t2m
    │   │   ├── text_mot_match
    │   │   │   └── model
    │   │   │       └── finest.tar
    │   │   └── length_est_bigru
    │   │       └── model
    │   │           └── finest.tar
    ├── HumanML3D
    │   ├── new_joint_vecs
    │   │   └── ...
    │   ├── new_joints
    │   │   └── ...
    │   ├── texts
    │   │   └── ...
    │   ├── Mean.npy
    │   ├── Std.npy
    │   ├── test.txt
    │   ├── train_val.txt
    │   ├── train.txt
    │   └── val.txt
    └── EmoT2M
        ├── new_joint_vecs
        │   └── ...
        ├── texts
        │   └── ...
        ├── Mean.npy
        ├── Std.npy
        ├── test.txt
        ├── train_val.txt
        ├── train.txt
        └── val.txt

Train

You can run the training code like:

PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \
    python -u tools/train.py \
        --name t2m_motionflow \
        --batch_size 128 \
        --times 25 \
        --num_epochs 100 \
        --dataset_name t2m \
        --is_vec True \
        --num_layers 8 \
        --loss_type l1 \
        --mask_type src \
         --lr_ratio 0.5 \
        --gpu_id 1

Evaluation

python -u tools/evaluation.py checkpoints/t2m/t2m_motionflow/opt.txt GPU_ID

Citation

Citation information will be released after paper uploaded to arXiv.

Acknowledgements

We sincerely thank the open-sourcing of these works where our code is based on:

MotionDiffuse, MDM, Guided-Diffusion and flow_matching

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages