mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-11 10:34:29 +08:00
Add dynamic batching to compound model (#535)
This commit is contained in:
parent
06b1c80d2e
commit
aea0cfc253
@ -55,7 +55,7 @@ base_configs: Dict[str, Config] = {}
|
||||
base_configs["compound"] = Config(
|
||||
method_name="compound",
|
||||
trainer=TrainerConfig(mixed_precision=True),
|
||||
pipeline=VanillaPipelineConfig(
|
||||
pipeline=DynamicBatchPipelineConfig(
|
||||
datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),
|
||||
model=CompoundModelConfig(eval_num_rays_per_chunk=8192),
|
||||
),
|
||||
|
||||
@ -186,9 +186,17 @@ class CompoundModel(Model):
|
||||
"accumulation": accumulation,
|
||||
"depth": depth,
|
||||
"alive_ray_mask": alive_ray_mask, # the rays we kept from sampler
|
||||
"num_samples_per_ray": packed_info[:, 1],
|
||||
}
|
||||
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):
|
||||
image = batch["image"].to(self.device)
|
||||
mask = outputs["alive_ray_mask"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user