object_detection_transformer#

object_detection_transformer(inp: tuple[numpy.ndarray, tuple[numpy.ndarray, numpy.ndarray, str]], transform: albumentations.core.transforms_interface.BasicTransform | None) tuple[torch.Tensor, rastervision.pytorch_learner.object_detection_utils.BoxList | None][source]#
object_detection_transformer(inp: tuple[numpy.ndarray, None], transform: albumentations.core.transforms_interface.BasicTransform | None) tuple[torch.Tensor, None]

Apply transform to image, bounding boxes, and labels. Also perform normalization and conversion to pytorch tensors.

The transform’s BBoxParams are expected to have the format ‘albumentations’ (i.e. normalized [ymin, xmin, ymax, xmax]).

Parameters
  • inp – Tuple of the form: (image, (boxes, class_ids, box_format)). box_format must be 'yxyx' or 'xywh'.

  • transform – A transform. Defaults to None.

Raises

NotImplementedError – If box_format is not 'yxyx' or 'xywh'.

Returns

Transformed image and boxes.