misc proposal network modifications (#578)

* misc improvements

* cleanup

* remove distortion

* dist loss

* only dist changed now

* changes

* remove comment
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-09-29 16:31:22 -07:00
1 parent 5bc011e5fa
commit 81fa5f9ba5
7 files changed
+100 -28

No files matched your search

+2 -4
View File
@@ -24,7 +24,6 @@ def distortion_loss(
ray_samples: RaySamples,
densities: TensorType["bs":..., "num_samples", 1] = None,
weights: TensorType["bs":..., "num_samples", 1] = None,
scale_factor: float = 1.0,
) -> TensorType["bs":..., 1]:
"""Ray based distortion loss proposed in MipNeRF-360. Returns distortion Loss.
@@ -40,7 +39,6 @@ def distortion_loss(
ray_samples: Ray samples to compute loss over
densities: Predicted sample densities
weights: Predicted weights from densities and sample locations
scale_factor: Scale the starts and ends by this factor
"""
if torch.is_tensor(densities):
assert not torch.is_tensor(weights), "Cannot use both densities and weights"
@@ -49,8 +47,8 @@ def distortion_loss(
if torch.is_tensor(weights):
assert not torch.is_tensor(densities), "Cannot use both densities and weights"
starts = ray_samples.frustums.starts * scale_factor
ends = ray_samples.frustums.ends * scale_factor
starts = ray_samples.spacing_starts
ends = ray_samples.spacing_ends
midpoints = (starts + ends) / 2.0 # (..., num_samples, 1)