code: def _get_iou(bb1: Dict[str, Any], bb2: Dict[str, Any]) -> float:
      """
      Calculate the Intersection over Union (IoU) of two bounding boxes.
      I've modified this to calculate overlap ratio in the line:
      iou = np.clip(intersection_area / float(min(bb1_area,bb2_area)),0.0,1.0)
  
      Parameters
      ----------
      bb1 : dict
          Keys: {'x1', 'x2', 'y1', 'y2'}
          The (x1, y1) position is at the top left corner,
          the (x2, y2) position is at the bottom right corner
      bb2 : dict
          Keys: {'x1', 'x2', 'y1', 'y2'}
          The (x, y) position is at the top left corner,
          the (x2, y2) position is at the bottom right corner
      Returns
      -------
      float
          in [0, 1]
      """
      # determine the coordinates of the intersection rectangle
      x_left = max(bb1["x1"], bb2["x1"])
      y_top = max(bb1["y1"], bb2["y1"])
      x_right = min(bb1["x2"], bb2["x2"])
      y_bottom = min(bb1["y2"], bb2["y2"])
  
      if x_right < x_left or y_bottom < y_top:
          return 0.0
  
      # The intersection of two axis-aligned bounding boxes is always an
      # axis-aligned bounding box
      intersection_area = (x_right - x_left) * (y_bottom - y_top)
  
      # compute the area of both AABBs
      bb1_area = (bb1["x2"] - bb1["x1"]) * (bb1["y2"] - bb1["y1"])
      bb2_area = (bb2["x2"] - bb2["x1"]) * (bb2["y2"] - bb2["y1"])
  
      # compute the intersection over union by taking the intersection
      # area and dividing it by the sum of prediction + ground-truth
      # areas - the interesection area
      iou = intersection_area / float(
          bb1_area + bb2_area - intersection_area
      )
      # There are some hyper-parameters here like consider tile area/object area
      return iou
  
imports: import warnings
  from cleanlab.internal.constants import ALPHA, CUSTOM_SCORE_WEIGHT_BADLOC, CUSTOM_SCORE_WEIGHT_OVERLOOKED, CUSTOM_SCORE_WEIGHT_SWAP, EUC_FACTOR, HIGH_PROBABILITY_THRESHOLD, LOW_PROBABILITY_THRESHOLD, MAX_ALLOWED_BOX_PRUNE, TINY_VALUE, TEMPERATURE, LABEL_OVERLAP_THRESHOLD
  import copy
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, TypeVar
  import numpy
  from cleanlab.internal.object_detection_utils import softmin1d, assert_valid_aggregation_weights, assert_valid_inputs
label_desc: Use image node_id 14 for calling a global function with example usage: _get_iou(bb1, bb2) and returns: iou, int