Skip to content

Commit

Permalink
raysampling stratified_sampling doc
Browse files Browse the repository at this point in the history
Summary: Followup to D39259775 (438c194)

Reviewed By: davnov134

Differential Revision: D39271753

fbshipit-source-id: 5cf11c1210369e1762ef0d5d0c7b60336711b261
  • Loading branch information
bottler authored and facebook-github-bot committed Sep 6, 2022
1 parent 73ea418 commit df36223
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pytorch3d/renderer/implicit/raysampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(
max_depth: The maximum depth of a ray-point.
n_rays_per_image: If given, this amount of rays are sampled from the grid.
unit_directions: whether to normalize direction vectors in ray bundle.
stratified_sampling: if set, performs stratified random sampling
stratified_sampling: if True, performs stratified random sampling
along the ray; otherwise takes ray points at deterministic offsets.
"""
super().__init__()
Expand Down Expand Up @@ -136,9 +136,8 @@ def forward(
max_depth: The maximum depth of a ray-point.
n_rays_per_image: If given, this amount of rays are sampled from the grid.
n_pts_per_ray: The number of points sampled along each ray.
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
bins for each ray; otherwise takes n_pts_per_ray deterministic points
on each ray with uniform offsets.
stratified_sampling: if set, overrides stratified_sampling provided
in __init__.
Returns:
A named tuple RayBundle with the following fields:
origins: A tensor of shape
Expand Down Expand Up @@ -296,7 +295,7 @@ def __init__(
min_depth: The minimum depth of each ray-point.
max_depth: The maximum depth of each ray-point.
unit_directions: whether to normalize direction vectors in ray bundle.
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
bins for each ray; otherwise takes n_pts_per_ray deterministic points
on each ray with uniform offsets.
"""
Expand All @@ -322,9 +321,9 @@ def forward(
"""
Args:
cameras: A batch of `batch_size` cameras from which the rays are emitted.
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
bins for each ray; otherwise takes n_pts_per_ray deterministic points
on each ray with uniform offsets.
stratified_sampling: if set, overrides stratified_sampling provided
in __init__.
Returns:
A named tuple RayBundle with the following fields:
origins: A tensor of shape
Expand Down Expand Up @@ -514,7 +513,7 @@ def _xy_to_ray_bundle(
max_depth: The maximum depth of each ray-point.
n_pts_per_ray: The number of points sampled along each ray.
unit_directions: whether to normalize direction vectors in ray bundle.
stratified_sampling: if set, performs stratified sampling in n_pts_per_ray
stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
bins for each ray; otherwise takes n_pts_per_ray deterministic points
on each ray with uniform offsets.
"""
Expand Down Expand Up @@ -583,7 +582,7 @@ def _jiggle_within_stratas(bin_centers: torch.Tensor) -> torch.Tensor:
More specifically, it replaces each point's value `z`
with a sample from a uniform random distribution on
`[z - delta_, z + delta_+]`, where `delta_` is half of the difference
`[z - delta_-, z + delta_+]`, where `delta_-` is half of the difference
between `z` and the previous point, and `delta_+` is half of the difference
between the next point and `z`. For the first and last items, the
corresponding boundary deltas are assumed zero.
Expand Down

0 comments on commit df36223

Please sign in to comment.