Skip to content

fix: handle image_rename_map key mismatch in colmap_to_json (issue #3759)#3761

Closed
vanhci wants to merge 1 commit into
nerfstudio-project:mainfrom
vanhci:fix/issue-3759-colmap-image-rename-keyerror
Closed

fix: handle image_rename_map key mismatch in colmap_to_json (issue #3759)#3761
vanhci wants to merge 1 commit into
nerfstudio-project:mainfrom
vanhci:fix/issue-3759-colmap-image-rename-keyerror

Conversation

@vanhci

@vanhci vanhci commented May 24, 2026

Copy link
Copy Markdown

Summary

Fixes #3759

When using COLMAP with nested image hierarchies (e.g., cube rigs with multiple cameras per face), colmap_to_json raises a KeyError because COLMAP stores image names with the images/ prefix (e.g., images/rig1/front/imageN.jpg) while image_rename_map keys are relative to the data directory (e.g., rig1/front/imageN.jpg).

Changes

  • Modified colmap_to_json in nerfstudio/process_data/colmap_utils.py to try both the direct lookup and the images/ prefix-stripped lookup
  • Added a descriptive error message if neither key matches, showing available keys for debugging

Testing

This is a runtime fix for a KeyError in COLMAP image rename mapping. The fix handles both flat and nested image directory structures gracefully.

)

COLMAP stores image names relative to the reconstruction directory
(e.g. 'images/rig1/front/imageN.jpg'), but image_rename_map keys are
relative to the data directory (e.g. 'rig1/front/imageN.jpg'). This
mismatch caused a KeyError when using nested image hierarchies with rigs.

Fix by trying both the direct lookup and stripping the 'images/' prefix,
with a descriptive error message if neither matches.
@vanhci vanhci closed this by deleting the head repository May 24, 2026
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_to_json KeyError

1 participant