ShapeDataset

class ShapeDataset(data_path, img_size, crop=None, extension=None, rotate=None, cached=False, random_offset=False, random_scale=False, point_indices=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Dataset to load image and corresponding shape

_make_dataset(path)[source]

default_loader

default_loader(data: str, img_size: tuple, crop=None, extension=None, rotate=None, cached=False, random_offset=False, random_scale=False, point_indices=None)[source]

Helper Function to load single sample

Parameters:
  • data (str or SingleImage2D) – image file to load
  • img_size (tuple) – image size for resizing
  • crop (None or float) – if None: nor cropping will be applied if float: specifies boundary proportion for cropping
  • extension (str or None:) – specifiying the extension
  • rotate (int or None) – specifies to image rotation (in degrees)
  • cached (bool) – whether or not the data is already cached
  • random_offset (bool or float) – if bool: must be False -> No Random Shift is applied if float: specifies the maximal number of pixels to shift
  • random_scale (bool or float) – if bool: must be False -> No random scaling is applied if float: specifies the maximum amount of scaling
  • point_indices (None or Iterable) – if None: All landmarks are returned if Iterable: only landmarks corresponding to indices are returned
Returns:

  • np.ndarray – image
  • np.ndarray – landmarks

preprocessing

preprocessing(img: shapedata.single_shape.data_processing.SingleImage2D, img_size: tuple, crop=None, rotate=None, random_offset=False, random_scale=False, point_indices=None)[source]

Helper Function to preprocess a single sample

Parameters:
  • img (SingleImage2D) – image file to preprocess
  • img_size (tuple) – image size for resizing
  • crop (None or float) – if None: nor cropping will be applied if float: specifies boundary proportion for cropping
  • extension (str or None:) – specifiying the extension
  • rotate (int or None) – specifies to image rotation (in degrees)
  • random_offset (bool or float) – if bool: must be False -> No Random Shift is applied if float: specifies the maximal number of pixels to shift
  • random_scale (bool or float) – if bool: must be False -> No random scaling is applied if float: specifies the maximum amount of scaling
  • point_indices (None or Iterable) – if None: All landmarks are returned if Iterable: only landmarks corresponding to indices are returned
Returns:

  • np.ndarray – image
  • np.ndarray – landmarks