mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 14:28:41 +08:00
Add dynamic batching to compound model (#535)
This commit is contained in:
1 parent
06b1c80d2e
commit
aea0cfc253
2 files changed
+9
-1
No files matched your search
@@ -55,7 +55,7 @@ base_configs: Dict[str, Config] = {}
|
|||||||
base_configs["compound"] = Config(
|
base_configs["compound"] = Config(
|
||||||
method_name="compound",
|
method_name="compound",
|
||||||
trainer=TrainerConfig(mixed_precision=True),
|
trainer=TrainerConfig(mixed_precision=True),
|
||||||
pipeline=VanillaPipelineConfig(
|
pipeline=DynamicBatchPipelineConfig(
|
||||||
datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),
|
datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),
|
||||||
model=CompoundModelConfig(eval_num_rays_per_chunk=8192),
|
model=CompoundModelConfig(eval_num_rays_per_chunk=8192),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -186,9 +186,17 @@ class CompoundModel(Model):
|
|||||||
"accumulation": accumulation,
|
"accumulation": accumulation,
|
||||||
"depth": depth,
|
"depth": depth,
|
||||||
"alive_ray_mask": alive_ray_mask, # the rays we kept from sampler
|
"alive_ray_mask": alive_ray_mask, # the rays we kept from sampler
|
||||||
|
"num_samples_per_ray": packed_info[:, 1],
|
||||||
}
|
}
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
|
def get_metrics_dict(self, outputs, batch):
|
||||||
|
image = batch["image"].to(self.device)
|
||||||
|
metrics_dict = {}
|
||||||
|
metrics_dict["psnr"] = self.psnr(outputs["rgb"], image)
|
||||||
|
metrics_dict["num_samples_per_batch"] = outputs["num_samples_per_ray"].sum()
|
||||||
|
return metrics_dict
|
||||||
|
|
||||||
def get_loss_dict(self, outputs, batch, metrics_dict=None):
|
def get_loss_dict(self, outputs, batch, metrics_dict=None):
|
||||||
image = batch["image"].to(self.device)
|
image = batch["image"].to(self.device)
|
||||||
mask = outputs["alive_ray_mask"]
|
mask = outputs["alive_ray_mask"]
|
||||||
|
|||||||
Reference in new issue
Block a user