code: def polygons_to_bitmask(
      polygons: List[np.ndarray], height: int, width: int
  ) -> np.ndarray:
      """
      Args:
          polygons (list[ndarray]): each array has shape (Nx2,)
          height, width (int)
  
      Returns:
          ndarray: a bool mask of shape (height, width)
      """
      if len(polygons) == 0:
          # COCOAPI does not support empty polygons
          return np.zeros((height, width)).astype(bool)
      rles = mask_util.frPyObjects(polygons, height, width)
      rle = mask_util.merge(rles)
      return mask_util.decode(rle).astype(bool)
  
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 2 for calling a global function with example usage: polygons_to_bitmask(polygons, height, width) and returns: mask_util, np