Shape-from-Template problem aims to reconstruct 3D object given a template. This repository provides a framework NSfT optimizing shapes using neural networks implemented in PyTorch. The overall pipeline is shown in the figure below.
The object masks can be estimated using SAM 2.
To install the dependencies, run the following command:
pip install -r requirements.txt
Our code still requires usage of differentiable renderers. We refer to the official documentation of the libraries Nvdiffrast and PyTorch3D for installation instructions.
To perform 3D reconstruction, you can config the runner using ConfigMyPy. Some config examples reported in our article can be found in configs/ICCV2025.
Then, you can run the following command to start the runner:
python main.py --config_file=configs/your/config/file.yaml --output_path=path/to/save/results/
This work is supported by the project RHINO (ANR-22-CE33-0014-01), a JCJC research grant.
We also thank Φ-SfT and PGSfT for releasing their code and their valuable discussions about the benchmarks.