Use Dockerfile to install it directly
Install nvidia-Docker before using Dockerfile to install Colmap in Docker
- use
NVCC version
Make sure yourcuda
version - Check out the available versions of Nvidia/CUDa on DockerHubDocker Hub Nvidia cuda
- Devel is recommended
- You are advised to select 18.04 for ubuntu. For details, see step installation
- Change the version of the first line, for example, my CUDA version is 11.2, and rewrite the first line to
FROM nvidia/cuda:11.2-devel-ubuntu18.04
Copy the code
- Then generate the image and wait for the installation
sudo docker build -t colmap:v0
Copy the code
Installation process need to download a lot of dependence, network speed you know, recommend looking for their own appropriate way, attention must be patient, many of the steps are really slow, before several midway I thought dead on the interruption, in fact, no problem!
- Verify that the installation is correct
colmap help
Copy the code
If the output is correct, colmap is successfully installed
You can use this command to open a GUI window, see this screen is done, if you open the window is all black and the command line error, it may be a display problem, you can see the following two error solutions for inspiration!! But it does not affect the use of cli!! (If you are developing remotely, you may not be able to use the GUI, so you can skip the problem details below.)
colmap gui
Copy the code
LibGL error: No matching fbConfigs or visuals found
LibGL error: failed to load driver: swrast】 The solution:Askubuntu.com/questions/8…
- View the NVIDIa-SMI version on the host:
nvidia-smi
- Download the corresponding package
apt get install lib nvidia-gl-460
I also deleted it from the forum
libGL.so.1
The file. I don’t know if it has any impact
sudo ldconfig -p | grep -i gl.so Then delete the file as prompted by the output message sudo rm /usr/lib/x86_64-linux-gnu/libGL.so.1 Copy the code
QOpenGLWidget: Failed to create context Failed to create context · Issue #749 · colmap/colmap · GitHub
apt-get install qt5-default
export QT_SELECTION=path/to/qmake
Copy the code
Later I found another issue github.com/colmap/colm… It is recommended to use the command line mode. It may also be because THE GUI in Docker may cause some inexplicable problems. Finally, Nvidia-drivers is installed to solve the installation steps are briefly introduced as follows: Install in docker container
sudo apt-get install ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
Copy the code
On the host
Wget - P/TMP curl https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb - s - L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart dockerCopy the code
Then add the –gpus all parameter to start Docker images
Install step by step on the machine or in Docker
- Install dependencies
apt-get update && apt-get install -y \
git \
cmake \
build-essential \
vim
Copy the code
apt-get update && apt-get install -y \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-regex-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libsuitesparse-dev \
libfreeimage-dev \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev
Copy the code
apt-get update && apt-get install -y \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libcgal-qt5-dev
Copy the code
- Compile the installation
ceres-solver
apt-get update && apt-get install -y libatlas-base-dev libsuitesparse-dev
git clone https://gitee.com/coolke/ceres-solver.git
git checkout $(git describe --tags)
cd ceres-solver
mkdir build && cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF This step will take a long time, so be patient
make -j4 && make install
Copy the code
Note the ubuntu version ⚠️ I originally selected 16.04, and the installation of Ceres-Solver has been stuck: – Detected Ceres being used as a git submodule, adding commit hook for Gerrit to: /ceres-solver/.git】, and the problem is very few. It took more than three hours to install it again and again, but it still stuck. Later, I changed the Ubuntu version to 18.04 and compiled successfully after more than ten minutes of this step. However, there may be survivor bias problem, as appropriate refer to 3. Compile and install colmap
git clone https://github.com/colmap/colmap.git
git checkout dev
mkdir build && cd build
cmake ..
make -j2 # This step will also be very, very, very long, must have enough patience and courage!! The senior said that there are too many threads to open, and swap is used for processing. Bit by bit, the handling is too slow. It is recommended not to open multithreading directly
make install
Copy the code
- Verify that the installation is correct
colmap help
Copy the code
Run Colmap’s Docker image
The final command to run the Docker image with Colmap is as follows:
xhost +
sudo docker run -itd \
-p 6789:22 \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--ipc=host \
--privileged=true \
--gpus all \
colmap:v0 \
/bin/bash
Copy the code
-v -e
: Lets Docker use the native display to run GUI Windows--ipc=host
: To increase the host and container shared memory, if an error occurs, use this commandM \ SHM - size in 5120
Instead of--privileged=true
: Enables special rights on the local machine
Note: I have changed the source of the installation in the tutorial because the domestic installation depends on the network speed
- The original link
- Ceres-solver.googlesource.com/ceres-solve…
- Github.com/colmap/colm…
- Link after replacement
- Gitee.com/coolke/cere…
- Gitee.com/liang-hao/c…
I thank Gitee on these occasions
Resources
- Colmap. Making. IO/install. HTM…
- GitHub – Kai-46/colmap_in_docker: install colmap in a docker
- 3d reconstruction _COLMAP installation, use and parameter description (translated from official documentation) _ Step by step -CSDN blog
- www.ceres-solver.org/installatio…
There are also some solutions to the environment error
- 【Docker】 install nVIDIA driver in Docker, CUDA, CUDNN, etc
- Initial Exploration of Docker call GPU-Zhihu