Run evaluation on motion data by first rendering to videos and then evaluating Args: evaluation_path: Path containing dimension folders with motion files name: Name for this evaluation run dimension_list: List of dimensions to evaluate (i
(self, evaluation_path: str, name: str,
dimension_list: List[str] = None,
device_id: int = 0, **kwargs)
| 319 | return cur_full_info_path |
| 320 | |
| 321 | def evaluate(self, evaluation_path: str, name: str, |
| 322 | dimension_list: List[str] = None, |
| 323 | device_id: int = 0, **kwargs) -> Dict[str, Any]: |
| 324 | """ |
| 325 | Run evaluation on motion data by first rendering to videos and then evaluating |
| 326 | |
| 327 | Args: |
| 328 | evaluation_path: Path containing dimension folders with motion files |
| 329 | name: Name for this evaluation run |
| 330 | dimension_list: List of dimensions to evaluate (if None, evaluates all) |
| 331 | device_id: CUDA device ID for rendering |
| 332 | **kwargs: Additional arguments passed to evaluation functions |
| 333 | |
| 334 | Returns: |
| 335 | Dictionary containing evaluation results for each dimension |
| 336 | """ |
| 337 | results_dict = {} |
| 338 | |
| 339 | if dimension_list is None: |
| 340 | dimension_list = self.build_full_dimension_list() |
| 341 | |
| 342 | # First, render motions to intermediate videos for video-based dimensions |
| 343 | # if "Motion_Condition_Consistency" in dimension_list or "Motion_Generalizability" in dimension_list: |
| 344 | # print("Rendering motions to intermediate videos...") |
| 345 | self.render_motions_to_videos(evaluation_path, dimension_list, name, device_id) |
| 346 | |
| 347 | # Build the full info JSON file using both videos and pt files |
| 348 | print("Building evaluation metadata...") |
| 349 | cur_full_info_path = self.build_full_info_json( |
| 350 | evaluation_path, name, dimension_list, **kwargs |
| 351 | ) |
| 352 | |
| 353 | # Evaluate each dimension |
| 354 | print("Running evaluations...") |
| 355 | per_motion_registry: Dict[str, Dict[str, Any]] = {} |
| 356 | |
| 357 | for dimension in dimension_list: |
| 358 | try: |
| 359 | # Import the dimension module |
| 360 | category = self.get_category(dimension) |
| 361 | dimension_lower = dimension.lower() |
| 362 | dimension_module = importlib.import_module(f'mbench.{category}') |
| 363 | evaluate_func = getattr(dimension_module, f'compute_{dimension_lower}') |
| 364 | |
| 365 | print(f'Evaluating dimension: {dimension}') |
| 366 | results = evaluate_func(cur_full_info_path, self.device, **kwargs) |
| 367 | results_dict[dimension] = results |
| 368 | |
| 369 | per_motion_entries = [] |
| 370 | if isinstance(results, dict): |
| 371 | per_motion_entries = results.get("per_motion") or [] |
| 372 | for entry in per_motion_entries: |
| 373 | motion_id = entry.get("id") |
| 374 | if motion_id is None: |
| 375 | continue |
| 376 | motion_key = str(motion_id) |
| 377 | base_record = per_motion_registry.setdefault( |
| 378 | motion_key, |
no test coverage detected