Skip to content
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

TensoRF bugfix: AABB normalized_positions to [-1, 1] #998

Merged
merged 1 commit into from
Nov 21, 2022

Conversation

JulianKnodt
Copy link
Contributor

Previously, SceneBox.get_normalized_positions() returned a value in 0,1. This was fine for InstantNGP and Nerfacto, which use these values directly in an MLP. For TensoRF though, this was an error because grid sample expects values in the range [-1,1]. Thus, I think only 1/4th of the encoding planes were actually being used, and half of the encoding lines were.

@tancik
Copy link
Contributor

tancik commented Nov 21, 2022

Nice find. Does this change effect nerfacto / instant-ngp performance?

@JulianKnodt
Copy link
Contributor Author

JulianKnodt commented Nov 21, 2022

I haven't checked if it affects their performance, since I was looking at TensoRF when I found this.

Does the HashGrid encoding expect values in [0,1]? If so I can just isolate it to TensoRF to the correct range.

This is where it appears in nerfacto at least:
image

@tancik
Copy link
Contributor

tancik commented Nov 21, 2022

I think hashgrid expects [0,1].

Previously, SceneBox.get_normalized_positions() returned a value in 0,1.
This was fine for InstantNGP and Nerfacto, which use these values directly in an MLP.
For TensoRF though, this was an error because grid sample expects values in the range [-1,1].
Thus, I think only 1/4th of the encoding planes were actually being used, and half of the
encoding lines were.
@JulianKnodt
Copy link
Contributor Author

I've changed it to the TensoRF callsites, altho I browsed tcnn's readme, I didn't see a specific doc that referenced it anywhere but better to not cause random changes elsewhere.

@tancik
Copy link
Contributor

tancik commented Nov 21, 2022

I just tested nerfacto with [-1,1] and it does work, but the results were worse. Lets just focus this PR on tensorf for now.

Copy link
Collaborator

@ethanweber ethanweber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too. Nice find!

@ethanweber ethanweber changed the title bugfix: AABB normalized_positions to [-1, 1] TensoRF bugfix: AABB normalized_positions to [-1, 1] Nov 21, 2022
@JulianKnodt JulianKnodt merged commit 0d3cfe2 into nerfstudio-project:main Nov 21, 2022
@JulianKnodt JulianKnodt deleted the normalize_bug_fix branch November 21, 2022 20:55
tancik pushed a commit to dozeri83/nerfstudio that referenced this pull request Jan 20, 2023
AABB normalized_positions to [-1, 1]

Previously, SceneBox.get_normalized_positions() returned a value in 0,1.
This was fine for InstantNGP and Nerfacto, which use these values directly in an MLP.
For TensoRF though, this was an error because grid sample expects values in the range [-1,1].
Thus, I think only 1/4th of the encoding planes were actually being used, and half of the
encoding lines were.
chris838 pushed a commit to chris838/nerfstudio that referenced this pull request Apr 22, 2023
AABB normalized_positions to [-1, 1]

Previously, SceneBox.get_normalized_positions() returned a value in 0,1.
This was fine for InstantNGP and Nerfacto, which use these values directly in an MLP.
For TensoRF though, this was an error because grid sample expects values in the range [-1,1].
Thus, I think only 1/4th of the encoding planes were actually being used, and half of the
encoding lines were.
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.

3 participants