xheon / panoptic-reconstruction

Official implementation of the NeurIPS 2021 paper "Panoptic 3D Scene Reconstruction from a Single RGB Image"
https://manuel-dahnert.com/research/panoptic-reconstruction
Other
194 stars 29 forks source link

Installation Help #8

Open themasterlink opened 2 years ago

themasterlink commented 2 years ago

Hey guys,

I just installed this library, but it wasn't as simple as I would have hoped. Here is my process it might help someone else in the future:

At first you download the github repo:

git clone https://github.com/xheon/panoptic-reconstruction.git
cd panoptic-reconstruction

Depending now on the graphics card you use you have to adapt a few things, I used a 3070 for testing this code, so I needed to use at least CUDA 11. That means I changed the following lines in the environment.yaml. I also used a more recent python version:

-    - python>=3.8
+    - python>=3.9
-    - pytorch>=1.7.1
+    - pytorch=1.10.0
-    - cudatoolkit=10.2
+    - cudatoolkit=11.3

Before now installing the environment you might need to make sure that you have support for OpenEXR, on Ubuntu 20.4 this can be installed via:

sudo apt-get install libopenexr-dev
sudo apt-get install openexr

After that we can just go forward and create the environment:

conda env create --file environment.yaml
conda activate panoptic

Now, you need to install some 3rdparty libs, we start with cocodataset API:

cd .. && mkdir 3rdparty && cd 3rdparty
conda install ipython pip
pip install ninja yacs cython matplotlib tqdm opencv-python
export INSTALL_DIR=$PWD
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install

Afterwards, you need to install cityscapescripts:

cd $INSTALL_DIR
git clone https://github.com/mcordts/cityscapesScripts.git
cd cityscapesScripts/
python setup.py build_ext install

Now, it is time to install apex, which is the most difficult to install from this group, if it fails there is a suggested fix for Ubuntu 20.4 below:

cd $INSTALL_DIR
git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install --cuda_ext --cpp_ext

This might fail, because your conda environment does not provide nvidias compiler nvcc, on ubuntu 20.4 you can change this via:

sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt update
sudo apt install cuda-11-3 cuda-runtime-11-3 cuda-demo-suite-11-3 cuda-drivers cuda-drivers-510 nvidia-dkms-510 nvidia-driver-510 nvidia-kernel-common-510 libnvidia-extra-510

After this cuda install, you need to reboot and afterwards set the CUDA_HOME and add the nvcc to your path:

export CUDA_HOME="/usr/local/cuda-11.3"
export PATH=$PATH:/usr/local/cuda-11.3/bin

Now you can run the command again, make sure that you first go to your 3rd_party folder:

cd apex
python setup.py install --cuda_ext --cpp_ext

After installing all these packages, you can now install the maskrcnn-benchmark:

cd ..
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
python setup.py build develop

Finally, you need to add the MinkowskiEngine:

cd ..
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd MinkowskiEngine
python setup.py install --blas=openblas --force_cuda

After you installed that package you only need to install the panoptic packge itself:

# Install library
cd ../panoptic-reconstruction/
cd lib/csrc/
python setup.py install

I hope this helps someone.

PS: I am not the maintainer of this package and I can not help you if this doesn't work for you.

Best, Max