code: def test_add_datasample(self):
      out_file = "out_file.jpg"
      h, w = 1080, 1920
      image = np.random.randint(0, 256, size=(h, w, 3)).astype("uint8")
      gt_instances = self._get_gt_instances()
      pred_instances = self._get_pred_instances()
      image_data_sample = DetDataSample()
      image_data_sample.gt_instances = gt_instances
      image_data_sample.pred_track_instances = pred_instances
  
      track_local_visualizer = TrackLocalVisualizer(alpha=0.2)
      track_local_visualizer.dataset_meta = dict(
          classes=["pedestrian", "vehicle"]
      )
  
      # test gt_instances
      track_local_visualizer.add_datasample(
          "image", image, image_data_sample, None
      )
  
      # test out_file
      track_local_visualizer.add_datasample(
          "image", image, image_data_sample, None, out_file=out_file
      )
      self._assert_image_and_shape(out_file, (h, w, 3))
  
      # test gt_instances and pred_instances
      track_local_visualizer.add_datasample(
          "image", image, image_data_sample, out_file=out_file
      )
      self._assert_image_and_shape(out_file, (h, 2 * w, 3))
  
      track_local_visualizer.add_datasample(
          "image",
          image,
          image_data_sample,
          draw_gt=False,
          out_file=out_file,
      )
      self._assert_image_and_shape(out_file, (h, w, 3))
  
      track_local_visualizer.add_datasample(
          "image",
          image,
          image_data_sample,
          draw_pred=False,
          out_file=out_file,
      )
      self._assert_image_and_shape(out_file, (h, w, 3))
  
imports: import os
  from unittest import TestCase
  import cv2
  import numpy
  import torch
  from mmengine.structures import InstanceData, PixelData
  from mmdet.evaluation import INSTANCE_OFFSET
  from mmdet.structures import DetDataSample
  from mmdet.visualization import DetLocalVisualizer, TrackLocalVisualizer
label_desc: Use image node_id 4 for calling the TestTrackLocalVisualizer obj's underlying member method code with example usage: obj.test_add_datasample() without return types