Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add core dependencies installation script #80

Merged
merged 15 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ RUN apt-get update && \
python3-setuptools

# Build raybender.
COPY docker/scripts/build_raybender.sh /tmp/
COPY scripts/build_raybender.sh /tmp/
RUN bash /tmp/build_raybender.sh && rm /tmp/build_raybender.sh

# Build pcdmeshing.
COPY docker/scripts/build_pcdmeshing.sh /tmp/
COPY scripts/build_pcdmeshing.sh /tmp/
RUN bash /tmp/build_pcdmeshing.sh && rm /tmp/build_pcdmeshing.sh

# Build hloc.
COPY docker/scripts/build_hloc.sh /tmp/
COPY scripts/build_hloc.sh /tmp/
RUN bash /tmp/build_hloc.sh && rm /tmp/build_hloc.sh

#
Expand Down Expand Up @@ -82,7 +82,7 @@ RUN python3 -m pip install --no-deps \
rawpy==0.19.1 \
scipy==1.11.4 \
numpy==1.26.4 \
pillow==10.3.0
pillow==10.3.0

RUN cd lamar && python3 -m pip install -e .[scantools] --no-deps
WORKDIR /lamar
Expand Down Expand Up @@ -123,7 +123,7 @@ RUN apt-get install -y --no-install-recommends --no-install-suggests wget && \
RUN cp -r /ceres_installed/* /usr/local/

# Build pyceres.
RUN git clone --depth 1 --recursive https://github.com/cvg/pyceres
RUN git clone --depth 1 -b v2.3 --recursive https://github.com/cvg/pyceres
pablospe marked this conversation as resolved.
Show resolved Hide resolved
RUN python3 -m pip install --upgrade pip
RUN cd pyceres && \
pip wheel . --no-deps -w dist-wheel -vv && \
Expand Down Expand Up @@ -168,13 +168,14 @@ RUN rm -rfv /tmp/*
# Note: The dependencies listed in pyproject.toml also include pyceres, already
# installed in previous Docker stages. Attempting to compile it in this stage
# will lead to failure due to missing necessary development dependencies.
# Therefore, we replicate the dependencies here, excluding pyceres
# Therefore, we replicate the dependencies here, excluding pyceres.
RUN python3 -m pip install --no-deps \
h5py==3.10.0 \
numpy==1.26.3 \
torch>=1.1 \
tqdm>=4.36.0 \
pycolmap==0.6.0
pycolmap==0.4.0 \
scikit-learn==1.5.2

RUN cd /lamar && python3 -m pip install -e . --no-deps
WORKDIR /lamar
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,29 @@ T_w_i = sessions.trajectories[keys[0]] # first pose, from sensor/rig to world

## Installation

:one: Install the core dependencies:

- Python >= 3.9
- [hloc v1.4](https://github.com/cvg/Hierarchical-Localization) and its dependencies, including [COLMAP 3.8](https://colmap.github.io/install.html) built from source.
- [pyceres](https://github.com/cvg/pyceres) built from source at tag v1.0.

:two: Install the LaMAR libraries and pull the remaining pip dependencies:
:one: Install the **core dependencies** using the provided script:
```bash
scripts/install_core_dependencies.sh
```
Alternatively, you can install them manually in the following order:
* Python 3.9 / 3.10 (we recommend using a `venv` virtual environment).
* [Ceres Solver 2.1](https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/2.1.0)
* [Colmap 3.8](https://colmap.github.io/install.html) built from source. Note: **Do not install libceres-dev** as it was installed in the previous step.
* [hloc 1.4](https://github.com/cvg/Hierarchical-Localization) and its dependencies
* [pyceres v1.0](https://github.com/cvg/pyceres) built from source.
pablospe marked this conversation as resolved.
Show resolved Hide resolved

:two: Install LaMAR libraries as editable packages:
```bash
python -m pip install -e .
```

:three: Optional: the processing pipeline additionally relies on heavier dependencies not required for benchmarking:
:three: **Optional**: the processing pipeline additionally relies on heavier dependencies not required for benchmarking:

- Pip dependencies: `python -m pip install -e .[scantools]`
- [raybender](https://github.com/cvg/raybender) for raytracing
- [pcdmeshing](https://github.com/cvg/pcdmeshing) for pointcloud meshing

:four: Optional: if you wish to contribute, install the development tools as well:
:four: **Optional**: if you wish to contribute, install the development tools as well:
```bash
python -m pip install -e .[dev]
```
Expand Down
13 changes: 0 additions & 13 deletions docker/scripts/build_hloc.sh

This file was deleted.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ dependencies = [
"numpy==1.26.3",
"torch>=1.1",
"tqdm>=4.36.0",
"pycolmap==0.6.0",
"pycolmap==0.4.0",
"scikit-learn==1.5.2", # is needed for hloc
"pyceres @ git+https://github.com/cvg/pyceres.git@v1.0",
]
urls = {Repository = "https://github.com/microsoft/lamar-benchmark"}
Expand All @@ -34,7 +35,7 @@ scantools = [
"pyzbar-upright==0.1.8",
"rawpy==0.19.1",
"scipy==1.11.4",
"numpy==1.26.4",
"numpy==1.26.3",
"pillow==10.3.0",
]
dev = [
Expand Down
13 changes: 13 additions & 0 deletions scripts/build_hloc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh

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

# Build the wheel.
pip wheel --no-deps -w dist-wheel .
whl_path=$(find dist-wheel/ -name "*.whl")
echo $whl_path >dist-wheel/whl_path.txt
sarlinpe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

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

sudo apt-get install -y --no-install-recommends --no-install-suggests \
libboost-dev libgmp3-dev libmpfrc++-dev
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

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

# Clone raybender.
git clone --recursive https://github.com/cvg/raybender.git --depth=1
Expand Down
18 changes: 18 additions & 0 deletions scripts/install_ceres_solver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh

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
cd ceres-solver-v2.1.0
cmake -S . -B build
cmake --build build --target install -- -j$(nproc)
28 changes: 28 additions & 0 deletions scripts/install_colmap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh

apt-get install -y --no-install-recommends --no-install-suggests \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libgmock-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev

# 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 --build build --target install -- -j$(nproc)
20 changes: 20 additions & 0 deletions scripts/install_core_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..)
source ${root_folder}/scripts/load_env.sh

# Comment this line out if you want to use it 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

# Create external folder.
mkdir ${root_folder}/external && cd ${root_folder}/external

# Ceres Solver.
sudo ${root_folder}/scripts/install_ceres_solver.sh

# Colmap.
sudo ${root_folder}/scripts/install_colmap.sh

# HLoc.
python3 -m pip install git+https://github.com/cvg/Hierarchical-Localization.git@v1.4

# Pyceres.
python3 -m pip install git+https://github.com/cvg/pyceres.git@v2.3
pablospe marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions scripts/load_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# PS4='\033[1;96m$(date +%H:%M:%S)\033[0m '

PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m '
set -euxo pipefail