(full_info_path: str, device: str, **kwargs)
| 91 | return data |
| 92 | |
| 93 | def compute_pose_quality(full_info_path: str, device: str, **kwargs): |
| 94 | prompt_dict_ls = load_dimension_info(full_info_path, dimension='Pose_Quality') |
| 95 | nrdf_model_dir = 'checkpoints/nrdf/amass_softplus_l1_0.0001_10000_dist0.5_eik0.0_man0.1' |
| 96 | nrdf_model = load_model(nrdf_model_dir) |
| 97 | |
| 98 | pose_quality_list = [] |
| 99 | per_motion_metrics = [] |
| 100 | skipped = 0 |
| 101 | |
| 102 | for prompt_dict in tqdm(prompt_dict_ls): |
| 103 | evaluation_file = prompt_dict["evaluation_file"] |
| 104 | try: |
| 105 | data = load_pose_data(evaluation_file, device, require_pose=True) |
| 106 | except ValueError as e: |
| 107 | skipped += 1 |
| 108 | continue |
| 109 | |
| 110 | pred_pose = torch.as_tensor(data['pose'], device=device, dtype=torch.float32) |
| 111 | |
| 112 | # Overall pose quality evaluation based on NRDF |
| 113 | # Convert predicted pose to quaternion |
| 114 | pose_quat = axis_angle_to_quaternion(pred_pose) |
| 115 | dist_pred = nrdf_model(pose_quat, train=False)['dist_pred'] |
| 116 | pose_quality = dist_pred.mean().item() * 10 |
| 117 | |
| 118 | pose_quality_value = float(pose_quality) |
| 119 | pose_quality_list.append(pose_quality_value) |
| 120 | per_motion_metrics.append( |
| 121 | { |
| 122 | "id": prompt_dict.get("id"), |
| 123 | "prompt": prompt_dict.get("prompt"), |
| 124 | "value": pose_quality_value, |
| 125 | "evaluation_file": evaluation_file, |
| 126 | "motion_duration": prompt_dict.get("motion_duration"), |
| 127 | } |
| 128 | ) |
| 129 | |
| 130 | if skipped > 0: |
| 131 | print(f"Pose_Quality: Skipped {skipped} samples (missing SMPLify data). Run SMPLify rendering first.") |
| 132 | |
| 133 | return { |
| 134 | "aggregate": summarize_scores(pose_quality_list), |
| 135 | "per_motion": per_motion_metrics, |
| 136 | } |
| 137 | |
| 138 | |
| 139 | def compute_body_penetration(full_info_path: str, device: str, **kwargs): |
nothing calls this directly
no test coverage detected