This is the official repo for PyTorch implementation of paper "ClimateNeRF: Extreme Weather Synthesis in Neural Radiance Field", ICCV 2023.
https://github.com/y-u-a-n-l-i/Climate_NeRF/assets/68422992/59efd3e2-1dd2-4ce6-a07b-2d53a6a6c89e
This project is tested on:
conda
git clone --recursive https://github.com/y-u-a-n-l-i/Climate_NeRF.git
conda create -n climatenerf python=3.8
and conda activate climatenerf
.pip install torch==1.11.0 torchvision==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
torch-scatter
by pip install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
tinycudann
.
segformer_mit-b5_8xb1-160k_cityscapes-1024x1024
is recommended.pip3 install --no-build-isolation git+https://github.com/lucasb-eyer/pydensecrf.git
.
pip install -r requirements.txt
pip install models/csrc
, pip
>= 22.1 is needed. Recompile CUDA extension after any modifications.We use the download link from ARF. Download and extract by:
pip install gdown
gdown 10Tj-0uh_zIIXf0FZ6vT7_te90VsDnfCU
unzip TanksAndTempleBG.zip && mv TanksAndTempleBG tnt
We use the download link from Panoptic NeRF. We use the same data folder sructure as the one in Panoptic NeRF.
We mainly test our project on garden scene in mipnerf360 dataset.
To train our model with semantic predictions, users need to set render_semantic
in config files to be True
. Moreover, users need to set $SEM_CONF
and $SEM_CKPT
to where they put semantic config file and predictor's checkpoint which downloaded from mmsegmentation.
plane.npy
in the folder of dataset (e.g. TanksAndTempleBG/Playground/plane.npy
)python -m utility.vanishing_point --dataset <DATASET_TYPE> -root_dir <DATA_ROOT> -output plane.npy
The configuration of each scene could be adjusted in the config files under configs/
, and we provide partial training/rendering/simulation scripts under scripts/
.
In the following we use TanksAndTemple Playground scene as example, please edit the paths, experiment names accordingly. You can also run all the following together with bash scripts/tanks/playground.sh
, and the output images and videos are under results/
.
DATA_ROOT=${PATH_TO}/TanksAndTempleBG/Playground
SEM_CONF=${PATH_TO}/mmsegmentation/ckpts/segformer_mit-b5_8xb1-160k_cityscapes-1024x1024.py
SEM_CKPT=${PATH_TO}/mmsegmentation/ckpts/segformer_mit-b5_8x1_1024x1024_160k_cityscapes_20211206_072934-87a052ec.pth
python train.py --config configs/Playground.txt --exp_name playground \
--root_dir $DATA_ROOT --sem_conf_path $SEM_CONF --sem_ckpt_path $SEM_CKPT
python render.py --config configs/Playground.txt --exp_name playground \
--root_dir $DATA_ROOT \
--weight_path $CKPT \
--render_depth --render_depth_raw --render_normal --render_semantic
python stylize.py --config configs/Playground.txt \
--weight_path $CKPT --num_epochs 10
python render.py --config configs/Playground.txt --exp_name playground-smog \
--root_dir $DATA_ROOT \
--weight_path $CKPT \
--simulate smog --chunk_size -1
python render.py --config configs/Playground.txt --exp_name playground-flood \
--root_dir $DATA_ROOT \
--weight_path $CKPT \
--simulate water \
--plane_path $DATA_ROOT/plane.npy \
--anti_aliasing_factor 2 --chunk_size 600000
First make snow by:
python make_snow.py --config configs/Playground.txt --exp_name playground-snow \
--weight_path $STYLIZED_CKPT \
--weight_path_origin_scene $CKPT \
--mb_size 5.e-3 --num_epochs 20
--shadow_hint
flag if there are strong shadows in the scene, e.g. kitti dataset.$STYLIZED_CKPT
to the checkpoint generated by stylize.py
or the same as $CKPT
if no stylization needed.Set $CKPT_SNOW
to the checkpoint generated by make_snow.py
and render
python render.py --config configs/Playground.txt \
--weight_path $CKPT_SNOW \
--simulate snow --exp_name playground-snow --chunk_size 65535 --mb_size 5.e-3
The code was built on ngp_pl. Thanks kwea123 for the great project!