kitcar_ml.utils.data.data_loader.transforms package

Submodules

kitcar_ml.utils.data.data_loader.transforms.albumentations_transform module

Classes:

AlbumentationsComposer(transforms[, ...])

AlbumentationsTransform(augmentations, ...)

class AlbumentationsComposer(transforms: Sequence[Union[BasicTransform, BaseCompose]], bbox_params: Optional[Union[dict, BboxParams]] = None, keypoint_params: Optional[Union[dict, KeypointParams]] = None, additional_targets: Optional[Dict[str, str]] = None, p: float = 1.0, is_check_shapes: bool = True)[source]

Bases: Compose

Attributes:

_abc_impl

_abc_impl = <_abc_data object>
processors: Dict[str, Union[BboxProcessor, KeypointsProcessor]]
class AlbumentationsTransform(augmentations: List[BasicTransform], **compose_kwargs)[source]

Bases: BBoxImageTransform

Attributes:

_abc_impl

_abc_impl = <_abc_data object>

kitcar_ml.utils.data.data_loader.transforms.bbox_image_transform module

Classes:

BBoxImageTransform()

Base transform for image/bbox augmentations.

class BBoxImageTransform[source]

Bases: ABC

Base transform for image/bbox augmentations.

Attributes:

imgs_per_output

Images needed to produce one output image.

_abc_impl

property imgs_per_output

Images needed to produce one output image.

_abc_impl = <_abc_data object>

kitcar_ml.utils.data.data_loader.transforms.mosaic_transform module

Classes:

MosaicTransform([rows, columns])

Transform multiple images into a grid/mosaic image.

class MosaicTransform(rows: int = 2, columns: int = 2)[source]

Bases: BBoxImageTransform

Transform multiple images into a grid/mosaic image.

All images before this transformation should have the same shape. A random cropping before this transformation adds variability.

Attributes:

imgs_per_output

Images needed to produce one mosaic image.

_abc_impl

Methods:

calculate_mosaic_image(mosaic_batch)

Calculate a mosaic image from a batch of images.

shift_box(box, index, height, width)

Shift a bounding box dependent on the position in the grid and the height and width of the images.

create_grid_image(images)

Concatenate the images to a new image.

property imgs_per_output: int

Images needed to produce one mosaic image.

calculate_mosaic_image(mosaic_batch: List[Tuple[ndarray, List[ndarray], List[str]]]) Tuple[ndarray, List[ndarray], List[str]][source]

Calculate a mosaic image from a batch of images.

shift_box(box: ndarray, index: int, height: int, width: int) ndarray[source]

Shift a bounding box dependent on the position in the grid and the height and width of the images.

Parameters
  • box – The bounding box that is shifted.

  • index – The index of the corresponding image.

  • height – The height of one image.

  • width – The width of one image.

create_grid_image(images: List[ndarray]) ndarray[source]

Concatenate the images to a new image.

_abc_impl = <_abc_data object>

Module contents