code: def rescale_bbox(
      bbox: np.ndarray, scale_factor: Tuple[int, int], mode: str = "mul"
  ) -> np.ndarray:
      """Rescale a bounding box according to scale_factor.
  
      The behavior is different depending on the mode. When mode is 'mul', the
      coordinates will be multiplied by scale_factor, which is usually used in
      preprocessing transforms such as :func:`Resize`.
      The coordinates will be divided by scale_factor if mode is 'div'. It can be
      used in postprocessors to recover the bbox in the original image size.
  
      Args:
          bbox (ndarray): A bounding box [x1, y1, x2, y2].
          scale_factor (tuple(int, int)): (w_scale, h_scale).
          model (str): Rescale mode. Can be 'mul' or 'div'. Defaults to 'mul'.
  
      Returns:
          np.ndarray: Rescaled bbox.
      """
      assert mode in ["mul", "div"]
      bbox = np.array(bbox, dtype=np.float32)
      bbox_shape = bbox.shape
      reshape_bbox = bbox.reshape(-1, 2)
      scale_factor = np.array(scale_factor, dtype=float)
      if mode == "div":
          scale_factor = 1 / scale_factor
      bbox = (reshape_bbox * scale_factor[None]).reshape(bbox_shape)
      return bbox
  
file_path: mmocr/mmocr/utils/bbox_utils.py
imports: from typing import List, Tuple
  import numpy
  from shapely.geometry import LineString, Point
  from mmocr.utils.check_argument import is_type_list
  from mmocr.utils.point_utils import point_distance, points_center
  from mmocr.utils.typing_utils import ArrayLike
label_desc: Use image node_id 1 for calling a global function with example usage: rescale_bbox(bbox, scale_factor, mode) and returns: bbox