MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / _load_motion_array

Method _load_motion_array

mbench/__init__.py:134–145  ·  view source on GitHub ↗

Load motion data from a supported file into a numpy array.

(self, motion_file: Path)

Source from the content-addressed store, hash-verified

132 return None
133
134 def _load_motion_array(self, motion_file: Path):
135 """Load motion data from a supported file into a numpy array."""
136 if motion_file.suffix == ".pt":
137 motions = torch.load(motion_file, map_location="cpu")
138 if isinstance(motions, dict):
139 motions = motions.get("joints", motions.get("motion", motions))
140 motions = motions.numpy() if hasattr(motions, "numpy") else motions
141 elif motion_file.suffix == ".npy":
142 motions = np.load(motion_file)
143 else:
144 raise ValueError(f"Unsupported motion file format: {motion_file}")
145 return motions
146
147 def render_motions_to_videos(self, evaluation_path: str, dimension_list: List[str],
148 name: str, device_id: int = 0) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected