code: def draw_rpn_pred_combined_loss(pred_dict, image, top_k=10):
      target = pred_dict["rpn_prediction"]["rpn_cls_target"]
      in_target = target >= 0
      bbox_pred = pred_dict["rpn_prediction"]["rpn_bbox_pred"][
          in_target
      ]
      all_anchors = pred_dict["all_anchors"][in_target]
      target = target[in_target]
  
      in_foreground = target > 0
  
      ce_loss = pred_dict["rpn_prediction"]["cross_entropy_per_anchor"][
          in_foreground
      ]
  
      bbox_pred = bbox_pred[in_foreground]
      all_anchors = all_anchors[in_foreground]
  
      reg_loss = pred_dict["rpn_prediction"]["reg_loss_per_anchor"]
  
      combined_loss = ce_loss + reg_loss
  
      bbox_final = decode(all_anchors, bbox_pred)
  
      image_pil, draw = get_image_draw(image)
  
      for bbox, loss in zip(bbox_final, combined_loss):
          bbox = list(bbox)
          draw.rectangle(
              bbox, fill=(30, 0, 240, 20), outline=(30, 0, 240, 100)
          )
          draw.text(
              tuple([bbox[0], bbox[1]]),
              text="{:.2f}".format(loss),
              font=font,
              fill=(0, 0, 0, 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 18 for calling a global function with example usage: draw_rpn_pred_combined_loss(pred_dict, image, top_k) and returns: image_pil