Fixing nerfw and adding to GH Actions (#167)

* added beta_min to nerfw, which I think is needed

* added camera interpolation path and restructured run_eval code

* adding to gitignore

* addressing github comments. mostly documentation

* fixing nerfw dataset for test cases
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-07-19 16:21:54 -07:00
1 parent f77d1fc110
commit 05b92e228b
13 files changed
+197 -67

No files matched your search

+6
View File
@@ -59,6 +59,11 @@ class AbstractGraph(nn.Module):
"""Returns the device that the torch parameters are on."""
return self.device_indicator_param.device
@property
def device(self):
"""Returns the device that the graph is on."""
return self.device_indicator_param.device
@abstractmethod
def forward(self, ray_indices: TensorType["num_rays", 3], batch: Union[str, Dict[str, torch.tensor]] = None):
"""Process starting with ray indices. Turns them into rays, then performs volume rendering."""
@@ -104,6 +109,7 @@ class Graph(AbstractGraph):
self.callbacks = None
# variable for visualizer to fetch TODO(figure out if there is cleaner way to do this)
self.vis_outputs = None
self.default_output_name = None
def register_callbacks(self): # pylint:disable=no-self-use
"""Option to register callback for training functions"""
+16 -3
View File
@@ -44,13 +44,24 @@ class NerfWGraph(Graph):
near_plane=2.0,
far_plane=6.0,
num_coarse_samples=64,
num_importance_samples=128,
num_importance_samples=64,
uncertainty_min=0.03,
**kwargs,
) -> None:
"""A NeRF-W graph.
Args:
...
uncertainty_min (float, optional): This is added to the end of the uncertainty
rendering operation. It's called 'beta_min' in other repos.
This avoids calling torch.log() on a zero value, which would be undefined.
Defaults to 0.03.
"""
self.near_plane = near_plane
self.far_plane = far_plane
self.num_coarse_samples = num_coarse_samples
self.num_importance_samples = num_importance_samples
self.uncertainty_min = uncertainty_min
self.field_coarse = None
self.field_fine = None
self.num_images = len(intrinsics)
@@ -151,6 +162,7 @@ class NerfWGraph(Graph):
# uncertainty
uncertainty = self.renderer_uncertainty(field_outputs_fine[FieldHeadNames.UNCERTAINTY], weights_fine_transient)
uncertainty += self.uncertainty_min
outputs = {
"rgb_coarse": rgb_coarse, # (num_rays, 3)
@@ -206,5 +218,6 @@ class NerfWGraph(Graph):
writer.put_image(name=f"img/image_idx_{image_idx}-nerfw", image=combined_image, step=step)
mask = batch["mask"].repeat(1, 1, 3)
writer.put_image(name=f"mask/image_idx_{image_idx}", image=mask, step=step)
if "mask" in batch:
mask = batch["mask"].repeat(1, 1, 3)
writer.put_image(name=f"mask/image_idx_{image_idx}", image=mask, step=step)