code: def convert_box_type(
      boxes: BoxType,
      *,
      src_type: Union[str, type] = None,
      dst_type: Union[str, type] = None,
  ) -> BoxType:
      """Convert boxes from source type to destination type.
  
      If ``boxes`` is a instance of BaseBoxes, the ``src_type`` will be set
      as the type of ``boxes``.
  
      Args:
          boxes (np.ndarray or Tensor or :obj:`BaseBoxes`): boxes need to
              convert.
          src_type (str or type, Optional): source box type. Defaults to None.
          dst_type (str or type, Optional): destination box type. Defaults to
              None.
  
      Returns:
          Union[np.ndarray, Tensor, :obj:`BaseBoxes`]: Converted boxes. It's type
          is consistent with the input's type.
      """
      assert dst_type is not None
      dst_type_name, dst_type_cls = get_box_type(dst_type)
  
      is_box_cls = False
      is_numpy = False
      if isinstance(boxes, BaseBoxes):
          src_type_name, _ = get_box_type(type(boxes))
          is_box_cls = True
      elif isinstance(boxes, (Tensor, np.ndarray)):
          assert src_type is not None
          src_type_name, _ = get_box_type(src_type)
          if isinstance(boxes, np.ndarray):
              is_numpy = True
      else:
          raise TypeError(
              "boxes must be a instance of BaseBoxes, Tensor or "
              f"ndarray, but get {type(boxes)}."
          )
  
      if src_type_name == dst_type_name:
          return boxes
  
      converter_name = src_type_name + "2" + dst_type_name
      assert (
          converter_name in box_converters
      ), "Convert function hasn't been registered in box_converters."
      converter = box_converters[converter_name]
  
      if is_box_cls:
          boxes = converter(boxes.tensor)
          return dst_type_cls(boxes)
      elif is_numpy:
          boxes = converter(torch.from_numpy(boxes))
          return boxes.numpy()
      else:
          return converter(boxes)
  
file_path: mmdetection/mmdet/structures/bbox/box_type.py
imports: from typing import Callable, Optional, Tuple, Type, Union
  import numpy
  import torch
  from torch import Tensor
  from .base_boxes import BaseBoxes
label_desc: Use image node_id 6 for calling a global function with example usage: convert_box_type(boxes) and returns: boxes, dst_type_cls, boxes, converter