Datasets:
Download code/dynamic_demo/motion.py from Heiheihaha17/MESH-Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/datasets/Heiheihaha17/MESH-Benchmark/resolve/main/code/dynamic_demo/motion.py
- Command line
-
hf download hf://datasets/Heiheihaha17/MESH-Benchmark/code/dynamic_demo/motion.py
-
curl -L -o motion.py https://huggingface.co/datasets/Heiheihaha17/MESH-Benchmark/resolve/main/code/dynamic_demo/motion.py
1.92 kB
| """Revise only motion in the frozen demo; preserve room, speech and clip length.""" | |
| from __future__ import annotations | |
| import argparse | |
| import copy | |
| from pathlib import Path | |
| from .common import read, uid, write | |
| REVISION = 'motion_2p6m_v2' | |
| SHIFTS = {'H01': [-2.4, 0., 1.], 'H02': [2.6, 0., 0.], | |
| 'R01': [-2., 0., -1.7], 'R02': [-2.6, 0., 0.]} | |
| def revised_recipe(original): | |
| recipe = copy.deepcopy(original) | |
| recipe['motion_revision'] = REVISION | |
| recipe['motion_constraints'] = dict(minimum_moving_displacement_m=2., | |
| maximum_human_speed_mps=.8, maximum_robot_speed_mps=.8, | |
| minimum_entity_clearance_m=.6, wall_and_furniture_clearance_m=.25) | |
| parent = recipe['parent_static_scene_id'] | |
| for scene in recipe['scenes']: | |
| revisions=[REVISION]+([recipe['speech_revision']] if recipe.get('speech_revision') else []) | |
| scene['scene_id'] = uid(parent, scene['branch'], *revisions) | |
| scene['scene_group_id'] = uid(parent, 'paired_motion', *revisions) | |
| for entity in scene['humans'] + scene['robots']: | |
| entity['displacement_m'] = (list(SHIFTS[entity['entity_id']]) | |
| if entity['entity_id'] in scene['moving_entity_ids'] else [0., 0., 0.]) | |
| entity['motion_duration_s'] = 6.3 | |
| for source in scene['playback_sources']: | |
| robot = next(r for r in scene['robots'] if r['entity_id'] == source['entity_id']) | |
| source['displacement_m'] = list(robot['displacement_m']) | |
| source['motion_duration_s'] = robot['motion_duration_s'] | |
| source['yaw_deg'] = robot['yaw_deg'] | |
| return recipe | |
| if __name__ == '__main__': | |
| p = argparse.ArgumentParser(); p.add_argument('--root', type=Path, required=True) | |
| args = p.parse_args(); path = args.root / 'data/recipe.json' | |
| write(path, revised_recipe(read(path))) | |
| print('Updated motion only; regenerate FOA, export, then decode binaural.') | |