Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
66f2f80
Replaced deprecated variable types.
icedwater Sep 9, 2024
a6d2b64
Fixed small typos found in README.md.
icedwater Sep 9, 2024
ba29376
Added vim swaps to .gitignore.
icedwater Sep 11, 2024
5bd340b
Added archive files to .gitignore.
icedwater Sep 11, 2024
b4e2cb5
Updated requirements for local env.
icedwater Sep 16, 2024
b631424
Updated README.md.
icedwater Sep 16, 2024
c4e6f6c
Updated plot_script to clear previous frames.
icedwater Sep 18, 2024
ebb3e62
Included max epoch output in tqdm to give more idea of progress.
icedwater Sep 18, 2024
c1471b5
Added tweaks to allow mesh generation from video.
icedwater Sep 25, 2024
5cc5ca8
Removed pdb and old debugging.
icedwater Sep 26, 2024
4d847b4
Updated vis_utils with notes and fixed whitespace.
icedwater Sep 26, 2024
6376732
Added npy and npz to .gitignore.
icedwater Oct 17, 2024
658f0bd
Added custom/ as template for new rigs.
icedwater Oct 17, 2024
904f57d
Added self.joints_num to bring joints_num into scope.
icedwater Oct 18, 2024
93fb47f
Deferred specification of cond_mode.
icedwater Oct 23, 2024
d0af2f4
Updated training to take custom models.
icedwater Oct 23, 2024
44b6aa9
Restored full paths to custom import statements.
icedwater Oct 23, 2024
4c7f6d0
Updated custom paramUtil with sample skeleton.
icedwater Oct 25, 2024
8687403
Reorganized README.
icedwater Oct 30, 2024
0bad2e1
Added basic framework for custom rig readme.
icedwater Oct 30, 2024
630958a
Added a distinct marker for the end of the README document.
icedwater Nov 5, 2024
a8ea852
Cleaned outputs from abs motion rep notebook.
icedwater Nov 6, 2024
09926ba
Updated the documentation with some new details.
icedwater Nov 7, 2024
259a145
Added working/ directory to ignore list.
icedwater Nov 7, 2024
bae0dd8
Updated steps 3-5 of the training procedure.
icedwater Nov 12, 2024
b9802f1
Added more whitespace between sections.
icedwater Nov 14, 2024
1c7f13f
Added details for training and inference steps.
icedwater Nov 14, 2024
5bd38cd
Updated unet to work with custom dataset.
icedwater Nov 19, 2024
b86b52d
Removed unreachable or unused code.
icedwater Nov 19, 2024
5ab556a
Cleaned up some of custom dataset README.md.
icedwater Nov 19, 2024
1f66b05
Added whitespace to separate sections.
icedwater Nov 20, 2024
4b8551e
Added basic overview of sequence at the top.
icedwater Nov 20, 2024
494deca
Added some details for output handling.
icedwater Nov 20, 2024
ebeb306
Restored full import path for custom dataset.py
icedwater Nov 21, 2024
654f023
Updated dataset.py in custom data loaders section.
icedwater Dec 10, 2024
c799cd5
Added custom training steps with documentation.
icedwater Dec 10, 2024
e0db74c
Updated training loop.
icedwater Dec 10, 2024
f4d1f98
Used t2m_collate for custom dataset.
icedwater Dec 10, 2024
c3ef1ae
Added new rig values in scripts/motion_process.
icedwater Dec 10, 2024
9124dba
Renamed variable to be in line with other datasets.
icedwater Dec 10, 2024
eab4ef8
Updated njoints and added_channels in MDM_UNET.
icedwater Dec 10, 2024
b2d0fdd
Added first tests of custom rig dimensions.
icedwater Dec 10, 2024
ce8bd18
Updated get_opt to handle custom rig.
icedwater Dec 10, 2024
1ac6b30
Added precalculate script for convenience.
icedwater Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ dmypy.json
.pyre/

# experiments
working/
save/
dataset/
kit/
Expand All @@ -139,3 +140,19 @@ glove/
body_models/
.vscode/
wandb/

# vim swaps
.*.sw?

# tarballs and zips
*.tar
*.tar.gz
*.tgz
*.zip
*.gz
*.7z
*.bzip
*.bz2

# numpy arrays
*.np[yz]
71 changes: 37 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ If you find this code useful in your research, please cite:
## Getting started

This code was developed on `Ubuntu 20.04 LTS` with Python 3.7, CUDA 11.7 and PyTorch 1.13.1.
The current `requirements.txt` was set up with Python 3.9, CUDA 11.3, PyTorch 1.12.1.


### 1. Setup environment
Expand All @@ -46,12 +47,10 @@ This codebase shares a large part of its base dependencies with [GMD](https://gi

Setup virtual env:
```shell
python3 -m venv .env_condmdi
source .env_condmdi/bin/activate
pip uninstall ffmpeg
pip install spacy
python -m spacy download en_core_web_sm
pip install git+https://github.com/openai/CLIP.git
python3 -m venv .env_condmdi # pick your preferred name here
source .env_condmdi/bin/activate # and use that name in place of .env_condmdi
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt # updated to include spacy and clip configuration
```

Download dependencies:
Expand All @@ -78,36 +77,40 @@ bash prepare/download_recognition_unconstrained_models.sh
### 2. Get data
There are two paths to get the data:

(a) **Generation only** wtih pretrained text-to-motion model without training or evaluating

(b) **Get full data** to train and evaluate the model.

<details>
<summary><b>(a) **Generation only** with pretrained text-to-motion model without training or evaluating</b></summary>

#### a. Generation only (text only)
#### a. Generation only (text only)

**HumanML3D** - Clone HumanML3D, then copy the data dir to our repository:
**HumanML3D** - Clone HumanML3D, then copy the data dir to our repository:

```shell
cd ..
git clone https://github.com/EricGuo5513/HumanML3D.git
unzip ./HumanML3D/HumanML3D/texts.zip -d ./HumanML3D/HumanML3D/
cp -r HumanML3D/HumanML3D diffusion-motion-inbetweening/dataset/HumanML3D
cd diffusion-motion-inbetweening
cp -a dataset/HumanML3D_abs/. dataset/HumanML3D/
```
```shell
cd ..
git clone https://github.com/EricGuo5513/HumanML3D.git
unzip ./HumanML3D/HumanML3D/texts.zip -d ./HumanML3D/HumanML3D/
cp -r HumanML3D/HumanML3D diffusion-motion-inbetweening/dataset/HumanML3D
cd CondMDI
cp -a dataset/HumanML3D_abs/. dataset/HumanML3D/
```
</details>

<details>
<summary><b>(b) **Get full data** to train and evaluate the model.</b></summary>

#### b. Full data (text + motion capture)
#### b. Full data (text + motion capture)

**[Important !]**
Following GMD, the representation of the root joint has been changed from relative to absolute. Therefore, you need to replace the original files and run GMD's version of `motion_representation.ipynb` and `cal_mean_variance.ipynb` provided in `./HumanML3D_abs/` instead to get the absolute-root data.
**HumanML3D** - Follow the instructions in [HumanML3D](https://github.com/EricGuo5513/HumanML3D.git),
then copy the result dataset to our repository:

**HumanML3D** - Follow the instructions in [HumanML3D](https://github.com/EricGuo5513/HumanML3D.git),
then copy the result dataset to our repository:
**[Important !]**
Following GMD, the representation of the root joint has been changed from relative to absolute. Therefore, when setting up HumanML3D, please
run GMD's version of `motion_representation.ipynb` and `cal_mean_variance.ipynb` instead to get the absolute-root data. These files are made
available in `./dataset/HumanML3D_abs/`.

```shell
cp -r ../HumanML3D/HumanML3D ./dataset/HumanML3D
```
```shell
cp -r ../HumanML3D/HumanML3D ./dataset/HumanML3D
```
</details>

### 3. Download the pretrained models

Expand Down Expand Up @@ -156,7 +159,7 @@ python -m sample.conditional_synthesis --model_path ./save/condmdi_randomframes/
<summary><b>Text to Motion - <u>With</u> keyframe conditioning</b></summary>

### Generate from a single prompt - condition on keyframe locations
#### using the uncoditioned model
#### using the unconditioned model
```shell
python -m sample.edit --model_path ./save/condmdi_uncond/model000500000.pt --edit_mode benchmark_sparse --transition_length 5 --num_samples 10 --num_repetitions 3 --imputate --stop_imputation_at 1 --reconstruction_guidance --reconstruction_weight 20 --text_condition "a person throws a ball"
```
Expand Down Expand Up @@ -189,7 +192,7 @@ python -m sample.conditional_synthesis --model_path ./save/condmdi_randomframes/
* `--device` id.
* `--seed` to sample different prompts.
* `--motion_length` (text-to-motion only) in seconds (maximum is 9.8[sec]).
* `--progress` to save the denosing progress.
* `--progress` to save the denoising progress.

**Running those will get you:**
* `results.npy` file with text prompts and xyz positions of the generated animation
Expand Down Expand Up @@ -227,11 +230,11 @@ Our model is trained on the **HumanML3D** dataset.
```shell
python -m train.train_condmdi --keyframe_conditioned
```
* You can ramove `--keyframe_conditioned` to train a unconditioned model.
* You can remove `--keyframe_conditioned` to train a unconditioned model.
* Use `--device` to define GPU id.

## Evaluate
All evaluation are done on the HumanML3D dataset.
All evaluations are done on the HumanML3D dataset.

### Text to Motion - <u>With</u> keyframe conditioning

Expand All @@ -247,7 +250,7 @@ python -m eval.eval_humanml_condmdi --model_path ./save/condmdi_uncond/model0005

#### on the conditional model
```shell
python -m eval.eval_humanml_condmdi --model_path ./save/condmdi_randomframes/model000750000.pt --edit_mode gmd_keyframes --keyframe_guidance_param 1.
python -m eval.eval_humanml_condmdi --model_path ./save/condmdi_randomframes/model000750000.pt --edit_mode gmd_keyframes --keyframe_guidance_param 1
```


Expand All @@ -260,4 +263,4 @@ We would like to thank the following contributors for the great foundation that
## License
This code is distributed under an [MIT LICENSE](LICENSE).

Note that our code depends on other libraries, including CLIP, SMPL, SMPL-X, PyTorch3D, and uses datasets that each have their own respective licenses that must also be followed.
Note that our code depends on other libraries, including CLIP, SMPL, SMPL-X, PyTorch3D, and uses datasets that each have their own respective licenses that must also be followed.
6 changes: 6 additions & 0 deletions configs/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ class motion_abs_unet_adagn_xl(
):
save_dir: str = 'save/unet_adazero_xl_x0_abs_loss1_fp16_clipwd_224'

@dataclass
class motion_abs_unet_adagn_xl_custom_batch(
data.humanml_motion_abs,
model.motion_unet_adagn_xl,
):
batch_size: int = 2 ## change the batch size here

@dataclass
class motion_abs_unet_adagn_xl_loss2(
Expand Down
12 changes: 6 additions & 6 deletions data_loaders/amass_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@


# Matrix that shows joint correspondces to SMPL features
MAT_POS = np.zeros((24, 764), dtype=np.bool)
MAT_POS = np.zeros((24, 764), dtype=bool)
MAT_POS[0, :3] = True # root position = trans
for joint_idx in range(24):
ub = 3 + 24*3*3 + 3 * (joint_idx + 1)
lb = ub - 3
MAT_POS[joint_idx, lb:ub] = True # joint position = pos

MAT_ROTMAT = np.zeros((24, 764), dtype=np.bool) # rotmat = 24,3,3 wrp to the parent joint
MAT_ROTMAT = np.zeros((24, 764), dtype=bool) # rotmat = 24,3,3 wrp to the parent joint
for joint_idx in range(24):
ub = 3 + 3*3 * (joint_idx + 1)
lb = ub - 9
MAT_ROTMAT[joint_idx, lb:ub] = True # joint rotation = rotmat

MAT_HEIGHT = np.zeros((24, 764), dtype=np.bool) # height = 24
MAT_HEIGHT = np.zeros((24, 764), dtype=bool) # height = 24
for joint_idx in range(24):
ub = 3 + 24*3*3 + 24*3 + 24*3 + 8 + (joint_idx + 1)
lb = ub - 1
MAT_HEIGHT[joint_idx, lb:ub] = True # joint rotation = rotmat

MAT_ROT6D = np.zeros((24, 764), dtype=np.bool) # rot2d = 24,2 wrp to the parent joint
MAT_ROT6D = np.zeros((24, 764), dtype=bool) # rot2d = 24,2 wrp to the parent joint
for joint_idx in range(24):
ub = 3 + 24*3*3 + 24*3 + 24*3 + 8 + 24 + 3 + 24*3 + 24*6 + 6 + 6 * (joint_idx + 1)
lb = ub - 6
MAT_ROT6D[joint_idx, lb:ub] = True # joint rotation = rotmat

MAT_ROT = np.zeros((24, 764), dtype=np.bool) # global_xform = 24, 6 wrp to the root
MAT_ROT = np.zeros((24, 764), dtype=bool) # global_xform = 24, 6 wrp to the root
lb = 3 + 24*3*3 + 24*3 + 24*3 + 8 + 24 + 3 + 24*3 + 24*6
MAT_ROT[0, lb:lb+6] = True # root rotation = root_orient
for joint_idx in range(24):
ub = 3 + 24*3*3 + 24*3 + 24*3 + 8 + 24 + 3 + 24*3 + (joint_idx + 1) * 6
lb = ub - 6
MAT_ROT[joint_idx, lb:ub] = True # joint rotation = global_xform
MAT_ROT[joint_idx, lb:ub] = True # joint rotation = global_xform
Loading