mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
fix wanb
This commit is contained in:
1 parent
6c9b37bff9
commit
c5bf04d595
4 files changed
+10
-16
No files matched your search
@@ -83,7 +83,7 @@ descriptions = {
|
|||||||
|
|
||||||
method_configs["nerfacto"] = TrainerConfig(
|
method_configs["nerfacto"] = TrainerConfig(
|
||||||
method_name="nerfacto",
|
method_name="nerfacto",
|
||||||
steps_per_eval_batch=500,
|
steps_per_eval_batch=20,
|
||||||
steps_per_save=2000,
|
steps_per_save=2000,
|
||||||
max_num_iterations=30000,
|
max_num_iterations=30000,
|
||||||
mixed_precision=True,
|
mixed_precision=True,
|
||||||
@@ -339,7 +339,8 @@ method_configs["phototourism"] = TrainerConfig(
|
|||||||
|
|
||||||
method_configs["dreamfusion"] = DreamfusionTrainerConfig(
|
method_configs["dreamfusion"] = DreamfusionTrainerConfig(
|
||||||
method_name="dreamfusion",
|
method_name="dreamfusion",
|
||||||
steps_per_eval_batch=500,
|
steps_per_eval_batch=50,
|
||||||
|
steps_per_eval_image=50,
|
||||||
steps_per_save=2000,
|
steps_per_save=2000,
|
||||||
max_num_iterations=30000,
|
max_num_iterations=30000,
|
||||||
mixed_precision=True,
|
mixed_precision=True,
|
||||||
|
|||||||
@@ -255,14 +255,6 @@ class DreamFusionDataManager(VanillaDataManager): # pylint: disable=abstract-me
|
|||||||
"""Returns the next batch of data from the eval dataloader."""
|
"""Returns the next batch of data from the eval dataloader."""
|
||||||
self.eval_count += 1
|
self.eval_count += 1
|
||||||
|
|
||||||
if step > 2000:
|
|
||||||
cameras, _, _ = random_train_pose(
|
|
||||||
self.config.train_images_per_batch, self.config.train_resolution, device=self.device
|
|
||||||
)
|
|
||||||
|
|
||||||
ray_bundle = cameras.generate_rays(torch.tensor([[i] for i in range(self.config.eval_images_per_batch)]))
|
|
||||||
return ray_bundle, {"initialization": False}
|
|
||||||
|
|
||||||
cameras, vertical_rotation, central_rotation = random_train_pose(
|
cameras, vertical_rotation, central_rotation = random_train_pose(
|
||||||
self.config.eval_images_per_batch,
|
self.config.eval_images_per_batch,
|
||||||
self.config.eval_resolution,
|
self.config.eval_resolution,
|
||||||
@@ -273,13 +265,12 @@ class DreamFusionDataManager(VanillaDataManager): # pylint: disable=abstract-me
|
|||||||
vertical_rotation_range=self.config.vertical_rotation_range,
|
vertical_rotation_range=self.config.vertical_rotation_range,
|
||||||
jitter_std=self.config.jitter_std,
|
jitter_std=self.config.jitter_std,
|
||||||
)
|
)
|
||||||
ray_bundle = cameras.generate_rays(torch.tensor([[i] for i in range(self.config.train_images_per_batch)]))
|
ray_bundle = cameras.generate_rays(
|
||||||
|
torch.tensor([[i] for i in range(self.config.train_images_per_batch)])
|
||||||
|
).flatten()
|
||||||
|
|
||||||
return ray_bundle, {"vertical": vertical_rotation, "central": central_rotation}
|
return ray_bundle, {"vertical": vertical_rotation, "central": central_rotation}
|
||||||
|
|
||||||
def next_eval_image(self, step: int) -> Tuple[int, RayBundle, Dict]:
|
|
||||||
raise ValueError("No more eval images")
|
|
||||||
|
|
||||||
def get_param_groups(self) -> Dict[str, List[Parameter]]: # pylint: disable=no-self-use
|
def get_param_groups(self) -> Dict[str, List[Parameter]]: # pylint: disable=no-self-use
|
||||||
"""Get the param groups for the data manager.
|
"""Get the param groups for the data manager.
|
||||||
Returns:
|
Returns:
|
||||||
|
|||||||
@@ -279,7 +279,6 @@ class DreamFusionModel(Model):
|
|||||||
def get_outputs(self, ray_bundle: RayBundle):
|
def get_outputs(self, ray_bundle: RayBundle):
|
||||||
# uniform sampling
|
# uniform sampling
|
||||||
background_rgb = self.field.get_background_rgb(ray_bundle)
|
background_rgb = self.field.get_background_rgb(ray_bundle)
|
||||||
|
|
||||||
ray_samples, weights_list, ray_samples_list = self.proposal_sampler(ray_bundle, density_fns=self.density_fns)
|
ray_samples, weights_list, ray_samples_list = self.proposal_sampler(ray_bundle, density_fns=self.density_fns)
|
||||||
field_outputs = self.field(ray_samples, compute_normals=True)
|
field_outputs = self.field(ray_samples, compute_normals=True)
|
||||||
weights = ray_samples.get_weights(field_outputs[FieldHeadNames.DENSITY])
|
weights = ray_samples.get_weights(field_outputs[FieldHeadNames.DENSITY])
|
||||||
@@ -354,7 +353,7 @@ class DreamFusionModel(Model):
|
|||||||
else:
|
else:
|
||||||
outputs["train_output"] = outputs["render"]
|
outputs["train_output"] = outputs["render"]
|
||||||
|
|
||||||
if self.training:
|
if self.training or True:
|
||||||
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
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -237,6 +237,9 @@ class NerfactoModel(Model):
|
|||||||
return callbacks
|
return callbacks
|
||||||
|
|
||||||
def get_outputs(self, ray_bundle: RayBundle):
|
def get_outputs(self, ray_bundle: RayBundle):
|
||||||
|
print(ray_bundle.shape)
|
||||||
|
if not self.training:
|
||||||
|
raise
|
||||||
ray_samples, weights_list, ray_samples_list = self.proposal_sampler(ray_bundle, density_fns=self.density_fns)
|
ray_samples, weights_list, ray_samples_list = self.proposal_sampler(ray_bundle, density_fns=self.density_fns)
|
||||||
field_outputs = self.field(ray_samples, compute_normals=self.config.predict_normals)
|
field_outputs = self.field(ray_samples, compute_normals=self.config.predict_normals)
|
||||||
weights = ray_samples.get_weights(field_outputs[FieldHeadNames.DENSITY])
|
weights = ray_samples.get_weights(field_outputs[FieldHeadNames.DENSITY])
|
||||||
|
|||||||
Reference in new issue
Block a user