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 bboxes on image.
  
  Args:
      image (np.ndarray): The origin image to draw. The format
          should be RGB.
      bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
      colors (Union[str, Sequence[str]]): The colors of bboxes.
          ``colors`` can have the same length with bboxes or just single
          value. If ``colors`` is single value, all the bboxes will have
          the same colors. Refer to `matplotlib.colors` for full list of
          formats that are accepted. Defaults to 'g'.
      filling (bool): Whether to fill the bboxes. Defaults to False.
      line_width (Union[int, float]): The line width of bboxes.
          Defaults to 0.5.
      alpha (float): The alpha of bboxes. Defaults to 0.5.
  
  Returns:
      np.ndarray: The image with bboxes drawn.
docstr_tok: ["Draw","bboxes","on","image",".","Args",":","image","(","np.ndarray",")",":","The","origin","image","to","draw",".","The","format","should","be","RGB",".","bboxes","(","Union","[","np.ndarray",",","torch.Tensor","]",")",":","The","bboxes","to","draw",".","colors","(","Union","[","str",",","Sequence","[","str","]","]",")",":","The","colors","of","bboxes",".","``","colors","``","can","have","the","same","length","with","bboxes","or","just","single","value",".","If","``","colors","``","is","single","value",",","all","the","bboxes","will","have","the","same","colors",".","Refer","to","`","matplotlib.colors","`","for","full","list","of","formats","that","are","accepted",".","Defaults","to","'","g","'",".","filling","(","bool",")",":","Whether","to","fill","the","bboxes",".","Defaults","to","False",".","line_width","(","Union","[","int",",","float","]",")",":","The","line","width","of","bboxes",".","Defaults","to","0.5.","alpha","(","float",")",":","The","alpha","of","bboxes",".","Defaults","to","0.5",".","Returns",":","np.ndarray",":","The","image","with","bboxes","drawn","."]
code: def get_bboxes_image(
      self: Visualizer,
      image: np.ndarray,
      bboxes: Union[np.ndarray, torch.Tensor],
      colors: Union[str, Sequence[str]] = "g",
      filling: bool = False,
      line_width: Union[int, float] = 0.5,
      alpha: float = 0.5,
  ) -> np.ndarray:
      """Draw bboxes on image.
  
      Args:
          image (np.ndarray): The origin image to draw. The format
              should be RGB.
          bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
          colors (Union[str, Sequence[str]]): The colors of bboxes.
              ``colors`` can have the same length with bboxes or just single
              value. If ``colors`` is single value, all the bboxes will have
              the same colors. Refer to `matplotlib.colors` for full list of
              formats that are accepted. Defaults to 'g'.
          filling (bool): Whether to fill the bboxes. Defaults to False.
          line_width (Union[int, float]): The line width of bboxes.
              Defaults to 0.5.
          alpha (float): The alpha of bboxes. Defaults to 0.5.
  
      Returns:
          np.ndarray: The image with bboxes drawn.
      """
      if colors is not None and isinstance(colors, (list, tuple)):
          size = math.ceil(len(bboxes) / len(colors))
          colors = (colors * size)[: len(bboxes)]
      self.set_image(image)
      if filling:
          self.draw_bboxes(
              bboxes,
              face_colors=colors,
              edge_colors=colors,
              line_widths=line_width,
              alpha=alpha,
          )
      else:
          self.draw_bboxes(
              bboxes,
              edge_colors=colors,
              line_widths=line_width,
              alpha=alpha,
          )
      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 5 for calling the BaseLocalVisualizer obj's underlying member method code with example usage: obj.get_bboxes_image(image, bboxes, colors, filling, line_width, alpha) and returns: self