class_docstr: Tracking Visualization Hook. Used to visualize validation and testing
  process prediction results.
  
  In the testing phase:
  
  1. If ``show`` is True, it means that only the prediction results are
      visualized without storing data, so ``vis_backends`` needs to
      be excluded.
  2. If ``test_out_dir`` is specified, it means that the prediction results
      need to be saved to ``test_out_dir``. In order to avoid vis_backends
      also storing data, so ``vis_backends`` needs to be excluded.
  3. ``vis_backends`` takes effect if the user does not specify ``show``
      and `test_out_dir``. You can set ``vis_backends`` to WandbVisBackend or
      TensorboardVisBackend to store the prediction result in Wandb or
      Tensorboard.
  
  Args:
      draw (bool): whether to draw prediction results. If it is False,
          it means that no drawing will be done. Defaults to False.
      frame_interval (int): The interval of visualization. Defaults to 30.
      score_thr (float): The threshold to visualize the bboxes
          and masks. Defaults to 0.3.
      show (bool): Whether to display the drawn image. Default to False.
      wait_time (float): The interval of show (s). Defaults to 0.
      test_out_dir (str, optional): directory where painted images
          will be saved in testing process.
      backend_args (dict): Arguments to instantiate a file client.
          Defaults to ``None``.
docstr: Run after every testing iteration.
  
  Args:
      runner (:obj:`Runner`): The runner of the testing process.
      batch_idx (int): The index of the current batch in the test loop.
      data_batch (dict): Data from dataloader.
      outputs (Sequence[:obj:`TrackDataSample`]): Outputs from model.
docstr_tok: ["Run","after","every","testing","iteration",".","Args",":","runner","(",":","obj",":","`","Runner","`",")",":","The","runner","of","the","testing","process",".","batch_idx","(","int",")",":","The","index","of","the","current","batch","in","the","test","loop",".","data_batch","(","dict",")",":","Data","from","dataloader",".","outputs","(","Sequence","[",":","obj",":","`","TrackDataSample","`","]",")",":","Outputs","from","model","."]
code: def after_test_iter(
      self,
      runner: Runner,
      batch_idx: int,
      data_batch: dict,
      outputs: Sequence[TrackDataSample],
  ) -> None:
      """Run after every testing iteration.
  
      Args:
          runner (:obj:`Runner`): The runner of the testing process.
          batch_idx (int): The index of the current batch in the test loop.
          data_batch (dict): Data from dataloader.
          outputs (Sequence[:obj:`TrackDataSample`]): Outputs from model.
      """
      if self.draw is False:
          return
  
      assert (
          len(outputs) == 1
      ), "only batch_size=1 is supported while testing."
  
      if self.test_out_dir is not None:
          self.test_out_dir = osp.join(
              runner.work_dir, runner.timestamp, self.test_out_dir
          )
          mkdir_or_exist(self.test_out_dir)
  
      sampler = runner.test_dataloader.sampler
      if isinstance(sampler, TrackImgSampler):
          if self.every_n_inner_iters(batch_idx, self.frame_interval):
              track_data_sample = outputs[0]
              self.visualize_single_image(
                  track_data_sample[0], batch_idx
              )
      else:
          # video visualization DefaultSampler
          if self.every_n_inner_iters(batch_idx, 1):
              track_data_sample = outputs[0]
              video_length = len(track_data_sample)
  
              for frame_id in range(video_length):
                  if frame_id % self.frame_interval == 0:
                      img_data_sample = track_data_sample[frame_id]
                      self.visualize_single_image(
                          img_data_sample, self.image_idx + frame_id
                      )
              self.image_idx = self.image_idx + video_length
  
imports: import os.path
  import warnings
  from typing import Optional, Sequence
  import mmcv
  import numpy
  from mmengine.fileio import get
  from mmengine.hooks import Hook
  from mmengine.runner import Runner
  from mmengine.utils import mkdir_or_exist
  from mmengine.visualization import Visualizer
  from mmdet.datasets.samplers import TrackImgSampler
  from mmdet.registry import HOOKS
  from mmdet.structures import DetDataSample, TrackDataSample
  from mmdet.structures.bbox import BaseBoxes
  from mmdet.visualization.palette import _get_adaptive_scales
label_desc: Use image node_id 3 for calling the TrackVisualizationHook obj's underlying member method code with example usage: obj.after_test_iter(runner, batch_idx, data_batch, outputs) without return types