mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-27 11:30:11 +08:00
add scenebox changes
This commit is contained in:
1 parent
ec603634ed
commit
490892ff1f
2 files changed
+12
-2
No files matched your search
@@ -18,7 +18,7 @@ from __future__ import annotations
|
|||||||
import math
|
import math
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Optional, Type
|
from typing import Optional, Tuple, Type
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
@@ -64,6 +64,8 @@ class NerfstudioDataParserConfig(DataParserConfig):
|
|||||||
"""The fraction of images to use for training. The remaining images are for eval."""
|
"""The fraction of images to use for training. The remaining images are for eval."""
|
||||||
depth_unit_scale_factor: float = 1e-3
|
depth_unit_scale_factor: float = 1e-3
|
||||||
"""Scales the depth values to meters. Default value is 0.001 for a millimeter to meter conversion."""
|
"""Scales the depth values to meters. Default value is 0.001 for a millimeter to meter conversion."""
|
||||||
|
shift_poses: Optional[Tuple[float, float, float]] = None
|
||||||
|
"""Shifts the poses by the given amount. Useful for shifting the cameras for front-facing scenes."""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -236,6 +238,9 @@ class Nerfstudio(DataParser):
|
|||||||
|
|
||||||
poses[:, :3, 3] *= scale_factor
|
poses[:, :3, 3] *= scale_factor
|
||||||
|
|
||||||
|
if self.config.shift_poses is not None:
|
||||||
|
poses[:, :3, 3] += torch.tensor(self.config.shift_poses)
|
||||||
|
|
||||||
# Choose image_filenames and poses based on split, but after auto orient and scaling the poses.
|
# Choose image_filenames and poses based on split, but after auto orient and scaling the poses.
|
||||||
image_filenames = [image_filenames[i] for i in indices]
|
image_filenames = [image_filenames[i] for i in indices]
|
||||||
mask_filenames = [mask_filenames[i] for i in indices] if len(mask_filenames) > 0 else []
|
mask_filenames = [mask_filenames[i] for i in indices] if len(mask_filenames) > 0 else []
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ class NerfactoModelConfig(ModelConfig):
|
|||||||
"""Whether to predict normals or not."""
|
"""Whether to predict normals or not."""
|
||||||
disable_scene_contraction: bool = False
|
disable_scene_contraction: bool = False
|
||||||
"""Whether to disable scene contraction or not."""
|
"""Whether to disable scene contraction or not."""
|
||||||
|
use_aabb_collider: bool = False
|
||||||
|
"""Whether to use aabb collider or not."""
|
||||||
|
|
||||||
|
|
||||||
class NerfactoModel(Model):
|
class NerfactoModel(Model):
|
||||||
@@ -206,7 +208,10 @@ class NerfactoModel(Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Collider
|
# Collider
|
||||||
self.collider = NearFarCollider(near_plane=self.config.near_plane, far_plane=self.config.far_plane)
|
if self.config.use_aabb_collider:
|
||||||
|
self.collider = AABBBoxCollider(scene_box=self.scene_box)
|
||||||
|
else:
|
||||||
|
self.collider = NearFarCollider(near_plane=self.config.near_plane, far_plane=self.config.far_plane)
|
||||||
|
|
||||||
# renderers
|
# renderers
|
||||||
self.renderer_rgb = RGBRenderer(background_color=self.config.background_color)
|
self.renderer_rgb = RGBRenderer(background_color=self.config.background_color)
|
||||||
|
|||||||
Reference in new issue
Block a user