Skip to content

Fix COLMAP sparse model selection when multiple reconstructions exist - #3789

Open
ChuyaoFu wants to merge 1 commit into
nerfstudio-project:mainfrom
ChuyaoFu:fix/colmap-sparse-model-selection
Open

ChuyaoFu wants to merge 1 commit into
nerfstudio-project:mainfrom
ChuyaoFu:fix/colmap-sparse-model-selection

Conversation

@ChuyaoFu

Copy link
Copy Markdown

Problem

When COLMAP produces multiple sparse reconstructions, ns-process-data defaults to sparse/0. If another reconstruction contains substantially more registered images, this can cause valid frames to be dropped from the generated Nerfstudio dataset.

This also occurs with HLoc outputs where additional reconstructions may be stored under nested models/ directories.

Fixes #3708.

Solution

When using the default COLMAP model path, automatically select the readable sparse reconstruction with the most registered images.

The selection supports both:

sparse/<model_id>

and the HLoc-style layout:

sparse/<model_id>/models/<model_id>

Exact ties are resolved deterministically by model path.

The selected reconstruction is then used consistently for intrinsic refinement, depth export, and transforms generation in both image and video processing pipelines.

Non-default colmap_model_path values preserve the existing behavior.

Testing

Added regression tests covering:

  • multiple direct COLMAP sparse models
  • HLoc-style nested reconstruction models
  • deterministic tie handling
  • non-contiguous model IDs
  • invalid/incomplete models
  • integration through ImagesToNerfstudioDataset

Targeted regression tests pass (5 passed).

The generated dataset was also successfully loaded by the Nerfstudio dataparser and used for a short Nerfacto training smoke test.

git diff --check passes.

This branch has not been deployed

No deployments
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.

ns-process-data: allow using best sparse model instead of always model 0

1 participant