-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Computing and predicting normals #905
Conversation
* documented coordinate conventions without a figure for now * another sentence * update frames docs * explain intrinsics and extrinsics * more comments * fix build
Start viewer with more accurate speed calc
0016d84
to
89a2c94
Compare
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.
Nice work. Left some comments that you can address before we merge @terrancewang.
nerfstudio/fields/nerfacto_field.py
Outdated
@@ -260,9 +289,19 @@ def get_outputs(self, ray_samples: RaySamples, density_embedding: Optional[Tenso | |||
dim=-1, | |||
) | |||
# print(semantics_input) |
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.
delete (although not a change you made)
nerfstudio/models/nerfacto.py
Outdated
@@ -281,6 +334,12 @@ def get_image_metrics_and_images( | |||
|
|||
images_dict = {"img": combined_rgb, "accumulation": combined_acc, "depth": combined_depth} | |||
|
|||
# normals to RGB for visualization. TODO: use a colormap | |||
if "normals" in outputs: | |||
images_dict["normals"] = outputs["normals"] |
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.
Does this not need to be scaled into the range [0, 1]? Normals would be in the range [-1, -1]
.
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.
Nice work! LGTM, but I'm not sure what you are doing with TensoRF. I'd either remove it or make sure it raises an error if you try to to use predict_normals=True
(since it looks like it won't work).
nerfstudio/models/tensorf.py
Outdated
@@ -219,7 +223,9 @@ def get_outputs(self, ray_bundle: RayBundle): | |||
ray_samples_pdf = self.sampler_pdf(ray_bundle, ray_samples_uniform, weights) | |||
|
|||
# fine field: | |||
field_outputs_fine = self.field.forward(ray_samples_pdf, acc_mask, colors.WHITE.to(weights.device)) | |||
field_outputs_fine = self.field.forward( | |||
ray_samples_pdf, self.predict_normals, acc_mask, colors.WHITE.to(weights.device) |
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.
Will TensoRF work with predicted normals?
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.
One last comment.
self, ray_samples: RaySamples, mask: Optional[TensorType] = None, bg_color: Optional[TensorType] = None | ||
self, | ||
ray_samples: RaySamples, | ||
compute_normals: bool = False, |
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.
Remove this
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.
Or raise on error if compute_normals
is True.
* staring normals PR * code runs but visualization looks bad * Camera and world coordinate conventions (nerfstudio-project#889) * documented coordinate conventions without a figure for now * another sentence * update frames docs * explain intrinsics and extrinsics * more comments * fix build * Start viewer with more accurate speed calculation (nerfstudio-project#899) Start viewer with more accurate speed calc * Minor doc updates (nerfstudio-project#903) * fix conflicts * code runs but visualization looks bad * normals implemented and vis fixed. still debugging quality * minor name change * comment * fix black * lint * predicting normals * adding detach * predicted normals * improved normals prediction performance * cleaning code * cleaning code * cleaning code * adding type to function param * fixing tensorf forward func * reverting tensorf changes * fix style with tensorf field * adding normals check to tensorffield Co-authored-by: Matthew Tancik <[email protected]> Co-authored-by: terrance <[email protected]>
This PR gives fields the options to compute and predict normals.