Skip to content

Commit df36223

Browse files
bottlerfacebook-github-bot
authored andcommitted
raysampling stratified_sampling doc
Summary: Followup to D39259775 (438c194) Reviewed By: davnov134 Differential Revision: D39271753 fbshipit-source-id: 5cf11c1210369e1762ef0d5d0c7b60336711b261
1 parent 73ea418 commit df36223

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pytorch3d/renderer/implicit/raysampling.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989
max_depth: The maximum depth of a ray-point.
9090
n_rays_per_image: If given, this amount of rays are sampled from the grid.
9191
unit_directions: whether to normalize direction vectors in ray bundle.
92-
stratified_sampling: if set, performs stratified random sampling
92+
stratified_sampling: if True, performs stratified random sampling
9393
along the ray; otherwise takes ray points at deterministic offsets.
9494
"""
9595
super().__init__()
@@ -136,9 +136,8 @@ def forward(
136136
max_depth: The maximum depth of a ray-point.
137137
n_rays_per_image: If given, this amount of rays are sampled from the grid.
138138
n_pts_per_ray: The number of points sampled along each ray.
139-
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
140-
bins for each ray; otherwise takes n_pts_per_ray deterministic points
141-
on each ray with uniform offsets.
139+
stratified_sampling: if set, overrides stratified_sampling provided
140+
in __init__.
142141
Returns:
143142
A named tuple RayBundle with the following fields:
144143
origins: A tensor of shape
@@ -296,7 +295,7 @@ def __init__(
296295
min_depth: The minimum depth of each ray-point.
297296
max_depth: The maximum depth of each ray-point.
298297
unit_directions: whether to normalize direction vectors in ray bundle.
299-
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
298+
stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
300299
bins for each ray; otherwise takes n_pts_per_ray deterministic points
301300
on each ray with uniform offsets.
302301
"""
@@ -322,9 +321,9 @@ def forward(
322321
"""
323322
Args:
324323
cameras: A batch of `batch_size` cameras from which the rays are emitted.
325-
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
326-
bins for each ray; otherwise takes n_pts_per_ray deterministic points
327-
on each ray with uniform offsets.
324+
stratified_sampling: if set, overrides stratified_sampling provided
325+
in __init__.
326+
328327
Returns:
329328
A named tuple RayBundle with the following fields:
330329
origins: A tensor of shape
@@ -514,7 +513,7 @@ def _xy_to_ray_bundle(
514513
max_depth: The maximum depth of each ray-point.
515514
n_pts_per_ray: The number of points sampled along each ray.
516515
unit_directions: whether to normalize direction vectors in ray bundle.
517-
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
516+
stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
518517
bins for each ray; otherwise takes n_pts_per_ray deterministic points
519518
on each ray with uniform offsets.
520519
"""
@@ -583,7 +582,7 @@ def _jiggle_within_stratas(bin_centers: torch.Tensor) -> torch.Tensor:
583582
584583
More specifically, it replaces each point's value `z`
585584
with a sample from a uniform random distribution on
586-
`[z - delta_, z + delta_+]`, where `delta_` is half of the difference
585+
`[z - delta_-, z + delta_+]`, where `delta_-` is half of the difference
587586
between `z` and the previous point, and `delta_+` is half of the difference
588587
between the next point and `z`. For the first and last items, the
589588
corresponding boundary deltas are assumed zero.

0 commit comments

Comments
 (0)