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

+14 -4
View File
@@ -108,20 +108,30 @@ class VanillaNerfWField(Field):
def get_density(self, ray_samples: RaySamples):
"""Computes and returns the densities."""
encoded_xyz = self.position_encoding(ray_samples.frustums.positions())
encoded_xyz = self.position_encoding(ray_samples.frustums.get_positions())
encoded_xyz = self.position_encoding(ray_samples.frustums.get_positions())
base_mlp_out = self.mlp_base(encoded_xyz)
density = self.field_head_density(base_mlp_out)
return density, base_mlp_out
def get_outputs(
self, ray_samples: RaySamples, density_embedding: Optional[TensorType] = None
self, ray_samples: RaySamples, density_embedding: Optional[TensorType[..., "embedding_size"]] = None
) -> Dict[FieldHeadNames, TensorType]:
"""Returns the outputs of the NeRF-W field.
Args:
ray_samples (RaySamples): Ray samples.
density_embedding (TensorType[..., "embedding_size"], optional): Density embedding. Defaults to None.
Returns:
Dict[FieldHeadNames, TensorType]: Outputs of the NeRF-W field.
"""
outputs = {}
encoded_dir = self.direction_encoding(ray_samples.frustums.directions)
embedded_appearance = self.embedding_appearance(ray_samples.camera_indices)
embedded_appearance = self.embedding_appearance(ray_samples.camera_indices.squeeze())
mlp_head_out = self.mlp_head(torch.cat([density_embedding, encoded_dir, embedded_appearance], dim=-1))
outputs[self.field_head_rgb.field_head_name] = self.field_head_rgb(mlp_head_out) # static rgb
embedded_transient = self.embedding_transient(ray_samples.camera_indices)
embedded_transient = self.embedding_transient(ray_samples.camera_indices.squeeze())
transient_mlp_out = self.mlp_transient(torch.cat([density_embedding, embedded_transient], dim=-1))
outputs[self.field_head_transient_uncertainty.field_head_name] = self.field_head_transient_uncertainty(
transient_mlp_out