original_docstring: Compute the IoU between two sets of bounding boxes
  
      Args:
          gt_boxes: bounding boxes of shape (N, 4) in format (xmin, ymin, xmax, ymax)
          pred_boxes: bounding boxes of shape (M, 4) in format (xmin, ymin, xmax, ymax)
      Returns:
          the IoU matrix of shape (N, M)
      
docstring: Compute the IoU between two sets of bounding boxes
docstring_tokens: Compute the IoU between two sets of bounding boxes
code: def box_iou(gt_boxes: np.ndarray, pred_boxes: np.ndarray) -> np.ndarray:
      """Compute the IoU between two sets of bounding boxes
  
      Args:
          gt_boxes: bounding boxes of shape (N, 4) in format (xmin, ymin, xmax, ymax)
          pred_boxes: bounding boxes of shape (M, 4) in format (xmin, ymin, xmax, ymax)
      Returns:
          the IoU matrix of shape (N, M)
      """
  
      num_gts, num_preds = gt_boxes.shape[0], pred_boxes.shape[0]
      iou_mat = np.zeros((num_gts, num_preds), dtype=np.float32)
      prec_mat = np.zeros((num_gts, num_preds), dtype=np.float32)
      recall_mat = np.zeros((num_gts, num_preds), dtype=np.float32)
  
      if gt_boxes.shape[0] > 0 and pred_boxes.shape[0] > 0:
          l1, t1, r1, b1 = np.split(gt_boxes, 4, axis=1)
          l2, t2, r2, b2 = np.split(pred_boxes, 4, axis=1)
  
          left = np.maximum(l1, l2.T)
          top = np.maximum(t1, t2.T)
          right = np.minimum(r1, r2.T)
          bot = np.minimum(b1, b2.T)
  
          intersection = np.clip(right - left, 0, np.Inf) * np.clip(bot - top, 0, np.Inf)
          union = (r1 - l1) * (b1 - t1) + ((r2 - l2) * (b2 - t2)).T - intersection
          iou_mat = intersection / (union + 1e-6)
          prec_mat = intersection / (np.zeros(num_gts) + ((r2 - l2) * (b2 - t2)).T + 1e-6)
          recall_mat = intersection / ((r1 - l1) * (b1 - t1) + np.zeros(num_preds).T + 1e-6)
  
      return iou_mat, prec_mat, recall_mat
code_tokens: def box_iou ( gt_boxes : np . ndarray , pred_boxes : np . ndarray ) -> np . ndarray : num_gts , num_preds = gt_boxes . shape [ 0 ] , pred_boxes . shape [ 0 ] iou_mat = np . zeros ( ( num_gts , num_preds ) , dtype = np . float32 ) prec_mat = np . zeros ( ( num_gts , num_preds ) , dtype = np . float32 ) recall_mat = np . zeros ( ( num_gts , num_preds ) , dtype = np . float32 ) if gt_boxes . shape [ 0 ] > 0 and pred_boxes . shape [ 0 ] > 0 : l1 , t1 , r1 , b1 = np . split ( gt_boxes , 4 , axis = 1 ) l2 , t2 , r2 , b2 = np . split ( pred_boxes , 4 , axis = 1 ) left = np . maximum ( l1 , l2 . T ) top = np . maximum ( t1 , t2 . T ) right = np . minimum ( r1 , r2 . T ) bot = np . minimum ( b1 , b2 . T ) intersection = np . clip ( right - left , 0 , np . Inf ) * np . clip ( bot - top , 0 , np . Inf ) union = ( r1 - l1 ) * ( b1 - t1 ) + ( ( r2 - l2 ) * ( b2 - t2 ) ) . T - intersection iou_mat = intersection / ( union + 1e-6 ) prec_mat = intersection / ( np . zeros ( num_gts ) + ( ( r2 - l2 ) * ( b2 - t2 ) ) . T + 1e-6 ) recall_mat = intersection / ( ( r1 - l1 ) * ( b1 - t1 ) + np . zeros ( num_preds ) . T + 1e-6 ) return iou_mat , prec_mat , recall_mat
short_docstring: Compute the IoU between two sets of bounding boxes
short_docstring_tokens: Compute the IoU between two sets of bounding boxes
comment: """Compute the IoU between two sets of bounding boxes
  
      Args:
          gt_boxes: bounding boxes of shape (N, 4) in format (xmin, ymin, xmax, ymax)
          pred_boxes: bounding boxes of shape (M, 4) in format (xmin, ymin, xmax, ymax)
      Returns:
          the IoU matrix of shape (N, M)
      """