/code-nerf-imle

Official repository for CodeNeRF

Primary LanguageJupyter NotebookMIT LicenseMIT

CodeNeRF: Disentangled Neural Radiance Fields for Object Categories

Date : 27th Feb, 2022

This contains the implementation of the paper CodeNeRF. Please refer to the project webpage for demos.

Install the environment

# python >= 3.8
conda env create -f environment.yml
conda activate codenerf
conda install pytorch==1.9.1 torchvision==0.10.1 cudatoolkit=11.3 faiss-gpu -c pytorch -c conda-forge
pip install setuptools==58.2.0 tensorboard

ComputeCanada

module load StdEnv/2020 python/3.8 gcc/9.3.0 cuda/11.1
virtualenv --no-download env
source env/bin/activate
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt

Catalog

  • Training
  • Optimizing with GT pose
  • Editing Shapes/Textures
  • Pose Optimizing

Download the data (ShapeNet-SRN)

For ShapeNet-SRN dataset, you can download it from https://drive.google.com/drive/folders/1PsT3uKwqHHD2bEEHkIXB99AlIjtmrEiR

Training

python train.py --gpu <gpu_id> --save_dir <save_dir> --jsonfiles <jsonfile.json> --iters_crop 1000000 --iters_all 1200000

JSON files contain hyper-parameters as well as data directory. 'iters_crop' and 'iters_all' are number of iterations for both cropped and whole images.

Optimizing

python optimize.py --gpu <gpu_id> --saved_dir <trained_dir>

The result will be stored in <trained_dir/test(_num)>, and each folder contains the progress of optimization, and the evaluation of test set. The final optimized results and the quantitative evaluations are stored in 'trained_dir/test(_num)/codes.pth'

BibTex

@inproceedings{jang2021codenerf,
  title={Codenerf: Disentangled neural radiance fields for object categories},
  author={Jang, Wonbong and Agapito, Lourdes},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={12949--12958},
  year={2021}
}

References

Some parts of code are borrowed from below amazing repositories.

Supplementary Video

03951-supp.mp4

License

MIT