Load motion tensor from .pt or .npy file.
(motion_path)
| 8 | |
| 9 | |
| 10 | def load_motion_tensor(motion_path): |
| 11 | """Load motion tensor from .pt or .npy file.""" |
| 12 | if motion_path.endswith(".pt"): |
| 13 | motion = torch.load(motion_path, weights_only=True, map_location="cpu") |
| 14 | elif motion_path.endswith(".npy"): |
| 15 | motion = torch.from_numpy(np.load(motion_path)).float() |
| 16 | else: |
| 17 | raise ValueError(f"Unsupported motion file format: {motion_path}") |
| 18 | |
| 19 | if isinstance(motion, dict): |
| 20 | motion = motion["motion"] |
| 21 | return motion |
| 22 | |
| 23 | |
| 24 | def compute_statistics(data_list, num_workers=8): |
no outgoing calls
no test coverage detected