mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
tune
This commit is contained in:
1 parent
335d159ded
commit
7a140a1f5b
2 files changed
+5
-11
No files matched your search
@@ -361,7 +361,7 @@ method_configs["dreamfusion"] = TrainerConfig(
|
|||||||
initialize_density=False,
|
initialize_density=False,
|
||||||
random_background=True,
|
random_background=True,
|
||||||
proposal_warmup=500,
|
proposal_warmup=500,
|
||||||
proposal_update_every=2,
|
proposal_update_every=0,
|
||||||
proposal_weights_anneal_max_num_iters=100,
|
proposal_weights_anneal_max_num_iters=100,
|
||||||
start_lambertian_training=500,
|
start_lambertian_training=500,
|
||||||
start_normals_training=1000,
|
start_normals_training=1000,
|
||||||
@@ -372,7 +372,7 @@ method_configs["dreamfusion"] = TrainerConfig(
|
|||||||
),
|
),
|
||||||
optimizers={
|
optimizers={
|
||||||
"proposal_networks": {
|
"proposal_networks": {
|
||||||
"optimizer": AdamOptimizerConfig(lr=5e-2, eps=1e-15),
|
"optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
|
||||||
"scheduler": None,
|
"scheduler": None,
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class DreamFusionModelConfig(ModelConfig):
|
|||||||
"""start training with lambertian shading after this many iterations"""
|
"""start training with lambertian shading after this many iterations"""
|
||||||
opacity_penalty: bool = True
|
opacity_penalty: bool = True
|
||||||
"""enables penalty to encourage sparse weights (penalizing for uniform density along ray)"""
|
"""enables penalty to encourage sparse weights (penalizing for uniform density along ray)"""
|
||||||
opacity_loss_mult: float = 1e-3
|
opacity_loss_mult: float = 1
|
||||||
"""scale for opacity penalty"""
|
"""scale for opacity penalty"""
|
||||||
max_res: int = 256
|
max_res: int = 256
|
||||||
"""Maximum resolution of the density field."""
|
"""Maximum resolution of the density field."""
|
||||||
@@ -303,7 +303,6 @@ 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,
|
update_every_num_iters=1,
|
||||||
args=[self, training_callback_attributes],
|
args=[self, training_callback_attributes],
|
||||||
@@ -354,9 +353,7 @@ class DreamFusionModel(Model):
|
|||||||
|
|
||||||
if self.initialize_density:
|
if self.initialize_density:
|
||||||
pos = ray_samples.frustums.get_positions()
|
pos = ray_samples.frustums.get_positions()
|
||||||
density_blob = (
|
density_blob = self.density_strength * torch.exp(-torch.norm(pos, dim=-1) / (2 * 0.04))[..., None]
|
||||||
self.density_strength * self.density_strength * torch.exp(-torch.norm(pos, dim=-1) * 10)[..., None]
|
|
||||||
)
|
|
||||||
density = density + density_blob
|
density = density + density_blob
|
||||||
|
|
||||||
weights = ray_samples.get_weights(density)
|
weights = ray_samples.get_weights(density)
|
||||||
@@ -426,7 +423,6 @@ class DreamFusionModel(Model):
|
|||||||
else:
|
else:
|
||||||
outputs["train_output"] = outputs["rgb"]
|
outputs["train_output"] = outputs["rgb"]
|
||||||
|
|
||||||
if self.training:
|
|
||||||
outputs["rendered_orientation_loss"] = orientation_loss(
|
outputs["rendered_orientation_loss"] = orientation_loss(
|
||||||
weights.detach(), field_outputs[FieldHeadNames.NORMALS], ray_bundle.directions
|
weights.detach(), field_outputs[FieldHeadNames.NORMALS], ray_bundle.directions
|
||||||
)
|
)
|
||||||
@@ -439,9 +435,7 @@ class DreamFusionModel(Model):
|
|||||||
|
|
||||||
assert weights.shape[-1] == 1
|
assert weights.shape[-1] == 1
|
||||||
if self.config.opacity_penalty:
|
if self.config.opacity_penalty:
|
||||||
outputs["opacity_loss"] = (
|
outputs["opacity_loss"] = torch.sqrt(torch.sum(weights, dim=-2) ** 2 + 0.01) * self.config.opacity_loss_mult
|
||||||
torch.sqrt(torch.sum(weights, dim=-2) ** 2 + 0.01) * self.config.opacity_loss_mult
|
|
||||||
)
|
|
||||||
|
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user