code: def bbox_mapping_back(
      bboxes: Tensor,
      img_shape: Tuple[int],
      scale_factor: Union[float, Tuple[float]],
      flip: bool,
      flip_direction: str = "horizontal",
  ) -> Tensor:
      """Map bboxes from testing scale to original image scale."""
      new_bboxes = (
          bbox_flip(bboxes, img_shape, flip_direction)
          if flip
          else bboxes
      )
      new_bboxes = new_bboxes.view(-1, 4) / new_bboxes.new_tensor(
          scale_factor
      )
      return new_bboxes.view(bboxes.shape)
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from mmdet.structures.bbox import BaseBoxes
label_desc: Use image node_id 4 for calling a global function with example usage: bbox_mapping_back(bboxes, img_shape, scale_factor, flip, flip_direction) and returns: new_bboxes