Skip to content

Latest commit

 

History

History
executable file
·
99 lines (73 loc) · 3.16 KB

README.md

File metadata and controls

executable file
·
99 lines (73 loc) · 3.16 KB

HashRF

Installation

Tested on Ubuntu 20.04 + Pytorch 1.10.1

Install environment:

conda create -n HashRF python=3.8
conda activate HashRF
pip install torch torchvision
pip install tqdm scikit-image opencv-python configargparse lpips imageio-ffmpeg kornia lpips tensorboard
# install tiny-cuda-nn(NGP)
cd Dependency/tiny-cuda-nn/bindings/torch
python setup.py install

Dataset

Quick Start

The training script is in train.py, to train a TensoRF:

python train.py --config configs/lego.txt

if your data has already downloads, test the dataset(eq.nerf_stnthetic) with command:

bash train_synthetic.sh

we provide a few examples in the configuration folder, please note:

dataset_name, choices = ['blender', 'llff', 'nsvf', 'tankstemple'];

shadingMode, choices = ['MLP_Fea', 'MLP_Res'];

model_name, choices = ['HashSplit','Hash']

Rendering

python train.py --config configs/lego.txt --ckpt path/to/your/checkpoint --render_only 1 --render_test 1 

You can just simply pass --render_only 1 and --ckpt path/to/your/checkpoint to render images from a pre-trained checkpoint. You may also need to specify what you want to render, like --render_test 1, --render_train 1 or --render_path 1. The rendering results are located in your checkpoint folder.

Extracting mesh

You can also export the mesh by passing --export_mesh 1:

python train.py --config configs/lego.txt --ckpt path/to/your/checkpoint --export_mesh 1

Note: Please re-train the model and don't use the pretrained checkpoints provided by us for mesh extraction, because some render parameters has changed.

Training with your own data

We provide two options for training on your own image set:

  1. Following the instructions in the NSVF repo, then set the dataset_name to 'tankstemple'.
  2. Calibrating images with the script from NGP: python dataLoader/colmap2nerf.py --colmap_matcher exhaustive --run_colmap, then adjust the datadir in configs/your_own_data.txt. Please check the scene_bbox and near_far if you get abnormal results.

Citation

Thanks to APChen's work TensoRF citing:

@INPROCEEDINGS{Chen2022ECCV,
  author = {Anpei Chen and Zexiang Xu and Andreas Geiger and Jingyi Yu and Hao Su},
  title = {TensoRF: Tensorial Radiance Fields},
  booktitle = {European Conference on Computer Vision (ECCV)},
  year = {2022}
}

and Tiny-cuda-nn(Instant-NGP)

@software{tiny-cuda-nn,
	author = {M\"uller, Thomas},
	license = {BSD-3-Clause},
	month = {4},
	title = {{tiny-cuda-nn}},
	url = {https://github.com/NVlabs/tiny-cuda-nn},
	version = {1.7},
	year = {2021}
}