Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Replace flann with faiss#3350

Merged
ahojnnes merged 95 commits into
maincolmap/colmap:mainfrom
user/jsch/faisscolmap/colmap:user/jsch/faissCopy head branch name to clipboard
May 29, 2025
Merged

Replace flann with faiss#3350
ahojnnes merged 95 commits into
maincolmap/colmap:mainfrom
user/jsch/faisscolmap/colmap:user/jsch/faissCopy head branch name to clipboard

Conversation

@ahojnnes

@ahojnnes ahojnnes commented May 17, 2025

Copy link
Copy Markdown
Contributor

First step towards fully replacing flann with faiss. This is to mitigate pycolmap crashes related to flann as well as improve runtime of various indexing operations:

  • Add feature descriptor index implementation based on faiss. Provides better precision and runtime than flann.
  • Replace visual index flann implementation with faiss. Tuned faiss index parameters provide roughly on-par retrieval precision/recall with flann. faiss is much faster. There is room for improvement by tuning the index parameters further in the future.
  • Add option to load legacy flann visual index and automatically upgrade it to faiss. This will be used to upgrade our existing vocabulary trees with faiss.

In a follow-up PR, we will remove flann and replace replace the flann-based vocabulary trees with faiss indexes (to be uploaded to github).

Comment thread src/colmap/retrieval/visual_index.cc
Comment thread src/pycolmap/retrieval/visual_index.cc
@ahojnnes
ahojnnes merged commit c7a5846 into main May 29, 2025
@ahojnnes
ahojnnes deleted the user/jsch/faiss branch May 29, 2025 20:23
@kevinddchen

Copy link
Copy Markdown

In a follow-up PR, we will remove flann and replace replace the flann-based vocabulary trees with faiss indexes (to be uploaded to github).

Have these been uploaded to github yet? I tried to manually upgrade the old flann vocab trees using vocab_tree_upgrader but I ran into some errors.

@ahojnnes

ahojnnes commented Jun 5, 2025

Copy link
Copy Markdown
Contributor Author

What are the errors? The indexes are uploaded as artifacts in the 3.11.1 release. They will be auto-downloaded by default to the $HOME/.cache/colmap folder.

@kevinddchen

Copy link
Copy Markdown

Huh! It actually works! Not sure what I did wrong before, i recall something with std::bad_alloc, but I can chalk that up to user error.

So what I did was

  • download https://demuc.de/colmap/vocab_tree_flickr100K_words32K.bin
  • checkout c7a58462b813e406c304a9dafb475b87036924cf and build
  • run colmap vocab_tree_upgrader --input_path vocab_tree_flickr100K_words32K.bin --output_path vocab_tree_flickr100K_words32K_faiss.bin
  • run COLMAP as usual. I previously got an error at colmap vocab_tree_matcher --VocabTreeMatching.vocab_tree_path path/to/vocab_tree_flickr100K_words32K_faiss.bin, but now I do not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.