GeoDataset#

class GeoDataset[source]#

Bases: AlbumentationsDataset

Dataset that reads directly from a Scene (i.e. a raster source and a label source).

__init__(scene: Scene, out_size: Optional[Union[PositiveInt, Tuple[PositiveInt, PositiveInt]]] = None, within_aoi: bool = True, transform: Optional[BasicTransform] = None, transform_type: Optional[TransformType] = None, normalize: bool = True, to_pytorch: bool = True, return_window: bool = False)[source]#

Constructor.

Parameters
  • scene (Scene) – A Scene object.

  • out_size (Optional[Union[PositiveInt, Tuple[PositiveInt, PositiveInt]]]) – Resize chips to this size before returning.

  • within_aoi (bool) – If True and if the scene has an AOI, only sample windows that lie fully within the AOI. If False, windows only partially intersecting the AOI will also be allowed. Defaults to True.

  • transform (Optional[A.BasicTransform], optional) – Albumentations transform to apply to the windows. Defaults to None. Each transform in Albumentations takes images of type uint8, and sometimes other data types. The data type requirements can be seen at https://albumentations.ai/docs/api_reference/augmentations/transforms/ # noqa If there is a mismatch between the data type of imagery and the transform requirements, a RasterTransformer should be set on the RasterSource that converts to uint8, such as MinMaxTransformer or StatsTransformer.

  • transform_type (Optional[TransformType], optional) – Type of transform. Defaults to None.

  • normalize (bool, optional) – If True, x is normalized to [0, 1] based on its data type. Defaults to True.

  • to_pytorch (bool, optional) – If True, x and y are converted to pytorch tensors. Defaults to True.

  • return_window (bool, optional) – Make __getitem__ return the window coordinates used to generate the image. Defaults to False.

Methods

__init__(scene[, out_size, within_aoi, ...])

Constructor.

append_resize_transform(transform, out_size)

Get transform to use for resizing windows to out_size.

from_uris(*args, **kwargs)

__contains__(key: str) bool#
Parameters

key (str) –

Return type

bool

__getitem__(key) Tuple[torch.Tensor, torch.Tensor]#
Return type

Tuple[torch.Tensor, torch.Tensor]

__init__(scene: Scene, out_size: Optional[Union[PositiveInt, Tuple[PositiveInt, PositiveInt]]] = None, within_aoi: bool = True, transform: Optional[BasicTransform] = None, transform_type: Optional[TransformType] = None, normalize: bool = True, to_pytorch: bool = True, return_window: bool = False)[source]#

Constructor.

Parameters
  • scene (Scene) – A Scene object.

  • out_size (Optional[Union[PositiveInt, Tuple[PositiveInt, PositiveInt]]]) – Resize chips to this size before returning.

  • within_aoi (bool) – If True and if the scene has an AOI, only sample windows that lie fully within the AOI. If False, windows only partially intersecting the AOI will also be allowed. Defaults to True.

  • transform (Optional[A.BasicTransform], optional) – Albumentations transform to apply to the windows. Defaults to None. Each transform in Albumentations takes images of type uint8, and sometimes other data types. The data type requirements can be seen at https://albumentations.ai/docs/api_reference/augmentations/transforms/ # noqa If there is a mismatch between the data type of imagery and the transform requirements, a RasterTransformer should be set on the RasterSource that converts to uint8, such as MinMaxTransformer or StatsTransformer.

  • transform_type (Optional[TransformType], optional) – Type of transform. Defaults to None.

  • normalize (bool, optional) – If True, x is normalized to [0, 1] based on its data type. Defaults to True.

  • to_pytorch (bool, optional) – If True, x and y are converted to pytorch tensors. Defaults to True.

  • return_window (bool, optional) – Make __getitem__ return the window coordinates used to generate the image. Defaults to False.

static __new__(cls, *args: Any, **kwargs: Any) Any#
Parameters
  • args (Any) –

  • kwargs (Any) –

Return type

Any

append_resize_transform(transform: albumentations.core.transforms_interface.BasicTransform | None, out_size: tuple[pydantic.types.PositiveInt, pydantic.types.PositiveInt]) albumentations.augmentations.geometric.resize.Resize | albumentations.core.composition.Compose[source]#

Get transform to use for resizing windows to out_size.

Parameters
  • transform (albumentations.core.transforms_interface.BasicTransform | None) –

  • out_size (tuple[pydantic.types.PositiveInt, pydantic.types.PositiveInt]) –

Return type

albumentations.augmentations.geometric.resize.Resize | albumentations.core.composition.Compose

classmethod from_uris(*args, **kwargs) GeoDataset[source]#
Return type

GeoDataset