Add optional GPU-accelerated panorama depth merge - #167
Open
Tejas (tejas-130704) wants to merge 1 commit into
Open
Tejas (tejas-130704) wants to merge 1 commit into
Tejas (tejas-130704) wants to merge 1 commit into
Conversation
|
Tejas (@tejas-130704) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The panorama pipeline (
moge infer_panorama) spends most of its time inmerge_panorama_depth, which stitches the per-view depth predictions into one panorama depth map usingscipy.sparse.linalg.lsmr— a CPU-only iterative least-squares solver. On a 12-view panorama this solve took 15-25s per frame in profiling, while GPU inference on the same frame took 5-15s and sat idle the rest of the time. Increasing GPU batch size or switching to TensorRT had no effect, confirming the bottleneck is this CPU solve, not the model.Fix
Adds an optional
deviceparameter tomerge_panorama_depthand a--gpu_mergeflag toinfer_panorama.py. When unset (default), behavior is unchanged — samelsmrCPU path as before. When a CUDA device is passed, the same sparse system is solved on GPU via atorch-based conjugate gradient loop instead oflsmr. Matrix assembly (csr_array/hstack/vstack) is untouched.No new dependencies —
torchis already required.Files changed
moge/utils/panorama.py—merge_panorama_depthgainsdevice: Optional[str] = None; new private_solve_gpuhelper.moge/scripts/infer_panorama.py— new--gpu_mergeflag, passed through tomerge_panorama_depth.Validation
Ran
infer_panoramawith and without--gpu_mergeon the same panoramas and compared:<fill in><fill in>vs<fill in><pass/fail>Compatibility
Default behavior (
--gpu_mergeunset) is unchanged. This is purely opt-in.