docstr: Draw instances on image.
  
  Args:
      image (np.ndarray): The origin image to draw. The format
          should be RGB.
      bboxes (np.ndarray, torch.Tensor): The bboxes to draw. The shape of
          bboxes should be (N, 4), where N is the number of texts.
      polygons (Sequence[np.ndarray]): The polygons to draw. The length
          of polygons should be the same as the number of bboxes.
      edge_labels (np.ndarray, torch.Tensor): The edge labels to draw.
          The shape of edge_labels should be (N, N), where N is the
          number of texts.
      texts (Sequence[str]): The texts to draw. The length of texts
          should be the same as the number of bboxes.
      class_names (dict): The class names for bbox labels.
      is_openset (bool): Whether the dataset is openset. Default: False.
  
  Returns:
      np.ndarray: The image with instances drawn.
code: def _draw_instances(
      self,
      image: np.ndarray,
      bboxes: Union[np.ndarray, torch.Tensor],
      polygons: Sequence[np.ndarray],
      texts: Sequence[str],
  ) -> np.ndarray:
      """Draw instances on image.
  
      Args:
          image (np.ndarray): The origin image to draw. The format
              should be RGB.
          bboxes (np.ndarray, torch.Tensor): The bboxes to draw. The shape of
              bboxes should be (N, 4), where N is the number of texts.
          polygons (Sequence[np.ndarray]): The polygons to draw. The length
              of polygons should be the same as the number of bboxes.
          edge_labels (np.ndarray, torch.Tensor): The edge labels to draw.
              The shape of edge_labels should be (N, N), where N is the
              number of texts.
          texts (Sequence[str]): The texts to draw. The length of texts
              should be the same as the number of bboxes.
          class_names (dict): The class names for bbox labels.
          is_openset (bool): Whether the dataset is openset. Default: False.
  
      Returns:
          np.ndarray: The image with instances drawn.
      """
      img_shape = image.shape[:2]
      empty_shape = (img_shape[0], img_shape[1], 3)
      text_image = np.full(empty_shape, 255, dtype=np.uint8)
      if texts:
          text_image = self.get_labels_image(
              text_image,
              labels=texts,
              bboxes=bboxes,
              font_families=self.font_families,
              font_properties=self.font_properties,
          )
      if polygons:
          polygons = [polygon.reshape(-1, 2) for polygon in polygons]
          image = self.get_polygons_image(
              image, polygons, filling=True, colors=self.PALETTE
          )
          text_image = self.get_polygons_image(
              text_image, polygons, colors=self.PALETTE
          )
      elif len(bboxes) > 0:
          image = self.get_bboxes_image(
              image, bboxes, filling=True, colors=self.PALETTE
          )
          text_image = self.get_bboxes_image(
              text_image, bboxes, colors=self.PALETTE
          )
      return np.concatenate([image, text_image], axis=1)
  
file_path: mmocr/mmocr/visualization/textspotting_visualizer.py
imports: from typing import Optional, Sequence, Union
  import mmcv
  import numpy
  import torch
  from mmocr.registry import VISUALIZERS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils.polygon_utils import poly2bbox
  from .base_visualizer import BaseLocalVisualizer
label_desc: Use image node_id 1 for calling the TextSpottingLocalVisualizer obj's underlying member method code with example usage: obj._draw_instances(image, bboxes, polygons, texts) and returns: np