code: def polygons_to_mask(polys, height, width):
      """
      Convert polygons to binary masks.
  
      Args:
          polys: a list of nx2 float array. Each array contains many (x, y) coordinates.
  
      Returns:
          a binary matrix of (height, width)
      """
      polys = [p.flatten().tolist() for p in polys]
      assert len(polys) > 0, "Polygons are empty!"
  
      import pycocotools.mask as cocomask
  
      rles = cocomask.frPyObjects(polys, height, width)
      rle = cocomask.merge(rles)
      return cocomask.decode(rle)
  
file_path: tensorpack/examples/FasterRCNN/common.py
imports: import numpy
  import cv2
  from tensorpack.dataflow import RNGDataFlow
  from tensorpack.dataflow.imgaug import ImageAugmentor, ResizeTransform
label_desc: Use image node_id 3 for calling a global function with example usage: polygons_to_mask(polys, height, width) and returns: cocomask