This is the official PyTorch implementation for the paper "Coordinating Multiple Conditions for Trajectory-Controlled Human Motion Generation".
We recommend using Conda to set up the environment. Run the following commands:
conda env create -f environment.yml
conda activate cmc
pip install git+https://github.com/openai/CLIP.git
Download the pre-trained weights for the HumanML3D and KIT datasets from our Google Drive link.
Extract the downloaded files into the output/ directory. The file structure should look exactly like this:
./output/
├── cmc_humanml3d/
│ ├── cmc_humanml3d_s1.pth
│ └── cmc_humanml3d_s2.pth
└── cmc_kit/
├── cmc_kit_s1.pth
└── cmc_kit_s2.pth
Follow MoMask Github. The structure should look like this:
./checkpoints/
├── t2m/
│ ├── text_mot_match
└── kit/
├── text_mot_match
ln -s /path/to/dataset/HumanML3D/ dataset/HumanML3D/
ln -s /path/to/dataset/KIT-ML/ dataset/KIT-ML/To train your own model from scratch, execute the following commands.
Training CMC HumanML3D Stage 1:
python train.py \
--exp_name cmc_humanml3d_s1 \
--batch_size 128 --gpu 2 --overwrite --save_iter 10000 \
--total_iter 600000 --lr 1e-4 --lr-scheduler 300000 \
--modeltype s1 --multi_joint_control
Training CMC HumanML3D Stage 2:
python train.py \
--exp_name cmc_humanml3d_s2 \
--batch_size 128 --gpu 2 --overwrite --save_iter 10000 \
--total_iter 600000 --lr 1e-4 --lr-scheduler 300000 \
--modeltype s2 --multi_joint_control
We provide several evaluation scripts for different configurations. For multi-joint control, you can specify joints using --control_joint (e.g., --control_joint 0 20).
1. HumanML3D (Stage 1 + Stage 2) | DDPM 1000+1000 steps:
python eval_cmc.py \
--resume_root output/cmc_humanml3d/cmc_humanml3d_s1.pth \
--resume_trans output/cmc_humanml3d/cmc_humanml3d_s2.pth \
--dataset_name t2m \
--control_joint 0 --density 100 --gpu 3
2. HumanML3D (Stage 1 + Stage 2) | DDIM 100+100 steps:
python eval_cmc.py \
--resume_root output/cmc_humanml3d/cmc_humanml3d_s1.pth \
--resume_trans output/cmc_humanml3d/cmc_humanml3d_s2.pth \
--dataset_name t2m \
--control_joint 0 --density 100 --gpu 3 \
--S1_diffusion_step 100 --S2_diffusion_step 100
3. HumanML3D (Stage 2 Only) | Text-to-Motion:
python eval_cmc.py \
--resume_trans output/cmc_humanml3d/cmc_humanml3d_s2.pth \
--dataset_name t2m \
--gpu 3 \
--only_t2m_s2 14. HumanML3D Sample:
python sample.pyThis script will visualize motion in a web page and save html file.