class_docstr: Tracking Local Visualizer for the MOT, VIS tasks.
  
  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.
          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.
      line_width (int, float): The linewidth of lines.
          Defaults to 3.
      alpha (int, float): The transparency of bboxes or mask.
              Defaults to 0.8.
class_docstr_tok: ["Tracking","Local","Visualizer","for","the","MOT",",","VIS","tasks",".","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",".","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",".","line_width","(","int",",","float",")",":","The","linewidth","of","lines",".","Defaults","to","3.","alpha","(","int",",","float",")",":","The","transparency","of","bboxes","or","mask",".","Defaults","to","0.8","."]
docstr: Draw datasample and save to all backends.
  
  - If GT and prediction are plotted at the same time, they are
  displayed in a stitched image where the left image is the
  ground truth and the right image is the prediction.
  - If ``show`` is True, all storage backends are ignored, and
  the images will be displayed in a local window.
  - If ``out_file`` is specified, the drawn image will be
  saved to ``out_file``. t is usually used when the display
  is not available.
  Args:
      name (str): The image identifier.
      image (np.ndarray): The image to draw.
      data_sample (OptTrackSampleList): A data
          sample that contain annotations and predictions.
          Defaults to None.
      draw_gt (bool): Whether to draw GT TrackDataSample.
          Default to True.
      draw_pred (bool): Whether to draw Prediction TrackDataSample.
          Defaults to True.
      show (bool): Whether to display the drawn image. Default to False.
      wait_time (int): The interval of show (s). Defaults to 0.
      out_file (str): Path to output file. Defaults to None.
      pred_score_thr (float): The threshold to visualize the bboxes
          and masks. Defaults to 0.3.
      step (int): Global step value to record. Defaults to 0.
docstr_tok: ["Draw","datasample","and","save","to","all","backends",".","-","If","GT","and","prediction","are","plotted","at","the","same","time",",","they","are","displayed","in","a","stitched","image","where","the","left","image","is","the","ground","truth","and","the","right","image","is","the","prediction",".","-","If","``","show","``","is","True",",","all","storage","backends","are","ignored",",","and","the","images","will","be","displayed","in","a","local","window",".","-","If","``","out_file","``","is","specified",",","the","drawn","image","will","be","saved","to","``","out_file","``",".","t","is","usually","used","when","the","display","is","not","available",".","Args",":","name","(","str",")",":","The","image","identifier",".","image","(","np.ndarray",")",":","The","image","to","draw",".","data_sample","(","OptTrackSampleList",")",":","A","data","sample","that","contain","annotations","and","predictions",".","Defaults","to","None",".","draw_gt","(","bool",")",":","Whether","to","draw","GT","TrackDataSample",".","Default","to","True",".","draw_pred","(","bool",")",":","Whether","to","draw","Prediction","TrackDataSample",".","Defaults","to","True",".","show","(","bool",")",":","Whether","to","display","the","drawn","image",".","Default","to","False",".","wait_time","(","int",")",":","The","interval","of","show","(","s",")",".","Defaults","to","0.","out_file","(","str",")",":","Path","to","output","file",".","Defaults","to","None",".","pred_score_thr","(","float",")",":","The","threshold","to","visualize","the","bboxes","and","masks",".","Defaults","to","0.3.","step","(","int",")",":","Global","step","value","to","record",".","Defaults","to","0","."]
code: def add_datasample(
      self,
      name: str,
      image: np.ndarray,
      data_sample: DetDataSample = None,
      draw_gt: bool = True,
      draw_pred: bool = True,
      show: bool = False,
      wait_time: int = 0,
      # TODO: Supported in mmengine's Viusalizer.
      out_file: Optional[str] = None,
      pred_score_thr: float = 0.3,
      step: int = 0,
  ) -> None:
      """Draw datasample and save to all backends.
  
      - If GT and prediction are plotted at the same time, they are
      displayed in a stitched image where the left image is the
      ground truth and the right image is the prediction.
      - If ``show`` is True, all storage backends are ignored, and
      the images will be displayed in a local window.
      - If ``out_file`` is specified, the drawn image will be
      saved to ``out_file``. t is usually used when the display
      is not available.
      Args:
          name (str): The image identifier.
          image (np.ndarray): The image to draw.
          data_sample (OptTrackSampleList): A data
              sample that contain annotations and predictions.
              Defaults to None.
          draw_gt (bool): Whether to draw GT TrackDataSample.
              Default to True.
          draw_pred (bool): Whether to draw Prediction TrackDataSample.
              Defaults to True.
          show (bool): Whether to display the drawn image. Default to False.
          wait_time (int): The interval of show (s). Defaults to 0.
          out_file (str): Path to output file. Defaults to None.
          pred_score_thr (float): The threshold to visualize the bboxes
              and masks. Defaults to 0.3.
          step (int): Global step value to record. Defaults to 0.
      """
      gt_img_data = None
      pred_img_data = None
  
      if data_sample is not None:
          data_sample = data_sample.cpu()
  
      if draw_gt and data_sample is not None:
          assert "gt_instances" in data_sample
          gt_img_data = self._draw_instances(
              image, data_sample.gt_instances
          )
  
      if draw_pred and data_sample is not None:
          assert "pred_track_instances" in data_sample
          pred_instances = data_sample.pred_track_instances
          if "scores" in pred_instances:
              pred_instances = pred_instances[
                  pred_instances.scores > pred_score_thr
              ].cpu()
          pred_img_data = self._draw_instances(image, pred_instances)
  
      if gt_img_data is not None and pred_img_data is not None:
          drawn_img = np.concatenate(
              (gt_img_data, pred_img_data), axis=1
          )
      elif gt_img_data is not None:
          drawn_img = gt_img_data
      else:
          drawn_img = pred_img_data
  
      if show:
          self.show(drawn_img, win_name=name, wait_time=wait_time)
  
      if out_file is not None:
          mmcv.imwrite(drawn_img[..., ::-1], out_file)
      else:
          self.add_image(name, drawn_img, step)
  
imports: from typing import Dict, List, Optional, Tuple, Union
  import cv2
  import mmcv
  import numpy
  import torch
  from mmengine.dist import master_only
  from mmengine.structures import InstanceData, PixelData
  from mmengine.visualization import Visualizer
  from ..evaluation import INSTANCE_OFFSET
  from ..registry import VISUALIZERS
  from ..structures import DetDataSample
  from ..structures.mask import BitmapMasks, PolygonMasks, bitmap_to_polygon
  from .palette import _get_adaptive_scales, get_palette, jitter_color
label_desc: Use image node_id 3 for calling the TrackLocalVisualizer obj's underlying member method code with example usage: obj.add_datasample(name, image, data_sample, draw_gt, draw_pred, show, wait_time, out_file, pred_score_thr, step) without return types