mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
param tweaks, change density bias scheduling
This commit is contained in:
1 parent
7ab04622d0
commit
2efd4c88b6
2 files changed
+14
-13
No files matched your search
@@ -353,7 +353,7 @@ method_configs["dreamfusion"] = TrainerConfig(
|
|||||||
model=DreamFusionModelConfig(
|
model=DreamFusionModelConfig(
|
||||||
eval_num_rays_per_chunk=1 << 15,
|
eval_num_rays_per_chunk=1 << 15,
|
||||||
distortion_loss_mult=0.02,
|
distortion_loss_mult=0.02,
|
||||||
interlevel_loss_mult=100,
|
interlevel_loss_mult=100.0,
|
||||||
orientation_loss_mult=0.1,
|
orientation_loss_mult=0.1,
|
||||||
max_res=256,
|
max_res=256,
|
||||||
sphere_collider=True,
|
sphere_collider=True,
|
||||||
@@ -371,12 +371,12 @@ method_configs["dreamfusion"] = TrainerConfig(
|
|||||||
),
|
),
|
||||||
optimizers={
|
optimizers={
|
||||||
"proposal_networks": {
|
"proposal_networks": {
|
||||||
"optimizer": AdamOptimizerConfig(lr=1e-8, eps=1e-15),
|
"optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
|
||||||
"scheduler": WarmupSchedulerConfig(lr_init=1e-8,lr_max=1e-3,lr_final=1e-6,warmup_steps=2000,max_steps=10000),
|
"scheduler": None#WarmupSchedulerConfig(lr_init=1e-8,lr_max=1e-3,lr_final=1e-6,warmup_steps=2000,max_steps=20000),
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"optimizer": AdamOptimizerConfig(lr=1e-8, eps=1e-15),
|
"optimizer": AdamOptimizerConfig(lr=1e-8, eps=1e-15),
|
||||||
"scheduler": WarmupSchedulerConfig(lr_init=1e-8,lr_max=1e-3,lr_final=1e-6,warmup_steps=2000,max_steps=10000),
|
"scheduler": WarmupSchedulerConfig(lr_init=1e-8,lr_max=1e-3,lr_final=1e-6,warmup_steps=2000,max_steps=20000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
viewer=ViewerConfig(num_rays_per_chunk=1 << 15),
|
viewer=ViewerConfig(num_rays_per_chunk=1 << 15),
|
||||||
|
|||||||
@@ -77,8 +77,10 @@ class DreamFusionModelConfig(ModelConfig):
|
|||||||
"""Randomizes light source per output."""
|
"""Randomizes light source per output."""
|
||||||
initialize_density: bool = True
|
initialize_density: bool = True
|
||||||
"""Initialize density in center of scene."""
|
"""Initialize density in center of scene."""
|
||||||
init_density_strength: float = 0.1
|
taper_range: Tuple[int,int] = (0,1000)
|
||||||
"""Initial strength of center density"""
|
'''Range of step values for the density tapering'''
|
||||||
|
taper_strength:Tuple[float,float] = (1.0,0.0)
|
||||||
|
"""Strength schedule of center density"""
|
||||||
sphere_collider: bool = True
|
sphere_collider: bool = True
|
||||||
"""Use spherical collider instead of box"""
|
"""Use spherical collider instead of box"""
|
||||||
random_background: bool = True
|
random_background: bool = True
|
||||||
@@ -114,7 +116,7 @@ class DreamFusionModelConfig(ModelConfig):
|
|||||||
"""Slope of the annealing function for the proposal weights."""
|
"""Slope of the annealing function for the proposal weights."""
|
||||||
proposal_weights_anneal_max_num_iters: int = 500
|
proposal_weights_anneal_max_num_iters: int = 500
|
||||||
"""Max num iterations for the annealing function."""
|
"""Max num iterations for the annealing function."""
|
||||||
use_single_jitter: bool = False
|
use_single_jitter: bool = True
|
||||||
"""Whether use single jitter or not for the proposal networks."""
|
"""Whether use single jitter or not for the proposal networks."""
|
||||||
interlevel_loss_mult: float = 1.0
|
interlevel_loss_mult: float = 1.0
|
||||||
"""Proposal loss multiplier."""
|
"""Proposal loss multiplier."""
|
||||||
@@ -234,7 +236,7 @@ class DreamFusionModel(Model):
|
|||||||
single_jitter=self.config.use_single_jitter,
|
single_jitter=self.config.use_single_jitter,
|
||||||
update_sched=update_schedule,
|
update_sched=update_schedule,
|
||||||
initial_sampler=UniformSampler(single_jitter=self.config.use_single_jitter),
|
initial_sampler=UniformSampler(single_jitter=self.config.use_single_jitter),
|
||||||
pdf_histogram_padding=0.001,
|
pdf_histogram_padding=0.005,
|
||||||
)
|
)
|
||||||
|
|
||||||
# renderers
|
# renderers
|
||||||
@@ -264,7 +266,7 @@ class DreamFusionModel(Model):
|
|||||||
def taper_density(
|
def taper_density(
|
||||||
self, training_callback_attributes: TrainingCallbackAttributes, step: int # pylint: disable=unused-argument
|
self, training_callback_attributes: TrainingCallbackAttributes, step: int # pylint: disable=unused-argument
|
||||||
):
|
):
|
||||||
self.density_strength -= 0.25
|
self.density_strength = np.interp(step,self.config.taper_range,self.config.taper_strength)
|
||||||
|
|
||||||
def start_training_normals(
|
def start_training_normals(
|
||||||
self, training_callback_attributes: TrainingCallbackAttributes, step: int # pylint: disable=unused-argument
|
self, training_callback_attributes: TrainingCallbackAttributes, step: int # pylint: disable=unused-argument
|
||||||
@@ -298,8 +300,8 @@ class DreamFusionModel(Model):
|
|||||||
callbacks = [
|
callbacks = [
|
||||||
TrainingCallback(
|
TrainingCallback(
|
||||||
where_to_run=[TrainingCallbackLocation.AFTER_TRAIN_ITERATION],
|
where_to_run=[TrainingCallbackLocation.AFTER_TRAIN_ITERATION],
|
||||||
iters=(150, 300, 450, 600),
|
|
||||||
func=taper_density,
|
func=taper_density,
|
||||||
|
update_every_num_iters=1,
|
||||||
args=[self, training_callback_attributes],
|
args=[self, training_callback_attributes],
|
||||||
),
|
),
|
||||||
TrainingCallback(
|
TrainingCallback(
|
||||||
@@ -352,11 +354,10 @@ class DreamFusionModel(Model):
|
|||||||
if self.initialize_density and self.training:
|
if self.initialize_density and self.training:
|
||||||
pos = ray_samples.frustums.get_positions()
|
pos = ray_samples.frustums.get_positions()
|
||||||
density_blob = (
|
density_blob = (
|
||||||
self.config.init_density_strength
|
self.density_strength
|
||||||
* self.density_strength
|
|
||||||
* torch.exp(-torch.norm(pos, dim=-1) / (2 * 0.04))[..., None]
|
* torch.exp(-torch.norm(pos, dim=-1) / (2 * 0.04))[..., None]
|
||||||
)
|
)
|
||||||
density += density_blob
|
density = density + density_blob
|
||||||
|
|
||||||
accumulation = self.renderer_accumulation(weights)
|
accumulation = self.renderer_accumulation(weights)
|
||||||
depth = self.renderer_depth(weights, ray_samples)
|
depth = self.renderer_depth(weights, ray_samples)
|
||||||
|
|||||||
Reference in new issue
Block a user