facebookresearch / facebookresearch/map-anything

Support pycolmap 4.x for COLMAP export

Open
#166 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
3.7k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

`scripts/demo_inference_on_colmap_outputs.py --save_colmap` fails when a pycolmap newer
than the pinned 3.10.0 is installed. pycolmap 4.x removed/renamed `Image.id`:

```
Traceback (most recent call last):
File "scripts/demo_inference_on_colmap_outputs.py", line 492, in main
_ = export_predictions_to_colmap(
File ".../mapanything/utils/colmap_export.py", line 342, in build_colmap_reconstruction
image = pycolmap.Image(
AttributeError: 'pycolmap._core.Image' object has no attribute 'id'
```

**Environment:** mapanything installed from `main`; pycolmap **4.1.1** (matching COLMAP
4.1.1); Ubuntu 26.04; Python 3.12; torch 2.13.0+cu130; RTX 5060 Ti (sm_120).

`pyproject.toml`'s `colmap` extra pins `pycolmap==3.10.0`, and **installing exactly that
pin resolves it** — the export then completes and the output reads cleanly in
`colmap model_analyzer` (60/60 registered images, 160,177 points, 4,540,060
observations). So this is not a bug report so much as two suggestions:

1. **The pin is easy to miss.** `pip install mapanything` (without `[colmap]`) plus a
later `pip install pycolmap` — which is what the error message in
`colmap_export.py:286` literally instructs, *"Install it with: pip install
pycolmap"* — lands you on 4.x and the failure above. That in-code hint could name the
pin: `pip install "pycolmap==3.10.0"`.
2. **Consider supporting pycolmap 4.x.** Anyone with a current COLMAP install will have
a matching pycolmap, and pinning 3.10.0 in a shared environment forces a divergence
between the Python bindings and the COLMAP binary on the same machine.

Happy to test a 4.x-compatible patch if useful.

Contributor guide

Open the contributing guide

Research direction

Start with pyproject.toml's colmap extra and mapanything/utils/colmap_export.py, especially the dependency hint at line 286 and construction around line 342. Compare the current pycolmap 3.10.0 pin with the 4.1.1 API, then run scripts/demo_inference_on_colmap_outputs.py --save_colmap. Done means the export completes with pycolmap 4.x and the generated output reads cleanly in colmap model_analyzer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.