draw_bounding_boxes — Torchvision 0.22 documentation (original) (raw)

torchvision.utils.draw_bounding_boxes(image: Tensor, boxes: Tensor, labels: Optional[List[str]] = None, colors: Optional[Union[List[Union[str, Tuple[int, int, int]]], str, Tuple[int, int, int]]] = None, fill: Optional[bool] = False, width: int = 1, font: Optional[str] = None, font_size: Optional[int] = None, label_colors: Optional[Union[List[Union[str, Tuple[int, int, int]]], str, Tuple[int, int, int]]] = None) → Tensor[source]

Draws bounding boxes on given RGB image. The image values should be uint8 in [0, 255] or float in [0, 1]. If fill is True, Resulting Tensor should be saved as PNG image.

Parameters:

Returns:

Image Tensor of dtype uint8 with bounding boxes plotted.

Return type:

img (Tensor[C, H, W])

Examples using draw_bounding_boxes: