class_docstr: mAP evaluation metrics for the VIS task.
  
  Args:
      metric (str | list[str]): Metrics to be evaluated.
          Default value is `youtube_vis_ap`.
      metric_items (List[str], optional): Metric result names to be
          recorded in the evaluation result. Defaults to None.
      outfile_prefix (str | None): The prefix of json files. It includes
          the file path and the prefix of filename, e.g., "a/b/prefix".
          If not specified, a temp file will be created. Defaults to None.
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonyms metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Default: None
      format_only (bool): If True, only formatting the results to the
          official format and not performing evaluation. Defaults to False.
code: def process_video(self, data_samples):
      video_length = len(data_samples)
      for frame_id in range(video_length):
          result = dict()
          img_data_sample = data_samples[frame_id].to_dict()
          pred = img_data_sample["pred_track_instances"]
          video_id = img_data_sample["video_id"]
  
          result["img_id"] = img_data_sample["img_id"]
          result["bboxes"] = pred["bboxes"].cpu().numpy()
          result["scores"] = pred["scores"].cpu().numpy()
          result["labels"] = pred["labels"].cpu().numpy()
          result["instances_id"] = pred["instances_id"].cpu().numpy()
          # encode mask to RLE
          assert (
              "masks" in pred
          ), "masks must exist in YouTube-VIS metric"
          result["masks"] = encode_mask_results(
              pred["masks"].detach().cpu().numpy()
          )
  
          # parse gt
          gt = dict()
          gt["width"] = img_data_sample["ori_shape"][1]
          gt["height"] = img_data_sample["ori_shape"][0]
          gt["img_id"] = img_data_sample["img_id"]
          gt["frame_id"] = frame_id
          gt["video_id"] = video_id
          gt["video_length"] = video_length
  
          if "instances" in img_data_sample:
              gt["anns"] = img_data_sample["instances"]
          else:
              gt["anns"] = dict()
          self.per_video_res.append((result, gt))
  
      preds, gts = zip(*self.per_video_res)
      # format the results
      # we must format gts first to update self._vis_meta_info
      gt_results = self._format_one_video_gts(gts)
      pred_results = self._format_one_video_preds(preds)
      self.per_video_res.clear()
      # add converted result to the results list
      self.results.append((pred_results, gt_results))
  
imports: import os.path
  import tempfile
  import warnings
  import zipfile
  from collections import OrderedDict, defaultdict
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import mmengine
  import numpy
  from mmengine.dist import all_gather_object, barrier, broadcast_object_list, is_main_process
  from mmengine.logging import MMLogger
  from mmdet.registry import METRICS
  from mmdet.structures.mask import encode_mask_results
  from ..functional import YTVIS, YTVISeval
  from .base_video_metric import BaseVideoMetric, collect_tracking_results
label_desc: Use image node_id 2 for calling the YouTubeVISMetric obj's underlying member method code with example usage: obj.process_video(data_samples) without return types