#!/usr/bin/env python3 """Unpack images.tar into the images/ directory for training.""" import subprocess import sys from pathlib import Path def main(): root = Path(__file__).parent.resolve() tar_file = root / "images.tar" if not tar_file.exists(): print(f"Error: {tar_file} not found.", file=sys.stderr) return 1 out_dir = root / "images" out_dir.mkdir(parents=True, exist_ok=True) print(f"Extracting {tar_file} into {root}...") res = subprocess.run(["tar", "-xf", str(tar_file), "-C", str(root)]) if res.returncode == 0: print("Extraction complete! Images are ready in ./images/") return 0 else: print("Failed to extract images.", file=sys.stderr) return res.returncode if __name__ == "__main__": sys.exit(main())