Skip to content

Commit

Permalink
Fix slow training issue when using mask (nerfstudio-project#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttaoREtw authored and tancik committed Jan 20, 2023
1 parent f7cb3ff commit aaff1b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nerfstudio/data/pixel_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def collate_image_dataset_batch(batch: Dict, num_rays_per_batch: int, keep_full_

# only sample within the mask, if the mask is in the batch
if "mask" in batch:
nonzero_indices = torch.nonzero(batch["mask"][..., 0].to(device), as_tuple=False)
nonzero_indices = torch.nonzero(batch["mask"][..., 0], as_tuple=False)
chosen_indices = random.sample(range(len(nonzero_indices)), k=num_rays_per_batch)
indices = nonzero_indices[chosen_indices]
else:
Expand Down

0 comments on commit aaff1b4

Please sign in to comment.