kaishi.image.file_group
¶
Definition for groups of image files.
Module Contents¶
-
kaishi.image.file_group.
THUMBNAIL_SIZE
= [64, 64]¶
-
kaishi.image.file_group.
MAX_DIM_FOR_SMALL
= 224¶
-
kaishi.image.file_group.
PATCH_SIZE
= [64, 64]¶
-
kaishi.image.file_group.
RESAMPLE_METHOD
¶
-
class
kaishi.image.file_group.
ImageFileGroup
(source: str, recursive: bool)¶ Bases:
kaishi.core.file_group.FileGroup
Group of image files that inherits from the core file group class.
-
load_all
(self)¶ Load all files in the directory that this class was initialized with.
-
build_numpy_batches
(self, channels_first: bool = True, batch_size: int = None, image_type: str = 'small_image')¶ Build a tensor from the entire image corpus (or generate batches if specified).
If a batch size is specified, this acts as a generator of batches and returns a list of file objects to manipulate. Otherwise, a single batch of all images is returned in an array format.
- Parameters
channels_first (bool) – flag indicating channels first (e.g. PyTorch) vs. channels last (e.g. Keras)
batch_size (int) – size of each batch (default is None, which will return a single batch)
image_type (str) – choice of “small_image”, “thumbnail”, or “patch”, indicating which version of each image to use
- Returns
batch of images (generator if batch size specified)
- Return type
numpy.array
-
save
(self, out_dir: str)¶ Save image data set in the current structure while preserving any changes.
- Parameters
out_dir (str) – output directory
-
run_pipeline
(self, verbose: bool = False)¶ Run the pipeline as configured.
- Parameters
verbose (bool) – flag indicating verbosity
-
report
(self)¶ Run a descriptive report (currently just prints the file report).
-