code: def draw_masks(
      image, masks, colors, thresh: float = 0.7, alpha: float = 0.5
  ):
      np_image = np.array(image)
      masks = np.where(masks > thresh, True, False)
  
      # colors = np.array(colors)
      img_to_draw = np.copy(np_image)
      # TODO: There might be a way to vectorize this
      for mask, color in zip(masks, colors):
          img_to_draw[mask] = color
  
      out = np_image * (1 - alpha) + img_to_draw * alpha
      return fromarray(out.astype(np.uint8))
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/retinaNet/draw_box_utils.py
imports: from PIL.Image import Image, fromarray
  import PIL.ImageDraw
  import PIL.ImageFont
  from PIL import ImageColor
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: draw_masks(image, masks, colors, thresh, alpha) and returns: fromarray