code: def draw_rcnn_cls_batch(
      pred_dict, image, foreground=True, background=True
  ):
      logger.debug(
          "Show the proposals used for training classifier. "
          "(GT labels are -1 from cls targets)"
      )
      logger.debug("blue => GT, green => foreground, red => background")
  
      proposals = pred_dict["rpn_prediction"]["proposals"]
      cls_targets = pred_dict["classification_prediction"]["target"][
          "cls"
      ]
      gt_bboxes = pred_dict["gt_bboxes"]
  
      batch_idx = np.where(cls_targets != -1)[0]
      bboxes = proposals[batch_idx]
      cls_targets = cls_targets[batch_idx]
  
      image_pil, draw = get_image_draw(image)
  
      for bbox, cls_target in zip(bboxes, cls_targets):
          bbox = list(bbox.astype(int))
          if cls_target > 0:
              fill = (0, 255, 0, 20)
              outline = (0, 255, 0, 100)
          else:
              fill = (255, 0, 0, 20)
              outline = (255, 0, 0, 100)
  
          draw.rectangle(bbox, fill=fill, outline=outline)
          draw.text(
              tuple(bbox[:2]),
              text=str(int(cls_target)),
              font=font,
              fill=fill,
          )
  
      for gt_box in gt_bboxes:
          draw.rectangle(
              list(gt_box[:4]),
              fill=(0, 0, 255, 20),
              outline=(0, 0, 255, 100),
          )
          draw.text(
              tuple(gt_box[:2]),
              text=str(gt_box[4]),
              font=font,
              fill=(0, 0, 255, 255),
          )
  
      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 23 for calling a global function with example usage: draw_rcnn_cls_batch(pred_dict, image, foreground, background) and returns: image_pil