Converts COCO-style polygon segmentation annotations from target $segmentation variable into boolean mask tensors as target $masks variable in order to ease later-on visualisation via draw_segmentation_mask(). Use as target_transform in coco_detection_dataset().

target_transform_coco_masks(y)

Arguments

y

list being COCO dataset target variable, with names segmentation, image_height, image_width.

Value

Modified y list with added masks field (N, H, W) boolean tensor, N being the number of classes.

See also

Other target_transforms: target_transform_trimap_masks()

Examples

if (FALSE) { # \dontrun{
ds <- coco_detection_dataset(
  root = "data",
  target_transform = target_transform_coco_masks
)
item <- ds[1]
draw_segmentation_masks(item)
} # }