Skip to content

PatchPixelSampler + Masks Bottleneck #3040

@JDihlmann

Description

@JDihlmann

Describe the bug
Using the patch pixel sampler (patch_size=32) and adding masks results in very slow training increasing training time from minutes (w/o masks) to days (w/ masks). After logging times I could identify that the torch.nn.functional.max_pool2d(tensor, kernel_size=kernel_size, stride=1, padding=(kernel_size - 1) // 2) within the dialate function in nerfstudio/data/utils/pixel_sampling_utils.py taking up to 77sec for one batch.

To Reproduce
Steps to reproduce the behavior:

  1. Find a NeRF scene with images and masks
  2. Set --pipeline.datamanager.patch-size 32
  3. Run w/ and w/o masks to see the difference

Expected behavior
A faster default implementation or the possibility to swap to GPU for fast max_pool2d computation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions