code: def _match_boxes(
      ious: np.ndarray, thresholds: Union[float, Iterable[float]]
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Match predictions and ground_truth through the pairwise IoUs.
  
      Args:
       ious: a numpy array, ious[i,j] is the iou between the i th prediction and the
         j th ground truth.
       thresholds: the minimum IoU for a pair to be considered match.
  
      Returns:
       (matches_gt, matches_pred): a tuple of ndarray of the following,
        matches_gt: a numpy array with shape [T, G], the matched prediction index
          at each iou threshold (-1 means unmatched)
         matches_pred: a numpy array with shape [T, P], the matched ground truth
          index at each iou threshold (-1 means unmatched)
       where,
        T: num of thresholds
        P: num of predictions
        G: num of ground truth
      """
      if ious.ndim != 2:
          raise ValueError("Input ious list should be a 2d array")
  
      if isinstance(thresholds, float):
          thresholds = [thresholds]
      for threshold in thresholds:
          if threshold < 0:
              raise ValueError(
                  f"Invalid input of threshold = {threshold}, should be"
                  " greater than or equal to 0"
              )
  
      num_iou_thresholds = len(thresholds)
      num_pred = ious.shape[0]
      num_gt = ious.shape[1]
  
      # initialize the matching, and set the type to int.
      matches_gt = -1 * np.ones((num_iou_thresholds, num_gt), dtype=int)
      matches_pred = -1 * np.ones(
          (num_iou_thresholds, num_pred), dtype=int
      )
  
      for i, threshold in enumerate(thresholds):
          # find the matched ground truth, for each prediction
          for pred_idx in range(num_pred):
              # initialize the index of ground truth which will match with the
              # prediction.
              match_gt_index = -1
              # make sure the threshold is < 1.0
              iou = np.minimum(threshold, 1.0 - 1e-10)
  
              for gt_idx in range(num_gt):
                  # if this ground truth is already matched, skip it
                  if matches_gt[i, gt_idx] != -1:
                      continue
  
                  if ious[pred_idx, gt_idx] < iou:
                      continue
  
                  iou = ious[pred_idx, gt_idx]
                  match_gt_index = gt_idx
  
              matches_pred[i, pred_idx] = match_gt_index
              if match_gt_index != -1:
                  matches_gt[i, match_gt_index] = pred_idx
      return (matches_gt, matches_pred)
  
imports: from typing import Callable, Iterable, Union, Tuple, Optional
  import numpy
  from tensorflow_model_analysis.metrics.preprocessors.utils import bounding_box
label_desc: Use image node_id 1 for calling a global function with example usage: _match_boxes(ious, thresholds) and returns: matches_gt,  matches_pred