mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
Add occupancy to samplers
This commit is contained in:
1 parent
4dee65b480
commit
22fdcfe235
4 files changed
+62
-84
No files matched your search
@@ -25,23 +25,23 @@ class Field(nn.Module):
|
||||
return density
|
||||
|
||||
@abstractmethod
|
||||
def get_density(self, point_samples: PointSamples, valid_mask=None):
|
||||
def get_density(self, point_samples: PointSamples):
|
||||
"""Computes and returns the densities."""
|
||||
|
||||
@abstractmethod
|
||||
def get_outputs(self, point_samples: PointSamples, density_embedding=None, valid_mask=None):
|
||||
"""Computes and returns the colors."""
|
||||
|
||||
def forward(self, point_samples: PointSamples, valid_mask_density=None):
|
||||
def forward(self, point_samples: PointSamples):
|
||||
"""Evaluates the field at points along the ray."""
|
||||
density, density_embedding = self.get_density(point_samples, valid_mask=valid_mask_density)
|
||||
density, density_embedding = self.get_density(point_samples)
|
||||
field_outputs = self.get_outputs(point_samples, density_embedding=density_embedding)
|
||||
field_outputs["density"] = density
|
||||
return field_outputs
|
||||
|
||||
def forward_with_weight_pruning(self, ray_samples: RaySamples, valid_mask_density=None):
|
||||
def forward_with_weight_pruning(self, ray_samples: RaySamples):
|
||||
"""Forward but with pruning based on weights, from the densities."""
|
||||
density, density_embedding = self.get_density(ray_samples, valid_mask=valid_mask_density)
|
||||
density, density_embedding = self.get_density(ray_samples)
|
||||
weights = ray_samples.get_weights(density)
|
||||
valid_mask_outputs = weights >= self.weights_threshold
|
||||
field_outputs = self.get_outputs(
|
||||
|
||||
Reference in new issue
Block a user