mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 21:39:06 +08:00
Setting near and far with scene bounds collider. Also LR schedules. (#74)
* some initial cuda code as I learn. using git to save progress. * first cuda kernel for ray sampling that mostly works * cleaning up code. working on lr. structs for scene bounds aabb * added scene bounds collider code * updated setup * setup * setup * black * including some files * exporting env variable * new file * git workflows * github actions * github actions * github actions * removing env var
This commit is contained in:
1 parent
752df417ce
commit
676beebb14
45 files changed
+803
-8354
No files matched your search
@@ -8,6 +8,8 @@ import torch
|
||||
|
||||
from torchtyping import TensorType
|
||||
|
||||
from mattport.utils.misc import is_not_none
|
||||
|
||||
|
||||
@dataclass
|
||||
class RayBundle:
|
||||
@@ -20,6 +22,9 @@ class RayBundle:
|
||||
origins: TensorType["num_rays", 3]
|
||||
directions: TensorType["num_rays", 3]
|
||||
camera_indices: Optional[TensorType["num_rays"]] = None
|
||||
nears: Optional[TensorType["num_rays"]] = None
|
||||
fars: Optional[TensorType["num_rays"]] = None
|
||||
valid_mask: Optional[TensorType["num_rays"]] = None
|
||||
|
||||
def to_camera_ray_bundle(self, image_height, image_width) -> "CameraRayBundle":
|
||||
"""Returns a CameraRayBundle from this object."""
|
||||
@@ -60,6 +65,17 @@ class RayBundle:
|
||||
camera_indices=self.camera_indices[indices],
|
||||
)
|
||||
|
||||
def get_masked_ray_bundle(self, valid_mask):
|
||||
"""Return a masked instance of the ray bundle."""
|
||||
return RayBundle(
|
||||
origins=self.origins[valid_mask],
|
||||
directions=self.directions[valid_mask],
|
||||
camera_indices=self.camera_indices[valid_mask] if is_not_none(self.camera_indices) else None,
|
||||
nears=self.nears[valid_mask] if is_not_none(self.nears) else None,
|
||||
fars=self.fars[valid_mask] if is_not_none(self.fars) else None,
|
||||
valid_mask=self.valid_mask[valid_mask] if is_not_none(self.valid_mask) else None,
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class CameraRayBundle:
|
||||
|
||||
Reference in new issue
Block a user