mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
Remove occluded samples during training. (#530)
remove occluded samples during training.
This commit is contained in:
1 parent
9b7075e49a
commit
1044defd1b
1 file changed
+2
-2
@@ -397,7 +397,7 @@ class VolumetricSampler(Sampler):
|
|||||||
ray_bundle: RayBundle,
|
ray_bundle: RayBundle,
|
||||||
num_samples: Optional[int] = None,
|
num_samples: Optional[int] = None,
|
||||||
near_plane: float = 0.0,
|
near_plane: float = 0.0,
|
||||||
remove_occluded_samples: bool = False,
|
remove_occluded_samples: bool = True,
|
||||||
) -> Tuple[RaySamples, TensorType["total_samples", 3], TensorType["total_samples", 2]]:
|
) -> Tuple[RaySamples, TensorType["total_samples", 3], TensorType["total_samples", 2]]:
|
||||||
"""Generate ray samples in a bounding box.
|
"""Generate ray samples in a bounding box.
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ class VolumetricSampler(Sampler):
|
|||||||
if camera_indices is not None:
|
if camera_indices is not None:
|
||||||
camera_indices = camera_indices[ray_indices]
|
camera_indices = camera_indices[ray_indices]
|
||||||
|
|
||||||
if remove_occluded_samples:
|
if remove_occluded_samples and self.training:
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
positions = origins + dirs * (starts + ends) / 2.0
|
positions = origins + dirs * (starts + ends) / 2.0
|
||||||
densities = self.density_fn(positions)
|
densities = self.density_fn(positions)
|
||||||
|
|||||||
Reference in new issue
Block a user