code: def draw_anchor_batch(pred_dict, image):
      """
      Draw anchors used in the batch for RPN.
      """
      anchors = pred_dict["all_anchors"]
      targets = pred_dict["rpn_prediction"]["rpn_cls_target"]
  
      in_batch_idx = targets >= 0
      anchors = anchors[in_batch_idx]
      targets = targets[in_batch_idx]
  
      image_pil, draw = get_image_draw(image)
  
      for anchor, target in zip(anchors, targets):
          if target == 1:
              draw.rectangle(
                  list(anchor),
                  fill=(20, 200, 10, 15),
                  outline=(20, 200, 10, 30),
              )
          else:
              draw.rectangle(
                  list(anchor),
                  fill=(200, 10, 170, 10),
                  outline=(200, 10, 170, 30),
              )
  
      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 12 for calling a global function with example usage: draw_anchor_batch(pred_dict, image) and returns: image_pil