Repository navigation
Commit 753efef
Make the linear solver of bundle_shot_poses configurable
Summary:
**Behavior before:**
- `BAHelpers::BundleShotPoses` always solves with Ceres `DENSE_QR`.
- Points and cameras are fixed, so the only unknowns are the 6 pose values of each shot, but the dense solver still builds the whole Jacobian: 2 rows per observation by 6 columns per shot. Its memory grows with the square of the number of shots.
- OpenSfM's incremental reconstruction calls it with the one or two shots it just added, where that is cheap. Cluster augment calls it with every image it resected into a chunk, 400+ for some chunks, which OOM-kills the augment operator (T298706237).
**Behavior after:**
- New config key `bundle_shot_poses_linear_solver_type`, default `DENSE_QR`, so every current caller is unchanged.
- `SPARSE_NORMAL_CHOLESKY` solves the same problem. With fixed points the poses are independent, so the normal equations are block-diagonal and memory grows linearly with the number of shots.
**Why:** measured on synthetic poses-only problems with 1000 observations per shot (scratch benchmark, not in this diff); both solvers took 4 iterations to the same final cost:
| shots | `SPARSE_NORMAL_CHOLESKY` | `DENSE_QR` |
| --- | --- | --- |
| 25 | 0.1 s, 0.03 GB | 0.8 s, 0.14 GB |
| 50 | 0.2 s, 0.05 GB | 3.7 s, 0.49 GB |
| 100 | 0.4 s, 0.09 GB | 28 s, 1.9 GB |
| 200 | 1.6 s, 0.19 GB | 149 s, 7.3 GB |
| 400 | 1.6 s, 0.36 GB | 1,100 s, 29.1 GB |
Memory is the peak RSS added by the solve. Dense memory quadruples each time the shot count doubles; at 400 shots it is about two dense copies of the 800k x 2400 Jacobian.
**Gating/Safety:**
- The default keeps `DENSE_QR`; nothing changes until a caller sets the key. The child diff uses the sparse solver in cluster augment.
- An unsupported value fails in `BundleAdjuster::Run` ("Linear solver type ... is not supported").
___
landed-with-radar-review
Differential Revision: D132259326
fbshipit-source-id: 86608f19e38514424715e1f7544a0d2cc609bf521 parent caf3e8f commit 753efef
3 files changed
Lines changed: 75 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | | - | |
| 688 | + | |
| 689 | + | |
689 | 690 | | |
690 | 691 | | |
691 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
0 commit comments