File size: 1,252 Bytes
178f61f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import os
import subprocess
import sys
from pathlib import Path
# Add project root to path
sys.path.append(str(Path(__file__).parent.parent))
participants = [f"p{i:02d}" for i in range(15)]
processed_dir = 'data/processed'
patch_size = 16
suffix = f"_v{patch_size}"
def run_command(cmd):
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
print(f"--- Study A-1 Data Preparation (Resolution: {patch_size}x{patch_size}) ---")
for p in participants:
h5_path = os.path.join(processed_dir, f"{p}{suffix}.h5")
# 1. Preprocess
if not os.path.exists(h5_path):
print(f"\n[1/2] Preprocessing {p}...")
run_command([sys.executable, "src/data/preprocess_mpii.py", "--patch_size", str(patch_size), "--participants", p])
else:
print(f"\n[1/2] {p}{suffix}.h5 already exists. Skipping preprocessing.")
# 2. Teacher Labels
# We check if labels are already in the file by attempting to read them (simplified check: always run if file exists)
print(f"[2/2] Generating teacher labels for {p}{suffix}...")
run_command([sys.executable, "src/data/generate_teacher_labels.py", "--participant", f"{p}{suffix}"])
print("\n--- All 16x16 data prepared with teacher labels! ---")
|