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.json and object_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]