mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 06:49:13 +08:00
rename to splatfacto
This commit is contained in:
1 parent
6389cacd19
commit
f70b7ce14d
10 files changed
+25
-25
No files matched your search
@@ -27,11 +27,11 @@ Because gaussian splatting trains on *full images* instead of bundles of rays, t
|
|||||||
|
|
||||||
|
|
||||||
### Running the Method
|
### Running the Method
|
||||||
To run gaussian splatting, run `ns-train gaussian-splatting --data <data>`. Just like NeRF methods, the splat can be interactively viewed in the web-viewer, loaded from a checkpoint, rendered, and exported.
|
To run gaussian splatting, run `ns-train splatfacto --data <data>`. Just like NeRF methods, the splat can be interactively viewed in the web-viewer, loaded from a checkpoint, rendered, and exported.
|
||||||
|
|
||||||
#### Quality and Regularization
|
#### Quality and Regularization
|
||||||
The default settings provided maintain a balance between speed, quality, and splat file size, but if you care more about quality than training speed or size, you can decrease the alpha cull threshold
|
The default settings provided maintain a balance between speed, quality, and splat file size, but if you care more about quality than training speed or size, you can decrease the alpha cull threshold
|
||||||
(threshold to delete translucent gaussians) and disable culling after 15k steps like so: `ns-train gaussian-splatting --pipeline.model.cull_scale_thresh=0.005 --pipeline.model.continue_cull_post_densification=False --data <data>`
|
(threshold to delete translucent gaussians) and disable culling after 15k steps like so: `ns-train splatfacto --pipeline.model.cull_scale_thresh=0.005 --pipeline.model.continue_cull_post_densification=False --data <data>`
|
||||||
|
|
||||||
A common artifact in splatting is long, spikey gaussians. [PhysGaussian](https://xpandora.github.io/PhysGaussian/) proposes an example of a scale-regularizer that encourages gaussians to be more evenly shaped. To enable this, set the `use_scale_regularization` flag to `True`.
|
A common artifact in splatting is long, spikey gaussians. [PhysGaussian](https://xpandora.github.io/PhysGaussian/) proposes an example of a scale-regularizer that encourages gaussians to be more evenly shaped. To enable this, set the `use_scale_regularization` flag to `True`.
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ from nerfstudio.engine.trainer import TrainerConfig
|
|||||||
from nerfstudio.field_components.temporal_distortions import TemporalDistortionKind
|
from nerfstudio.field_components.temporal_distortions import TemporalDistortionKind
|
||||||
from nerfstudio.fields.sdf_field import SDFFieldConfig
|
from nerfstudio.fields.sdf_field import SDFFieldConfig
|
||||||
from nerfstudio.models.depth_nerfacto import DepthNerfactoModelConfig
|
from nerfstudio.models.depth_nerfacto import DepthNerfactoModelConfig
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModelConfig
|
|
||||||
from nerfstudio.models.generfacto import GenerfactoModelConfig
|
from nerfstudio.models.generfacto import GenerfactoModelConfig
|
||||||
from nerfstudio.models.instant_ngp import InstantNGPModelConfig
|
from nerfstudio.models.instant_ngp import InstantNGPModelConfig
|
||||||
from nerfstudio.models.mipnerf import MipNerfModel
|
from nerfstudio.models.mipnerf import MipNerfModel
|
||||||
@@ -59,6 +58,7 @@ from nerfstudio.models.nerfacto import NerfactoModelConfig
|
|||||||
from nerfstudio.models.neus import NeuSModelConfig
|
from nerfstudio.models.neus import NeuSModelConfig
|
||||||
from nerfstudio.models.neus_facto import NeuSFactoModelConfig
|
from nerfstudio.models.neus_facto import NeuSFactoModelConfig
|
||||||
from nerfstudio.models.semantic_nerfw import SemanticNerfWModelConfig
|
from nerfstudio.models.semantic_nerfw import SemanticNerfWModelConfig
|
||||||
|
from nerfstudio.models.splatfacto import SplatfactoModelConfig
|
||||||
from nerfstudio.models.tensorf import TensoRFModelConfig
|
from nerfstudio.models.tensorf import TensoRFModelConfig
|
||||||
from nerfstudio.models.vanilla_nerf import NeRFModel, VanillaModelConfig
|
from nerfstudio.models.vanilla_nerf import NeRFModel, VanillaModelConfig
|
||||||
from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
|
from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
|
||||||
@@ -80,7 +80,7 @@ descriptions = {
|
|||||||
"generfacto": "Generative Text to NeRF model",
|
"generfacto": "Generative Text to NeRF model",
|
||||||
"neus": "Implementation of NeuS. (slow)",
|
"neus": "Implementation of NeuS. (slow)",
|
||||||
"neus-facto": "Implementation of NeuS-Facto. (slow)",
|
"neus-facto": "Implementation of NeuS-Facto. (slow)",
|
||||||
"gaussian-splatting": "Gaussian Splatting model",
|
"splatfacto": "Gaussian Splatting model",
|
||||||
}
|
}
|
||||||
|
|
||||||
method_configs["nerfacto"] = TrainerConfig(
|
method_configs["nerfacto"] = TrainerConfig(
|
||||||
@@ -588,8 +588,8 @@ method_configs["neus-facto"] = TrainerConfig(
|
|||||||
vis="viewer",
|
vis="viewer",
|
||||||
)
|
)
|
||||||
|
|
||||||
method_configs["gaussian-splatting"] = TrainerConfig(
|
method_configs["splatfacto"] = TrainerConfig(
|
||||||
method_name="gaussian-splatting",
|
method_name="splatfacto",
|
||||||
steps_per_eval_image=100,
|
steps_per_eval_image=100,
|
||||||
steps_per_eval_batch=0,
|
steps_per_eval_batch=0,
|
||||||
steps_per_save=2000,
|
steps_per_save=2000,
|
||||||
@@ -601,7 +601,7 @@ method_configs["gaussian-splatting"] = TrainerConfig(
|
|||||||
datamanager=FullImageDatamanagerConfig(
|
datamanager=FullImageDatamanagerConfig(
|
||||||
dataparser=NerfstudioDataParserConfig(load_3D_points=True),
|
dataparser=NerfstudioDataParserConfig(load_3D_points=True),
|
||||||
),
|
),
|
||||||
model=GaussianSplattingModelConfig(),
|
model=SplatfactoModelConfig(),
|
||||||
),
|
),
|
||||||
optimizers={
|
optimizers={
|
||||||
"xyz": {
|
"xyz": {
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ class Nerfstudio(DataParser):
|
|||||||
else:
|
else:
|
||||||
if not self.prompted_user:
|
if not self.prompted_user:
|
||||||
CONSOLE.print(
|
CONSOLE.print(
|
||||||
"[bold yellow]Warning: load_3D_points set to true but no point cloud found. gaussian-splatting models will use random point cloud initialization."
|
"[bold yellow]Warning: load_3D_points set to true but no point cloud found. splatfacto models will use random point cloud initialization."
|
||||||
)
|
)
|
||||||
ply_file_path = None
|
ply_file_path = None
|
||||||
|
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ def projection_matrix(znear, zfar, fovx, fovy, device: Union[str, torch.device]
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class GaussianSplattingModelConfig(ModelConfig):
|
class SplatfactoModelConfig(ModelConfig):
|
||||||
"""Gaussian Splatting Model Config"""
|
"""Gaussian Splatting Model Config"""
|
||||||
|
|
||||||
_target: Type = field(default_factory=lambda: GaussianSplattingModel)
|
_target: Type = field(default_factory=lambda: SplatfactoModel)
|
||||||
warmup_length: int = 500
|
warmup_length: int = 500
|
||||||
"""period of steps where refinement is turned off"""
|
"""period of steps where refinement is turned off"""
|
||||||
refine_every: int = 100
|
refine_every: int = 100
|
||||||
@@ -149,14 +149,14 @@ class GaussianSplattingModelConfig(ModelConfig):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class GaussianSplattingModel(Model):
|
class SplatfactoModel(Model):
|
||||||
"""Gaussian Splatting model
|
"""Gaussian Splatting model
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
config: Gaussian Splatting configuration to instantiate model
|
config: Gaussian Splatting configuration to instantiate model
|
||||||
"""
|
"""
|
||||||
|
|
||||||
config: GaussianSplattingModelConfig
|
config: SplatfactoModelConfig
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -40,7 +40,7 @@ from nerfstudio.exporter import texture_utils, tsdf_utils
|
|||||||
from nerfstudio.exporter.exporter_utils import collect_camera_poses, generate_point_cloud, get_mesh_from_filename
|
from nerfstudio.exporter.exporter_utils import collect_camera_poses, generate_point_cloud, get_mesh_from_filename
|
||||||
from nerfstudio.exporter.marching_cubes import generate_mesh_with_multires_marching_cubes
|
from nerfstudio.exporter.marching_cubes import generate_mesh_with_multires_marching_cubes
|
||||||
from nerfstudio.fields.sdf_field import SDFField # noqa
|
from nerfstudio.fields.sdf_field import SDFField # noqa
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModel
|
from nerfstudio.models.splatfacto import SplatfactoModel
|
||||||
from nerfstudio.pipelines.base_pipeline import Pipeline, VanillaPipeline
|
from nerfstudio.pipelines.base_pipeline import Pipeline, VanillaPipeline
|
||||||
from nerfstudio.utils.eval_utils import eval_setup
|
from nerfstudio.utils.eval_utils import eval_setup
|
||||||
from nerfstudio.utils.rich_utils import CONSOLE
|
from nerfstudio.utils.rich_utils import CONSOLE
|
||||||
@@ -488,9 +488,9 @@ class ExportGaussianSplat(Exporter):
|
|||||||
|
|
||||||
_, pipeline, _, _ = eval_setup(self.load_config)
|
_, pipeline, _, _ = eval_setup(self.load_config)
|
||||||
|
|
||||||
assert isinstance(pipeline.model, GaussianSplattingModel)
|
assert isinstance(pipeline.model, SplatfactoModel)
|
||||||
|
|
||||||
model: GaussianSplattingModel = pipeline.model
|
model: SplatfactoModel = pipeline.model
|
||||||
|
|
||||||
filename = self.output_dir / "splat.ply"
|
filename = self.output_dir / "splat.ply"
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from typing_extensions import Literal
|
|||||||
|
|
||||||
from nerfstudio.data.scene_box import OrientedBox
|
from nerfstudio.data.scene_box import OrientedBox
|
||||||
from nerfstudio.models.base_model import Model
|
from nerfstudio.models.base_model import Model
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModel
|
from nerfstudio.models.splatfacto import SplatfactoModel
|
||||||
from nerfstudio.viewer.control_panel import ControlPanel
|
from nerfstudio.viewer.control_panel import ControlPanel
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ def populate_export_tab(
|
|||||||
config_path: Path,
|
config_path: Path,
|
||||||
viewer_model: Model,
|
viewer_model: Model,
|
||||||
) -> None:
|
) -> None:
|
||||||
viewing_gsplat = isinstance(viewer_model, GaussianSplattingModel)
|
viewing_gsplat = isinstance(viewer_model, SplatfactoModel)
|
||||||
if not viewing_gsplat:
|
if not viewing_gsplat:
|
||||||
crop_output = server.add_gui_checkbox("Use Crop", False)
|
crop_output = server.add_gui_checkbox("Use Crop", False)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ from viser import ClientHandle
|
|||||||
|
|
||||||
from nerfstudio.cameras.cameras import Cameras
|
from nerfstudio.cameras.cameras import Cameras
|
||||||
from nerfstudio.model_components.renderers import background_color_override_context
|
from nerfstudio.model_components.renderers import background_color_override_context
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModel
|
from nerfstudio.models.splatfacto import SplatfactoModel
|
||||||
from nerfstudio.utils import colormaps, writer
|
from nerfstudio.utils import colormaps, writer
|
||||||
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName, TimeWriter
|
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName, TimeWriter
|
||||||
from nerfstudio.viewer.utils import CameraState, get_camera
|
from nerfstudio.viewer.utils import CameraState, get_camera
|
||||||
@@ -136,7 +136,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
|
|
||||||
with TimeWriter(None, None, write=False) as vis_t:
|
with TimeWriter(None, None, write=False) as vis_t:
|
||||||
with self.viewer.train_lock if self.viewer.train_lock is not None else contextlib.nullcontext():
|
with self.viewer.train_lock if self.viewer.train_lock is not None else contextlib.nullcontext():
|
||||||
if isinstance(self.viewer.get_model(), GaussianSplattingModel):
|
if isinstance(self.viewer.get_model(), SplatfactoModel):
|
||||||
color = self.viewer.control_panel.background_color
|
color = self.viewer.control_panel.background_color
|
||||||
background_color = torch.tensor(
|
background_color = torch.tensor(
|
||||||
[color[0] / 255.0, color[1] / 255.0, color[2] / 255.0],
|
[color[0] / 255.0, color[1] / 255.0, color[2] / 255.0],
|
||||||
@@ -168,7 +168,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
self.viewer.get_model().train()
|
self.viewer.get_model().train()
|
||||||
num_rays = (camera.height * camera.width).item()
|
num_rays = (camera.height * camera.width).item()
|
||||||
if self.viewer.control_panel.layer_depth:
|
if self.viewer.control_panel.layer_depth:
|
||||||
if isinstance(self.viewer.get_model(), GaussianSplattingModel):
|
if isinstance(self.viewer.get_model(), SplatfactoModel):
|
||||||
# Gaussians render much faster than we can send depth images, so we do some downsampling.
|
# Gaussians render much faster than we can send depth images, so we do some downsampling.
|
||||||
assert len(outputs["depth"].shape) == 3
|
assert len(outputs["depth"].shape) == 3
|
||||||
assert outputs["depth"].shape[-1] == 1
|
assert outputs["depth"].shape[-1] == 1
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from nerfstudio.cameras.cameras import CameraType
|
|||||||
from nerfstudio.configs import base_config as cfg
|
from nerfstudio.configs import base_config as cfg
|
||||||
from nerfstudio.data.datasets.base_dataset import InputDataset
|
from nerfstudio.data.datasets.base_dataset import InputDataset
|
||||||
from nerfstudio.models.base_model import Model
|
from nerfstudio.models.base_model import Model
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModel
|
from nerfstudio.models.splatfacto import SplatfactoModel
|
||||||
from nerfstudio.pipelines.base_pipeline import Pipeline
|
from nerfstudio.pipelines.base_pipeline import Pipeline
|
||||||
from nerfstudio.utils.decorators import check_main_thread, decorate_all
|
from nerfstudio.utils.decorators import check_main_thread, decorate_all
|
||||||
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName
|
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName
|
||||||
@@ -250,7 +250,7 @@ class Viewer:
|
|||||||
|
|
||||||
# Diagnostics for Gaussian Splatting: where the points are at the start of training.
|
# Diagnostics for Gaussian Splatting: where the points are at the start of training.
|
||||||
# This is hidden by default, it can be shown from the Viser UI's scene tree table.
|
# This is hidden by default, it can be shown from the Viser UI's scene tree table.
|
||||||
if isinstance(pipeline.model, GaussianSplattingModel):
|
if isinstance(pipeline.model, SplatfactoModel):
|
||||||
self.viser_server.add_point_cloud(
|
self.viser_server.add_point_cloud(
|
||||||
"/gaussian_splatting_initial_points",
|
"/gaussian_splatting_initial_points",
|
||||||
points=pipeline.model.means.numpy(force=True) * VISER_NERFSTUDIO_SCALE_RATIO,
|
points=pipeline.model.means.numpy(force=True) * VISER_NERFSTUDIO_SCALE_RATIO,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import torch
|
|||||||
|
|
||||||
from nerfstudio.cameras.cameras import Cameras
|
from nerfstudio.cameras.cameras import Cameras
|
||||||
from nerfstudio.model_components.renderers import background_color_override_context
|
from nerfstudio.model_components.renderers import background_color_override_context
|
||||||
from nerfstudio.models.gaussian_splatting import GaussianSplattingModel
|
from nerfstudio.models.splatfacto import SplatfactoModel
|
||||||
from nerfstudio.utils import colormaps, writer
|
from nerfstudio.utils import colormaps, writer
|
||||||
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName, TimeWriter
|
from nerfstudio.utils.writer import GLOBAL_BUFFER, EventName, TimeWriter
|
||||||
from nerfstudio.viewer_legacy.server import viewer_utils
|
from nerfstudio.viewer_legacy.server import viewer_utils
|
||||||
@@ -130,7 +130,7 @@ class RenderStateMachine(threading.Thread):
|
|||||||
with self.viewer.train_lock if self.viewer.train_lock is not None else contextlib.nullcontext():
|
with self.viewer.train_lock if self.viewer.train_lock is not None else contextlib.nullcontext():
|
||||||
# TODO jake-austin: Make this check whether the model inherits from a camera based model or a ray based model
|
# TODO jake-austin: Make this check whether the model inherits from a camera based model or a ray based model
|
||||||
# TODO Zhuoyang: First made some dummy judgements, need to be fixed later
|
# TODO Zhuoyang: First made some dummy judgements, need to be fixed later
|
||||||
isGaussianSplattingModel = isinstance(self.viewer.get_model(), GaussianSplattingModel)
|
isGaussianSplattingModel = isinstance(self.viewer.get_model(), SplatfactoModel)
|
||||||
if isGaussianSplattingModel:
|
if isGaussianSplattingModel:
|
||||||
# TODO fix me before ship
|
# TODO fix me before ship
|
||||||
camera_ray_bundle = camera.generate_rays(camera_indices=0, aabb_box=self.viewer.get_model().render_aabb)
|
camera_ray_bundle = camera.generate_rays(camera_indices=0, aabb_box=self.viewer.get_model().render_aabb)
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ BLACKLIST = [
|
|||||||
"neus",
|
"neus",
|
||||||
"generfacto",
|
"generfacto",
|
||||||
"neus-facto",
|
"neus-facto",
|
||||||
"gaussian-splatting",
|
"splatfacto",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user