class_docstr: The MMOCR Text Detection Local Visualizer.
  
  Args:
      name (str): Name of the instance. Defaults to 'visualizer'.
      image (np.ndarray, optional): the origin image to draw. The format
          should be RGB. Defaults to None.
      vis_backends (list, optional): Visual backend config list.
          Default to None.
      save_dir (str, optional): Save file dir for all storage backends.
          If it is None, the backend storage will not save any data.
      fig_save_cfg (dict): Keyword parameters of figure for saving.
          Defaults to empty dict.
      fig_show_cfg (dict): Keyword parameters of figure for showing.
          Defaults to empty dict.
      is_openset (bool, optional): Whether the visualizer is used in
          OpenSet. Defaults to False.
      font_families (Union[str, List[str]]): The font families of labels.
          Defaults to 'sans-serif'.
      font_properties (Union[str, FontProperties], optional):
          The font properties of texts. The format should be a path str
          to font file or a `font_manager.FontProperties()` object.
          If you want to draw Chinese texts, you need to prepare
          a font file that can show Chinese characters properly.
          For example: `simhei.ttf`,`simsun.ttc`,`simkai.ttf` and so on.
          Then set font_properties=matplotlib.font_manager.FontProperties
          (fname='path/to/font_file') or font_properties='path/to/font_file'
          This function need mmengine version >=0.6.0.
          Defaults to None.
docstr: Draw labels on image.
  
  Args:
      image (np.ndarray): The origin image to draw. The format
          should be RGB.
      labels (Union[np.ndarray, torch.Tensor]): The labels to draw.
      bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
      colors (Union[str, Sequence[str]]): The colors of labels.
          ``colors`` can have the same length with labels or just single
          value. If ``colors`` is single value, all the labels will have
          the same colors. Refer to `matplotlib.colors` for full list of
          formats that are accepted. Defaults to 'k'.
      font_size (Union[int, float]): The font size of labels. Defaults
          to 10.
      auto_font_size (bool): Whether to automatically adjust font size.
          Defaults to False.
      font_families (Union[str, List[str]]): The font families of labels.
          Defaults to 'sans-serif'.
      font_properties (Union[str, FontProperties], optional):
          The font properties of texts. The format should be a path str
          to font file or a `font_manager.FontProperties()` object.
          If you want to draw Chinese texts, you need to prepare
          a font file that can show Chinese characters properly.
          For example: `simhei.ttf`,`simsun.ttc`,`simkai.ttf` and so on.
          Then set font_properties=matplotlib.font_manager.FontProperties
          (fname='path/to/font_file') or
          font_properties='path/to/font_file'.
          This function need mmengine version >=0.6.0.
          Defaults to None.
docstr_tok: ["Draw","labels","on","image",".","Args",":","image","(","np.ndarray",")",":","The","origin","image","to","draw",".","The","format","should","be","RGB",".","labels","(","Union","[","np.ndarray",",","torch.Tensor","]",")",":","The","labels","to","draw",".","bboxes","(","Union","[","np.ndarray",",","torch.Tensor","]",")",":","The","bboxes","to","draw",".","colors","(","Union","[","str",",","Sequence","[","str","]","]",")",":","The","colors","of","labels",".","``","colors","``","can","have","the","same","length","with","labels","or","just","single","value",".","If","``","colors","``","is","single","value",",","all","the","labels","will","have","the","same","colors",".","Refer","to","`","matplotlib.colors","`","for","full","list","of","formats","that","are","accepted",".","Defaults","to","'","k","'",".","font_size","(","Union","[","int",",","float","]",")",":","The","font","size","of","labels",".","Defaults","to","10.","auto_font_size","(","bool",")",":","Whether","to","automatically","adjust","font","size",".","Defaults","to","False",".","font_families","(","Union","[","str",",","List","[","str","]","]",")",":","The","font","families","of","labels",".","Defaults","to","'sans-serif","'",".","font_properties","(","Union","[","str",",","FontProperties","]",",","optional",")",":","The","font","properties","of","texts",".","The","format","should","be","a","path","str","to","font","file","or","a","`","font_manager.FontProperties","(",")","`","object",".","If","you","want","to","draw","Chinese","texts",",","you","need","to","prepare","a","font","file","that","can","show","Chinese","characters","properly",".","For","example",":","`","simhei.ttf","`",",","`","simsun.ttc","`",",","`","simkai.ttf","`","and","so","on",".","Then","set","font_properties=matplotlib.font_manager.FontProperties","(","fname='path\/to\/font_file","'",")","or","font_properties='path\/to\/font_file","'",".","This","function","need","mmengine","version",">","=0.6.0",".","Defaults","to","None","."]
code: def get_labels_image(
      self,
      image: np.ndarray,
      labels: Union[np.ndarray, torch.Tensor],
      bboxes: Union[np.ndarray, torch.Tensor],
      colors: Union[str, Sequence[str]] = "k",
      font_size: Union[int, float] = 10,
      auto_font_size: bool = False,
      font_families: Union[str, List[str]] = "sans-serif",
      font_properties: Optional[Union[str, FontProperties]] = None,
  ) -> np.ndarray:
      """Draw labels on image.
  
      Args:
          image (np.ndarray): The origin image to draw. The format
              should be RGB.
          labels (Union[np.ndarray, torch.Tensor]): The labels to draw.
          bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
          colors (Union[str, Sequence[str]]): The colors of labels.
              ``colors`` can have the same length with labels or just single
              value. If ``colors`` is single value, all the labels will have
              the same colors. Refer to `matplotlib.colors` for full list of
              formats that are accepted. Defaults to 'k'.
          font_size (Union[int, float]): The font size of labels. Defaults
              to 10.
          auto_font_size (bool): Whether to automatically adjust font size.
              Defaults to False.
          font_families (Union[str, List[str]]): The font families of labels.
              Defaults to 'sans-serif'.
          font_properties (Union[str, FontProperties], optional):
              The font properties of texts. The format should be a path str
              to font file or a `font_manager.FontProperties()` object.
              If you want to draw Chinese texts, you need to prepare
              a font file that can show Chinese characters properly.
              For example: `simhei.ttf`,`simsun.ttc`,`simkai.ttf` and so on.
              Then set font_properties=matplotlib.font_manager.FontProperties
              (fname='path/to/font_file') or
              font_properties='path/to/font_file'.
              This function need mmengine version >=0.6.0.
              Defaults to None.
      """
      if not labels and not bboxes:
          return image
      if colors is not None and isinstance(colors, (list, tuple)):
          size = math.ceil(len(labels) / len(colors))
          colors = (colors * size)[: len(labels)]
      if auto_font_size:
          assert font_size is not None and isinstance(
              font_size, (int, float)
          )
          font_size = (bboxes[:, 2:] - bboxes[:, :2]).min(
              -1
          ) * font_size
          font_size = font_size.tolist()
      self.set_image(image)
      self.draw_texts(
          labels,
          (bboxes[:, :2] + bboxes[:, 2:]) / 2,
          vertical_alignments="center",
          horizontal_alignments="center",
          colors="k",
          font_sizes=font_size,
          font_families=font_families,
          font_properties=font_properties,
      )
      return self.get_image()
  
file_path: mmocr/mmocr/visualization/base_visualizer.py
imports: import math
  from typing import List, Optional, Sequence, Union
  import numpy
  import torch
  from matplotlib.font_manager import FontProperties
  from mmengine.visualization import Visualizer
  from mmocr.registry import VISUALIZERS
label_desc: Use image node_id 3 for calling the BaseLocalVisualizer obj's underlying member method code with example usage: obj.get_labels_image(image, labels, bboxes, colors, font_size, auto_font_size, font_families, font_properties) and returns: self, image