Add PSF-guided hashgrid auto-configuration for Nerfstudio models#3744
Open
txdai wants to merge 1 commit intonerfstudio-project:mainfrom
Open
Add PSF-guided hashgrid auto-configuration for Nerfstudio models#3744txdai wants to merge 1 commit intonerfstudio-project:mainfrom
txdai wants to merge 1 commit intonerfstudio-project:mainfrom
Conversation
Integrates the PSF-based hashgrid parameter selection workflow from the PSF study directly into Nerfstudio so growth-factor tuning can be computed a priori instead of swept empirically.
Highlights:
- Added a new utility module: nerfstudio/utils/hashgrid_psf.py.
- Implements revised axis-FWHM approximation for multi-resolution hash encodings.
- Solves per-level growth factor (b) from a target empirical FWHM using binary search.
- Converts solved growth to Nerfstudio-compatible max_res.
- Estimates pixel-to-world scale from train cameras (perspective pinhole approximation) with robust scene-scale fallback.
Model integration:
- nerfstudio/models/nerfacto.py
- Added opt-in config flags:
- psf_guided_hashgrid
- psf_target_fwhm_pixels
- psf_broadening
- psf_adjust_proposal_nets
- Computes PSF-guided hashgrid parameters at startup when enabled.
- Applies solved max_res to the main field.
- Optionally propagates the same solved growth factor to proposal network max_res values.
- Logs chosen b / max_res and whether camera-scale or fallback scale was used.
- nerfstudio/models/instant_ngp.py
- Added opt-in config flags:
- psf_guided_hashgrid
- psf_target_fwhm_pixels
- psf_broadening
- num_levels
- base_res
- Computes and applies PSF-guided max_res at startup.
- Logs selected parameters and scale source.
Pipeline plumbing:
- nerfstudio/pipelines/base_pipeline.py
- Passes train cameras into model setup so PSF sizing can use real camera intrinsics/extrinsics.
Method preset:
- nerfstudio/configs/method_configs.py
- Added new method entry: nerfacto-psf.
- Provides a ready-to-use no-sweep preset with PSF-guided hashgrid enabled.
Tests:
- Added tests/utils/test_hashgrid_psf.py covering:
- Growth-factor solve accuracy against target FWHM.
- max_res conversion behavior.
- Pixel-world estimation.
- End-to-end parameter computation with both camera-based and fallback sizing.
Robustness follow-up included in this squash:
- Relaxed camera typing in PSF utility/model checks to avoid importing heavy camera dependencies during test collection.
- Updated tests to use a lightweight camera stub, removing unnecessary cv2 dependency for this test module.
Outcome:
- Enables PSF-guided, no-grid-sweep hashgrid initialization in Nerfstudio while remaining fully opt-in and backward-compatible by default.
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.
Integrates the PSF-based hashgrid parameter selection workflow from the ICLR poster PSF study into Nerfstudio so growth-factor tuning can be computed a priori instead of swept empirically.
Highlights:
Model integration:
nerfstudio/models/nerfacto.py
nerfstudio/models/instant_ngp.py
Pipeline plumbing:
Method preset:
Tests:
Outcome: