Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build-and-push:
permissions: write-all
runs-on: ubuntu-latest
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
52 changes: 31 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ARG UBUNTU_VERSION=22.04
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:${UBUNTU_VERSION} AS common
FROM runpod/pytorch:1.0.1-cu1281-torch280-ubuntu2404 AS common

# To avoid compiler segfault when building the image on ARM.
# ENV CFLAGS="-fno-lto"
# ENV CXXFLAGS="-fno-lto"
# ENV LDFLAGS="-fno-lto"

# Minimal toolings.
RUN apt-get update && \
Expand Down Expand Up @@ -55,21 +59,21 @@ RUN apt-get update && \
# Install raybender.
COPY --from=builder /raybender/embree-3.12.2/lib /raybender/embree-3.12.2/lib
COPY --from=builder /raybender/dist-wheel /tmp/dist-wheel
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install $whl_path
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install --ignore-installed $whl_path
RUN rm -rfv /tmp/*

# Install pcdmeshing.
COPY --from=builder /pcdmeshing/dist-wheel /tmp/dist-wheel
RUN apt-get install -y --no-install-recommends --no-install-suggests libmpfrc++-dev
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install $whl_path
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install --ignore-installed $whl_path
RUN rm -rfv /tmp/*

RUN python3 -m pip install --no-deps \
RUN python3 -m pip install --ignore-installed --no-deps \
astral==3.2 \
beautifulsoup4==4.12.2 \
lxml==4.9.2 \
lxml==5.3.0 \
matplotlib \
open3d==0.18.0 \
open3d==0.19.0 \
opencv-python==4.7.0.72 \
plyfile==1.0.3 \
pytijo==0.0.2 \
Expand Down Expand Up @@ -102,26 +106,27 @@ RUN bash /tmp/install_colmap.sh
RUN git clone --depth 1 -b v1.0 --recursive https://github.com/cvg/pyceres
RUN python3 -m pip install --upgrade pip
RUN apt-get install -y --no-install-recommends --no-install-suggests python3-dev
RUN cd pyceres/pybind11 && \
git fetch --tags && \
git checkout v2.13.6
RUN cd pyceres && \
pip wheel . --no-deps -w dist-wheel -vv && \
whl_path=$(find dist-wheel/ -name "*.whl") && \
echo $whl_path >dist-wheel/whl_path.txt

RUN git clone --depth=1 -b v0.4.0 --recursive https://github.com/colmap/pycolmap pycolmap
RUN cd pycolmap/pybind11 && \
git fetch --tags && \
git checkout v2.13.6
RUN cd pycolmap && \
pip wheel . --no-deps -w dist-wheel -vv && \
whl_path=$(find dist-wheel/ -name "*.whl") && \
echo $whl_path >dist-wheel/whl_path.txt

#
# pyceres stage.
#
FROM scantools as pyceres

# Install minimal runtime dependencies.
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
libgoogle-glog0v5 \
libspqr2 \
libcxsparse3 \
libatlas3-base \
python-is-python3 \
python3-minimal \
python3-pip
FROM scantools AS pyceres

# Copy installed libraries in the builder stage.
COPY --from=pyceres-builder /usr/local/ /usr/local/
Expand All @@ -132,10 +137,16 @@ RUN pip install --upgrade pip
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && pip install $whl_path
RUN rm -rfv /tmp/*

# Install pycolmap.
COPY --from=pyceres-builder /pycolmap/dist-wheel /tmp/dist-wheel
RUN pip install --upgrade pip
RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && pip install $whl_path
RUN rm -rfv /tmp/*

#
# lamar stage.
#
FROM pyceres as lamar
FROM pyceres AS lamar

# Install hloc.
COPY scripts/install_hloc.sh /tmp/
Expand All @@ -150,7 +161,6 @@ RUN python3 -m pip install --no-deps \
numpy==1.26.3 \
torch>=1.1 \
tqdm>=4.36.0 \
pycolmap==0.4.0 \
scikit-learn==1.5.2

RUN cd /lamar && python3 -m pip install -e . --no-deps
Expand Down
9 changes: 7 additions & 2 deletions scripts/build_pcdmeshing.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh
PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail

sudo apt-get install -y --no-install-recommends --no-install-suggests \
libboost-dev libgmp3-dev libmpfrc++-dev
git clone --recursive https://github.com/cvg/pcdmeshing.git --depth=1
cd pcdmeshing

cd pybind11
git fetch --tags
git checkout v2.13.6
cd ..

# Build the wheel.
pip wheel --no-deps -w dist-wheel .
whl_path=$(find dist-wheel/ -name "*.whl")
Expand Down
9 changes: 7 additions & 2 deletions scripts/build_raybender.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh
PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail

# Clone raybender.
git clone --recursive https://github.com/cvg/raybender.git --depth=1
cd raybender

cd pybind11
git fetch --tags
git checkout v2.13.6
cd ..

# Install Embree following the official instructions and set the environmental
# variable embree_DIR to point to embree-config.cmake. On Linux, this can be
# done as follows:
Expand Down
5 changes: 2 additions & 3 deletions scripts/install_ceres_solver.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh
PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail

apt-get install -y --no-install-recommends --no-install-suggests \
cmake \
libgoogle-glog-dev \
libgflags-dev \
libatlas-base-dev \
libeigen3-dev \
libsuitesparse-dev \
build-essential

git clone -b 2.1.0 https://github.com/ceres-solver/ceres-solver.git ceres-solver-v2.1.0 --depth=1
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_colmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ apt-get install -y --no-install-recommends --no-install-suggests \
# Installing COLMAP version 3.8
git clone --recursive -b 3.8 https://github.com/colmap/colmap colmap_v3.8 --depth=1
cd colmap_v3.8
cmake -S . -B build -DCMAKE_CUDA_ARCHITECTURES=all
cmake -S . -B build -DCUDA_ENABLED=False
cmake --build build --target install -- -j$(nproc)
4 changes: 2 additions & 2 deletions scripts/install_core_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh
PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail

# Uncomment the following line if you want to use this script inside Docker.
# apt-get update && apt-get install -y --no-install-recommends --no-install-suggests git python3 python3-dev python3-pip python-is-python3 sudo
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_hloc.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh
PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail

git clone --recursive -b v1.4 https://github.com/cvg/Hierarchical-Localization/ hloc --depth=1
cd hloc
Expand Down
Loading