Skip to content

fix(process_data): use faiss vocab tree for COLMAP >= 3.12.0 - #3777

Open
wyyyz1937365497 wants to merge 3 commits into
nerfstudio-project:mainfrom
wyyyz1937365497:fix/vocab-tree-faiss-compat
Open

fix(process_data): use faiss vocab tree for COLMAP >= 3.12.0#3777
wyyyz1937365497 wants to merge 3 commits into
nerfstudio-project:mainfrom
wyyyz1937365497:fix/vocab-tree-faiss-compat

Conversation

@wyyyz1937365497

Copy link
Copy Markdown

Summary

ns-process-data crashes during the default vocab_tree feature matching step on COLMAP >= 3.12.0, because COLMAP switched its vocabulary tree index format from FLANN to faiss in 3.12.0 (June 2025). nerfstudio auto-downloads a FLANN tree from demuc.de, which faiss-based COLMAP cannot read:

E... visual_index.cc:665] Check failed: file_version == 1 (32762 vs. 1) Failed to read faiss
index. This may be caused by reading a legacy flann-based index, because COLMAP switched from
flann to faiss in May 2025.

This is reported in #3664 and affects anyone using a recent COLMAP install.

The fix

get_vocab_tree() is now version-aware:

  • COLMAP >= 3.12.0 → downloads the official faiss-based tree from the COLMAP 3.11.1 release:
    https://github.com/colmap/colmap/releases/download/3.11.1/vocab_tree_faiss_flickr100K_words32K.bin
  • COLMAP < 3.12.0 → keeps the legacy FLANN tree from demuc.de (unchanged behavior).

Each format is cached under a distinct filename (vocab_tree_faiss_words32K.bin vs vocab_tree.fbow) so that upgrading COLMAP never silently serves a stale tree of the wrong format — the exact footgun that caused this bug.

The version detection already exists in run_colmap() via get_colmap_version(), so this adds no new system calls.

Test plan

  • Verified with a requests.get mock that COLMAP 3.12.6 selects the faiss URL/filename and COLMAP 3.11.1 selects the FLANN URL/filename.
  • ruff format + ruff check clean.
  • End-to-end: the previously-crashing colmap vocab_tree_matcher command runs to completion on a real dataset after swapping to the faiss tree.

Fixes #3664

wyyyz1937365497 and others added 3 commits March 5, 2026 19:30
feat(plugins): 支持可调用入口点以避免循环导入

在插件注册表中添加对函数入口点的支持,通过检测并调用可调用对象来避免循环导入问题。
这使得入口点可以作为函数定义,而不是直接的类实例,从而提高模块间的解耦性。
```
COLMAP switched from FLANN to faiss for vocabulary tree indexing in 3.12.0
(June 2025). The FLANN-based tree that nerfstudio auto-downloads is
incompatible with faiss-based COLMAP, causing `vocab_tree_matcher` (the
default matching method) to crash:

  Check failed: file_version == 1 (32762 vs. 1) Failed to read faiss index.

`get_vocab_tree()` now selects the correct tree format based on the detected
COLMAP version, downloading the faiss-based tree from the official COLMAP
3.11.1 release for COLMAP >= 3.12.0 and keeping the legacy FLANN tree for
older versions. Each format is cached under a distinct filename so that
upgrading COLMAP never silently serves a stale tree of the wrong format.

Fixes nerfstudio-project#3664
…field

`read_points3D_binary` stores `error` as a numpy array, but
`write_points3D_binary` passed it directly to `struct.pack("<d", ...)`,
which fails on numpy 2.x because 1-d arrays are no longer auto-coerced
to Python scalars.  Wrap `pt.error.item()` in `float()` for robust
extraction—this matches the existing convention in
`write_cameras_binary` (line 184: `float(p)`).

Fixes a pre-existing test failure on CI where
`test_process_images_skip_colmap` and
`test_process_images_recursively_skip_colmap` crashed with
`struct.error: required argument is not a float`.
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.

COLMAP vocab tree needs to be converted to Faiss

1 participant