Skip to content

Latest commit

 

History

History
130 lines (96 loc) · 5.65 KB

installation.md

File metadata and controls

130 lines (96 loc) · 5.65 KB

Installation

We provide some tips for XRNerf installation in this file.

Requirements

  • Linux
  • Python 3.7+
  • PyTorch 1.10+
  • CUDA 11.0+
  • GCC 7.5+
  • build-essential: Install by apt-get install -y build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1
  • mmcv-full
  • Numpy
  • ffmpeg (4.2 is preferred)
  • opencv-python 3+: Install by pip install opencv-python>=3
  • imageio: Install by pip install imageio
  • scikit-image: Install by pip install scikit-image
  • spconv: Install proper vision that matches your cuda-vision, for example pip install spconv-cu113
  • pytorch3d: Install by pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"

Prepare environment

a. Install development libs.

sudo apt install libgl-dev freeglut3-dev build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1

b. Create a conda virtual environment and activate it.

conda create -n xrnerf python=3.7 -y
conda activate xrnerf

c. Install PyTorch and torchvision

  1. check pytorch-cuda vision match table from here or here
  2. find a proper torch vision (>=1.10.0 and match your cuda vision) from here, like cu111/torch-1.10.0%2Bcu111-cp37-cp37m-linux_x86_64.whl, download the whl file
  3. install your whl file, for example pip install torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl
  4. check here and install specified vision of torchvision, for example pip install torchvision==0.12.0

d. Install Other Needed Python Packages

  • pip install opencv-python>=3 yapf imageio scikit-image
  • install mmcv-full following their Installation
  • install spconv using pip install, for example pip install spconv-cu111. notice that only specified cuda-vision are supported, following their Installation
  • install pytorch3d using pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
  • install tcnn using pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
  • install kilo-cuda following their Installation
  • install tcnn using pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch, or following their Installation

e. Install Extensions

  • build cuda-extension raymarch for instant-ngp supported, following ngp_raymarch
  • build cuda-extension mesh_grid for gnr supported, following mesh_grid

Another option: Docker Image

a. Build an Image

We provide a Dockerfile to build an image.

docker build -f ./docker/Dockerfile --rm -t xrnerf .

Important: Make sure you've installed the nvidia-container-toolkit.

b. Create a Container

Create a container with command:

docker run --gpus all -it xrnerf /workspace

c. Copy XRNerf into Container

Open a teiminal in your host computer, copy project into docker container

# d287273af72e is container id, using 'docker ps -a' to find id
docker cp ProjectPath/xrnerf d287273af72e:/workspace

e. Install Other Needed Packages

  • Install tcnn using
    git clone --recurse-submodules https://gitclone.com/github.com/NVlabs/tiny-cuda-nn.git
    cd tiny-cuda-nn/bindings/torch
    python setup.py install
    If you have installed tcnn in dockerfile, skip this.
  • Build cuda-extension raymarch for instant-ngp supported, folling ngp_raymarch
  • Build cuda-extension mesh_grid for gnr supported, following mesh_grid

Verification

To verify whether XRNerf and the required environment are installed correctly, we can run unit-test python codes

coverage run --source xrnerf/models -m pytest -s test/models && coverage report -m

Notice that coverage and pytest need to be installed before that

pip install coverage pytest -i https://pypi.tuna.tsinghua.edu.cn/simple