eurocropsml.dataset.base.TransformDatasetΒΆ

class TransformDataset(dataset: ~torch.utils.data.dataset.Dataset[~eurocropsml.dataset.base.LabelledData], data_transforms: list[~typing.Callable[[~torch.Tensor], ~torch.Tensor]] | None = None, target_transforms: list[~typing.Callable[[~torch.Tensor], ~torch.Tensor]] | None = None, collate_fn: ~typing.Callable[[~collections.abc.Sequence[~eurocropsml.dataset.base.LabelledData]], ~eurocropsml.dataset.base.LabelledData] = <function custom_collate_fn>, polygons: dict[int, ~shapely.geometry.polygon.Polygon | ~shapely.geometry.multipolygon.MultiPolygon] | None = None)ΒΆ

Bases: Dataset[LabelledData]

Wrapper around torch dataset, applying data and target transformations.

Parameters:
  • dataset – Dataset to wrap.

  • data_transforms – List of transforms to apply to data

  • target_transforms – List of transforms to apply to targets

  • collate_fn – Function to collate list of batches.

  • polygons – (Optional) mapping associating a polygon to each entry.

Raises:

ValueError – If the wrapped dataset does not have a well-defined length.

Methods

__init__(dataset[, data_transforms, ...])

concat(datasets)

Concatenate given datasets to one large dataset.

overlaps(ix1, ix2)

Check if polygons corresponding to ix1 and ix2 overlap.

subset(indices)

Return a subset of the dataset corresponding to the given indices.