object_detection_transformer#

object_detection_transformer(inp: Tuple[ndarray, Optional[Tuple[ndarray, ndarray, str]]], transform: Optional[BasicTransform] = None) Tuple[torch.Tensor, Optional[BoxList]][source]#

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[np.ndarray, Optional[Tuple[np.ndarray, np.ndarray, str]]]) – Tuple of the form: (image, (boxes, class_ids, box_format)). box_format must be ‘yxyx’ or ‘xywh’.

  • transform (Optional[A.BasicTransform], optional) – A transform. Defaults to None.

Raises

NotImplementedError – If box_format is not ‘yxyx’ or ‘xywh’.

Returns

Transformed image and boxes.

Return type

Tuple[torch.Tensor, BoxList]