Train Test Helpers¶
-
src.pipelines.tensorflow_v2.helpers.train_test.get_filepath_list(base_dir, leaf_ext, mask_ext, incl_aug=True)[source]¶ Gets a list of leaf and mask file paths. The folder structure needs to have been created using this code base.
- Parameters
base_dir (
str) – base directory file pathleaf_ext (
str) – the leaf extensionmask_ext (
str) – the mask extensionincl_aug (
bool) – whether augmented images should be used
- Return type
Tuple[List[str],List[str]]- Returns
a list of leaf and mask file paths, as two separate lists
-
src.pipelines.tensorflow_v2.helpers.train_test.get_tf_dataset(base_dir, leaf_ext, mask_ext, incl_aug=False, cfp=True, batch_size=2, buffer_size=200, leaf_shape=(512, 512, 1), mask_shape=(512, 512, 1), test=False, shift_256=False, transform_uint8=False)[source]¶ Creates a tf dataset, which has samples consisited of leaf, mask pairs. The dataset is also configured for performance. Both the dataset and list of leaf names are returned.
- Parameters
base_dir (
str) – the base directory; the subfolders in this directory should contain the leaf and mask images the dataset will useleaf_ext (
str) – the leaf extensionsmask_ext (
str) – the mask extensionsincl_aug (
bool) – whether augmented images should be includedcfp (
bool) – whether to configure the datasest for performancebatch_size (
int) – the batch sizebuffer_size (
int) – the buffer size; this controls the extent of shuffling in the datasetleaf_shape (
Tuple[int,int,int]) – the leaf shapemask_shape (
Tuple[int,int,int]) – the mask shapetest (
bool) – whether a test set dataset is being configuredshift_256 (
bool) – whether the leaf images should be shifted by 256transform_uint8 (
bool) – whether the leaf images should be transformed to a uint8 format
- Return type
Tuple[DatasetV2,List[str]]- Returns
a tf dataset and a list of leaf file paths