Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
a89303a
Add ALIKED/LightGlue feature based on libtorch
ahojnnes Dec 21, 2024
1705c16
d
ahojnnes Dec 21, 2024
64424ab
d
ahojnnes Dec 21, 2024
88bbfbe
d
ahojnnes Dec 21, 2024
99a46ca
d
ahojnnes Dec 21, 2024
a95a0c3
d
ahojnnes Dec 21, 2024
380716b
d
ahojnnes Dec 21, 2024
4856e82
d
ahojnnes Dec 21, 2024
1b887b9
d
ahojnnes Dec 21, 2024
3156d1a
d
ahojnnes Dec 21, 2024
1103222
d
ahojnnes Dec 21, 2024
6ee2b04
d
ahojnnes Dec 21, 2024
70de0d2
d
ahojnnes Dec 21, 2024
3cfcaa5
d
ahojnnes Dec 21, 2024
a6d8619
d
ahojnnes Dec 21, 2024
0fae1b1
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Jan 4, 2025
df41fd9
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Jan 26, 2025
c877ae8
d
ahojnnes Jan 26, 2025
676577d
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Jan 30, 2025
28364c5
d
ahojnnes Feb 2, 2025
d79efbc
Support enum from string conversion
ahojnnes Feb 2, 2025
ea29d68
d
ahojnnes Feb 2, 2025
864590f
Merge branch 'user/jsch/enum-from-str' into user/jsch/torch-aligked-l…
ahojnnes Feb 2, 2025
65a309b
d
ahojnnes Feb 2, 2025
6c4453d
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Feb 2, 2025
60f770d
d
ahojnnes Feb 2, 2025
333b4ae
d
ahojnnes Feb 6, 2025
dca41df
d
ahojnnes Feb 15, 2025
57d4651
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Apr 10, 2025
39c29ee
d
ahojnnes Apr 10, 2025
a6c360a
Fixes
ahojnnes Apr 10, 2025
1bd573c
d
ahojnnes Apr 10, 2025
f58bc17
d
ahojnnes Apr 10, 2025
f0129a6
d
ahojnnes Apr 10, 2025
74d6024
d
ahojnnes Apr 10, 2025
e417af9
d
ahojnnes Apr 10, 2025
95056cc
d
ahojnnes Apr 10, 2025
f5fe4d9
torch 2.6.0
ahojnnes Apr 10, 2025
7639f8c
d
ahojnnes Apr 11, 2025
eccc5b9
d
ahojnnes Apr 11, 2025
995ed8f
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Apr 11, 2025
d018844
s
ahojnnes Apr 11, 2025
2ac1d40
s
ahojnnes Apr 11, 2025
b90e7ca
d
ahojnnes Apr 11, 2025
a513d33
speedup image conversion
ahojnnes Apr 11, 2025
c5f23e6
s
ahojnnes Apr 11, 2025
c180b22
d
ahojnnes Apr 12, 2025
b5b8307
d
ahojnnes Apr 14, 2025
693c342
d
ahojnnes Apr 14, 2025
60df7e7
d
ahojnnes Apr 14, 2025
17b0881
d
ahojnnes Apr 14, 2025
5df008c
s
ahojnnes Apr 14, 2025
a30e9ef
d
ahojnnes Apr 14, 2025
e3d1656
s
ahojnnes Apr 14, 2025
016e449
d
ahojnnes Apr 14, 2025
7ff97d2
d
ahojnnes Apr 14, 2025
82ae347
s
ahojnnes Apr 14, 2025
bb0ad78
d
ahojnnes Apr 14, 2025
501dd82
d
ahojnnes Apr 14, 2025
7cc1f2b
d
ahojnnes Apr 14, 2025
6dd5a76
s
ahojnnes Apr 14, 2025
3c17fd2
d
ahojnnes Apr 14, 2025
bd99bdd
d
ahojnnes Apr 14, 2025
4b6b53d
d
ahojnnes Apr 14, 2025
d852d35
d
ahojnnes Apr 15, 2025
4ea27d7
d
ahojnnes Apr 16, 2025
2a0eaee
s
ahojnnes Apr 21, 2025
b987fee
d
ahojnnes Apr 21, 2025
29035ac
d
ahojnnes Apr 21, 2025
60380ee
d
ahojnnes Apr 21, 2025
8dc614b
d
ahojnnes Apr 21, 2025
5eb1fa0
d
ahojnnes Apr 22, 2025
8d231c8
d
ahojnnes Apr 22, 2025
e1dcfd5
d
ahojnnes Apr 22, 2025
8d9f062
Merge branch 'user/jsch/torch-aligked-lightglue' of https://github.co…
ahojnnes Apr 22, 2025
5b26355
d
ahojnnes Apr 22, 2025
cc342f4
d
ahojnnes Apr 22, 2025
e841300
d
ahojnnes Apr 22, 2025
95eea5b
d
ahojnnes Apr 22, 2025
8733845
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Apr 29, 2025
b783e91
d
ahojnnes Apr 30, 2025
35a350d
d
ahojnnes Apr 30, 2025
733e461
d
ahojnnes May 1, 2025
3534760
d
ahojnnes May 1, 2025
948e224
d
ahojnnes May 1, 2025
424d8ef
d
ahojnnes May 1, 2025
ba8af30
d
ahojnnes May 1, 2025
f5952f1
d
ahojnnes May 1, 2025
7cc9b53
d
ahojnnes May 1, 2025
f4aed38
Merge branch 'main' into user/jsch/torch-aligked-lightglue
ahojnnes May 1, 2025
e4c8bfd
d
ahojnnes May 1, 2025
ad8751c
Merge branch 'user/jsch/torch-aligked-lightglue' of https://github.co…
ahojnnes May 1, 2025
a8c3c01
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes May 7, 2025
e0bc5ca
Merge branch 'main' of https://github.com/colmap/colmap into user/jsc…
ahojnnes Jun 1, 2025
5809c3d
d
ahojnnes Jun 1, 2025
071a2f1
d
ahojnnes Jun 1, 2025
ac2568a
d
ahojnnes Jun 1, 2025
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
4 changes: 3 additions & 1 deletion .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ jobs:
glew \
cgal \
sqlite3 \
ccache
ccache \
pytorch
brew link --force libomp

- name: Configure and build
Expand All @@ -76,6 +77,7 @@ jobs:
-GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.config.cmakeBuildType }} \
-DTESTS_ENABLED=ON \
-DTORCH_ENABLED=ON \
-DQt5_DIR="$(brew --prefix qt@5)/lib/cmake/Qt5"
ninja

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-pycolmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
strategy:
matrix:
config: [
{os: ubuntu-latest},
{os: macos-13, arch: x86_64, deploymentTarget: 13.0},
{os: macos-14, arch: arm64, deploymentTarget: 14.0},
{os: windows-latest},
{os: ubuntu-latest},
{os: macos-13, arch: x86_64, deploymentTarget: 13.0},
{os: macos-14, arch: arm64, deploymentTarget: 14.0},
{os: windows-latest},
]
env:
COMPILER_CACHE_VERSION: 1
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
e2eTests: false,
checkCodeFormat: true,
coverageEnabled: true,
torchEnabled: false,
},
{
os: ubuntu-22.04,
Expand All @@ -40,6 +41,7 @@ jobs:
e2eTests: true,
checkCodeFormat: true,
coverageEnabled: false,
torchEnabled: true,
},
{
os: ubuntu-22.04,
Expand All @@ -50,6 +52,7 @@ jobs:
e2eTests: false,
checkCodeFormat: false,
coverageEnabled: false,
torchEnabled: false,
},
{
os: ubuntu-24.04,
Expand All @@ -60,6 +63,7 @@ jobs:
e2eTests: false,
checkCodeFormat: false,
coverageEnabled: false,
torchEnabled: false,
},
{
os: ubuntu-24.04,
Expand All @@ -70,6 +74,7 @@ jobs:
e2eTests: false,
checkCodeFormat: false,
coverageEnabled: false,
torchEnabled: false,
},
]

Expand All @@ -82,12 +87,16 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
lfs: true

- uses: actions/cache@v4
id: cache-builds
with:
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ github.run_id }}-${{ github.run_number }}
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ matrix.config.torchEnabled }}-${{ github.run_id }}-${{ github.run_number }}
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ matrix.config.torchEnabled }}
path: ${{ env.COMPILER_CACHE_DIR }}

- name: Install compiler cache
run: |
mkdir -p "$CCACHE_DIR" "$CTCACHE_DIR"
Expand Down Expand Up @@ -144,7 +153,8 @@ jobs:
libgl1-mesa-dri \
libunwind-dev \
libcurl4-openssl-dev \
xvfb
xvfb \
libmkl-dev

if [ "${{ matrix.config.cudaEnabled }}" == "true" ]; then
if [ "${{ matrix.config.os }}" == "ubuntu-20.04" ]; then
Expand Down Expand Up @@ -180,6 +190,12 @@ jobs:
sudo apt-get install -y gcovr
fi

if [ "${{ matrix.config.torchEnabled }}" == "true" ]; then
sudo apt-get install -y python3 python3-pip
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
echo "Torch_DIR=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'`" >> $GITHUB_ENV
fi

- name: Configure and build
run: |
set -x
Expand All @@ -195,6 +211,7 @@ jobs:
-DCUDA_ENABLED=${{ matrix.config.cudaEnabled }} \
-DGUI_ENABLED=${{ matrix.config.guiEnabled }} \
-DASAN_ENABLED=${{ matrix.config.asanEnabled }} \
-DTORCH_ENABLED=${{ matrix.config.torchEnabled }} \
-DCOVERAGE_ENABLED=${{ matrix.config.coverageEnabled }}
ninja -k 10000

Expand Down Expand Up @@ -275,6 +292,7 @@ jobs:
indicators: true
output: both
thresholds: '75 90'

# TODO: Add code coverage comment to PR. Currently, this action reports
# coverage for the entire repository, not just the changed files in the PR.
# We could manually filter the coverage report to only include the changed
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ jobs:
os: windows-2022,
cmakeBuildType: Release,
cudaEnabled: true,
torchEnabled: false,
testsEnabled: true,
exportPackage: true,
},
{
os: windows-2022,
cmakeBuildType: Release,
cudaEnabled: false,
torchEnabled: false,
testsEnabled: true,
exportPackage: true,
},
Expand All @@ -45,6 +47,9 @@ jobs:
VCPKG_COMMIT_ID: bc3512a509f9d29b37346a7e7e929f9a26e66c7e
GLOG_v: 1
GLOG_logtostderr: 1
CUDA_MAJOR_VERSION: 12
CUDA_MINOR_VERSION: 6
CUDA_PATCH_VERSION: 2

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -95,10 +100,18 @@ jobs:
if: matrix.config.cudaEnabled
id: cuda-toolkit
with:
cuda: '12.6.2'
sub-packages: '["nvcc", "nvtx", "cudart", "curand", "curand_dev", "nvrtc_dev"]'
cuda: '${{ env.CUDA_MAJOR_VERSION }}.${{ env.CUDA_MINOR_VERSION }}.${{ env.CUDA_PATCH_VERSION }}'
sub-packages: '["nvcc", "nvtx", "cudart", "curand", "curand_dev", "nvrtc_dev", "cublas", "cublas_dev", "cusparse", "cusparse_dev"]'
method: 'network'

- name: Install cuDNN
if: ${{ matrix.config.torchEnabled && matrix.config.cudaEnabled }}
shell: pwsh
run: |
.github/workflows/install-cudnn.ps1 `
-CudaMajorVersion "${{ env.CUDA_MAJOR_VERSION }}" `
-CudaMinorVersion "${{ env.CUDA_MINOR_VERSION }}"

- name: Setup vcpkg
shell: pwsh
run: |
Expand Down Expand Up @@ -129,6 +142,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release `
-DTESTS_ENABLED=${{ matrix.config.testsEnabled }} `
-DGUI_ENABLED=ON `
-DTORCH_ENABLED=${{ matrix.config.torchEnabled }} `
-DCUDA_ENABLED=${{ matrix.config.cudaEnabled }} `
-DCMAKE_CUDA_ARCHITECTURES=all-major `
-DCUDAToolkit_ROOT="${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" `
Expand Down Expand Up @@ -159,7 +173,8 @@ jobs:
--x-feature=gui `
--x-feature=cgal `
$(if ($${{ matrix.config.testsEnabled }}) { echo "--x-feature=tests" }) `
$(if ($${{ matrix.config.cudaEnabled }}) { echo "--x-feature=cuda" })
$(if ($${{ matrix.config.cudaEnabled }}) { echo "--x-feature=cuda" }) `
$(if ($${{ matrix.config.torchEnabled }}) { echo "--x-feature=torch" })
../vcpkg/vcpkg.exe export --raw --output-dir vcpkg_export --output colmap
cp vcpkg_export/colmap/installed/x64-windows/bin/*.dll install/bin
cp vcpkg_export/colmap/installed/x64-windows-release/bin/*.dll install/bin
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/install-cudnn.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $CudaMajorVersion,

[Parameter(Mandatory = $true)]
[string] $CudaMinorVersion
)

$version = "9.6.0.74"
$folder="cudnn-windows-x86_64-${version}_cuda${CudaMajorVersion}-archive"
$url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/windows-x86_64/cudnn-windows-x86_64-${version}_cuda${CudaMajorVersion}-archive.zip"
$expectedSha256 = "65CA0F2D77A46DE1DEF35E289780B8D8729EF2FA39CF8DD0C8448E381DD2978C"

$ErrorActionPreference = "Stop"

try {
Write-Host "Download cuDNN"
$zipFilePath = Join-Path "$env:TEMP" "$folder.zip"
Invoke-WebRequest -Uri $url -UseBasicParsing -OutFile "$zipFilePath" -MaximumRetryCount 3

$hash = Get-FileHash $zipFilePath -Algorithm "sha256"
if ($hash.Hash -ne $expectedSha256) {
throw "File $Path hash $hash.Hash did not match expected hash $expectedHash"
}

Write-Host "Unzip cuDNN"
Expand-Archive -Path "$zipFilePath" -DestinationPath "$env:TEMP" -Force

Write-Host "Move cuDNN"
$sourceFolder = "$env:TEMP/$folder"
$targetFolder = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${CudaMajorVersion}.${CudaMinorVersion}"
Move-Item -Path "$sourceFolder/include/*" -Destination "$targetFolder/include" -Force
Move-Item -Path "$sourceFolder/bin/*" -Destination "$targetFolder/bin" -Force
Move-Item -Path "$sourceFolder/lib/x64/*" -Destination "$targetFolder/lib/x64" -Force
}
catch {
Write-Host "Installation failed with an error"
$_.Exception | Format-List
exit -1
}
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ option(DOWNLOAD_ENABLED "Whether to enable (automatic) download of resources (re
option(UNINSTALL_ENABLED "Whether to create a target to 'uninstall' colmap" ON)
option(FETCH_POSELIB "Whether to consume PoseLib using FetchContent or find_package" ON)
option(FETCH_FAISS "Whether to consume faiss using FetchContent or find_package" ON)
option(TORCH_ENABLED "Whether to enable torch support" ON)
option(ALL_SOURCE_TARGET "Whether to create a target for all source files (for Visual Studio / XCode development)" OFF)

# Disables default features, as we specify each required feature manually below.
Expand All @@ -69,6 +70,13 @@ endif()
if(CGAL_ENABLED)
list(APPEND VCPKG_MANIFEST_FEATURES "cgal")
endif()
if(TORCH_ENABLED)
if(CUDA_ENABLED)
list(APPEND VCPKG_MANIFEST_FEATURES "torch-cuda")
else()
list(APPEND VCPKG_MANIFEST_FEATURES "torch")
endif()
endif()

if(LSD_ENABLED)
message(STATUS "Enabling LSD support")
Expand All @@ -87,7 +95,12 @@ set(COLMAP_VERSION "3.12.0.dev0")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 14)
if(TORCH_ENABLED)
# Torch requires C++17, which excludes Ubuntu 20.04's default compiler.
set(CMAKE_CUDA_STANDARD 17)
else()
set(CMAKE_CUDA_STANDARD 14)
endif()
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON)
Expand All @@ -114,6 +127,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
################################################################################

set(COLMAP_FIND_QUIETLY FALSE)
set(FIND_TORCH TRUE)
include(cmake/FindDependencies.cmake)

################################################################################
Expand Down Expand Up @@ -241,8 +255,8 @@ include(GenerateVersionDefinitions)
include_directories(src)
link_directories(${COLMAP_LINK_DIRS})

add_subdirectory(src/colmap)
add_subdirectory(src/thirdparty)
add_subdirectory(src/colmap)

################################################################################
# Generate source groups for Visual Studio, XCode, etc.
Expand Down Expand Up @@ -385,6 +399,12 @@ if(GPU_ENABLED)
colmap_sift_gpu
)
endif()
if(TORCH_ENABLED)
list(APPEND COLMAP_EXPORT_LIBS
colmap_aliked
colmap_lightglue
)
endif()
if(FETCH_POSELIB)
list(APPEND COLMAP_EXPORT_LIBS PoseLib)
endif()
Expand Down
31 changes: 31 additions & 0 deletions cmake/FindDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,34 @@ if(OPENGL_ENABLED OR CUDA_ENABLED)
message(STATUS "Enabling GPU support (OpenGL: ${OPENGL_ENABLED}, CUDA: ${CUDA_ENABLED})")
set(GPU_ENABLED ON)
endif()

if(TORCH_ENABLED)
if(NOT DEFINED MKL_ROOT)
cmake_policy(SET CMP0074 NEW)
if(IS_LINUX)
set(DEBIAN_DEFAULT_MKL_LIB_PATH "/usr/lib/x86_64-linux-gnu/libmkl_core.so")
if(EXISTS "${DEBIAN_DEFAULT_MKL_LIB_PATH}")
set(MKL_INCLUDE_DIR "/usr/include")
set(MKL_LIBRARIES "${DEBIAN_DEFAULT_MKL_LIB_PATH}")
else()
set(MKL_ROOT "/opt/intel/mkl")
endif()
elseif(IS_MSVC)
set(DEFAULT_MKL_LIB_PATH "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64/mkl_core_dll.lib")
if(EXISTS "${DEFAULT_MKL_LIB_PATH}")
set(MKL_INCLUDE_DIR "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include")
set(MKL_LIBRARIES "${DEFAULT_MKL_LIB_PATH}")
endif()
endif()
endif()
find_package(Torch QUIET)
if(TORCH_FOUND)
add_definitions("-DCOLMAP_TORCH_ENABLED")
set(TORCH_ENABLED ON)
message(STATUS "Enabling Torch support")
else()
message(STATUS "Disabling Torch support (not found)")
endif()
else()
message(STATUS "Disabling Torch support")
endif()
2 changes: 2 additions & 0 deletions cmake/colmap-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ set(CGAL_ENABLED @CGAL_ENABLED@)

set(LSD_ENABLED @LSD_ENABLED@)

set(TORCH_ENABLED @TORCH_ENABLED@)

set(FETCH_POSELIB @FETCH_POSELIB@)

set(FETCH_FAISS @FETCH_FAISS@)
Expand Down
Loading
Loading