class_docstr: This class stores the segmentation masks for all objects in one image, in the form of polygons.
  
  Attributes:
      polygons: list[list[ndarray]]. Each ndarray is a float64 vector representing a polygon.
class_docstr_tok: ["This","class","stores","the","segmentation","masks","for","all","objects","in","one","image",",","in","the","form","of","polygons",".","Attributes",":","polygons",":","list","[","list","[","ndarray","]","]",".","Each","ndarray","is","a","float64","vector","representing","a","polygon","."]
docstr: Returns:
      Boxes: tight bounding boxes around polygon masks.
docstr_tok: ["Returns",":","Boxes",":","tight","bounding","boxes","around","polygon","masks","."]
code: def get_bounding_boxes(self) -> Boxes:
      """
      Returns:
          Boxes: tight bounding boxes around polygon masks.
      """
      boxes = torch.zeros(len(self.polygons), 4, dtype=torch.float32)
      for idx, polygons_per_instance in enumerate(self.polygons):
          minxy = torch.as_tensor(
              [float("inf"), float("inf")], dtype=torch.float32
          )
          maxxy = torch.zeros(2, dtype=torch.float32)
          for polygon in polygons_per_instance:
              coords = (
                  torch.from_numpy(polygon)
                  .view(-1, 2)
                  .to(dtype=torch.float32)
              )
              minxy = torch.min(minxy, torch.min(coords, dim=0).values)
              maxxy = torch.max(maxxy, torch.max(coords, dim=0).values)
          boxes[idx, :2] = minxy
          boxes[idx, 2:] = maxxy
      return Boxes(boxes)
  
imports: import copy
  import itertools
  import numpy
  from typing import Any, Iterator, List, Union
  import pycocotools.mask
  import torch
  from torch import device
  from detectron2.layers.roi_align import ROIAlign
  from detectron2.utils.memory import retry_if_cuda_oom
  from .boxes import Boxes
label_desc: Use image node_id 4 for calling the PolygonMasks obj's underlying member method code with example usage: obj.get_bounding_boxes() and returns: Boxes