Learn R Programming

torchvision (version 0.7.0)

coco_polygon_to_mask: Convert COCO polygon to mask tensor (Robust Version)

Description

Converts a COCO-style polygon annotation (list of coordinates) into a binary mask tensor.

Usage

coco_polygon_to_mask(segmentation, height, width)

Value

A torch_bool() tensor of shape (height, width)

Arguments

segmentation

A list of polygons from COCO annotations (e.g., anns$segmentation[[i]]).

height

Height of the image

width

Width of the image