code: def draw_positive_anchors(pred_dict, image):
      """
      Draws positive anchors used as "correct" in RPN
      """
      anchors = pred_dict["all_anchors"]
      correct_labels = pred_dict["rpn_prediction"]["rpn_cls_target"]
      correct_labels = np.squeeze(
          correct_labels.reshape(anchors.shape[0], 1)
      )
      positive_indices = np.nonzero(correct_labels > 0)[0]
      positive_anchors = anchors[positive_indices]
      correct_labels = correct_labels[positive_indices]
      gt_bboxes = pred_dict["gt_bboxes"]
      max_overlap = pred_dict["rpn_prediction"]["rpn_max_overlap"]
      max_overlap = np.squeeze(max_overlap.reshape(anchors.shape[0], 1))
      overlap_iou = max_overlap[positive_indices]
  
      image_pil, draw = get_image_draw(image)
  
      logger.debug(
          "We have {} positive_anchors".format(
              positive_anchors.shape[0]
          )
      )
      logger.debug("GT boxes: {}".format(gt_bboxes))
  
      for label, positive_anchor in zip(
          list(overlap_iou), positive_anchors
      ):
          draw.rectangle(
              list(positive_anchor),
              fill=(255, 0, 0, 40),
              outline=(0, 255, 0, 100),
          )
          x, y = positive_anchor[:2]
          x = max(x, 0)
          y = max(y, 0)
          draw.text(
              tuple([x, y]),
              text=str(label),
              font=font,
              fill=(0, 255, 0, 255),
          )
  
      for gt_box in gt_bboxes:
          draw.rectangle(
              list(gt_box[:4]),
              fill=(0, 0, 255, 60),
              outline=(0, 0, 255, 150),
          )
  
      return image_pil
  
imports: import io
  import numpy
  import os
  import logging
  import PIL.Image
  import PIL.ImageDraw
  import PIL.ImageFont
  import tensorflow
  from .bbox_overlap import bbox_overlap
  from .bbox_transform import decode
  from base64 import b64encode
  from sys import stdout
label_desc: Use image node_id 8 for calling a global function with example usage: draw_positive_anchors(pred_dict, image) and returns: image_pil