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.
      with_poly (bool): Whether to draw polygons. Defaults to True.
      with_bbox (bool): Whether to draw bboxes. Defaults to False.
      vis_backends (list, optional): Visual backend config list.
          Defaults 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.
      gt_color (Union[str, tuple, list[str], list[tuple]]): The
          colors of GT polygons and bboxes. ``colors`` can have the same
          length with lines or just single value. If ``colors`` is single
          value, all the lines will have the same colors. Refer to
          `matplotlib.colors` for full list of formats that are accepted.
          Defaults to 'g'.
      gt_ignored_color (Union[str, tuple, list[str], list[tuple]]): The
          colors of ignored GT polygons and bboxes. ``colors`` can have
          the same length with lines or just single value. If ``colors``
          is single value, all the lines will have the same colors. Refer
          to `matplotlib.colors` for full list of formats that are accepted.
          Defaults to 'b'.
      pred_color (Union[str, tuple, list[str], list[tuple]]): The
          colors of pred polygons and bboxes. ``colors`` can have the same
          length with lines or just single value. If ``colors`` is single
          value, all the lines will have the same colors. Refer to
          `matplotlib.colors` for full list of formats that are accepted.
          Defaults to 'r'.
      line_width (int, float): The linewidth of lines. Defaults to 2.
      alpha (float): The transparency of bboxes or polygons. Defaults to 0.8.
docstr: Draw bboxes and polygons on image.
  
  Args:
      image (np.ndarray): The origin image to draw.
      bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
      polygons (Sequence[np.ndarray]): The polygons to draw.
      color (Union[str, tuple, list[str], list[tuple]]): The
          colors of polygons and bboxes. ``colors`` can have the same
          length with lines or just single value. If ``colors`` is
          single value, all the lines will have the same colors. Refer
          to `matplotlib.colors` for full list of formats that are
          accepted. Defaults to 'g'.
  
  Returns:
      np.ndarray: The image with bboxes and polygons drawn.
code: def _draw_instances(
      self,
      image: np.ndarray,
      bboxes: Union[np.ndarray, torch.Tensor],
      polygons: Sequence[np.ndarray],
      color: Union[str, Tuple, List[str], List[Tuple]] = "g",
  ) -> np.ndarray:
      """Draw bboxes and polygons on image.
  
      Args:
          image (np.ndarray): The origin image to draw.
          bboxes (Union[np.ndarray, torch.Tensor]): The bboxes to draw.
          polygons (Sequence[np.ndarray]): The polygons to draw.
          color (Union[str, tuple, list[str], list[tuple]]): The
              colors of polygons and bboxes. ``colors`` can have the same
              length with lines or just single value. If ``colors`` is
              single value, all the lines will have the same colors. Refer
              to `matplotlib.colors` for full list of formats that are
              accepted. Defaults to 'g'.
  
      Returns:
          np.ndarray: The image with bboxes and polygons drawn.
      """
      if polygons is not None and self.with_poly:
          polygons = [polygon.reshape(-1, 2) for polygon in polygons]
          image = self.get_polygons_image(
              image,
              polygons,
              filling=True,
              colors=color,
              alpha=self.alpha,
          )
      if bboxes is not None and self.with_bbox:
          image = self.get_bboxes_image(
              image,
              bboxes,
              colors=color,
              line_width=self.line_width,
              alpha=self.alpha,
          )
      return image
  
file_path: mmocr/mmocr/visualization/textdet_visualizer.py
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import mmcv
  import numpy
  import torch
  from mmocr.registry import VISUALIZERS
  from mmocr.structures import TextDetDataSample
  from .base_visualizer import BaseLocalVisualizer
label_desc: Use image node_id 2 for calling the TextDetLocalVisualizer obj's underlying member method code with example usage: obj._draw_instances(image, bboxes, polygons, color) and returns: image