jkulhanek / tetra-nerf

Official implementation for Tetra-NeRF paper - NeRF represented as triangulation of input point cloud.
https://jkulhanek.com/tetra-nerf
MIT License
273 stars 14 forks source link

ns-train: error: invalid choice: tetra-nerf #19

Closed Mehi44 closed 1 year ago

Mehi44 commented 1 year ago

Hello,

My nerf studio version is 0.2.2 which is higher than the one required 0.2.0. But it seems not to have tetra-nerf implemented. Is there some sort of path variable that needs to be introduced somewhere or something?

(nerfstudio) mehi@DGX3:/nas1/mehi/tetranerf$ ns-train tetra-nerf-original --pipeline.model.tetrahedra-path /nas1/mehi/tetranerf/data/sparse.th minimal-parse
r --data /nas1/mehi/tetranerf/data
usage: ns-train [-h]
                {nerfacto,nerfacto-big,depth-nerfacto,volinga,instant-ngp,instant-ngp-bounded,mipnerf,semantic-nerfw,vanilla-nerf,tensorf,dnerf,phototouri
sm,nerfplayer-nerfacto,nerfplayer-ngp,neus,neus-facto}

ns-train: error: argument {nerfacto,nerfacto-big,depth-nerfacto,volinga,instant-ngp,instant-ngp-bounded,mipnerf,semantic-nerfw,vanilla-nerf,tensorf,dnerf,phototourism,nerfplayer-nerfacto,nerfplayer-ngp,neus,neus-facto}: invalid choice: 'tetra-nerf-original' (choose from 'nerfacto', 'nerfacto-big', 'depth-nerfacto', 'volinga', 'instant-ngp', 'instant-ngp-bounded', 'mipnerf', 'semantic-nerfw', 'vanilla-nerf', 'tensorf', 'dnerf', 'phototourism', 'nerfplayer-nerfacto', 'nerfplayer-ngp', 'neus', 'neus-facto')
liuxiaozhu01 commented 1 year ago

From what I've experienced, tetra-nerf should be installed firstly. Try to run cmake . && make. If everything goes well, the .so extension will exist in tetranerf/utils/extension Then you can install it by pip install . After that, ns-train may work well with tetranerf :)

Mehi44 commented 1 year ago

I have already installed tetra-nerf with cmake, I ran the commands

python -m tetranerf.scripts.process_images --path /nas1/mehi/tetranerf/data
python -m tetranerf.scripts.triangulate --pointcloud /nas1/mehi/tetranerf/data/sparse.ply --output /nas1/mehi/tetranerf/data/sparse.th

successfully but ns-train doesnt work

I tried what you said and I got this :

(nerfstudio) mehi@DGX3:/nas1/mehi/tetranerf/tetra-nerf/tetranerf/utils/extension$ pip install .
ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

the extensions folder doesnt have a setup.py in it

(nerfstudio) mehi@DGX3:/nas1/mehi/tetranerf/tetra-nerf/tetranerf/utils/extension$ ls
__init__.py  __pycache__  tetranerf_cpp_extension.cpython-39-x86_64-linux-gnu.so
liuxiaozhu01 commented 1 year ago

sorry that i dont make it clear. the cmd pip install . should be executed at directory tetra-nerf where setup.py is located

Mehi44 commented 1 year ago

I already tried that and it gave this :

Building wheels for collected packages: tetra-nerf
  Building wheel for tetra-nerf (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [87 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- Using torch libraries: /home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/lib
      -- Using torch includes: /home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include;/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/torch/csrc/api/include;/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/TH;/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/THC
      -- Using CUDA toolkit: /usr/local/cuda-11.3
      -- Using CUDA architectures: 80
      -- Using header-only CGAL
      -- Targetting Unix Makefiles
      -- Using /usr/bin/c++ compiler.
      -- Boost include dirs: /usr/include
      -- Boost libraries:
      -- Using gcc version 4 or later. Adding -frounding-math
      -- pybind11 v2.9.2
      -- Configuring done (4.9s)
      -- Generating done (0.1s)
      -- Build files have been written to: /nas1/mehi/tetranerf/tetra-nerf
      [ 12%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/src/triangulation.cpp.o
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:27:15: error: ‘Parallel_if_available_tag’ in namespace ‘CGAL’ does not name a type
         27 | typedef CGAL::Parallel_if_available_tag Concurrency_tag;
            |               ^~~~~~~~~~~~~~~~~~~~~~~~~
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp: In function ‘float find_average_spacing(size_t, float3*)’:
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:75:56: error: ‘Concurrency_tag’ was not declared in this scope
         75 |     FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(L, nb_neighbors);
            |                                                        ^~~~~~~~~~~~~~~
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:75:88: error: no matching function for call to ‘compute_average_spacing<<expression error> >(std::vector<CGAL::Point_3<CGAL::Epick> >&, const unsigned int&)’
         75 |     FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(L, nb_neighbors);
            |                                                                                        ^
      In file included from /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:9:
      /usr/include/CGAL/compute_average_spacing.h:190:1: note: candidate: ‘template<class ConcurrencyTag, class PointRange, class T, class Tag, class Base> typename CGAL::Point_set_processing_3::GetK<PointRange, CGAL::Named_function_parameters<T, Tag, Base> >::Kernel::FT CGAL::compute_average_spacing(const PointRange&, unsigned int, const CGAL::Named_function_parameters<T, Tag, Base>&)’
        190 | compute_average_spacing(
            | ^~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/CGAL/compute_average_spacing.h:190:1: note:   template argument deduction/substitution failed:
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:75:88: error: template argument 1 is invalid
         75 |     FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(L, nb_neighbors);
            |                                                                                        ^
      In file included from /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:9:
      /usr/include/CGAL/compute_average_spacing.h:284:1: note: candidate: ‘template<class ConcurrencyTag, class PointRange> typename CGAL::Point_set_processing_3::GetFT<PointRange>::type CGAL::compute_average_spacing(const PointRange&, unsigned int)’
        284 | compute_average_spacing(
            | ^~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/CGAL/compute_average_spacing.h:284:1: note:   template argument deduction/substitution failed:
      /nas1/mehi/tetranerf/tetra-nerf/src/triangulation.cpp:75:88: error: template argument 1 is invalid
         75 |     FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(L, nb_neighbors);
            |                                                                                        ^
      make[2]: *** [CMakeFiles/tetranerf_cpp_extension.dir/build.make:284: CMakeFiles/tetranerf_cpp_extension.dir/src/triangulation.cpp.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/tetranerf_cpp_extension.dir/all] Error 2
      make: *** [Makefile:91: all] Error 2
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/nas1/mehi/tetranerf/tetra-nerf/setup.py", line 122, in <module>
          setup(
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/nas1/mehi/tetranerf/tetra-nerf/setup.py", line 63, in run
          self.build_extension(ext)
        File "/nas1/mehi/tetranerf/tetra-nerf/setup.py", line 108, in build_extension
          subprocess.run(["cmake", "--build", ".", *build_args], cwd=ext.sourcedir, check=True)
        File "/home/mehi/anaconda3/envs/nerfstudio/lib/python3.8/subprocess.py", line 516, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tetra-nerf
  Running setup.py clean for tetra-nerf
Failed to build tetra-nerf
ERROR: Could not build wheels for tetra-nerf, which is required to install pyproject.toml-based projects
(nerfstudio) mehi@DGX3:/nas1/mehi/tetranerf/tetra-nerf$ 
Mehi44 commented 1 year ago

It's solved as follows :

I downgraded to nerfstudio 0.2.0 I reinstalled tetra-nerf with cmake . && make then I ran pip install . finally added PYTHONPATH variable pointing to the tetra-nerf location