code: def overlay_mask(self, image, predictions):
          
          masks = predictions.get_field("mask").numpy()
          labels = predictions.get_field("labels")
  
          colors = self.compute_colors_for_labels(labels).tolist()
  
          for mask, color in zip(masks, colors):
              thresh = mask[0, :, :, None]
              contours, hierarchy = cv2_util.findContours(
                  thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
              )
              image = cv2.drawContours(image, contours, -1, color, 3)
  
          composite = image
  
          return composite
docs: Adds the instances contours for each predicted object.
          Each label has a different color.
  
          Arguments:
              image (np.ndarray): an image as returned by OpenCV
              predictions (BoxList): the result of the computation by the model.
                  It should contain the field `mask` and `labels`.