PatchDataset#
- class PatchDataset(inputs, labels=None)[source]#
- Defines a simple patch dataset, which inherits from the
torch.utils.data.Dataset class.
- inputs#
Either a list of patches, where each patch is a ndarray or a list of valid path with its extension be (“.jpg”, “.jpeg”, “.tif”, “.tiff”, “.png”) pointing to an image.
- labels#
List of labels for sample at the same index in inputs. Default is None.
- preproc_func#
Preprocessing function used to transform the input data.
Examples
>>> # A user defined preproc func and expected behavior >>> preproc_func = lambda img: img/2 # reduce intensity by half >>> transformed_img = preproc_func(img) >>> # create a dataset to get patches preprocessed by the above function >>> ds = PatchDataset( ... inputs=['/A/B/C/img1.png', '/A/B/C/img2.png'], ... preproc_func=preproc_func ... )
Methods
Attributes