Neural Factorization of Shape and Reflectance Under An Unknown Illumination

Overview

NeRFactor

[Paper] [Video] [Project]

teaser

This is the authors' code release for:

NeRFactor: Neural Factorization of Shape and Reflectance Under an Unknown Illumination
Xiuming Zhang, Pratul P. Srinivasan, Boyang Deng, Paul Debevec, William T. Freeman, Jonathan T. Barron
arXiv

This is not an officially supported Google product.

Setup

  1. Clone this repository:

    git clone https://github.com/google/nerfactor.git
  2. Install a Conda environment with all dependencies:

    cd nerfactor
    conda env create -f environment.yml
    conda activate nerfactor

Tips:

  • You can find the TensorFlow, cuDNN, and CUDA versions in environment.yml.
  • The IPython dependency in environment.yml is for IPython.embed() alone. If you are not using that to insert breakpoints during debugging, you can take it out (it should not hurt to just leave it there).

Data

If you are using our data, see the "Downloads" section of the project page.

If you are BYOD (bringing your own data), go to data_gen/ to either render your own synthetic data or process your real captures.

Running the Code

Go to nerfactor/ and follow the instructions there.

Issues or Questions?

If the issue is code-related, please open an issue here.

For questions, please also consider opening an issue as it may benefit future reader. Otherwise, email Xiuming Zhang.

Changelog

  • 06/01/2021: Initial release.
Comments
  • Question about incompatible shapes(0,3) and (100,3) at II. Joint Optimization in Training, Validation, and Testing

    Question about incompatible shapes(0,3) and (100,3) at II. Joint Optimization in Training, Validation, and Testing

    Hi, thank you for the inspiring work and your open source code!When I run the following script, I get an ValueError report the at step II. Joint Optimization in Training, Validation, and Testing: I. Shape Pre-Training and II. Joint Optimization (training and validation)


    '''

    scene='hotdog_2163' gpus='2' model='nerfactor' overwrite='True' proj_root='/lyy/nerfactor' repo_dir="$proj_root/nerfactor" viewer_prefix='' # or just use ''

    I. Shape Pre-Training

    data_root="$proj_root/data/selected/$scene" if [[ "$scene" == scan* ]]; then # DTU scenes imh='256' else imh='512' fi if [[ "$scene" == pinecone || "$scene" == vasedeck || "$scene" == scan* ]]; then # Real scenes: NeRF & DTU near='0.1'; far='2' else near='2'; far='6' fi if [[ "$scene" == pinecone || "$scene" == vasedeck || "$scene" == scan* ]]; then # Real scenes: NeRF & DTU use_nerf_alpha='True' else use_nerf_alpha='False' fi surf_root="$proj_root/output/surf/$scene" shape_outdir="$proj_root/output/train/${scene}_shape" REPO_DIR="$repo_dir" "$repo_dir/nerfactor/trainvali_run.sh" "$gpus" --config='shape.ini' --config_override="data_root=$data_root,imh=$imh,near=$near,far=$far,use_nerf_alpha=$use_nerf_alpha,data_nerf_root=$surf_root,outroot=$shape_outdir,viewer_prefix=$viewer_prefix,overwrite=$overwrite"

    II. Joint Optimization (training and validation)

    shape_ckpt="$shape_outdir/lr1e-2/checkpoints/ckpt-2" brdf_ckpt="$proj_root/output/train/merl/lr1e-2/checkpoints/ckpt-50" if [[ "$scene" == pinecone || "$scene" == vasedeck || "$scene" == scan* ]]; then # Real scenes: NeRF & DTU xyz_jitter_std=0.001 else xyz_jitter_std=0.01 fi test_envmap_dir="$proj_root/data/envmaps/for-render_h16/test" shape_mode='finetune' outroot="$proj_root/output/train/${scene}_$model" REPO_DIR="$repo_dir" "$repo_dir/nerfactor/trainvali_run.sh" "$gpus" --config="$model.ini" --config_override="data_root=$data_root,imh=$imh,near=$near,far=$far,use_nerf_alpha=$use_nerf_alpha,data_nerf_root=$surf_root,shape_model_ckpt=$shape_ckpt,brdf_model_ckpt=$brdf_ckpt,xyz_jitter_std=$xyz_jitter_std,test_envmap_dir=$test_envmap_dir,shape_mode=$shape_mode,outroot=$outroot,viewer_prefix=$viewer_prefix,overwrite=$overwrite"

    III. Simultaneous Relighting and View Synthesis (testing)

    ckpt="$outroot/lr5e-3/checkpoints/ckpt-10" if [[ "$scene" == pinecone || "$scene" == vasedeck || "$scene" == scan* ]]; then # Real scenes: NeRF & DTU color_correct_albedo='false' else color_correct_albedo='true' fi REPO_DIR="$repo_dir" "$repo_dir/nerfactor/test_run.sh" "$gpus" --ckpt="$ckpt" --color_correct_albedo="$color_correct_albedo"

    '''


    [trainvali] For results, see: /lyy/nerfactor/output/train/hotdog_2163_nerfactor/lr5e-3 [datasets/nerf_shape] Number of 'train' views: 100 [datasets/nerf_shape] Number of 'vali' views: 8 [models/base] Trainable layers registered: ['net_normal_mlp_layer0', 'net_normal_mlp_layer1', 'net_normal_mlp_layer2', 'net_normal_mlp_layer3', 'net_normal_out_layer0', 'net_lvis_mlp_layer0', 'net_lvis_mlp_layer1', 'net_lvis_mlp_layer2', 'net_lvis_mlp_layer3', 'net_lvis_out_layer0'] [models/base] Trainable layers registered: ['net_brdf_mlp_layer0', 'net_brdf_mlp_layer1', 'net_brdf_mlp_layer2', 'net_brdf_mlp_layer3', 'net_brdf_out_layer0'] Traceback (most recent call last): File "/lyy/nerfactor/nerfactor/nerfactor/trainvali.py", line 341, in app.run(main) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 308, in run _run_main(main, args) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 254, in _run_main sys.exit(main(argv)) File "/lyy/nerfactor/nerfactor/nerfactor/trainvali.py", line 106, in main model = Model(config, debug=FLAGS.debug) File "/lyy/nerfactor/nerfactor/nerfactor/models/nerfactor.py", line 68, in init ioutil.restore_model(self.brdf_model, brdf_ckpt) File "/lyy/nerfactor/nerfactor/nerfactor/util/io.py", line 48, in restore_model ckpt.restore(ckpt_path).expect_partial() File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/tracking/util.py", line 2009, in restore status = self._saver.restore(save_path=save_path) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/tracking/util.py", line 1304, in restore checkpoint=checkpoint, proto_id=0).restore(self._graph_view.root) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 209, in restore restore_ops = trackable._restore_from_checkpoint_position(self) # pylint: disable=protected-access File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 907, in _restore_from_checkpoint_position tensor_saveables, python_saveables)) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/tracking/util.py", line 289, in restore_saveables validated_saveables).restore(self.save_path_tensor) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/saving/functional_saver.py", line 281, in restore restore_ops.update(saver.restore(file_prefix)) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/training/saving/functional_saver.py", line 103, in restore restored_tensors, restored_shapes=None) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/distribute/values.py", line 647, in restore for v in self._mirrored_variable.values)) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/distribute/values.py", line 647, in for v in self._mirrored_variable.values)) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/distribute/values.py", line 392, in _assign_on_device return variable.assign(tensor) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 846, in assign self._shape.assert_is_compatible_with(value_tensor.shape) File "/home/ly/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 1117, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (0, 3) and (100, 3) are incompatible


    The shape checkpoints are generated by step I. Shape Pre-Training and the BRDF checkpoints are downloaded from your page. Does it mean i need to pre-train brdf model by myself?

    Very much looking forward to your help!

    opened by Osavalon 19
  • Crash at shape pre-training

    Crash at shape pre-training

    I am trying to reproduce the results but meet some problems at 'I. Shape Pre-Training'. I find the script would crash at validation of shape pre-training. It looks like a OOM issue because log says "killed" and it stop crashing if I set shuffle_buffer_size=False at shape.ini. Any suggestions would help!

    I am using a machine with 4 3090 GPUs, 12 cpu cores and 60 GB memory. My dataset have 100 train data and 7 validate data. There are 120 test data, 99 train data, 99 val data at surf_root directory.

    opened by Woolseyyy 7
  • I get error when I train vanilla NeRF.

    I get error when I train vanilla NeRF.

    Hi, thanks to your nice work. However, I get error when I prepare to train vanilla NeRF following the instruction.

    The error is printed as follow: [trainvali] For results, see: /home/linxiong/nerfactor/output/train/hotdog_nerf/lr5e-4 [datasets/nerf] Number of 'train' views: 100 Traceback (most recent call last): File "/home/linxiong/nerfactor/nerfactor/trainvali.py", line 348, in app.run(main) File "/home/linxiong/.local/lib/python3.8/site-packages/absl/app.py", line 312, in run _run_main(main, args) File "/home/linxiong/.local/lib/python3.8/site-packages/absl/app.py", line 258, in _run_main sys.exit(main(argv)) File "/home/linxiong/nerfactor/nerfactor/trainvali.py", line 91, in main datapipe_train = dataset_train.build_pipeline(no_batch=no_batch) File "../nerfactor/datasets/base.py", line 115, in build_pipeline dataset = dataset.map( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1623, in map return ParallelMapDataset( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 4016, in init self._map_func = StructuredFunctionWrapper( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 3221, in init self._function = wrapper_fn.get_concrete_function() File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2531, in get_concrete_function graph_function = self._get_concrete_function_garbage_collected( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2496, in _get_concrete_function_garbage_collected graph_function, args, kwargs = self._maybe_define_function(args, kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2777, in _maybe_define_function graph_function = self._create_graph_function(args, kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2657, in _create_graph_function func_graph_module.func_graph_from_py_func( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 981, in func_graph_from_py_func func_outputs = python_func(*func_args, **func_kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 3214, in wrapper_fn ret = _wrapper_helper(*args) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 3156, in _wrapper_helper ret = autograph.tf_convert(func, ag_ctx)(*nested_args) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 580, in call result = self._call(*args, **kwds) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 627, in _call self._initialize(args, kwds, add_initializers_to=initializers) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 505, in _initialize self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2446, in _get_concrete_function_internal_garbage_collected graph_function, _, _ = self._maybe_define_function(args, kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2777, in _maybe_define_function graph_function = self._create_graph_function(args, kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2657, in _create_graph_function func_graph_module.func_graph_from_py_func( File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 981, in func_graph_from_py_func func_outputs = python_func(*func_args, **func_kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 441, in wrapped_fn return weak_wrapped_fn().wrapped(*args, **kwds) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3299, in bound_method_wrapper return wrapped_fn(*args, **kwargs) File "/home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 968, in wrapper raise e.ag_error_metadata.to_exception(e) NotImplementedError: in user code:

    /home/linxiong/nerfactor/nerfactor/datasets/nerf.py:111 _process_example_postcache  *
        rayo, rayd, rgb = self._sample_rays(self.rayo, self.rayd, self.rgb)
    /home/linxiong/nerfactor/nerfactor/datasets/nerf.py:130 _sample_rays  *
        coords = tf.stack(
    /home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py:3391 meshgrid  **
        mult_fact = ones(shapes, output_dtype)
    /home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py:2967 ones
        output = _constant_if_small(one, shape, dtype, name)
    /home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py:2662 _constant_if_small
        if np.prod(shape) < 1000:
    <__array_function__ internals>:5 prod
        
    /home/linxiong/.local/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3051 prod
        return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
    /home/linxiong/.local/lib/python3.8/site-packages/numpy/core/fromnumeric.py:86 _wrapreduction
        return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
    /home/linxiong/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py:748 __array__
        raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
    
    NotImplementedError: Cannot convert a symbolic Tensor (meshgrid/Size:0) to a numpy array.
    

    Any suggestion ?

    opened by bruinxiong 6
  • run geometry_from_nerf.py issues

    run geometry_from_nerf.py issues

    Hi,xiuming

    Great job! i want to run this work, but i meet some problems when i run geometry_from_nerf.py , could you help me? and i didn't find the trained models in your data from project website, so do you publish the trained model for testing later?

    Thanks! looking forward to your reply.

    WARNING:tensorflow:10 out of the last 10 calls to <function pfor..f at 0x7f6d021b9bf8> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details. W0911 12:21:18.196791 140106441705280 def_function.py:126] 10 out of the last 10 calls to <function pfor..f at 0x7f6d021b9bf8> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.

    opened by XiaoKangW 5
  • "ValueError: 'a' cannot be empty unless no samples are taken" in preparation step

    Hi, I was trying to follow the first step here to get BRDF priors, but I am getting the following error:

    $ REPO_DIR="$repo_dir" "$repo_dir/nerfactor/trainvali_run.sh" "$gpus" --config='brdf.ini' --config_override="data_root=$data_root,outroot=$outroot,viewer_prefix=$viewer_prefix"
    
    2021-08-18 12:21:52.126973: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
    2021-08-18 12:21:52.165148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: 
    pciBusID: 0000:68:00.0 name: GeForce RTX 2080 Ti computeCapability: 7.5
    coreClock: 1.545GHz coreCount: 68 deviceMemorySize: 10.76GiB deviceMemoryBandwidth: 573.69GiB/s
    2021-08-18 12:21:52.165428: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
    2021-08-18 12:21:52.171059: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
    2021-08-18 12:21:52.173348: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
    2021-08-18 12:21:52.173750: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
    2021-08-18 12:21:52.176352: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
    2021-08-18 12:21:52.186737: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
    2021-08-18 12:21:52.192472: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
    2021-08-18 12:21:52.194714: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
    2021-08-18 12:21:52.195193: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
    2021-08-18 12:21:52.203031: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 3299990000 Hz
    2021-08-18 12:21:52.203763: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f68dc000b60 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
    2021-08-18 12:21:52.203782: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
    2021-08-18 12:21:52.290736: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x564ac481a330 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
    2021-08-18 12:21:52.290795: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce RTX 2080 Ti, Compute Capability 7.5
    2021-08-18 12:21:52.292470: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: 
    pciBusID: 0000:68:00.0 name: GeForce RTX 2080 Ti computeCapability: 7.5
    coreClock: 1.545GHz coreCount: 68 deviceMemorySize: 10.76GiB deviceMemoryBandwidth: 573.69GiB/s
    2021-08-18 12:21:52.292553: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
    2021-08-18 12:21:52.292584: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
    2021-08-18 12:21:52.292611: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
    2021-08-18 12:21:52.292637: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
    2021-08-18 12:21:52.292663: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
    2021-08-18 12:21:52.292690: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
    2021-08-18 12:21:52.292717: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
    2021-08-18 12:21:52.294454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
    2021-08-18 12:21:52.294508: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
    2021-08-18 12:21:52.295132: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
    2021-08-18 12:21:52.295142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]      0 
    2021-08-18 12:21:52.295148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0:   N 
    2021-08-18 12:21:52.296183: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10150 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:68:00.0, compute capability: 7.5)
    INFO:tensorflow:Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:GPU:0',)
    I0818 12:21:52.299249 140098729092928 mirrored_strategy.py:500] Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:GPU:0',)
    [util/io] Output directory already exisits:
    	/home/jiwonchoi/nerfactor/output/train/merl/lr1e-2
    [util/io] Overwrite is off, so doing nothing
    [trainvali] For results, see:
    	/home/jiwonchoi/nerfactor/output/train/merl/lr1e-2
    Traceback (most recent call last):
      File "/home/jiwonchoi/nerfactor/nerfactor/trainvali.py", line 341, in <module>
        app.run(main)
      File "/home/jiwonchoi/.conda/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 312, in run
        _run_main(main, args)
      File "/home/jiwonchoi/.conda/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 258, in _run_main
        sys.exit(main(argv))
      File "/home/jiwonchoi/nerfactor/nerfactor/trainvali.py", line 81, in main
        dataset_train = Dataset(config, 'train', debug=FLAGS.debug)
      File "/home/jiwonchoi/nerfactor/nerfactor/datasets/brdf_merl.py", line 52, in __init__
        mats = np.random.choice(self.brdf_names, n_iden, replace=False)
      File "mtrand.pyx", line 908, in numpy.random.mtrand.RandomState.choice
    ValueError: 'a' cannot be empty unless no samples are taken
    

    I double checked my paths. Not sure where this error has originated from.

    opened by cjw531 4
  • The pre-trained models and data provided are not sufficient to perform tests on the blender dataset

    The pre-trained models and data provided are not sufficient to perform tests on the blender dataset

    I want to render the albedo, relighting results with pre-trained nerfactor on the blender dataset without further training. However, I find the pre-trained models and data provided are not sufficient to perform tests with test.py on the blender dataset. It requires shape_ckpt, brdf_ckpt and processed data(lvis.npy, xyz.npy, alpha.png, normal.npy) of each view which are not provided. So, does it mean I still need to do DataPreparation step and train shapemodel by myself ? Are pre-trained models provided useless?

    opened by 1612190130 3
  • NerFactor generated images from the quantitative evaluations

    NerFactor generated images from the quantitative evaluations

    Congrats to a nice paper!

    Would it be possible to access the NerFactor output images for the view synthesis comparison (column III, row "NerfFactor") in Table 1 (the eight validation images for each of the four scenes), in order to generate other metrics, check the metric and visual quality per image and per scene.

    opened by jmunkberg 3
  • How to get the result in your paper?

    How to get the result in your paper?

    Hi, in general NeRFactor is trully an outstanding and inspiring work.

    However, when I run the code with the default scripts and settings you privided under nerfactor/, the result, especially the testing relighting result, is not that satisfied, as compared to the figures in your paper: image

    I set the 'ims' and 'imh' to 512 in all those experiments, is there any settings needs to be changed, like total number of iterations or learning rates, when run the code? Or is there anything else you suppose may lead to this performance?

    Thanks!

    opened by JiuTongBro 3
  • OOM at II. Joint Optimization in Training, Validation, and Testing

    OOM at II. Joint Optimization in Training, Validation, and Testing

    It keeps out of memory at II. Joint Optimization in Training, Validation, and Testing. Note that it is NOT out of GPU memory but cpu memory. And it seems to happen at for batch_i, batch in enumerate(datapipe_train): I run on a machine with 1 3090 GPU, 20 cpu cores, 80 GB memory. Any suggestion would help!

    opened by Woolseyyy 2
  • NaN or Inf in 'Albedo' at step II. Joint Optimization

    NaN or Inf in 'Albedo' at step II. Joint Optimization

    Hi,

    Great work. I am training your model on my own dataset in real-data format. However, it always reports the following error message when processing step II. Joint Optimization in Training, Validation, and Testing. Could you provide me some insight about what configuration/data format might be wrong?

    Error message

    Exception has occurred: InvalidArgumentError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
    2 root error(s) found.
      (0) Invalid argument:  Not a number (NaN) or infinity (Inf) values detected in gradient. b'Albedo' : Tensor had NaN values
    	 [[{{node cond/else/_1/StatefulPartitionedCall/gradient_tape/model/CheckNumerics_2}}]]
    	 [[cond/else/_1/StatefulPartitionedCall/replica_1/model/assert_greater_3/Assert/AssertGuard/branch_executed/_57539/_6203]]
      (1) Invalid argument:  Not a number (NaN) or infinity (Inf) values detected in gradient. b'Albedo' : Tensor had NaN values
    	 [[{{node cond/else/_1/StatefulPartitionedCall/gradient_tape/model/CheckNumerics_2}}]]
    0 successful operations.
    3 derived errors ignored. [Op:__inference_fn_with_cond_190304]
    
    Function call stack:
    fn_with_cond -> fn_with_cond
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute
        inputs, attrs, num_outputs)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 598, in call
        ctx=ctx)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 1746, in _call_flat
        ctx, args, cancellation_manager=cancellation_manager))
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 1665, in _filtered_call
        self.captured_inputs)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 2420, in __call__
        return graph_function._filtered_call(args, kwargs)  # pylint: disable=protected-access
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 708, in _call
        return function_lib.defun(fn_with_cond)(*canon_args, **canon_kwds)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 580, in __call__
        result = self._call(*args, **kwds)
      File "/home/admin/FaceReal/nerfactor/nerfactor/trainvali.py", line 181, in main
        strategy, model, batch, optimizer, global_bs_train)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 258, in _run_main
        sys.exit(main(argv))
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/site-packages/absl/app.py", line 312, in run
        _run_main(main, args)
      File "/home/admin/FaceReal/nerfactor/nerfactor/trainvali.py", line 341, in <module>
        app.run(main)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/runpy.py", line 96, in _run_module_code
        mod_name, mod_spec, pkg_name, script_name)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/runpy.py", line 263, in run_path
        pkg_name=pkg_name, script_name=fname)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/home/admin/anaconda3/envs/nerfactor/lib/python3.6/runpy.py", line 193, in _run_module_as_main (Current frame)
        "__main__", mod_spec)
    

    My dataset directory looks like

    root
    │   transforms_test.json
    │   transforms_train.json
    │   transforms_val.json
    │   
    ├───test_000
    │       metadata.json
    │       nn.png
    │       rgba.png
    │       
    ├───train_000
    │       albedo.png
    │       metadata.json
    │       rgba.png
    │       
    ├───train_001
    │       metadata.json
    │       rgba.png
    │       
    ├───train_002
    │       metadata.json
    │       rgba.png
    │       
    ├───train_003
    │       metadata.json
    │       rgba.png
    │       
    ├───train_004
    │       metadata.json
    │       rgba.png
    │       
    ├───train_005
    │       metadata.json
    │       rgba.png
    │       
    ├───train_006
    │       metadata.json
    │       rgba.png
    │       
    ├───train_007
    │       metadata.json
    │       rgba.png
    │       
    ├───train_008
    │       metadata.json
    │       rgba.png
    │       
    ├───train_009
    │       metadata.json
    │       rgba.png
    │       
    └───val_000
            metadata.json
            rgba.png
    
    opened by CorneliusHsiao 2
  • how to set up the 'ims'

    how to set up the 'ims'

    hi,xiuming.

    I want to learn how to set up the value of 'ims' when converting the brdf dataset. and is there a relationship between 'ims' and 'imh'?

    thanks in advance!

    opened by XiaoKangW 2
  • Wrong NeRF and surface

    Wrong NeRF and surface

    Hi, xiuming,thanks for your outstanding work and resources!

    When I run the code with the scripts, settings and the your data provided in google drive, I got wrong result.

    Git1 git2 git3

    Maybe I set a wrong learning rate or wrong path of dataset? I found train set and validation set without nn.png. Could you provide me some suggestions? Thanks!

    My dataset directory:

    /home/kf/nerfactor/data/selected/hotdog_2163
    │   transforms_test.json
    │   transforms_train.json
    │   transforms_val.json
    │   
    ├───test_000
    │       albedo.png
    │       diffuse-color.exr
    │       metadata.json
    │       nn.png
    │       normal.exr
    │       normal.png
    │       refball-normal.exr
    │       refball-normal.png
    │       rgba_city.png
    │       rgba_courtyard.png
    │       rgba_forest.png
    │       rgba_interior.png
    │       rgba_night.png
    │       rgba_olat-0000-0000.png
    │       rgba_olat-0000-0008.png
    │       rgba_olat-0000-0016.png
    │       rgba_olat-0000-0024.png
    │       rgba_olat-0004-0000.png
    │       rgba_olat-0004-0008.png
    │       rgba_olat-0004-0016.png
    │       rgba_olat-0004-0024.png
    │       rgba_studio.png
    │       rgba_sunrise.png
    │       rgba_sunset.png
    │       rgba.png
    │       
    ├───test_001
    │       .......
    ├───test_199
    │       .......
    ├───train_000
    │       albedo.png
    │       diffuse-color.exr
    │       metadata.json
    │       normal.exr
    │       normal.png
    │       refball-normal.exr
    │       refball-normal.png
    │       rgba_city.png
    │       rgba_courtyard.png
    │       rgba_forest.png
    │       rgba_interior.png
    │       rgba_night.png
    │       rgba_olat-0000-0000.png
    │       rgba_olat-0000-0008.png
    │       rgba_olat-0000-0016.png
    │       rgba_olat-0000-0024.png
    │       rgba_olat-0004-0000.png
    │       rgba_olat-0004-0008.png
    │       rgba_olat-0004-0016.png
    │       rgba_olat-0004-0024.png
    │       rgba_studio.png
    │       rgba_sunrise.png
    │       rgba_sunset.png
    │       rgba.png
    │       
    ├───train_001
    
    │       
    ├───train_002
    │       metadata.json
    │       rgba.png
    │       
    ├───train_002
    │       .......
    ├───train_099
    │     
    ├───val_000
    │       albedo.png
    │       diffuse-color.exr
    │       metadata.json
    │       normal.exr
    │       normal.png
    │       refball-normal.exr
    │       refball-normal.png
    │       rgba_city.png
    │       rgba_courtyard.png
    │       rgba_forest.png
    │       rgba_interior.png
    │       rgba_night.png
    │       rgba_olat-0000-0000.png
    │       rgba_olat-0000-0008.png
    │       rgba_olat-0000-0016.png
    │       rgba_olat-0000-0024.png
    │       rgba_olat-0004-0000.png
    │       rgba_olat-0004-0008.png
    │       rgba_olat-0004-0016.png
    │       rgba_olat-0004-0024.png
    │       rgba_studio.png
    │       rgba_sunrise.png
    │       rgba_sunset.png
    │       rgba.png
    │ 
    ├───val_001
    │     ........
    └───val_007
    
    
    opened by kafai7777 0
  • MLPs wrong skip connection

    MLPs wrong skip connection

    Hello,

    According to paper, MLPs skip connection is on layer 2 (starting from 0 is the third one) but using nerfactor I've seen strange behaviour so I checked the code. Network .call() in mlp.py does the following:

        x_ = x + 0 # make a copy
        for i, layer in enumerate(self.layers):
            y = layer(x_)
            if i in self.skip_at:
                y = tf.concat((y, x), -1)
            x_ = y
        return y
    

    So the concatenation is applied after calling the layer and therefore the true skip connection is at the next layer (the fourth one).

    opened by SirSykon 0
  • gradient error in Joint Optimization

    gradient error in Joint Optimization

    I train successfully in shape pre-training but stuck in joint optimization. 2022-09-27 02:30:25.358618: E tensorflow/core/kernels/check_numerics_op.cc:289] abnormal_detected_host @0x7f43f6808a00 = {1, 0} Not a number (NaN) or infinity (Inf) values detected in gradient. b'Albedo' tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Not a number (NaN) or infinity (Inf) values detected in gradient. b'Albedo' : Tensor had NaN values [[node gradient_tape/model/CheckNumerics (defined at tmp/tmp398ckawp.py:22) ]] [[Identity_6/_372]] (1) Invalid argument: Not a number (NaN) or infinity (Inf) values detected in gradient. b'Albedo' : Tensor had NaN values [[node gradient_tape/model/CheckNumerics (defined at tmp/tmp398ckawp.py:22) ]] 0 successful operations. 0 derived errors ignored. [Op:__inference_distributed_train_step_45946]

    opened by hongsiyu 6
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 2.8k Feb 12, 2021
Large Scale Multi-Illuminant (LSMI) Dataset for Developing White Balance Algorithm under Mixed Illumination

Large Scale Multi-Illuminant (LSMI) Dataset for Developing White Balance Algorithm under Mixed Illumination (ICCV 2021) Dataset License This work is l

DongYoung Kim 33 Jan 4, 2023
NeRD: Neural Reflectance Decomposition from Image Collections

NeRD: Neural Reflectance Decomposition from Image Collections Project Page | Video | Paper | Dataset Implementation for NeRD. A novel method which dec

Computergraphics (University of Tübingen) 195 Dec 29, 2022
Codes and models for the paper "Learning Unknown from Correlations: Graph Neural Network for Inter-novel-protein Interaction Prediction".

GNN_PPI Codes and models for the paper "Learning Unknown from Correlations: Graph Neural Network for Inter-novel-protein Interaction Prediction". Lear

Ursa Zrimsek 2 Dec 14, 2022
CUP-DNN is a deep neural network model used to predict tissues of origin for cancers of unknown of primary.

CUP-DNN CUP-DNN is a deep neural network model used to predict tissues of origin for cancers of unknown of primary. The model was trained on the expre

null 1 Oct 27, 2021
PyTorch framework, for reproducing experiments from the paper Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks

Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks. Code, based on the PyTorch framework, for reprodu

Asaf 3 Dec 27, 2022
Multi-robot collaborative exploration and mapping through Voronoi partition and DRL in unknown environment

Voronoi Multi_Robot Collaborate Exploration Introduction In the unknown environment, the cooperative exploration of multiple robots is completed by Vo

PeaceWord 6 Nov 22, 2022
Official implementation of "Robust channel-wise illumination estimation"

This repository provides the official implementation of "Robust channel-wise illumination estimation." accepted in BMVC (2021).

Firas Laakom 4 Nov 8, 2022
Code for "Modeling Indirect Illumination for Inverse Rendering", CVPR 2022

Modeling Indirect Illumination for Inverse Rendering Project Page | Paper | Data Preparation Set up the python environment conda create -n invrender p

ZJU3DV 116 Jan 3, 2023
Towards Debiasing NLU Models from Unknown Biases

Towards Debiasing NLU Models from Unknown Biases Abstract: NLU models often exploit biased features to achieve high dataset-specific performance witho

Ubiquitous Knowledge Processing Lab 22 Jun 14, 2022
Code release for our paper, "SimNet: Enabling Robust Unknown Object Manipulation from Pure Synthetic Data via Stereo"

SimNet: Enabling Robust Unknown Object Manipulation from Pure Synthetic Data via Stereo Thomas Kollar, Michael Laskey, Kevin Stone, Brijen Thananjeyan

null 68 Dec 14, 2022
Code for "Neural Parts: Learning Expressive 3D Shape Abstractions with Invertible Neural Networks", CVPR 2021

Neural Parts: Learning Expressive 3D Shape Abstractions with Invertible Neural Networks This repository contains the code that accompanies our CVPR 20

Despoina Paschalidou 161 Dec 20, 2022
TuckER: Tensor Factorization for Knowledge Graph Completion

TuckER: Tensor Factorization for Knowledge Graph Completion This codebase contains PyTorch implementation of the paper: TuckER: Tensor Factorization f

Ivana Balazevic 296 Dec 6, 2022
A PyTorch implementation of a Factorization Machine module in cython.

fmpytorch A library for factorization machines in pytorch. A factorization machine is like a linear model, except multiplicative interaction terms bet

Jack Hessel 167 Jul 6, 2022
Implementation of SSMF: Shifting Seasonal Matrix Factorization

SSMF Implementation of SSMF: Shifting Seasonal Matrix Factorization, Koki Kawabata, Siddharth Bhatia, Rui Liu, Mohit Wadhwa, Bryan Hooi. NeurIPS, 2021

Koki Kawabata 9 Jun 10, 2022
Pytorch implementation for A-NeRF: Articulated Neural Radiance Fields for Learning Human Shape, Appearance, and Pose

A-NeRF: Articulated Neural Radiance Fields for Learning Human Shape, Appearance, and Pose Paper | Website | Data A-NeRF: Articulated Neural Radiance F

Shih-Yang Su 172 Dec 22, 2022
This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CNPs), Neural Processes (NPs), Attentive Neural Processes (ANPs).

The Neural Process Family This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CN

DeepMind 892 Dec 28, 2022