code: def draw_top_proposals(
      pred_dict,
      image,
      min_score=0.8,
      max_display=20,
      top_k=True,
      used_in_batch=False,
  ):
      tf.logging.debug(
          "Top proposals (blue = matches target in batch, "
          "green = matches background in batch, red = ignored in batch)"
      )
      proposal_prediction = pred_dict["rpn_prediction"][
          "proposal_prediction"
      ]
      if top_k:
          scores = proposal_prediction["sorted_top_scores"]
          proposals = proposal_prediction["sorted_top_proposals"]
      else:
          scores = proposal_prediction["scores"]
          proposals = proposal_prediction["proposals"]
  
      min_score_idx = scores > min_score
      scores = scores[min_score_idx]
      proposals = proposals[min_score_idx]
  
      top_scores_idx = np.argsort(scores)[::-1][:max_display]
      scores = scores[top_scores_idx]
      proposals = proposals[top_scores_idx]
  
      image_pil, draw = get_image_draw(image)
  
      for proposal, score in zip(proposals, scores):
          bbox = list(proposal)
          if (bbox[2] - bbox[0] <= 0) or (bbox[3] - bbox[1] <= 0):
              logger.debug(
                  "Ignoring top proposal without positive area: "
                  "{}, score: {}".format(proposal, score)
              )
              continue
  
          draw.rectangle(
              list(bbox), fill=(0, 255, 0, 20), outline=(0, 255, 0, 80)
          )
          x, y = bbox[:2]
          x = max(x, 0)
          y = max(y, 0)
  
          draw.text(
              tuple([x, y]),
              text=str(score),
              font=font,
              fill=(30, 30, 30, 80),
          )
  
      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 14 for calling a global function with example usage: draw_top_proposals(pred_dict, image, min_score, max_display, top_k, used_in_batch) and returns: image_pil