Refactoring (data loading, semantic-nerf/nerf-w fixes, ...) (#8)

* in progress. camera_indices broken

* faster dataloader. starting on pixel sampler logic

* imagesampler and pixelsampler

* lint and black

* continuing merge

* pytest working

* fixed docs

* docs

* minor changes
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-06-02 14:58:46 -04:00
1 parent 1f189b3e54
commit 146332cfb6
50 files changed
+914 -831

No files matched your search

+20 -2
View File
@@ -13,8 +13,8 @@ from torchtyping import TensorType
class PointCloud:
"""_summary_"""
xyz = None
rgb = None
xyz: TensorType["num_points", 3] = None
rgb: TensorType["num_points", 3] = None
@dataclass
@@ -22,8 +22,10 @@ class Semantics:
"""_summary_"""
stuff_classes: List[str] = None
stuff_colors: List[List[int]] = None
stuff_filenames: List[str] = None
thing_classes: List[str] = None
thing_colors: List[List[int]] = None
thing_filenames: List[str] = None
@@ -37,6 +39,22 @@ class SceneBounds:
aabb: TensorType[2, 3] = None
def get_diagonal_length(self):
"""Returns the longest diagonal length."""
diff = self.aabb[1] - self.aabb[0]
length = torch.sqrt((diff**2).sum() + 1e-20)
return length
def get_center(self):
"""Reterns the center of the box."""
diff = self.aabb[1] - self.aabb[0]
return self.aabb[0] + diff / 2.0
def get_centered_and_scaled_scene_bounds(self, scale_factor=1.0):
"""Returns a new box that has been shifted and rescaled to be centered
about the origin."""
return SceneBounds(aabb=(self.aabb - self.get_center()) * scale_factor)
@dataclass
class DatasetInputs: