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

Method render_motions_to_videos

mbench/__init__.py:147–254  ·  view source on GitHub ↗

Render motion files to intermediate files for evaluation Only renders each category once Args: evaluation_path: Path containing dimension folders with motion files dimension_list: List of dimensions to process name: Name for the e

(self, evaluation_path: str, dimension_list: List[str], 
                            name: str, device_id: int = 0)

Source from the content-addressed store, hash-verified

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:
149 """
150 Render motion files to intermediate files for evaluation
151 Only renders each category once
152
153 Args:
154 evaluation_path: Path containing dimension folders with motion files
155 dimension_list: List of dimensions to process
156 name: Name for the evaluation run
157 device_id: CUDA device ID for rendering
158 """
159 from .render import render
160
161 # Load full info list
162 full_info_list = load_json(self.full_info_dir)
163 if not full_info_list:
164 print("WARNING: No entries found in full info list")
165 return
166
167 processed_categories = set()
168 rendered_count = 0
169
170 # Only video-based metrics need SMPLify + video rendering
171 # pose_quality needs SMPLify for pose/vertices but no video
172 # motion_quality only needs raw 3D joints (already in .npy format)
173 video_categories = {"motion_condition_consistency", "motion_generalizability"}
174 smplify_categories = {"pose_quality"} # Need SMPLify but no video
175 joints_only_categories = {"motion_quality"} # Only need raw joints
176 mbench_dir = self._get_mbench_dir(evaluation_path)
177
178 for dimension in dimension_list:
179 category = self.get_category(dimension)
180
181 if category in processed_categories:
182 print(f'Skipping dimension {dimension} already processed')
183 continue
184 processed_categories.add(category)
185
186 # For motion_quality, skip SMPLify entirely - use raw 3D joints from .npy files
187 if category in joints_only_categories:
188 print(f'Dimension {dimension} uses raw 3D joints; skipping SMPLify rendering')
189 continue
190
191 # Filter entries for current dimension
192 dimension_entries = [
193 entry for entry in full_info_list if entry["dimension"] == dimension
194 ]
195
196 for entry in dimension_entries:
197 motion_id = entry["id"]
198 try:
199 target_pt = mbench_dir / f"{motion_id}.pt"
200 target_video = mbench_dir / f"{motion_id}.mp4"
201
202 # For video categories, check if video already exists
203 if category in video_categories and target_video.exists():
204 print(f'Using existing rendered video for ID {motion_id} at {target_video}')

Callers 1

evaluateMethod · 0.95

Calls 7

_get_mbench_dirMethod · 0.95
get_categoryMethod · 0.95
_load_motion_arrayMethod · 0.95
renderFunction · 0.90
load_jsonFunction · 0.85

Tested by

no test coverage detected