code: def draw_ssd_target_proposals(pred_dict, image):
      image_pil, draw = get_image_draw(image)
  
      all_anchors = pred_dict["target"]["anchors"]
      bbox_pred = pred_dict["loc_pred"]
      bbox_targets = pred_dict["target"]["cls"]
  
      bboxes = decode(all_anchors, bbox_pred)
  
      fill_alpha = 70
  
      for proposal, target in zip(bboxes, bbox_targets):
          bbox = list(proposal)
          if (bbox[2] - bbox[0] <= 0) or (bbox[3] - bbox[1] <= 0):
              logger.debug(
                  "Proposal has negative area: {}".format(bbox)
              )
              continue
  
          if target == 0:
              # Background.
              fill = (255, 0, 0, fill_alpha)
              outline = (255, 0, 0, 100)
          elif target > 0:
              # Foreground.
              fill = (0, 255, 0, fill_alpha)
              outline = (0, 255, 0, 100)
          else:
              # Unknown.
              continue
  
          draw.rectangle(bbox, fill=fill, outline=outline)
  
          fill_alpha -= 5
  
      gt_bboxes = pred_dict["gt_bboxes"]
      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 31 for calling a global function with example usage: draw_ssd_target_proposals(pred_dict, image) and returns: image_pil