Giter Site home page Giter Site logo

plenoctree's Introduction

PlenOctrees Official Repo: NeRF-SH training and conversion

This repository contains code to train NeRF-SH and to extract the PlenOctree, constituting part of the code release for:

PlenOctrees for Real Time Rendering of Neural Radiance Fields
Alex Yu, Ruilong Li, Matthew Tancik, Hao Li, Ren Ng, Angjoo Kanazawa

https://alexyu.net/plenoctrees

@inproceedings{yu2021plenoctrees,
      title={{PlenOctrees} for Real-time Rendering of Neural Radiance Fields},
      author={Alex Yu and Ruilong Li and Matthew Tancik and Hao Li and Ren Ng and Angjoo Kanazawa},
      year={2021},
      booktitle={ICCV},
}

Please see the following repository for our C++ PlenOctrees volume renderer: https://github.com/sxyu/volrend

Setup

Please use conda for a replicable environment.

conda env create -f environment.yml
conda activate plenoctree
pip install --upgrade pip

Or you can install the dependencies manually by:

conda install pytorch torchvision cudatoolkit=11.0 -c pytorch
conda install tqdm
pip install -r requirements.txt

[Optional] Install GPU and TPU support for Jax. This is useful for NeRF-SH training. Remember to change cuda110 to your CUDA version, e.g. cuda102 for CUDA 10.2.

pip install --upgrade jax jaxlib==0.1.65+cuda110 -f https://storage.googleapis.com/jax-releases/jax_releases.html

NeRF-SH Training

We release our trained NeRF-SH models as well as converted plenoctrees at Google Drive. You can also use the following commands to reproduce the NeRF-SH models.

Training and evaluation on the NeRF-Synthetic dataset (Google Drive):

export DATA_ROOT=./data/NeRF/nerf_synthetic/
export CKPT_ROOT=./data/Plenoctree/checkpoints/syn_sh16/
export SCENE=chair
export CONFIG_FILE=nerf_sh/config/blender

python -m nerf_sh.train \
    --train_dir $CKPT_ROOT/$SCENE/ \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/

python -m nerf_sh.eval \
    --chunk 4096 \
    --train_dir $CKPT_ROOT/$SCENE/ \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/

Note for SCENE=mic, we adopt a warmup learning rate schedule (--lr_delay_steps 50000 --lr_delay_mult 0.01) to avoid unstable initialization.

Training and evaluation on TanksAndTemple dataset (Download Link) from the NSVF paper:

export DATA_ROOT=./data/TanksAndTemple/
export CKPT_ROOT=./data/Plenoctree/checkpoints/tt_sh25/
export SCENE=Barn
export CONFIG_FILE=nerf_sh/config/tt

python -m nerf_sh.train \
    --train_dir $CKPT_ROOT/$SCENE/ \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/

python -m nerf_sh.eval \
    --chunk 4096 \
    --train_dir $CKPT_ROOT/$SCENE/ \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/

PlenOctrees Conversion and Optimization

Before converting the NeRF-SH models into plenoctrees, you should already have the NeRF-SH models trained/downloaded and placed at ./data/Plenoctree/checkpoints/{syn_sh16, tt_sh25}/. Also make sure you have the training data placed at ./data/NeRF/nerf_synthetic and/or ./data/TanksAndTemple.

To reproduce our results in the paper, you can simplly run:

# NeRF-Synthetic dataset
python -m octree.task_manager octree/config/syn_sh16.json --gpus="0 1 2 3"

# TanksAndTemple dataset
python -m octree.task_manager octree/config/tt_sh25.json --gpus="0 1 2 3"

The above command will parallel all scenes in the dataset across the gpus you set. The json files contain dedicated hyper-parameters towards better performance (PSNR, SSIM, LPIPS). So in this setting, a 24GB GPU is needed for each scene and in averange the process takes about 15 minutes to finish. The converted plenoctree will be saved to ./data/Plenoctree/checkpoints/{syn_sh16, tt_sh25}/$SCENE/octrees/.

Below is a more straight-forward script for demonstration purpose:

export DATA_ROOT=./data/NeRF/nerf_synthetic/
export CKPT_ROOT=./data/Plenoctree/checkpoints/syn_sh16
export SCENE=chair
export CONFIG_FILE=nerf_sh/config/blender

python -m octree.extraction \
    --train_dir $CKPT_ROOT/$SCENE/ --is_jaxnerf_ckpt \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/ \
    --output $CKPT_ROOT/$SCENE/octrees/tree.npz

python -m octree.optimization \
    --input $CKPT_ROOT/$SCENE/tree.npz \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/ \
    --output $CKPT_ROOT/$SCENE/octrees/tree_opt.npz

python -m octree.evaluation \
    --input $CKPT_ROOT/$SCENE/octrees/tree_opt.npz \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/

# [Optional] Only used for in-browser viewing.
python -m octree.compression \
    $CKPT_ROOT/$SCENE/octrees/tree_opt.npz \
    --out_dir $CKPT_ROOT/$SCENE/ \
    --overwrite

MISC

Project Vanilla NeRF to PlenOctree

A vanilla trained NeRF can also be converted to a plenoctree for fast inference. To mimic the view-independency propertity as in a NeRF-SH model, we project the vanilla NeRF model to SH basis functions by sampling view directions for every points in the space. Though this makes converting vanilla NeRF to a plenoctree possible, the projection process inevitability loses the quality of the model, even with a large amount of sampling view directions (which takes hours to finish). So we recommend to just directly train a NeRF-SH model end-to-end.

Below is a example of projecting a trained vanilla NeRF model from JaxNeRF repo (Download Link) to a plenoctree. After extraction, you can optimize & evaluate & compress the plenoctree just like usual:

export DATA_ROOT=./data/NeRF/nerf_synthetic/ 
export CKPT_ROOT=./data/JaxNeRF/jaxnerf_models/blender/ 
export SCENE=drums
export CONFIG_FILE=nerf_sh/config/misc/proj

python -m octree.extraction \
    --train_dir $CKPT_ROOT/$SCENE/ --is_jaxnerf_ckpt \
    --config $CONFIG_FILE \
    --data_dir $DATA_ROOT/$SCENE/ \
    --output $CKPT_ROOT/$SCENE/octrees/tree.npz \
    --projection_samples 100 \
    --radius 1.3

Note --projection_samples controls how many sampling view directions are used. More sampling view directions give better projection quality but takes longer time to finish. For example, for the drums scene in the NeRF-Synthetic dataset, 100 / 10000 sampling view directions takes about 2 mins / 2 hours to finish the plenoctree extraction. It produce raw plenoctrees with PSNR=22.49 / 23.84 (before optimization). Note that extraction from a NeRF-SH model produce a raw plenoctree with PSNR=25.01.

List of possible improvements

In the interst reproducibility, the parameters used in the paper are also used here. For future work we recommend trying the changes in mip-NeRF https://jonbarron.info/mipnerf/ for improved stability and quality:

  • Centered pixels (+ 0.5 on x, y) when generating rays
  • Use shifted SoftPlus instead of ReLU for density (including for octree optimization)
  • Pad the RGB sigmoid output (avoid low gradient region near 0/1 color)
  • Multi-scale training from mip-NeRF

plenoctree's People

Contributors

liruilong940607 avatar sxyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plenoctree's Issues

using nerfvis for visualization does not work for other blender dataset

Hello there, I tried your code on "chair" example from blender dataset and used the nerfvis library for visualization. It totally worked. However, when I tried to visualize other examples, like "ship" from blender dataset, it stops at loading 100% and it never shows the 3D model like
image

Can you tell me what is the problem? Thank you in advance.

svox fails to install

The command conda env create -f environment.yml fails with the following output:

Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Installing pip dependencies: ...working... Pip subprocess error:
    ERROR: Command errored out with exit status 1:
     command: /home/julius_m/miniconda3/envs/plenoctree/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4j3q1aav/svox_d94175d95f2e44f3af58d34c864072e7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4j3q1aav/svox_d94175d95f2e44f3af58d34c864072e7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-4rfnzt2l
         cwd: /tmp/pip-install-4j3q1aav/svox_d94175d95f2e44f3af58d34c864072e7/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4j3q1aav/svox_d94175d95f2e44f3af58d34c864072e7/setup.py", line 4, in <module>
        from torch.utils.cpp_extension import BuildExtension, CUDAExtension
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/9f/bd/12837d0f1589546e94786ece045d3250ada53bd5ee8a66234308c11b59f2/svox-0.2.32.tar.gz#sha256=b086aecbbe22f5d4c6941162290413b52ef763cd30a7d1e1e3e27edfc8309ad0 (from https://pypi.org/simple/svox/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Command errored out with exit status 1:
     command: /home/julius_m/miniconda3/envs/plenoctree/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4j3q1aav/svox_2512b4322737469394e215e440a3fb07/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4j3q1aav/svox_2512b4322737469394e215e440a3fb07/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-oum785ux
         cwd: /tmp/pip-install-4j3q1aav/svox_2512b4322737469394e215e440a3fb07/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4j3q1aav/svox_2512b4322737469394e215e440a3fb07/setup.py", line 4, in <module>
        from torch.utils.cpp_extension import BuildExtension, CUDAExtension
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/7b/e9/46007938df43c9a51826dd56b69bc897b0216ce0c2d0082fd355721cf378/svox-0.2.31.tar.gz#sha256=24efe346fab6aa2fbbcd3fa83e961d9fdb5adff6eb8e8d2d88dcc955b461f639 (from https://pypi.org/simple/svox/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Command errored out with exit status 1:
     command: /home/julius_m/miniconda3/envs/plenoctree/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4j3q1aav/svox_66aa37c3639140ca9e7933035cd95dad/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4j3q1aav/svox_66aa37c3639140ca9e7933035cd95dad/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-w8t7wafl
         cwd: /tmp/pip-install-4j3q1aav/svox_66aa37c3639140ca9e7933035cd95dad/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4j3q1aav/svox_66aa37c3639140ca9e7933035cd95dad/setup.py", line 4, in <module>
        from torch.utils.cpp_extension import BuildExtension, CUDAExtension
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ca/92/bf2bff8c58f27c0481f7ad89dea4b2ac9d9637e4b5caf1d39be9ed702b37/svox-0.2.30.tar.gz#sha256=95f7bcf01ef1e9106f458f95261de439f1c91dc668184277d0463dd9687b2cb4 (from https://pypi.org/simple/svox/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Command errored out with exit status 1:
     command: /home/julius_m/miniconda3/envs/plenoctree/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4j3q1aav/svox_7cbe926eb4ad472c920d471061d9f7f7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4j3q1aav/svox_7cbe926eb4ad472c920d471061d9f7f7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-6ncndzwq
         cwd: /tmp/pip-install-4j3q1aav/svox_7cbe926eb4ad472c920d471061d9f7f7/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4j3q1aav/svox_7cbe926eb4ad472c920d471061d9f7f7/setup.py", line 4, in <module>
        from torch.utils.cpp_extension import BuildExtension, CUDAExtension
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c1/83/13373194ee8823735cd1c5ff9bbc73d2d6ca7e61494d4ae81d8d514680c3/svox-0.2.29.tar.gz#sha256=5a7462665bc106be11817e1d0e3e0acf53dc9c6c082342de8ffcd02799b17bbf (from https://pypi.org/simple/svox/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    ERROR: Command errored out with exit status 1:
     command: /home/julius_m/miniconda3/envs/plenoctree/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4j3q1aav/svox_20700ac0eded45488f2b17800ed403b8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4j3q1aav/svox_20700ac0eded45488f2b17800ed403b8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ffwllv9k
         cwd: /tmp/pip-install-4j3q1aav/svox_20700ac0eded45488f2b17800ed403b8/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4j3q1aav/svox_20700ac0eded45488f2b17800ed403b8/setup.py", line 4, in <module>
        from torch.utils.cpp_extension import BuildExtension, CUDAExtension
    ModuleNotFoundError: No module named 'torch'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/5c/37/e479cb95e48ffe041f806ffc1a6720cddf57da281eed248116e7bc384685/svox-0.2.28.tar.gz#sha256=cbc3d4dcf834e8bb8ec90331f8a8c92dc23472561f1d905e8db638e6e44410a8 (from https://pypi.org/simple/svox/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement svox>=0.2.28 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.2.11, 0.2.12, 0.2.13, 0.2.14, 0.2.15, 0.2.16, 0.2.17, 0.2.18, 0.2.19, 0.2.20, 0.2.21, 0.2.22, 0.2.23, 0.2.24, 0.2.25, 0.2.26, 0.2.27, 0.2.28, 0.2.29, 0.2.30, 0.2.31, 0.2.32)
ERROR: No matching distribution found for svox>=0.2.28

Ran pip subprocess with arguments:
['/home/julius_m/miniconda3/envs/plenoctree/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/julius_m/code/plenoctree/condaenv.h9g_s1_e.requirements.txt']
Pip subprocess output:
Collecting dotmap
  Using cached dotmap-1.3.24-py3-none-any.whl (11 kB)
Collecting imageio
  Using cached imageio-2.9.0-py3-none-any.whl (3.3 MB)
Collecting imageio-ffmpeg
  Using cached imageio_ffmpeg-0.4.5-py3-none-manylinux2010_x86_64.whl (26.9 MB)
Collecting ipdb
  Using cached ipdb-0.13.9.tar.gz (16 kB)
Collecting pretrainedmodels
  Using cached pretrainedmodels-0.7.4.tar.gz (58 kB)
Collecting lpips
  Using cached lpips-0.1.4-py3-none-any.whl (53 kB)
Collecting jax==0.2.9
  Using cached jax-0.2.9.tar.gz (551 kB)
Collecting jaxlib>=0.1.57
  Using cached jaxlib-0.1.71-cp38-none-manylinux2010_x86_64.whl (50.9 MB)
Collecting flax>=0.3.1
  Using cached flax-0.3.5-py3-none-any.whl (193 kB)
Collecting opencv-python>=4.4.0
  Using cached opencv_python-4.5.3.56-cp38-cp38-manylinux2014_x86_64.whl (49.9 MB)
Collecting Pillow>=7.2.0
  Using cached Pillow-8.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
Collecting pyyaml>=5.3.1
  Using cached PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
Collecting tensorboard>=2.4.0
  Using cached tensorboard-2.6.0-py3-none-any.whl (5.6 MB)
Collecting tensorflow>=2.3.1
  Using cached tensorflow-2.6.0-cp38-cp38-manylinux2010_x86_64.whl (458.4 MB)
Collecting pymcubes
  Using cached PyMCubes-0.1.2-cp38-cp38-manylinux2010_x86_64.whl (282 kB)
Collecting svox>=0.2.28
  Using cached svox-0.2.32.tar.gz (43 kB)
  Using cached svox-0.2.31.tar.gz (40 kB)
  Using cached svox-0.2.30.tar.gz (37 kB)
  Using cached svox-0.2.29.tar.gz (36 kB)
  Using cached svox-0.2.28.tar.gz (36 kB)

failed

CondaEnvException: Pip failed

System Information
OS: Ubuntu 20.04.1 (Linux 5.11.0-27-generic)

Train script doesnt run

Hi,

When I follow the instructions for building the environment:

conda env create -f environment.yml
conda activate plenoctree
pip install --upgrade pip
pip install --upgrade jaxlib==0.1.65+cuda110 -f https://storage.googleapis.com/jax-releases/jax_releases.html

My setup is: cuda/11.0 cudnn/8.0-cuda-11.0

I get

(plenoctree) [gkopanas@nefgpu37 plenoctree]$ python -m nerf_sh.train --train_dir ckpts/chair/ --config nerf_sh/config/blender --data_dir ../scenes/nerf/chair/
Traceback (most recent call last):
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/data/graphdeco/user/gkopanas/plenoctree/nerf_sh/train.py", line 29, in <module>
    import flax
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/flax/__init__.py", line 36, in <module>
    from . import core
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/flax/core/__init__.py", line 15, in <module>
    from .axes_scan import broadcast
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/flax/core/axes_scan.py", line 17, in <module>
    import jax
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/__init__.py", line 93, in <module>
    from . import image
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/image/__init__.py", line 18, in <module>
    from jax._src.image.scale import (
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/_src/image/scale.py", line 20, in <module>
    from jax import lax
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/lax/__init__.py", line 324, in <module>
    from jax._src.lax.fft import (
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/_src/lax/fft.py", line 87, in <module>
    def _rfft_transpose(t, fft_lengths):
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/api.py", line 184, in jit
    return _cpp_jit(fun, static_argnums, device, backend, donate_argnums)
  File "/home/gkopanas/.conda/envs/plenoctree/lib/python3.8/site-packages/jax/api.py", line 370, in _cpp_jit
    cpp_jitted_f = jax_jit.jit(fun, cache_miss, get_device_info,
TypeError: jit(): incompatible function arguments. The following argument types are supported:
    1. (fun: function, cache_miss: function, get_device: function, static_argnums: List[int], cache_size: int = 4096) -> jaxlib.xla_extension.jax_jit.CompiledFunction

Invoked with: <function _rfft_transpose at 0x7f71ac928a60>, <function _cpp_jit.<locals>.cache_miss at 0x7f71ac928af0>, <function _cpp_jit.<locals>.get_device_info at 0x7f71ac928b80>, <function _cpp_jit.<locals>.get_jax_enable_x64 at 0x7f71ac928c10>, <function _cpp_jit.<locals>.get_jax_disable_jit_flag at 0x7f71ac928ca0>, (0, 2)

Does anyone have a clue what went wrong?

Unstable training

Thank you for your impressive work. As illustrated in the following figure, the training process is not stable. Could you check the phenomenon?
image

NPZ

Hi, I am trying to apply the model on mobile phone.
Is that any way to render the NPZ result on phones?

CUDA out of memory for init_grid_depth

If I set value of init_grid_depth in octree.extraction.py as 9, then it get RuntimeError: CUDA out of memory.
Any idea to avoid out of gpu memory for higher volume size processing?
Thank you in advance.

Octree extraction

Hello!

Can you elaborate on what step1 & step2 in octree extraction means?

I'm no expert on CV and I'm sorry if this is a trivial question.

Thanks in advanced

own synthetic data, loss is not converging.

Thanks for the great work!

I want to train the nerf-sh model on my own synthetic dataset. I have tried so many times with different dataset generated through blender script. but every time loss is not converging and gives blank white images only. Please suggest.

The name of "Plen"Octree

Hi there, thanks for your nice work.

I wonder about the meaning of "PlenOctree" instead of just Octree.
please be kind if I miss any explanation.

Thanks!

Invoked in extraction

I run the script in MISC to Project Vanilla NeRF to PlenOctree an error happened

image

and I finally find out only running this line

https://github.com/sxyu/plenoctree/blob/f0b82631199a1aa7dc9ce263c08980a3a7504014/octree/nerf/models.py#L70

import this package will get that error.

Anyone knows what happened?

Jax version:RuntimeError: Internal: Could not find the corresponding function

When I ran the command:python -m nerf_sh.eval --chunk 4096 --train_dir $CKPT_ROOT/$SCENE/ --config $CONFIG_FILE --data_dir $DATA_ROOT/$SCENE/:
/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/flax/nn/init.py:35: DeprecationWarning: The flax.nn module is Deprecated, use flax.linen instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md
warnings.warn("The flax.nn module is Deprecated, use flax.linen instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md", DeprecationWarning)
Traceback (most recent call last):
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/ubuntu/plenoctree-master/nerf_sh/eval.py", line 137, in
app.run(main)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "/home/ubuntu/plenoctree-master/nerf_sh/eval.py", line 46, in main
rng = random.PRNGKey(20200823)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/_src/random.py", line 66, in PRNGKey
k1 = convert(lax.shift_right_logical(seed, lax._const(seed, 32)))
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/_src/lax/lax.py", line 383, in shift_right_logical
return shift_right_logical_p.bind(x, y)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 284, in bind
out = top_trace.process_primitive(self, tracers, params)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 622, in process_primitive
return primitive.impl(*tracers, **params)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/interpreters/xla.py", line 242, in apply_primitive
return compiled_fun(*args)
File "/home/ubuntu/Downloads/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/interpreters/xla.py", line 360, in _execute_compiled_primitive
out_bufs = compiled.execute(input_bufs)
RuntimeError: Internal: Could not find the corresponding function
I also try to upgrade jax version, but the numpy version requirement cannot satisfy the jax and tensorflow.

Errors raised in the function: utils.render_image (nerf_sh.train, line 255)

Thanks for the contribution of the authors.
In the first 20000 iterations, the provided codes run normally. But in the test set evaluation, errors of utils.render_image stops the evaluation. Specific errors like this:

File "/hdd8T_4/chensq/PlenOctree/nerf_sh/train.py", line 255, in main
pred_color, pred_disp, pred_acc = utils.render_image(
File "/hdd8T_4/chensq/PlenOctree/nerf_sh/nerf/utils.py", line 350, in render_image
unusedrng, key_0, key_1 = jax.random.split(rng, 3)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/_src/random.py", line 270, in split
return _split(key, int(num)) # type: ignore
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/_src/traceback_util.py", line 143, in reraise_with_filtered_traceback
return fun(*args, **kwargs)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/_src/api.py", line 426, in cache_miss
out_flat = xla.xla_call(
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 1565, in bind
return call_bind(self, fun, *args, **params)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 1556, in call_bind
outs = primitive.process(top_trace, fun, tracers, params)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 1568, in process
return trace.process_call(self, fun, tracers, params)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/core.py", line 609, in process_call
return primitive.impl(f, *tracers, **params)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/interpreters/xla.py", line 581, in _xla_call_impl
return compiled_fun(*args)
File "/hdd8T_4/chensq/anaconda3/envs/plenoctree/lib/python3.8/site-packages/jax/interpreters/xla.py", line 874, in _execute_compiled
out_bufs = compiled.execute(input_bufs)
jax._src.traceback_util.UnfilteredStackTrace: RuntimeError: CUDA operation failed: invalid resource handle

There is something wrong with the function jax.random.split(rng, 3). I don't know how to resolve it.
Looking forward to the authors' reply!

RuntimeError when running Octree extraction

Hi, i've tried this now for a while and keep encountering this issue.

Training goes well, but when i run the extraction i get this:

image

Anyone know what is wrong? or how to resolve it?

Fatal Python error: Aborted when use library svox

Hi, when i run python -m octree.task_manager octree/config/tt_sh25.json --gpus="0"
image
This error rise in line 205
image
But this library PyTorch CUDA Extension of PlenOctrees and installed by git url.
How can I solve this problem?

ViewDirs vs Direction in the named tuple `Rays`

Why not just have the direction field with the origin, and remove the viewdirs field in Rays?
The direction field should always contain the normalized direction (unit vector) anyway. If the un-normalized direction doesn't serve a specific purpose, these twin fields will cause confusion

octree optimization does not work for LLFF dataset

Hello, I found that the codes seems not to work for LLFF dataset. I can successfully train the model for scene synthesis. However, when I try to use octree to extract the nerf model, it cannot work. i have tested that the codes work well for blender dataset. I wonder if the authors have any solutions. Thanks in advance.

Use my own image for training

I want to use my own pictures to reconstruct the scene.
At present, I can use colmap to calculate the pose.I can calculate the pose from colmap and convert it to nex MPI( https://github.com/nex-mpi/nex-code )hwf_cxcy.npy and poses_ bounds.npy
image

Next, how do I make data sets for training? Is there any relevant code?

how do you visualize the npz files by nerfvis?

I understand that you release the trained NeRF-SH models as well as converted plenoctrees. However, when I used your converted plenoctrees for 3D visualization like using "ship.npz" from your file as following,

import nerfvis
scene = nerfvis.Scene("My 3D model")
scene.export(dirname='checkpoints/ship', display=True,
tree_file='tree.npz',
url="100.80.243.129", port=80)

I cannot get a 3D view from my browser. It always show loading at 100% but it never visualize the view, like
image

I assume that the problem is from the plenoctree compression step but I still cannot get it resolved.
Could you please help me out? Thank you!

Extraction from vanilla TF-NeRF or pyTorch NeRF

I'm trying to project NeRFs created by implementations that are not based on jaxnerf.
Is this possible? Has it been done?

I tried loading .ckpt files from krrish94/nerf-pytorch implementation but it fails as the state dicts don't match.
The original TF-NeRF implementation and yenchenlin/nerf-pytorch implementation export checkpoints in .npy files not .ckpt.

Which implementation can be used to perform extraction without is_jaxnerf_ckpt flag?

Thanks

error when run the training code

I tried to install the code following the same procedure. However, I got the error when installing Jax, Jaxlib and Flax as follows.

raise RuntimeError(msg)
RuntimeError: jaxlib is version 0.1.57, but this version of jax requires version >= 0.3.7.

I checked that I installed Jax==0.3.9 and Jaxlib==0.1.57, which meets the requirement. I do not know what the problem is. I am looking forward to your reply.

error when run octree extraction

Hello, thank you for providing codes! I met the problem when trying to extract the octree from a Jax checkpoint.

I ran the command as:
python -m octree.extraction --train_dir checkpoints/chair/ --is_jaxnerf_ckpt --config nerf_sh/config/blender --data_dir ../../data/3D/synthetic/chair --output checkpoints/chair/octrees/tree.npz

and I got the error as:
File "/workspace/NeRF/plenoctree/octree/extraction.py", line 184, in calculate_grid_weights
opts = _C.RenderOptions()
AttributeError: 'NoneType' object has no attribute 'RenderOptions'

Could you please help me?

Train LLFF datasets

Hello, it's interesting project! Do you have config to LLFF datasets, I'm using config as
dataset: llff
image_batching: false
factor: 4
num_coarse_samples: 64
num_fine_samples: 128
use_viewdirs: false
white_bkgd: true # No alpha channel
batch_size: 1024
randomized: true
sh_deg: 4
max_steps: 1000000
, but nerf-sh isn't training and has bad results. Can you help me?

Training problem

When I Training and evaluation on TanksAndTemple dataset.
python -m nerf_sh.train --train_dir $CKPT_ROOT/$SCENE/ --config$CONFIG_FILE --data_dir $DATA_ROOT/$SCENE/
(NO Install GPU and TPU support for Jax.)
There are the following errors
bddb316a42cc6668d2bb1fed23a97f6
7633f460bbda3cd6f3040d11fae3c34

issue of loading pretrained chair model

RuntimeError: Error(s) in loading state_dict for NerfModel:
size mismatch for MLP_0.rgb_layer.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([48, 256]).
size mismatch for MLP_0.rgb_layer.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([48]).
size mismatch for MLP_1.rgb_layer.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([48, 256]).
size mismatch for MLP_1.rgb_layer.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([48]).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.