wormpose.dataset.loaders.resizer

Handles all about the optional resizing of the images of a Dataset

It will modify the FeaturesDataset and the FramesDataset to update with the resized values.

The resize parameter can be specified as a single number (ex: 2 for upscale to twice the size, or 0.5 to downscale half the size) or as the desired image size, in that case, the resize factor will be calculated depending on the average worm length in the dataset.

class wormpose.dataset.loaders.resizer.ResizeOptions(resize_factor: Optional[float] = None, image_size: Optional[int] = None, **kwargs)[source]

Class handling the possible resize options: either a scaling factor, or a set image size

wormpose.dataset.loaders.resizer.add_resizing_arguments(parser)[source]

For command line arguments, adds two mutually exclusive resize options: either a scaling factor, or a set image size

Parameters

parser – Argparse parser

wormpose.dataset.loaders.resizer.features_dataset_resizer(features_dataset_class: Type[wormpose.dataset.base_dataset.BaseFeaturesDataset], resize_factor: float)[source]

Modifies a FeaturesDataset class so that all features are resized by resize_factor

Parameters
  • frames_dataset_class – original FeaturesDataset class without resizing

  • resize_factor – by how much to rescale the features

Returns

new FeaturesDataset with resizing

wormpose.dataset.loaders.resizer.frames_dataset_resizer(frames_dataset_class: Type[wormpose.dataset.base_dataset.BaseFramesDataset], resize_factor: float)[source]

Modifies a FramesDataset class so that all frames are resized by resize_factor

Parameters
  • frames_dataset_class – original FramesDataset class without resizing

  • resize_factor – by how much to rescale the images

Returns

new FramesDataset with resizing