-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera pose optimization for Splatfacto #2891
Camera pose optimization for Splatfacto #2891
Conversation
Again, interesting PR. 👍 Is it compatible with latest |
This is expected. Like I commented here #2885 (comment), there are two separate cases:
I now disabled the feature by default so that the assumed target use case remains as 1. (2. can be addressed by re-enabling this on the command line as
No. Need to install from Git since the view matrix gradients from nerfstudio-project/gsplat#127 (or, alternatively, nerfstudio-project/gsplat#123) are neeed. |
Thanks for your clarification, in my experiment before, I already use
I think it is good if the camera opt can detect automatically if the poses already accurate or not. If it already accurate and it hurts quality, it will be turn off. But I am sorry I can not coding since it too advance for me. |
I think these changes look reasonable to me, delaying pose optimization until partial convergence makes sense. @jh-surh have you had a chance to take a look? |
Regarding quantitative validation of this PR, Here is my suggestion: (1) take a dataset which you think is suitable for pose optimization If (3b) is better than (2), one has strong evidence that pose optimization works. What do you think? @oseiskar |
Delay pose optimization until partial convergence might be useful for fixing a few bad local poses, but would not correct systematic drift in SfM/SLAM. |
I think this makes a lot of sense. I am planning to do that in the near-ish future. To clarify, this PR is not yet in the state where it would be robust enough for general use. The main intention was to help #2885 so that it's not necessary to reinvent the wheel in all aspects there. In particular, I think if this commit 5fe47c9 is probably a pre-requisite for getting anything working well. These new metrics 3b02a7f can also be helpful for debugging/monitoring pose optimization. |
I think the changes look good. I'll try them out.
Wouldn't (3a) showing a better PSNR already show that the pose optimization works? |
(3a) uses all images to train, so the metrics calculated on the set of validation images is biased. Evaluation on hold out set of images for calculating metrics like (3b) is unbiased and produce apple-to-apple comparison to (2). In (3b), image data of validation sets are only used to optimize their poses, but not gaussian splat models. |
I've been looking into ways to enable evaluation using pose optimization and I tried the method you outlined using nerfacto and nerfacto-big. For some reason, my results on the extracted optimized poses are worse than simply not using pose optimization, even though the training PSNR increases when I enable pose optimization, indicating that it helps. See my comment here for more details: #2863 (comment). Do you have any ideas why this might be the case? |
e162f0c
to
1384df1
Compare
@ichsan2895 @jb-ye I now rebased this on top of the current main branch (with #3019), removed deprecated workarounds and changed the hyperparameters to what we used in Gaussian Splatting on the Move. Here's how to test branch and verify that it works: First, install and download a suitable test dataset (our version of Deblur-NeRF, which contains a variant with artificial pose noise): conda activate nerfstudio
# download a suitable dataset
git clone https://github.com/SpectacularAI/3dgs-deblur
cd 3dgs-deblur
python download_data.py --dataset synthetic
cd ..
# check out and install this branch
https://github.com/SpectacularAI/nerfstudio
cd nerfstudio
git checkout camera-pose-optimization
pip install -e . Then, run a basline test with the noisy pose data but without pose optimization:
Then check Viser: Looks terrible (Figure 1). Now, let's run another test with pose optimization:
Check viser again: Looks great (Figure 2). (Bonus: also add Now, the caveats:
In any case, I think this PR is now in a mergeable state despite the (minor) weaknesses above. The pose optimization is now anyway off by default. Figure 1: BaselineFigure 2: With pose optimizationThis was actually with |
730557a
to
4f43b8e
Compare
70a5ec6
to
197c3ab
Compare
@oseiskar Thanks, I will try to take a closer look in the next few days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, some minor comments.
@@ -632,8 +632,10 @@ | |||
}, | |||
"quats": {"optimizer": AdamOptimizerConfig(lr=0.001, eps=1e-15), "scheduler": None}, | |||
"camera_opt": { | |||
"optimizer": AdamOptimizerConfig(lr=1e-3, eps=1e-15), | |||
"scheduler": ExponentialDecaySchedulerConfig(lr_final=5e-5, max_steps=30000), | |||
"optimizer": AdamOptimizerConfig(lr=1e-4, eps=1e-15), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add this change to "splatfacto-big" config?
Hello, interesting PR to be implemented. Here is my own dataset (already processed with colmap) with some of motion blur. Already processed by |
197c3ab
to
4aafd50
Compare
@jb-ye : Done. I tested very briefly (i.e., only with this same synthetic scene) that it looks reasonable and better than the old splatfacto-big camera pose opt. defaults. This was the case (result here) so these are probably a good starting point for further hyperparameter tuning. @ichsan2895 To clarify, this PR does not implement motion blur compensation. This is just one of the building blocks that can help in that goal and other tasks as well. For testing the Gaussian Splatting on the Move method with custom data, see here. |
@oseiskar Great work. I used ARkit's pose based data for testing, and it did work.
Is there anything that can be improved here? |
@lxzbg Thank you for testing, good to hear that this also gave positive results in your test. I think those observations all make sense. In general, there is a lot that can be improved around this topic, but probably not in the scope of this PR. Getting 3DGS to work robustly for data with larger pose errors probably requires a combination of different techniques, where 3DGS pose optimization like this is one piece in the puzzle. Replacing COLMAP with some of the new methods like Dust3r or Cameras as Rays seems like a promising direction. This was already verified to work well by the InstantSplat authors. It is probably also possible to improve performance a bit by further tuning of these hyperparameters, but I would not expect miracles there. I am not planning to try further performance improvements in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the effort!
@oseiskar You need to rebase and the PR should be auto-merged. |
Do not chain modifications to camera_to_worlds to improve numerical stability and enable L2 rot/trans penalties.
Parameters used in the Gaussian Splatting on the Move paper v1
Same parameters as in normal Splatfacto
Head branch was pushed to by a user without write access
4aafd50
to
dc62759
Compare
@jb-ye Great! I now rebased but auto-merge seems to have been auto-disabled |
commit d9b022b Author: J.Y <[email protected]> Date: Fri Apr 19 14:03:55 2024 -0400 Allow alpha transparency training for blender datasets input (nerfstudio-project#3088) Allow alpha transparency training for rgba input Co-authored-by: Justin Kerr <[email protected]> commit eddf2d2 Author: Congrong Xu <[email protected]> Date: Thu Apr 18 17:37:50 2024 -0700 Changes for trainer.py to support the Gradio webui (nerfstudio-project#3046) * changes for trainer to support webui * Update trainer to support webui * format * add a seperated shutdown() function to stop training * typo fix * get rid of _stop_viewer_server() * Update trainer.py * organize import --------- Co-authored-by: Brent Yi <[email protected]> commit 45d8bb7 Author: Justin Kerr <[email protected]> Date: Wed Apr 17 23:54:43 2024 -0700 updates to apply_pca_colormap (nerfstudio-project#3086) * improvements to pca_colormap: allow input pca matrix, optional ignore_zeros arg * typo commit babf577 Author: Patrick Morgan <[email protected]> Date: Fri Apr 12 14:23:47 2024 -0700 Fix call to detect ODM reconstruction file (nerfstudio-project#3018) commit a64026f Author: Justin Kerr <[email protected]> Date: Fri Apr 12 12:32:22 2024 -0700 shift principle points by .5 in undistortion (nerfstudio-project#3071) * shift principle points by .5 * fix ordering * add fisheye offset commit c302cc5 Author: Gunjan Chhablani <[email protected]> Date: Thu Apr 11 16:41:14 2024 -0400 Add pointcloud loading for blender parser (nerfstudio-project#2902) * Add pointcloud loading for blender parser * Fix argument * Fix docstring * Fix metadata in dataparsers * Add changes from review * Avoid changing default behavior * Apply `scale_factor` to loaded points --------- Co-authored-by: Brent Yi <[email protected]> commit 03bdeff Author: hyperzy <[email protected]> Date: Thu Apr 11 14:56:37 2024 -0400 Fixed Unexpectedly huge RAM consumption of parallel datamanager (nerfstudio-project#3060) * Reduced the memory usage by caching image after the datamanager process starts commit 4714ae7 Author: J.Y <[email protected]> Date: Thu Apr 11 14:37:02 2024 -0400 write eval combined images for diagnostics (nerfstudio-project#3070) commit eba72db Author: Otto Seiskari <[email protected]> Date: Thu Apr 11 21:23:17 2024 +0300 Camera pose optimization for Splatfacto (nerfstudio-project#2891) * Add pose optimization to Splatfacto * Disable Splatfacto pose optimization by default * Improve apply_to_camera for Gaussian Splatting pose optimization Do not chain modifications to camera_to_worlds to improve numerical stability and enable L2 rot/trans penalties. * Add separate mean and max rot/trans metrics to camera-opt * Tweak pose optimization hyperparameters Parameters used in the Gaussian Splatting on the Move paper v1 * Unit test fix for new cameara_optimizer training metrics * Adjust splatfacto-big camera pose optimization parameters Same parameters as in normal Splatfacto --------- Co-authored-by: jh-surh <[email protected]> commit 2d9bbe5 Author: dberga <[email protected]> Date: Thu Apr 11 04:04:33 2024 +0200 fix exporter.py for FullImageDataManager and RandomCamerasDataManager (nerfstudio-project#3065) * fix exporter.py for FullImageDataManager and RandomCamerasDataManager * sort imports * ruff --------- Co-authored-by: Brent Yi <[email protected]> commit c381fc8 Author: Justin Kerr <[email protected]> Date: Wed Apr 10 18:59:20 2024 -0700 Fix custom elements nested under @Property (nerfstudio-project#3066) * patch custom elements bug * Skip `cached_property` * fomrat * comment, type hint --------- Co-authored-by: Brent Yi <[email protected]> commit d1fc2ee Author: Saurav Maheshkar <[email protected]> Date: Mon Apr 8 23:46:00 2024 +0100 feat(ci): migrate to `uv` in CI (nerfstudio-project#3038) * feat(ci): migrate to `uv` in CI * feat(ci): drop upgrade strategy * feat(ci): use `uv` in docs workflow * fix(ci/doc): update sphinx build cmd * fix(ci/doc): specify python path * (experimental) simplify * remove venv * Revert line wrap change for doc.yml --------- Co-authored-by: Brent Yi <[email protected]> commit 2b91715 Author: Sahil Jain <[email protected]> Date: Mon Apr 8 13:04:20 2024 -0400 Fix config loading for Eyeful Tower dataset (nerfstudio-project#3054) Add test_filenames to transforms.json generated by eyeful_tower.py commit 26804f8 Author: Ling Jing <[email protected]> Date: Tue Apr 9 00:07:21 2024 +0800 Make colmapDataParser compatible with 360_v2 dataset format (nerfstudio-project#2860) * added an option to colmapdataparser to round up the image size when downscaling * add round mode and update ffmpeg command * [fix] wrong variable order * update format --------- Co-authored-by: Jing <[email protected]> commit 911091c Author: Jan-Niklas Dihlmann <[email protected]> Date: Mon Apr 8 16:17:56 2024 +0200 Added SIGNeRF to Nerfstudio methods (nerfstudio-project#3053) * feat: signerf as nerfstudio method * fix: formating issues and indexing
* Add pose optimization to Splatfacto * Disable Splatfacto pose optimization by default * Improve apply_to_camera for Gaussian Splatting pose optimization Do not chain modifications to camera_to_worlds to improve numerical stability and enable L2 rot/trans penalties. * Add separate mean and max rot/trans metrics to camera-opt * Tweak pose optimization hyperparameters Parameters used in the Gaussian Splatting on the Move paper v1 * Unit test fix for new cameara_optimizer training metrics * Adjust splatfacto-big camera pose optimization parameters Same parameters as in normal Splatfacto --------- Co-authored-by: jh-surh <[email protected]>
Updated description, April 7: Camera pose optimization for Splatfacto, based on nerfstudio-project/gsplat#127, which is included in gsplat 0.1.9+. See #2891 (comment) for instructions and examples.
.
Original description, outdated:
This PR is intended as an extension of #2885, but I could not easily create a PR to that branch, so creating a new PR instead. A detailed description in a comment in the original PR: #2885 (comment)@jh-surh : Feel free to merge / cherry-pick any of my commits in this branch to your original PR, [...]