This installation guide assumes you have Python 3.9+ and recommend using Anaconda to manage the environment.
- Python 3.9+
- Anaconda (recommended)
- NVIDIA GPU with CUDA support (CUDA 11.8+ recommended)
- SMPL model files (download from SMPL website)
Clone the repository with submodules:
If you've already cloned the repository without submodules, initialize them:
git submodule update --init --recursiveconda create -n monoclothrecon python=3.9
conda activate monoclothreconInstall PyTorch with CUDA support. For CUDA 11.8:
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu118Or using conda:
conda install pytorch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 pytorch-cuda=11.8 -c pytorch -c nvidiaFirst, install the required dependencies:
conda install -c fvcore -c iopath -c conda-forge fvcore iopathThen install pytorch3d:
pip install "git+https://github.com/facebookresearch/pytorch3d.git"Build and install nvdiffrast from the submodule:
cd packages/nvdiffrast
pip install .
cd ../..Install the remaining required Python packages:
pip install trimesh pyyaml easydict tensorboard torchvision numpy scipyInstall the local nvdiffmodeling package:
pip install -e packages/nvdiffmodeling- Copy the configuration template:
cp scripts/configs/config_template.yml my_config.yml- Edit
my_config.ymland update the following paths:smpl_path: Path to SMPL_NEUTRAL.pklsmpl_pkl: Path to SMPL fitting resultsmesh: Path to template mesh (.obj file)target_images: Path to input imagestarget_diffuse_maps: Path to diffuse mapstarget_shil_maps: Path to silhouette mapsoutput_path: Path for output directory- Other dataset-specific paths
Run the full pipeline (geometry + texture reconstruction):
python main.py --config my_config.ymlOr run specific stages:
# Geometry training only
from scripts.geometry import geometry_training_loop
geometry_training_loop(cfg, device)
# Texture/appearance training
from scripts.appearance import appearance_training_loop
appearance_training_loop(cfg, device)
# Inference
from scripts.inference import Inference
Inference(cfg, texture=True, device=device)Key configuration parameters in config.yml:
-
Model Configuration:
model_type: Dataset type (Dress4DorPeopleSnapshot)model: Model architecture (hashgrid,hashgrid_vd,general,diffusion)
-
Training Configuration:
num_epochs: Number of training epochswarm_ups: Warm-up epochs before deformationremeshing: Enable/disable remeshing
-
Texture Configuration:
texture_recon: Enable texture reconstructionuse_dynamic_texture: Use dynamic texture modeltexture_map: Texture map resolution [width, height]
See scripts/configs/config_template.yml for all available options.
- Organize your data in the following structure:
data/
├── images/
├── masks/
├── smpl_fittings.pkl
└── template_mesh.obj
- Update the configuration file with your data paths.
Follow similar structure as Dress4D. Ensure SMPL fittings are available for each frame.
MonoClothRecon/
├── main.py # Main entry point
├── scripts/
│ ├── geometry.py # Geometry training loop
│ ├── appearance.py # Texture/appearance training
│ ├── inference.py # Inference and evaluation
│ ├── models/ # Model definitions
│ ├── dataloader/ # Data loading utilities
│ ├── losses/ # Loss functions
│ ├── renderer/ # Rendering utilities
│ └── utils/ # Utility functions
├── packages/ # External dependencies (submodules)
│ ├── nvdiffrast/ # NVIDIA differentiable rasterizer
│ ├── nvdiffrec/ # NVIDIA differentiable reconstruction
│ ├── fashion-clip/ # Fashion-CLIP model
│ ├── nvdiffmodeling/ # Local modeling utilities
│ └── fashion_clip/ # Local fashion-clip copy
└── preprocessing/ # Data preprocessing scripts
If you use this code, please cite:
@article{dasgupta2025ngd,
title={NGD: Neural Gradient Based Deformation for Monocular Garment Reconstruction},
author={Dasgupta, Soham and Naik, Shanthika and Savalia, Preet and Ingle, Sujay Kumar and Sharma, Avinash},
journal={arXiv preprint arXiv:2508.17712},
year={2025}
}Please check individual package licenses:
- nvdiffrast: NVIDIA Source Code License
- nvdiffrec: NVIDIA Source Code License
- fashion-clip: Check original repository license
- NVIDIA nvdiffrast and nvdiffrec for differentiable rendering
- SMPL model from Max Planck Institute