Skip to content

Commit 03d364b

Browse files
committed
debug
1 parent bb08289 commit 03d364b

9 files changed

+124
-15
lines changed

command/get_rendered_images.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cd CR-NeRF
1+
# cd CR-NeRF
22

33
#Path of checkpoints
44
ckpt_path1="ckpts/CR-NeRF-downscale=2.ckpt"
@@ -9,6 +9,7 @@ img_downscale=2
99
# img_downscale=4
1010

1111
#Path of in-the-wild dataset
12+
echo !!modify the following path!!
1213
root_dir1="/mnt/cephfs/dataset/NVS/nerfInWild/brandenburg_gate/"
1314
#Path to save the synthesized images
1415
save_dir1=/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results

command/get_video_demo.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
# --ckpt_path ckpts/CR-NeRF-trevi_fountain.ckpt
1111

1212
##generating videos of brandenburg_gate
13-
source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
14-
conda activate crnerf
15-
cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
13+
# source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
14+
# conda activate crnerf
15+
# cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
16+
echo !!modify the following path!!
1617
CUDA_VISIBLE_DEVICES=2 python appearance_modification_video.py \
1718
--save_dir /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results \
1819
--chunk 4096 --encode_a --nerf_out_dim 64 --decoder_num_res_blocks 1\

command/test.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Description: test script for CR-Nerf
2-
cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
3-
source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
4-
conda activate crnerf
5-
exp_name1="test_only/test" #replace with your own experiment name
2+
# cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
3+
# source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
4+
# conda activate crnerf
5+
exp_name1="test_only/test1" #replace with your own experiment name
66
root_dir1="/mnt/cephfs/dataset/NVS/nerfInWild/brandenburg_gate/" #repalce with your own dataset path
77
save_dir1=/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results #replace with your own save path
88
model_mode1="1-1"
99
decoder='linearStyle'
10-
ckpt_path1="ckpts/CR-NeRF-branden.ckpt"
10+
echo !!modify the following path!!
11+
ckpt_path1="/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/ckpts/debug/CR-NeRF-branden.ckpt"
1112
dataset_name1='phototourism'
1213
decoder_num_res_blocks=1
1314
img_downscale=4 #The provided model is trained with image resolution downscale ratio = 4.

command/train.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
#set --encode_a to use the proposed cross ray appearance transfer module
55
#set --use_mask to use the proposed transient handling module
66

7-
cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
8-
source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
9-
conda activate crnerf
7+
# cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
8+
# source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
9+
# conda activate crnerf
1010
nerf_out_dim1=64
11-
exp_name1="train/exp1"
11+
exp_name1="train/reproduce-20231111"
1212
model_mode1="1-1"
1313
decoder='linearStyle'
14+
echo !!modify the following path!!
1415
ckpt_path1="/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/ckpts/${exp_name1}/last.ckpt"
1516
root_dir1="/mnt/cephfs/dataset/NVS/nerfInWild/brandenburg_gate/"
1617
dataset_name1='phototourism'
@@ -21,7 +22,8 @@ img_downscale=4 ##Change this to 2 if you want to reproduce the results with im
2122

2223

2324
#train#
24-
CUDA_VISIBLE_DEVICES=3 python train_mask_grid_sample.py --root_dir $root_dir1 --dataset_name phototourism --save_dir /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results --img_downscale $img_downscale --N_importance 64 --N_samples 64 --num_epochs 20 --batch_size 1024 --optimizer adam --lr 5e-4 --lr_scheduler cosine --N_emb_xyz 15 --N_vocab 1500 --maskrs_max 5e-2 --maskrs_min 6e-3 --maskrs_k 1e-3 --maskrd 0 --N_a 48 --weightKL 1e-5 --weightRecA 1e-3 --weightMS 1e-6 --chunk 1310720 --encode_a --encode_c --encode_random --model_mode 1-1 --decoder linearStyle --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1 --use_cache --proj_name style_gnerf --num_gpus 1 --use_mask --exp_name $exp_name1
25+
CUDA_VISIBLE_DEVICES=3,4,5,6 python train_mask_grid_sample.py --root_dir $root_dir1 --dataset_name phototourism --save_dir /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results --img_downscale $img_downscale --N_importance 64 --N_samples 64 --num_epochs 20 --batch_size 1024 --optimizer adam --lr 5e-4 --lr_scheduler cosine --N_emb_xyz 15 --N_vocab 1500 --maskrs_max 5e-2 --maskrs_min 6e-3 --maskrs_k 1e-3 --maskrd 0 --N_a 48 --weightKL 1e-5 --weightRecA 1e-3 --weightMS 1e-6 --chunk 1310720 --encode_a --encode_c --encode_random --model_mode 1-1 --decoder linearStyle --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1 --use_cache --proj_name style_gnerf --num_gpus 0 --use_mask --exp_name $exp_name1
26+
2527

2628

2729

@@ -39,6 +41,7 @@ CUDA_VISIBLE_DEVICES=3 python eval.py \
3941
--ckpt_path $ckpt_path1 \
4042
--chunk 2048 --img_wh 320 240 --encode_a --decoder $decoder --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1
4143

44+
4245
#calculate metrics#
4346
CUDA_VISIBLE_DEVICES=0 python eval_metric.py \
4447
--root_dir $root_dir1 \

command/train_ds2.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
#!Note: set N_vocab to 1500 for brandenburg_gate and Sacre coeur dataset, 3200 for trevi fountain datasets
3+
#use command --use_cache to use prepared dataset as described in docs/dataset.md for speeding up training
4+
#set --encode_a to use the proposed cross ray appearance transfer module
5+
#set --use_mask to use the proposed transient handling module
6+
7+
# cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
8+
# source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
9+
# conda activate crnerf
10+
nerf_out_dim1=64
11+
exp_name1="train/reproduce-ds2-20231111"
12+
model_mode1="1-1"
13+
decoder='linearStyle'
14+
echo !!modify the following path!!
15+
ckpt_path1="/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/ckpts/${exp_name1}/last.ckpt"
16+
root_dir1="/mnt/cephfs/dataset/NVS/nerfInWild/brandenburg_gate/"
17+
dataset_name1='phototourism'
18+
save_dir1=/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results
19+
decoder_num_res_blocks=1
20+
img_downscale=2 ##Change this to 2 if you want to reproduce the results with image resolution downscale ratio = 2, note that downscale =2 requires more training and inference time due to the larger image size.
21+
22+
23+
24+
#train#
25+
# CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python train_mask_grid_sample.py --root_dir $root_dir1 --dataset_name phototourism --save_dir /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results --img_downscale $img_downscale --N_importance 64 --N_samples 64 --num_epochs 20 --batch_size 1024 --optimizer adam --lr 5e-4 --lr_scheduler cosine --N_emb_xyz 15 --N_vocab 1500 --maskrs_max 5e-2 --maskrs_min 6e-3 --maskrs_k 1e-3 --maskrd 0 --N_a 48 --weightKL 1e-5 --weightRecA 1e-3 --weightMS 1e-6 --chunk 1310720 --encode_a --encode_c --encode_random --model_mode 1-1 --decoder linearStyle --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1 --use_cache --proj_name style_gnerf --num_gpus 8 --use_mask --exp_name $exp_name1
26+
27+
28+
29+
30+
#test#
31+
cd /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/logs/$exp_name1/codes
32+
33+
#render image#
34+
CUDA_VISIBLE_DEVICES=3 python eval.py \
35+
--root_dir $root_dir1 \
36+
--save_dir $save_dir1 \
37+
--dataset_name $dataset_name1 --scene_name $exp_name1 \
38+
--split test_test --img_downscale $img_downscale \
39+
--N_samples 256 --N_importance 256 --N_emb_xyz 15 \
40+
--N_vocab 1500 \
41+
--ckpt_path $ckpt_path1 \
42+
--chunk 2048 --img_wh 320 240 --encode_a --decoder $decoder --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1
43+
44+
45+
#calculate metrics#
46+
CUDA_VISIBLE_DEVICES=0 python eval_metric.py \
47+
--root_dir $root_dir1 \
48+
--save_dir $save_dir1 \
49+
--dataset_name $dataset_name1 --scene_name $exp_name1 \
50+
--split test_test --img_downscale $img_downscale \
51+
--img_wh 320 240

commandv1/train_ds2_weights.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
#!Note: set N_vocab to 1500 for brandenburg_gate and Sacre coeur dataset, 3200 for trevi fountain datasets
3+
#use command --use_cache to use prepared dataset as described in docs/dataset.md for speeding up training
4+
#set --encode_a to use the proposed cross ray appearance transfer module
5+
#set --use_mask to use the proposed transient handling module
6+
7+
cd /mnt/cephfs/home/yangyifan/yangyifan/code/learnToSyLf/CR-NeRF
8+
source /mnt/cephfs/home/yangyifan/miniconda/etc/profile.d/conda.sh
9+
conda activate crnerf
10+
nerf_out_dim1=64
11+
exp_name1="train/debug"
12+
model_mode1="1-1"
13+
decoder='linearStyle'
14+
ckpt_path1="/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/ckpts/${exp_name1}/last.ckpt"
15+
root_dir1="/mnt/cephfs/dataset/NVS/nerfInWild/brandenburg_gate/"
16+
dataset_name1='phototourism'
17+
save_dir1=/mnt/cephfs/dataset/NVS/nerfInWild/experimental_results
18+
decoder_num_res_blocks=1
19+
img_downscale=2 ##Change this to 2 if you want to reproduce the results with image resolution downscale ratio = 2, note that downscale =2 requires more training and inference time due to the larger image size.
20+
21+
22+
23+
#train#
24+
CUDA_VISIBLE_DEVICES=3 python train_mask_grid_sample.py --root_dir $root_dir1 --dataset_name phototourism --save_dir /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results --img_downscale $img_downscale --N_importance 64 --N_samples 64 --num_epochs 20 --batch_size 1024 --optimizer adam --lr 5e-4 --lr_scheduler cosine --N_emb_xyz 15 --N_vocab 1500 --maskrs_max 5e-2 --maskrs_min 6e-3 --maskrs_k 1e-3 --maskrd 0 --N_a 48 --weightKL 1e-5 --weightRecA 1e-3 --weightMS 1e-6 --chunk 1310720 --encode_a --encode_c --encode_random --model_mode 1-1 --decoder linearStyle --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1 --use_cache --proj_name style_gnerf --num_gpus 1 --use_mask --exp_name $exp_name1 --weightcontent 1e-7
25+
26+
27+
28+
29+
#test#
30+
cd /mnt/cephfs/dataset/NVS/nerfInWild/experimental_results/logs/$exp_name1/codes
31+
32+
#render image#
33+
CUDA_VISIBLE_DEVICES=2 python eval.py \
34+
--root_dir $root_dir1 \
35+
--save_dir $save_dir1 \
36+
--dataset_name $dataset_name1 --scene_name $exp_name1 \
37+
--split test_test --img_downscale $img_downscale \
38+
--N_samples 256 --N_importance 256 --N_emb_xyz 15 \
39+
--N_vocab 1500 \
40+
--ckpt_path $ckpt_path1 \
41+
--chunk 2048 --img_wh 320 240 --encode_a --decoder $decoder --decoder_num_res_blocks $decoder_num_res_blocks --nerf_out_dim $nerf_out_dim1
42+
43+
44+
#calculate metrics#
45+
CUDA_VISIBLE_DEVICES=0 python eval_metric.py \
46+
--root_dir $root_dir1 \
47+
--save_dir $save_dir1 \
48+
--dataset_name $dataset_name1 --scene_name $exp_name1 \
49+
--split test_test --img_downscale $img_downscale \
50+
--img_wh 320 240

eval.py

+1
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def eulerAnglesToRotationMatrix(theta):
297297
img_pred_ = (img_pred*255).astype(np.uint8)
298298
imgs += [img_pred_]
299299
imageio.imwrite(os.path.join(dir_name, f'{i:03d}.png'), img_pred_)
300+
print("image saving path",os.path.join(dir_name, f'{i:03d}.png'))")
300301

301302
if args.dataset_name == 'blender' or \
302303
(args.dataset_name == 'phototourism' and args.split == 'test'):

eval_metric.py

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def get_opts():
7272
for i in tqdm(range(len(dataset))):
7373
sample = dataset[i]
7474
image_pre_path = os.path.join(dir_name, f_list[idx_list.index(f'{i:03d}')])
75+
print("image_pre_path",image_pre_path)
7576
img_pred = Image.open(image_pre_path).convert('RGB')
7677
img_pred = toTensor(img_pred) # (3, h, w)
7778
if args.dataset_name == 'blender':

train_mask_grid_sample.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def save_code(hparams_):
477477

478478
if __name__ == '__main__':
479479
import os
480-
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
480+
# os.environ["CUDA_VISIBLE_DEVICES"] = "6"
481481
hparams_ = get_opts()
482482
print(hparams_.exp_name)
483483
if hparams_.testit:

0 commit comments

Comments
 (0)