MBench: Motion generation benchmark for evaluating human motion videos
| 11 | |
| 12 | |
| 13 | class MBench(object): |
| 14 | """ |
| 15 | MBench: Motion generation benchmark for evaluating human motion videos |
| 16 | """ |
| 17 | |
| 18 | def __init__(self, device: str, output_path: str, full_info_dir: Optional[str] = None): |
| 19 | """ |
| 20 | Initialize MBench evaluator |
| 21 | |
| 22 | Args: |
| 23 | device: Device to use for evaluation ('cuda' or 'cpu') |
| 24 | output_path: Directory to save evaluation results |
| 25 | full_info_dir: Path to full info JSON file (optional) |
| 26 | """ |
| 27 | self.device = device |
| 28 | self.output_path = output_path |
| 29 | self.full_info_dir = full_info_dir |
| 30 | os.makedirs(self.output_path, exist_ok=True) |
| 31 | self.category_dir_map = { |
| 32 | "motion_quality": "Motion_Quality", |
| 33 | "pose_quality": "Pose_Quality", |
| 34 | "motion_condition_consistency": "Motion_Condition_Consistency", |
| 35 | "motion_generalizability": "Motion_Generalizability" |
| 36 | } |
| 37 | |
| 38 | def build_full_dimension_list(self) -> List[str]: |
| 39 | """ |
| 40 | Build the complete list of available evaluation dimensions |
| 41 | |
| 42 | Returns: |
| 43 | List of available dimension names organized by categories |
| 44 | """ |
| 45 | return [ |
| 46 | # Motion Quality category dimensions |
| 47 | "Jitter_Degree", |
| 48 | "Ground_Penetration", |
| 49 | "Foot_Floating", |
| 50 | "Foot_Sliding", |
| 51 | "Dynamic_Degree", |
| 52 | "Body_Penetration", |
| 53 | "Pose_Quality", |
| 54 | # Motion-Condition Consistency category |
| 55 | "Motion_Condition_Consistency", |
| 56 | # Motion Generalizability category |
| 57 | "Motion_Generalizability" |
| 58 | ] |
| 59 | |
| 60 | def get_category(self, dimension: str) -> str: |
| 61 | """ |
| 62 | Get mapping of dimensions to their categories |
| 63 | |
| 64 | Returns: |
| 65 | mapping category name |
| 66 | """ |
| 67 | dimension_categories = { |
| 68 | # Motion_Quality category |
| 69 | "Jitter_Degree": "motion_quality", |
| 70 | "Ground_Penetration": "motion_quality", |