MCPcopy Index your code
hub / github.com/MotrixLab/ViMoGen / load_pose_data

Function load_pose_data

mbench/pose_quality.py:54–91  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

52
53
54def 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
93def compute_pose_quality(full_info_path: str, device: str, **kwargs):
94 prompt_dict_ls = load_dimension_info(full_info_path, dimension='Pose_Quality')

Callers 2

compute_pose_qualityFunction · 0.85
compute_body_penetrationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected