Skip to content

Commit

Permalink
Merge pull request #189 from roey1rg/main
Browse files Browse the repository at this point in the history
Fixed evaluation bug #182 - wrong cap_len calculation
  • Loading branch information
GuyTevet committed Jan 31, 2024
2 parents af061ca + e817e56 commit 63edacf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -34,6 +34,8 @@ url={https://openreview.net/forum?id=SJ1kSyO2jwu}


## News
📢 **25/Jan/24** - Fixed bug in evalutation code (#182) - Please use the fixed results when citing MDM.<br>
![fixed_results](assets/fixed_results_caplen_bug.png)

📢 **1/Jun/23** - Fixed generation issue (#104) - Please pull to improve generation results.

Expand Down
Binary file added assets/fixed_results_caplen_bug.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions data_loaders/humanml/motion_loaders/comp_v6_model_dataset.py
Expand Up @@ -207,12 +207,16 @@ def __init__(self, model, diffusion, dataloader, mm_num_samples, mm_num_repeats,
)

if t == 0:
sub_dicts = [{'motion': sample[bs_i].squeeze().permute(1,0).cpu().numpy(),
'length': model_kwargs['y']['lengths'][bs_i].cpu().numpy(),
'caption': model_kwargs['y']['text'][bs_i],
'tokens': tokens[bs_i],
'cap_len': len(tokens[bs_i]),
} for bs_i in range(dataloader.batch_size)]
sub_dicts = [{
'motion': sample[bs_i].squeeze().permute(1, 0).cpu().numpy(),
'length': model_kwargs['y']['lengths'][bs_i].cpu().numpy(),
'caption': model_kwargs['y']['text'][bs_i],
'tokens': tokens[bs_i],
# Fixed cap_len calculation, changed from len(tokens[bs_i])
# Lead to improved R-precision and Multimodal Dist.
# issue: https://github.com/GuyTevet/motion-diffusion-model/issues/182
'cap_len': tokens[bs_i].index('eos/OTHER') + 1,
} for bs_i in range(dataloader.batch_size)]
generated_motion += sub_dicts

if is_mm:
Expand Down

0 comments on commit 63edacf

Please sign in to comment.