Skip to content

Add PSF-guided hashgrid auto-configuration for Nerfstudio models#3744

Open
txdai wants to merge 1 commit intonerfstudio-project:mainfrom
txdai:psf-guided-hashgrid
Open

Add PSF-guided hashgrid auto-configuration for Nerfstudio models#3744
txdai wants to merge 1 commit intonerfstudio-project:mainfrom
txdai:psf-guided-hashgrid

Conversation

@txdai
Copy link

@txdai txdai commented Feb 20, 2026

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:

  • 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.

Outcome:

  • Enables PSF-guided, no-grid-sweep hashgrid initialization in Nerfstudio while remaining fully opt-in and backward-compatible by default.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant