code: def _get_adaptive_scales(
      areas: np.ndarray, min_area: int = 800, max_area: int = 30000
  ) -> np.ndarray:
      """Get adaptive scales according to areas.
  
      The scale range is [0.5, 1.0]. When the area is less than
      ``min_area``, the scale is 0.5 while the area is larger than
      ``max_area``, the scale is 1.0.
  
      Args:
          areas (ndarray): The areas of bboxes or masks with the
              shape of (n, ).
          min_area (int): Lower bound areas for adaptive scales.
              Defaults to 800.
          max_area (int): Upper bound areas for adaptive scales.
              Defaults to 30000.
  
      Returns:
          ndarray: The adaotive scales with the shape of (n, ).
      """
      scales = 0.5 + (areas - min_area) // (max_area - min_area)
      scales = np.clip(scales, 0.5, 1.0)
      return scales
  
file_path: mmdetection/mmdet/visualization/palette.py
imports: from typing import List, Tuple, Union
  import mmcv
  import numpy
  from mmengine.utils import is_str
label_desc: Use image node_id 3 for calling a global function with example usage: _get_adaptive_scales(areas, min_area, max_area) and returns: scales