Rebuild COLMAP Sparse
Rescue a broken dataset's camera data without re-running SfM
- dataset_dir
- sparse_dir
- num_images
- num_points
- report
This is the repair node for the "my dataset's camera data is gone or inconsistent" moment. A SphereSfM run leaves its scratch in _spheresfm_work/, and as long as that's intact, Rebuild COLMAP Sparse can regenerate the dataset's sparse/0 from it - in seconds, without re-running structure-from-motion. Running real SfM over a finished dataset's images would mean millions of matching pairs and hours; reusing the existing solve is the entire point.
The mechanism reassembles exactly what the pipeline would have produced: the reprojected cube-face poses and point cloud, with the hires views' SfM poses dropped in (verified first to be in the same world frame). Along the way it fixes two common messes:
fix_intrinsics(default on) - after an upscale pass, the model often still declares the old image size, which scales those views' focal length wrong. This re-derives each view's intrinsics from its actual on-disk resolution - exact rather than estimated.- Stripping - images that are gone from
images/are left out and their observations stripped, so it's safe to run aftertools/prune_covered_faces.py.
Inputs: dataset_dir (needs images/ and _spheresfm_work/), include_hires (default on - include the hires pinhole views from the solve; off rebuilds cube-faces-only), fix_intrinsics, dry_run (report what would be written without touching anything - the tooltip says run this first on a dataset you care about), backup (default on - copies existing sparse/0 into _sparse_backup/NNN/ before overwriting), plus faces_model / poses_model overrides for advanced use. Outputs: dataset_dir, sparse_dir, num_images, num_points, and a report.
When you'd actually use it
The typical story: you upscaled a dataset, or pruned covered faces, and now sparse/0 is missing or half-written, or every image's intrinsics silently scale wrong. Point this node at the dataset, run it with dry_run on, confirm the counts look right, then let it write. The backup default means a bad rebuild costs you nothing.
Install & gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-SplatKit
python_embeded\python.exe -m pip install -r ComfyUI-SplatKit/requirements.txt
Restart. This node needs no extra downloads - it reads the scratch left by the SfM nodes, which themselves auto-download the SphereSfM binary on first use. The hard requirement is that _spheresfm_work/ still exists; if you deleted it, this node can't help and you're back to a full rebuild. That's also why the README is emphatic about keeping _spheresfm_work/ around until you're done training.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| dataset_dir | STRING | The dataset to repair -- wire the Dataset Project node's dataset_dir here, or type the folder path / bare name under ComfyUI/output. Must contain images/ and _spheresfm_work/. | |
| include_hiresopt | BOOLEAN | true | Include the hires_*.png pinhole views, taking their poses from the SfM solve in _spheresfm_work. Turn OFF to rebuild a cube-faces-only dataset. |
| fix_intrinsicsopt | BOOLEAN | true | Re-derive each view's intrinsics from its ACTUAL on-disk resolution. Leave ON: after an upscale pass the model often still declares the old size, which scales those views' focal length wrong. OFF keeps the model's declared cameras verbatim. |
| dry_runopt | BOOLEAN | false | Report what WOULD be written without touching anything. Run this first on a dataset you care about. |
| backupopt | BOOLEAN | true | Copy any existing sparse/0 into _sparse_backup/NNN/ before overwriting it. |
| faces_modelopt | STRING | Override the cube-face model. Blank = auto (cubic_hires/sparse, then cubic_inc/sparse, then cubic/sparse). Path may be relative to _spheresfm_work. | |
| poses_modelopt | STRING | Override the model supplying hires poses. Blank = auto (sparse_hires_tri, then sparse_hires, sparse_inc_tri, sparse_inc, sparse/0). |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| dataset_dir | STRING | — |
| sparse_dir | STRING | — |
| num_images | INT | — |
| num_points | INT | — |
| report | STRING | — |