osc.data.tfrecords.deserialize_image_and_mask

deserialize_image_and_mask(example: bytes, *, img_size: Tuple[int, int], num_classes: int) Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor][source]

Deserialize an image and a mask as read from a TFRecord.

Parameters
  • example (bytes) – byte serialization of the image and mask.

  • img_size (Tuple[int, int]) – expected shape of the image (H, W).

  • num_classes (int) – expected number of classes C for the mask.

Return type

Tuple[Tensor, Tensor]

Returns

One uint8 tensor of shape [H W 3] and one bool tensor of shape [H W, C].