data.load_images
Routines to load images from the file-system and split into different training, validation, test etc. datasets.
Module Contents
Classes
Loads images from the file-system. |
- class data.load_images.ImageLoader[source]
Loads images from the file-system.
- extension :str = jpg[source]
The extension (without a leading period) that all image files must match.
- rgb :bool = True[source]
When true, images are always loaded as RGB. when false, they are loaded as grayscale.
- load_images(self) torch.utils.data.DataLoader [source]
Load all images recursively from a directory.
- Returns
a data-loader with all the images that match the extension recursively in a directory.
- load_images_split_two(self, ratio_validation: float = 0.3) Tuple[torch.utils.data.DataLoader, torch.utils.data.DataLoader] [source]
Load all images recursively from a directory, and split into training and validation batches.
- Parameters
ratio_validation – a number between 0 and 1 determining linearly how many elements belong in the validation set e.g. 0.4 would try and place 40% approximately of elements into the second partition.
- Returns
the loaded images, split into training and validation data respectively.
- load_images_split_three(self, ratio_validation: float = 0.3, ratio_test: float = 0.2) Tuple[torch.utils.data.DataLoader, torch.utils.data.DataLoader, torch.utils.data.DataLoader] [source]
Load all images recursively from a directory, and split into training, validation and test batches.
- Parameters
ratio_validation – a number between 0 and 1 determining linearly how many elements belong in the validation set e.g. 0.4 would try and place 40% approximately of elements into the second batch.
ratio_test – a number between 0 and 1 determining linearly how many elements belong in the validation set e.g. 0.2 would try and place 20% approximately of elements into the third batch.
- Returns
the loaded images, split into training and validation data and test data respectively.