Optimization module: data preparation and usage
September 8, 2025 ยท View on GitHub
Follow the root setup, then prepare a per-sample folder containing all inputs the optimizer expects. The code reads files directly from a single sample folder whose name must match the image filename.
You can download and unzip an example folder by running fetch_data.sh optim-demo-data
๐ Sample folder structure (example)
optim_data/
โโโ ๐ tennis_racket__000000041045.jpg # RGB input image
โโโ ๐ osx_human2.npz # OS-X output: smpl_vertices, smpl_faces, bbox_2
โโโ ๐ hcontact_vertices.npz # Human contact probs (pred_contact_3d_smplx)
โโโ ๐ human_mask.png # Person mask (binary HxW) โ or use JSON below
โโโ ๐ human_detection.json # Alternative to PNG; contains "mask": HxW
โโโ ๐ object_mesh.obj # Retrieved object mesh (triangles, meters)
โโโ ๐ ocontact_vertices.npz # Object contact probs (pred_contact_3d)
โโโ ๐ object_mask.png # Object mask (binary HxW) โ or use JSON below
โโโ ๐ object_detection.json # { bbox: [x,y,w,h], mask: HxW }
Sources for these files:
- OS-X โ produces
osx_human2.npz - Grounded-SAM โ produces
human_mask.png/human_detection.jsonandobject_mask.png/object_detection.json - Object_Retrieval โ produces
object_mesh.obj
Run
Run the optimization demo:
bash scripts/run_optim.sh
or
python -m optim.fit \
--input_path optim_data/tennis_racket__000000041045.jpg \
--cfg optim/cfg/fit.yaml \
[--out_root /path/to/output_root]