code: def fastrcnn_predictions(boxes, scores):
      """
      Generate final results from predictions of all proposals.
  
      Args:
          boxes: n#classx4 floatbox in float32
          scores: nx#class
  
      Returns:
          boxes: Kx4
          scores: K
          labels: K
      """
      assert boxes.shape[1] == scores.shape[1]
      boxes = tf.transpose(boxes, [1, 0, 2])[1:, :, :]  # #catxnx4
      scores = tf.transpose(scores[:, 1:], [1, 0])  # #catxn
  
      max_coord = tf.reduce_max(boxes)
      filtered_ids = tf.where(
          scores > cfg.TEST.RESULT_SCORE_THRESH
      )  # Fx2
      filtered_boxes = tf.gather_nd(boxes, filtered_ids)  # Fx4
      filtered_scores = tf.gather_nd(scores, filtered_ids)  # F,
      cls_per_box = tf.slice(filtered_ids, [0, 0], [-1, 1])
      offsets = tf.cast(cls_per_box, tf.float32) * (
          max_coord + 1
      )  # F,1
      nms_boxes = filtered_boxes + offsets
      selection = tf.image.non_max_suppression(
          nms_boxes,
          filtered_scores,
          cfg.TEST.RESULTS_PER_IM,
          cfg.TEST.FRCNN_NMS_THRESH,
      )
      final_scores = tf.gather(
          filtered_scores, selection, name="scores"
      )
      final_labels = tf.add(
          tf.gather(cls_per_box[:, 0], selection), 1, name="labels"
      )
      final_boxes = tf.gather(filtered_boxes, selection, name="boxes")
      return final_boxes, final_scores, final_labels
  
imports: import tensorflow
  from tensorpack import tfv1
  from tensorpack.models import Conv2D, FullyConnected, layer_register
  from tensorpack.tfutils.argscope import argscope
  from tensorpack.tfutils.scope_utils import under_name_scope
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.utils.argtools import memoized_method
  from config import config
  from utils.box_ops import pairwise_iou
  from .model_box import decode_bbox_target, encode_bbox_target
  from .backbone import GroupNorm
label_desc: Use image node_id 5 for calling a global function with example usage: fastrcnn_predictions(boxes, scores) and returns: final_boxes,  final_scores,  final_labels