code: def draw_final_outputs_blackwhite(img, results):
      """
      Args:
          results: [DetectionResult]
      """
      img_bw = img.mean(axis=2)
      img_bw = np.stack([img_bw] * 3, axis=2)
  
      if len(results) == 0:
          return img_bw
  
      boxes = np.asarray([r.box for r in results])
  
      all_masks = [r.mask for r in results]
      if all_masks[0] is not None:
          m = all_masks[0] > 0
          for m2 in all_masks[1:]:
              m = m | (m2 > 0)
          img_bw[m] = img[m]
  
      tags = [
          "{},{:.2f}".format(cfg.DATA.CLASS_NAMES[r.class_id], r.score)
          for r in results
      ]
      ret = viz.draw_boxes(img_bw, boxes, tags)
      return ret
  
file_path: tensorpack/examples/FasterRCNN/viz.py
imports: import numpy
  from tensorpack.utils import viz
  from tensorpack.utils.palette import PALETTE_RGB
  from config import config
  from utils.np_box_ops import area
  from utils.np_box_ops import iou
  from common import polygons_to_mask
label_desc: Use image node_id 5 for calling a global function with example usage: draw_final_outputs_blackwhite(img, results) and returns: ret, img_bw