noether.data.pipeline.sample_processors.point_sampling

Classes

PointSamplingSampleProcessor

Randomly subsamples points from a tensor.

Module Contents

class noether.data.pipeline.sample_processors.point_sampling.PointSamplingSampleProcessor(items, num_points, seed=None)

Bases: noether.data.pipeline.sample_processor.SampleProcessor

Randomly subsamples points from a tensor.

# dummy example
processor = PointSamplingSampleProcessor(
    items={"input_position", "output_position"},
    num_points=1024,
    seed=42,
)
input_sample = {
    "input_position": torch.randn(5000, 3),
    "output_position": torch.randn(5000, 3),
    "input_features": torch.randn(5000, 6),
}
output_sample = processor(input_sample)
# output_sample['input_position'] will be a tensor of shape (1024, 3)
# output_sample['output_position'] will be a tensor of shape (1024, 3)
# output_sample['input_features'] will be unchanged.
# If input features is also added to items, it will be of shape (1024, 6)
Parameters:
  • items (set[str]) – Which pointcloud items should be subsampled (e.g., input_position, output_position, …). If multiple

  • present (items are)

  • (e.g. (the subsampling will use identical indices for all items)

  • downsample (to)

  • subsampling). (output_position and output_pressure with the same)

  • num_points (int) – Number of points to sample.

  • seed (int | None) – Random seed for deterministic sampling for evaluation. Default None (i.e., no seed). If not None, requires sample index to be present in batch.

items
num_points
seed = None