Closed nfyfamr closed 11 months ago
Hello. The code looks to have simple bug. Any help to fix the bug will be appreciated! Thanks.
Environment:
Ubuntu 22.04.3 LTS NVIDIA RTX A6000 CUDA: 11.1.1 Python: 3.8.18 PyTorch: 1.10.0+cu111
Reproduce: bash Chair_train.sh
points to process: 145392 | 0/25 [00:00<?, ?it/s] #points to process: 914571 #points to process: 1588298 #points to process: 50218 run_nerf_test_with_depth.py:281: FutureWarning: `multichannel` is a deprecated argument name for `structural_similarity`. It will be removed in version 1.0. Please use `channel_axis` instead. ssim = calculate_ssim(rgb.cpu().numpy(), gt_img_numpy, data_range=gt_img_numpy.max() - gt_img_numpy.min(), multichannel=True) Setting up [LPIPS] perceptual loss: trunk [alex], v[0.1], spatial [off] Loading model from: /home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/lpips/weights/v0.1/alex.pth 0%| | 0/25 [00:00<?, ?it/s] 25%|████████████████████████████████████████████▉ | 4999/20000 [04:12<12:37, 19.80it/s] Traceback (most recent call last): File "run_nerf_test_with_depth.py", line 1326, in <module> main() File "run_nerf_test_with_depth.py", line 1322, in main restarting_job = train(cfg, log_path, render_cfg_path) File "run_nerf_test_with_depth.py", line 1244, in train render_path(torch.Tensor(poses[i_test]).to(device), intrinsics, cfg['chunk_size'], render_kwargs_test, gt_imgs=images[i_test], savedir=testsavedir) File "run_nerf_test_with_depth.py", line 308, in render_path imageio.imwrite(filename3, rgb8(depths[-1])) TypeError: 'numpy.ndarray' object is not callable auto log path: logs/paper/pretrain_occupancy/Synthetic_NeRF_Chair400_400 {'dataset_dir': 'data/nsvf/Synthetic_NeRF/Chair400_400', 'dataset_type': 'nsvf', 'pretrained_cfg_path': 'cfgs/paper/pretrain/Synthetic_NeRF_Chair400_400.yaml', 'pretrained_checkpoint_path': 'logs/paper/finetune/Synthetic_NeRF_Chair200_200/checkpoint_0020000.pth', 'resolution': [256, 256, 256], 'subsample_resolution': [3, 3, 3], 'threshold': 10, 'voxel_batch_size': 16384} global_domain_min: tensor([-0.9129, -0.8928, -1.1940]), global_domain_max: tensor([0.6871, 0.7072, 1.2060]) Traceback (most recent call last): File "build_occupancy_tree.py", line 172, in <module> main() File "build_occupancy_tree.py", line 169, in main build_occupancy_tree(cfg, log_path) File "build_occupancy_tree.py", line 53, in build_occupancy_tree cp = torch.load(cfg['pretrained_checkpoint_path']) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'logs/paper/finetune/Synthetic_NeRF_Chair200_200/checkpoint_0020000.pth' auto log path: logs/paper/distill/Synthetic_NeRF_Chair400_400 {'blender_half_res': False, 'dataset_dir': 'data/nsvf/Synthetic_NeRF/Chair800_800', 'dataset_type': 'nsvf', 'discovery': {'alpha_distance': 0.0211, 'alpha_rgb_initalization': 'pass_actual_nonlinearity', 'bias_initialization_method': 'standard', 'convert_density_to_alpha': True, 'direction_layer_size': 32, 'equal_split_metric': 'mse', 'hidden_layer_size': 32, 'iterations': 50000, 'late_feed_direction': True, 'max_num_networks': 1024, 'network_rng_seed': 8078673, 'nonlinearity_initalization': 'pass_actual_nonlinearity', 'num_examples_per_network': 408000, 'num_frequencies': 10, 'num_frequencies_direction': 4, 'num_hidden_layers': 2, 'num_train_examples_per_network': 400000, 'outputs': 'color_and_density', 'quantile_se': 0.99, 'query_batch_size': 80000, 'refeed_position_index': 'None', 'test_batch_size': 512, 'test_error_metric': 'quantile_se', 'test_every': 50000, 'train_batch_size': 128, 'use_same_initialization_for_all_networks': True, 'weight_initialization_method': 'kaiming_uniform'}, 'res_preres_scale': 4, 'fixed_resolution': [16, 16, 16], 'max_error': 40000, 'performance_monitoring': False, 'pretrained_cfg_path': 'cfgs/paper/distill/Synthetic_NeRF_Chair200_200.yaml', 'pretrained_checkpoint_path': 'logs/paper/finetune/Synthetic_NeRF_Chair200_200/checkpoint_0020000.pth', 'render_only': True, 'restart_after_checkpoint': True, 'skip_final': True, 'tree_type': 'kdtree_longest'} global_domain_min: [-0.9128502 -0.89277196 -1.1939759 ], global_domain_max: [0.6871498 0.70722806 1.2060242 ] No checkpoint found. Fresh start. #nodes to process: 4096 #saturated nodes to process: 0 Traceback (most recent call last): File "local_multidistill_multiseg.py", line 765, in <module> main() File "local_multidistill_multiseg.py", line 760, in main restarting_job = train(cfg, log_path) File "local_multidistill_multiseg.py", line 640, in train pretrained_nerf, embed_fn, embeddirs_fn = load_pretrained_nerf_model(dev, cfg, cycle_index) File "/data/ylee236/Pyramid-NeRF/multiutils_multiseg.py", line 53, in load_pretrained_nerf_model checkpoint = torch.load(cfg['pretrained_checkpoint_path']) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'logs/paper/finetune/Synthetic_NeRF_Chair200_200/checkpoint_0020000.pth' auto log path: logs/paper/finetune/Synthetic_NeRF_Chair400_400 {'checkpoint_interval': 50000, 'render_testset_interval': 50000, 'chunk_size': 40000, 'distilled_cfg_path': 'cfgs/paper/distill/Synthetic_NeRF_Chair400_400.yaml', 'distilled_checkpoint_path': 'logs/paper/distill/Synthetic_NeRF_Chair400_400/checkpoint.pth', 'initial_learning_rate': 0.001, 'iterations': 1000000, 'pretrain_iterations': 100000, 'l2_regularization_lambda': 1e-06, 'learing_rate_decay_rate': 500, 'no_batching': True, 'num_rays_per_batch': 8192, 'num_samples_per_ray': 768, 'num_samples_per_ray_train': 1024, 'num_depth_samples_per_ray': 128, 'near_d': 0.2, 'far_d': 0.2, 'occupancy_cfg_path': 'cfgs/paper/pretrain_occupancy/Synthetic_NeRF_Chair400_400.yaml', 'occupancy_log_path': 'logs/paper/pretrain_occupancy/Synthetic_NeRF_Chair400_400/occupancy.pth', 'depth_log_path': 'logs/paper/finetune/Synthetic_NeRF_Chair400_400/depths_0100000.pth', 'perturb': 1.0, 'precrop_fraction': 0.5, 'precrop_iterations': 0, 'raw_noise_std': 0.0, 'render_only': False, 'no_color_sigmoid': False, 'render_test': True, 'render_factor': 0, 'testskip': 8, 'deepvoxels_shape': 'greek', 'blender_white_background': True, 'blender_half_res': False, 'llff_factor': 8, 'llff_no_ndc': False, 'llff_lindisp': False, 'llff_spherify': False, 'llff_hold': False, 'print_interval': 100, 'render_video_interval': 100000000, 'network_chunk_size': 65536, 'rng_seed': 0, 'use_same_initialization_for_all_networks': False, 'use_initialization_fix': False, 'num_importance_samples_per_ray': 0, 'model_type': 'multi_network', 'random_direction_probability': -1, 'von_mises_kappa': -1, 'view_dependent_dropout_probability': -1} Using GPU: NVIDIA RTX A6000 /data/ylee236/Pyramid-NeRF/utils.py:254: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return np.array([[float(w) for w in line.strip().split()] for line in open(path)]).astype(np.float32) Loaded a NSVF-style dataset (138, 800, 800, 4) (138, 4, 4) (0,) data/nsvf/Synthetic_NeRF/Chair800_800 (100,) (13,) (25,) Converting alpha to white. global_domain_min: [-0.9128502 -0.89277196 -1.1939759 ], global_domain_max: [0.6871498 0.70722806 1.2060242 ], near: 2.0, far: 6.0, background_color: tensor([1., 1., 1.]) Traceback (most recent call last): File "run_nerf_test_with_depth.py", line 1326, in <module> main() File "run_nerf_test_with_depth.py", line 1322, in main restarting_job = train(cfg, log_path, render_cfg_path) File "run_nerf_test_with_depth.py", line 751, in train cp = torch.load(cfg['distilled_checkpoint_path']) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/home/ylee236/.conda/envs/pyramid_nerf/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__ super(_open_file, self).__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'logs/paper/distill/Synthetic_NeRF_Chair400_400/checkpoint.pth'
I fixed it myself. I just need to change from imageio.imwrite(filename3,depths[-1]) to imageio.imwrite(filename3, to8b(depths[-1])) at line 308 in run_nerf_test_with_depth.py
imageio.imwrite(filename3,depths[-1])
imageio.imwrite(filename3, to8b(depths[-1]))
Hello. The code looks to have simple bug. Any help to fix the bug will be appreciated! Thanks.
Environment:
Reproduce: bash Chair_train.sh