Load pose data from evaluation file. Args: evaluation_file: Path to the evaluation file (.npy or .pt) device: Target device require_pose: If True, raises an error if 'pose' key is missing require_vertices: If True, raises an error if 'vertices' key is mi
(evaluation_file: str, device: str, require_pose: bool = False, require_vertices: bool = False)
| 52 | |
| 53 | |
| 54 | def load_pose_data(evaluation_file: str, device: str, require_pose: bool = False, require_vertices: bool = False): |
| 55 | """ |
| 56 | Load pose data from evaluation file. |
| 57 | |
| 58 | Args: |
| 59 | evaluation_file: Path to the evaluation file (.npy or .pt) |
| 60 | device: Target device |
| 61 | require_pose: If True, raises an error if 'pose' key is missing |
| 62 | require_vertices: If True, raises an error if 'vertices' key is missing |
| 63 | |
| 64 | Returns: |
| 65 | Dictionary with available data ('joints', 'pose', 'vertices') |
| 66 | |
| 67 | Raises: |
| 68 | ValueError: If required keys are missing |
| 69 | """ |
| 70 | import numpy as np |
| 71 | |
| 72 | if evaluation_file.endswith('.npy'): |
| 73 | # .npy files only contain raw joints |
| 74 | if require_pose or require_vertices: |
| 75 | raise ValueError( |
| 76 | f"File {evaluation_file} is .npy format (raw joints only). " |
| 77 | f"Pose_Quality and Body_Penetration require SMPLify-processed .pt files with 'pose' and 'vertices'. " |
| 78 | f"Please run SMPLify rendering first." |
| 79 | ) |
| 80 | joints = np.load(evaluation_file) |
| 81 | return {'joints': torch.from_numpy(joints).float().to(device)} |
| 82 | else: |
| 83 | # .pt files from SMPLify have pose, joints, vertices |
| 84 | data = torch.load(evaluation_file, map_location=device, weights_only=False) |
| 85 | |
| 86 | if require_pose and 'pose' not in data: |
| 87 | raise ValueError(f"File {evaluation_file} missing required 'pose' key") |
| 88 | if require_vertices and 'vertices' not in data: |
| 89 | raise ValueError(f"File {evaluation_file} missing required 'vertices' key") |
| 90 | |
| 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') |
no outgoing calls
no test coverage detected