NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
15.81k stars 1.9k forks source link

Detectron2 for Windows? #1199

Open felixgeen opened 1 year ago

felixgeen commented 1 year ago

I cannot get Detectron2 to install, presumably because I am using Windows? Will there be a future update where there is an alternative tool that works with Windows? Would be very cool!

Detectron2 is not installed. Press enter to install it.
Collecting git+https://github.com/facebookresearch/detectron2.git
  Cloning https://github.com/facebookresearch/detectron2.git to c:\users\\appdata\local\temp\pip-req-build-_idwv5xj
  Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/detectron2.git 'C:\Users\\AppData\Local\Temp\pip-req-build-_idwv5xj'
  Resolved https://github.com/facebookresearch/detectron2.git to commit 58e472e076a5d861fdcf773d9254a3664e045bf8
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\\AppData\Local\Temp\pip-req-build-_idwv5xj\setup.py", line 10, in <module>
          import torch
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Traceback (most recent call last):
  File "C:\Users\\instant-ngp\scripts\colmap2nerf.py", line 397, in <module>
    import detectron2
ModuleNotFoundError: No module named 'detectron2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\\instant-ngp\scripts\colmap2nerf.py", line 402, in <module>
    subprocess.check_call([sys.executable, "-m", "pip", "install", package])
  File "C:\Users\\anaconda3\envs\ngp\lib\subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\\\anaconda3\\envs\\ngp\\python.exe', '-m', 'pip', 'install', 'git+https://github.com/facebookresearch/detectron2.git']' returned non-zero exit status 1.
Tom94 commented 1 year ago
ModuleNotFoundError: No module named 'torch'

Indicates that you can likely fix this by installing pytorch first

felixgeen commented 1 year ago

I installed pytorch with conda install -c conda-forge pytorch and ran the script again with --mask_categories person car but it errored out somewhere near the end of the process. Is this something to do with the detectron2?

==============================================================================
Global bundle adjustment
==============================================================================

iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius  ls_iter  iter_time  total_time
   0  1.709408e+05    0.00e+00    1.79e+06   0.00e+00   0.00e+00  1.00e+04        0    2.92e-02    1.47e-01

CHOLMOD version 3.0.14, Oct 22, 2019: Symbolic Analysis: status: OK
  Architecture: Microsoft Windows
    sizeof(int):      4
    sizeof(SuiteSparse_long):  8
    sizeof(void *):   8
    sizeof(double):   8
    sizeof(Int):      4 (CHOLMOD's basic integer)
    sizeof(BLAS_INT): 4 (integer used in the BLAS)
  Results from most recent analysis:
    Cholesky flop count: 4.4704e+06
    Nonzeros in L:       33825
  memory blocks in use:          11
  memory in use (MB):           0.0
  peak memory usage (MB):       0.1
  maxrank:    update/downdate rank:   8
  supernodal control: 1 40 (supernodal if flops/lnz >= 40)
  nmethods:   number of ordering methods to try: 1
    method 0: natural
        flop count: 4.4704e+06
        nnz(L):     33825
  OK
FATAL: command failed
felixgeen commented 1 year ago

It seems like this error is unrelated to the Detectron2 command since I now get this error if I run --mask_categories or not. Could his be because I installed pytorch and broke something else in the process?

felixgeen commented 1 year ago
Global bundle adjustment
==============================================================================

iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius  ls_iter  iter_time  total_time
   0  1.569681e+05    0.00e+00    6.75e+12   0.00e+00   0.00e+00  1.00e+04        0    4.98e-02    2.94e-01

CHOLMOD version 3.0.14, Oct 22, 2019: Symbolic Analysis: status: OK
  Architecture: Microsoft Windows
    sizeof(int):      4
    sizeof(SuiteSparse_long):  8
    sizeof(void *):   8
    sizeof(double):   8
    sizeof(Int):      4 (CHOLMOD's basic integer)
    sizeof(BLAS_INT): 4 (integer used in the BLAS)
  Results from most recent analysis:
    Cholesky flop count: 1.1285e+07
    Nonzeros in L:       52326
  memory blocks in use:          11
  memory in use (MB):           0.0
  peak memory usage (MB):       0.2
  maxrank:    update/downdate rank:   8
  supernodal control: 1 40 (supernodal if flops/lnz >= 40)
  nmethods:   number of ordering methods to try: 1
    method 0: natural
        flop count: 1.1285e+07
        nnz(L):     52326
  OK
FATAL: command failed

Colmap fails now on every dataset. Is there a potential fix?

jdiazram commented 1 year ago

Hi, how do you use detectron2 in instant-ngp? What is the command? Thx