ImageDataset#
- class ImageDataset[source]#
Bases:
AlbumentationsDataset
Dataset that reads from image files.
- __init__(orig_dataset: Any, transform: albumentations.core.transforms_interface.BasicTransform | None = None, transform_type: TransformType = TransformType.noop, normalize=True, to_pytorch=True)#
Constructor.
- Parameters:
orig_dataset (Any) – An object with a __getitem__ and __len__.
transform (albumentations.core.transforms_interface.BasicTransform | None) – 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 asMinMaxTransformer
orStatsTransformer
.transform_type (TransformType) – The type of transform so that its inputs and outputs can be handled correctly. Defaults to
TransformType.noop
.normalize – If
True
, the sampled chips are normalized to [0, 1] based on their data type. Defaults toTrue
.to_pytorch – If
True
, the sampled chips and labels are converted to pytorch tensors. Defaults toTrue
.
Methods
__init__
(orig_dataset[, transform, ...])Constructor.
- __add__(other: Dataset[T_co]) ConcatDataset[T_co] #
- Parameters:
other (Dataset[T_co]) –
- Return type:
ConcatDataset[T_co]
- __getitem__(key) tuple[torch.Tensor, torch.Tensor] #
- Return type:
- __init__(orig_dataset: Any, transform: albumentations.core.transforms_interface.BasicTransform | None = None, transform_type: TransformType = TransformType.noop, normalize=True, to_pytorch=True)#
Constructor.
- Parameters:
orig_dataset (Any) – An object with a __getitem__ and __len__.
transform (albumentations.core.transforms_interface.BasicTransform | None) – 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 asMinMaxTransformer
orStatsTransformer
.transform_type (TransformType) – The type of transform so that its inputs and outputs can be handled correctly. Defaults to
TransformType.noop
.normalize – If
True
, the sampled chips are normalized to [0, 1] based on their data type. Defaults toTrue
.to_pytorch – If
True
, the sampled chips and labels are converted to pytorch tensors. Defaults toTrue
.