minerva.data.datasets.context_dataset¶
Classes¶
An abstract class representing a |
Module Contents¶
- class minerva.data.datasets.context_dataset.ContextDataset(readers, transform=None)[source]¶
Bases:
torch.utils.data.DatasetAn abstract class representing a
Dataset.All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite
__getitem__(), supporting fetching a data sample for a given key. Subclasses could also optionally overwrite__len__(), which is expected to return the size of the dataset by manySamplerimplementations and the default options ofDataLoader. Subclasses could also optionally implement__getitems__(), for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.Note
DataLoaderby default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.A PyTorch Dataset class for handling paired image and mask data with optional context transformations.
Parameters¶
- readersTuple[_Reader, _Reader]
A tuple containing two reader objects. The first reader should provide images, and the second reader should provide corresponding masks. Both readers must support indexing and have the same length.
- transformOptional[_Transform], default=None
An optional transformation function or callable that takes a tuple of (image, mask) and returns a transformed tuple of (image, mask). If None, no transformations are applied.
- readers¶
- transform = None¶
- Parameters:
readers (Tuple[minerva.data.readers.reader._Reader, minerva.data.readers.reader._Reader])
transform (Optional[minerva.transforms.transform._Transform])