Download examples/load_motion.py from JianuoCao/Moving: direct link, hf CLI and curl.
- Browser
- Download file 864 Bytes
-
https://huggingface.co/datasets/JianuoCao/Moving/resolve/main/examples/load_motion.py
- Command line
-
hf download hf://datasets/JianuoCao/Moving/examples/load_motion.py
-
curl -L -o load_motion.py https://huggingface.co/datasets/JianuoCao/Moving/resolve/main/examples/load_motion.py
864 Bytes
| """pip install datasets numpy; python examples/load_motion.py""" | |
| import numpy as np | |
| from datasets import load_dataset | |
| dataset = load_dataset("JianuoCao/Moving", "motions", split="train") | |
| clip = dataset[0] | |
| t = np.asarray(clip["timestamps_s"], dtype=np.float64) | |
| measured = np.asarray(clip["dynamic_qpos"], dtype=np.float64) | |
| reference = np.asarray(clip["kinematic_qpos"], dtype=np.float64) | |
| assert measured.shape == reference.shape == (len(t), 36) | |
| print(clip["sample_id"], clip["mode"], clip["command_speed_mps"]) | |
| print("Frames:", len(t), "measured Hz:", clip["measured_fps"]) | |
| # Align translations before comparing: reference XY is already start-relative. | |
| aligned_measured = measured[:, :2] - measured[0, :2] | |
| aligned_reference = reference[:, :2] - reference[0, :2] | |
| print("Final measured XY:", aligned_measured[-1]) | |
| print("Final reference XY:", aligned_reference[-1]) | |