diff --git a/Dockerfile b/Dockerfile index a52a2d3..94e57bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 v1.0 --recursive https://github.com/cvg/pyceres RUN python3 -m pip install --upgrade pip RUN cd pyceres && \ pip wheel . --no-deps -w dist-wheel -vv && \ @@ -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 diff --git a/README.md b/README.md index dc59e83..fa13897 100644 --- a/README.md +++ b/README.md @@ -66,32 +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 / 3.10, we recommend to use `venv` virtual environment. -- Install in order: - * [Ceres 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. Follow the instructions on the page, but **DO NOT install libceres-dev!!!** We just installed a correct version in the previous step. - * [hloc 1.4](https://github.com/cvg/Hierarchical-Localization) and its dependencies - * [pyceres](https://github.com/cvg/pyceres) built from source at tag v1.0. - - or use the provided script: +:one: Install the **core dependencies** using the provided script: ```bash - ./install_core_dependencies.sh + 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. -:two: Install the LaMAR libraries and pull the remaining pip dependencies: +: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] ``` diff --git a/scripts/build_hloc.sh b/scripts/build_hloc.sh index 2b3088c..96233b2 100755 --- a/scripts/build_hloc.sh +++ b/scripts/build_hloc.sh @@ -4,7 +4,7 @@ root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) source ${root_folder}/scripts/load_env.sh # Clone hloc. -git clone --recursive https://github.com/cvg/Hierarchical-Localization/ hloc --depth=1 +git clone --recursive -b v1.4 https://github.com/cvg/Hierarchical-Localization/ hloc --depth=1 cd hloc # Build the wheel. diff --git a/scripts/install_ceres_solver.sh b/scripts/install_ceres_solver.sh new file mode 100755 index 0000000..560438d --- /dev/null +++ b/scripts/install_ceres_solver.sh @@ -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) diff --git a/scripts/install_colmap.sh b/scripts/install_colmap.sh new file mode 100755 index 0000000..8a82dd1 --- /dev/null +++ b/scripts/install_colmap.sh @@ -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) diff --git a/scripts/install_core_dependencies.sh b/scripts/install_core_dependencies.sh index 934bf73..23b582c 100755 --- a/scripts/install_core_dependencies.sh +++ b/scripts/install_core_dependencies.sh @@ -1,101 +1,20 @@ -# Create a directory for all the dependencies -mkdir external -cd external +root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) +source ${root_folder}/scripts/load_env.sh -####################### -## Installing Ceres-Solver with tag 2.1.0 -## Check webpage https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/2.1.0 for more details -git clone --no-checkout https://ceres-solver.googlesource.com/ceres-solver ceres_v2.1.0 -cd ceres_v2.1.0 -git checkout f68321e7de8929fbcdb95dd42877531e64f72f66 +# 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 -# Installing system-wide dependencies for Ceres -# Commands from http://ceres-solver.org/installation.html -echo "Installing system-wide dependencies cmake build-essential libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev" -sudo apt-get install cmake libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev build-essential +# Create external folder. +mkdir ${root_folder}/external && cd ${root_folder}/external -mkdir build -cd build -cmake .. -make -j4 -sudo make install -cd .. # exit build folder -cd .. # Exiting ceres_v2.1.0 +# Ceres Solver. +sudo ${root_folder}/scripts/install_ceres_solver.sh +# Colmap. +sudo ${root_folder}/scripts/install_colmap.sh -####################### -## Installing COLMAP version 3.8 -git clone https://github.com/colmap/colmap colmap_v3.8 -cd colmap_v3.8 -git checkout 3.8 -git submodule update --init --recursive +# HLoc. +python3 -m pip install git+https://github.com/cvg/Hierarchical-Localization.git@v1.4 -# # Installation instructions from https://colmap.github.io/install.html#build-from-source -echo "Installing system-wide dependencies - ninja-build \ - 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 \ " -sudo apt-get install \ - ninja-build \ - 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 \ - -mkdir build -cd build -cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=all -ninja -sudo ninja install - -cd .. # exit build folder -cd .. # exit colmap_v3.8 - -####################### -## Installing HLOC version 1.4 -git clone --recursive https://github.com/cvg/Hierarchical-Localization/ hloc_v1.4 -cd hloc_v1.4 -git checkout v1.4 -git submodule update --init --recursive - -# installing -echo "Installing hloc...." -python -m pip install -e . - -cd .. # exit hloc_v1.4 folder - -### Installing pyceres version 1.0 -git clone https://github.com/cvg/pyceres.git pyceres_v1.0 -cd pyceres_v1.0 -git checkout v1.0 -git submodule update --init --recursive - -# installing pyceres -python -m pip install . -cd .. # exit pyceres \ No newline at end of file +# Pyceres. +python3 -m pip install git+https://github.com/cvg/pyceres.git@v1.0 diff --git a/scripts/load_env.sh b/scripts/load_env.sh old mode 100644 new mode 100755 index d638c25..4d78858 --- a/scripts/load_env.sh +++ b/scripts/load_env.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash -PS4='\033[1;96m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +# 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