text
stringlengths
0
1.47k
get_object_metadata,
load_all_metadata,
load_json,
print_summary,
save_metadata_report,
save_outputs,
)
from data_process.utils.motion_features import process_object
MIXAMO_OBJECT_TYPE = 'mixamo'
def parse_args(argv=None):
"""Stage-4 arguments from *argv* (default: the command line)."""
parser = argparse.ArgumentParser(
description="Process exported NPZ motions into canonicalized training clips.")
# Dataset selection
parser.add_argument("--dataset_type", type=str, required=True,
choices=['truebones', 'objaverse', 'mixamo', 'general'],
help="Which dataset layout to process")
# Directories
parser.add_argument("--data_dir", type=str, required=True,
help="Root data directory (motions under data_dir/motions, "
"metadata JSONs in data_dir)")
parser.add_argument("--save_dir", type=str, required=True,
help="Output directory for processed clips and metadata")
# Clip windowing
parser.add_argument("--max_clip_len", type=int, default=200,
help="Max frames per saved clip")
parser.add_argument("--diffusion_max_len", type=int, default=90,
help="Longest model training max length (the dataloader "
"random-crops to it). It sets the clip overlap: a "
"training crop is only reachable when it fits inside "
"one saved clip, so the stride is max_clip_len minus "
"this value. Set it to the largest max_motion_length "
"you train with.")
parser.add_argument("--apply_clip", action="store_true", default=False,
help="Crop long motions into overlapping fixed-length clips of "
"max_clip_len frames (stride = max_clip_len - "
"diffusion_max_len). Otherwise (default), keep only the "
"first max_clip_len frames of each motion.")
# Topology
parser.add_argument("--max_path_len", type=int, default=5,
help="Max path length for topology edge relations")
parser.add_argument("--max_freqs", type=int, default=8,
help="Number of Laplacian eigenvector frequencies for "
"spectral joint features")
# Scaling / grounding
parser.add_argument("--target_diameter", type=float, default=2.0,
help="Target skeleton diameter for leaf-to-leaf scaling")
parser.add_argument("--use_tpos_ground_height", action="store_true", default=False,
help="Ground every motion of an object type on the T-pose's "
"floor height. Otherwise (default), each motion is "
"grounded on its own minimum Y. The applied value is "
"recorded in cond as ground_height / ground_height_mode.")
# Filtering
parser.add_argument("--activity_threshold", type=float, default=0.02,
help="Min joint activity (temporal spread at canonical "
"scale) to keep a clip")
parser.add_argument("--static_threshold", type=float, default=1e-5,
help="Per-frame max-joint displacement below which a frame "
"is static; leading/trailing static frames are trimmed")
parser.add_argument("--jump_step_threshold", type=float, default=0.2,
help="Discontinuity filter: a clip is dropped when one "
"frame moves the skeleton at least this many clip "
"extents (the box the clip sweeps, root travel "
"included) AND that step is at least "
"--jump_ratio_threshold times the clip median "
"(concatenated actions / teleports). 0 disables.")
parser.add_argument("--jump_ratio_threshold", type=float, default=8.0,
help="Discontinuity filter: max/median per-frame joint "
"displacement ratio required alongside "
"--jump_step_threshold.")
parser.add_argument("--min_frames", type=int, default=8,
help="Minimum frame count for a motion to be kept "
"(checked after downsampling and static trimming)")
parser.add_argument("--mixamo_core_joints", action=argparse.BooleanOptionalAction,
default=True,
help="(mixamo only) Restrict the rig to the built-in "
"22-joint humanoid core (drops finger chains and "
"End bones). Use --no-mixamo_core_joints to keep "
"the full 65-joint skeleton.")
parser.add_argument("--min_joints", type=int, default=8,
help="Skip object types with fewer joints than this "
"(counted after corps filtering)")
parser.add_argument("--max_joints", type=int, default=150,
help="Skip object types with more joints than this "
"(counted after corps filtering)")
# Objaverse-only filtering
parser.add_argument("--filtered_clips", type=str, default="auto",
help="Path to a txt file listing individual export "
"clips (motion NPZ stems) to skip, one per line "
"with optional '#' comments. Default 'auto' uses "
"<data_dir>/filtered_clips.txt if present. Pass an "
"empty string to disable. Complements the on-the-fly "
"quality filters. Listed clips are dropped before "
"any object is processed, so they do NOT appear in "
"filtered_clips.json (which records runtime filters).")
parser.add_argument("--filtered_objects", type=str, default="auto",