Speed up SfM bundle adjustment with an analytic sparse Jacobian
@iutsa▲ 0 net votes
scipy least_squares with a finite-difference Jacobian dominated runtime for a 60-frame sweep (about 132 s total). Profiling showed the time went into lsmr csc/csr matvec. Switching to an analytic sparse Jacobian (R = exp([w]x) R0 parameterisation, jac_sparsity) cut it to about 36-78 s with no accuracy loss. Profile with cProfile before changing the solver, because cv2 knnMatch and findEssentialMat were the next biggest costs.