class_docstr: This class stores the segmentation masks for all objects in one image, in
  the form of bitmaps.
  
  Attributes:
      tensor: bool Tensor of N,H,W, representing N instances in the image.
class_docstr_tok: ["This","class","stores","the","segmentation","masks","for","all","objects","in","one","image",",","in","the","form","of","bitmaps",".","Attributes",":","tensor",":","bool","Tensor","of","N",",","H",",","W",",","representing","N","instances","in","the","image","."]
docstr: Returns:
      Boxes: tight bounding boxes around bitmasks.
      If a mask is empty, it's bounding box will be all zero.
docstr_tok: ["Returns",":","Boxes",":","tight","bounding","boxes","around","bitmasks",".","If","a","mask","is","empty",",","it","'s","bounding","box","will","be","all","zero","."]
code: def get_bounding_boxes(self) -> Boxes:
      """
      Returns:
          Boxes: tight bounding boxes around bitmasks.
          If a mask is empty, it's bounding box will be all zero.
      """
      boxes = torch.zeros(self.tensor.shape[0], 4, dtype=torch.float32)
      x_any = torch.any(self.tensor, dim=1)
      y_any = torch.any(self.tensor, dim=2)
      for idx in range(self.tensor.shape[0]):
          x = torch.where(x_any[idx, :])[0]
          y = torch.where(y_any[idx, :])[0]
          if len(x) > 0 and len(y) > 0:
              boxes[idx, :] = torch.as_tensor(
                  [x[0], y[0], x[-1] + 1, y[-1] + 1],
                  dtype=torch.float32,
              )
      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 12 for calling the BitMasks obj's underlying member method code with example usage: obj.get_bounding_boxes() and returns: Boxes