Skip to content

Conversation

@yanxke
Copy link
Contributor

@yanxke yanxke commented Jan 26, 2026

Fixed the view-graph calibration crash by handling the “no valid image pairs” case and by setting focal lower bounds only on parameter blocks that actually exist in the Ceres problem. The failure (“HasParameterBlock”) was due to calling set_parameter_lower_bound on the full focals array even when no parameter blocks were added, which happens when there are 0 valid pairs.

Changes

Added an early return when there are zero valid image pairs, with a clear log line.
Switched lower-bound setting to per-camera blocks after those blocks are added, avoiding invalid pointer lookups.

Also add option to skip ins-feat if database.db already exists, thereby speeding up resumes when there are crashes.

-------------------------------------
Running view graph calibration ...
-------------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/ins-sfm", line 7, in <module>
    sys.exit(entrypoint())
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/instantsfm/scripts/sfm.py", line 57, in entrypoint
    run_sfm()
  File "/usr/local/lib/python3.12/dist-packages/instantsfm/scripts/sfm.py", line 42, in run_sfm
    cameras, images, tracks = SolveGlobalMapper(view_graph, cameras, images, config, depths=depths, visualizer=visualizer)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/instantsfm/controllers/global_mapper.py", line 39, in SolveGlobalMapper
    SolveViewGraphCalibration(view_graph, cameras, images, config.VIEW_GRAPH_CALIBRATOR_OPTIONS)
  File "/usr/local/lib/python3.12/dist-packages/instantsfm/processors/view_graph_calibration.py", line 41, in SolveViewGraphCalibration
    problem.set_parameter_lower_bound(focals, 0, 1e-3)
ValueError: [problem.h:122] Check failed: self.HasParameterBlock((double*)info.ptr) 

@cre185
Copy link
Owner

cre185 commented Jan 27, 2026

I think it's better to use a command line parameter like '--force_rebuild' in the feat script, to make things easier.

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.

2 participants