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.
docstr: Convert the annotation to the format of YouTube-VIS.
  
  This operation is to make it easier to use the official eval API.
  
  Args:
      pred_dicts (Tuple[dict]): Prediction of the dataset.
  
  Returns:
      List: The formatted predictions.
docstr_tok: ["Convert","the","annotation","to","the","format","of","YouTube-VIS",".","This","operation","is","to","make","it","easier","to","use","the","official","eval","API",".","Args",":","pred_dicts","(","Tuple","[","dict","]",")",":","Prediction","of","the","dataset",".","Returns",":","List",":","The","formatted","predictions","."]
code: def _format_one_video_preds(self, pred_dicts: Tuple[dict]) -> List:
      """Convert the annotation to the format of YouTube-VIS.
  
      This operation is to make it easier to use the official eval API.
  
      Args:
          pred_dicts (Tuple[dict]): Prediction of the dataset.
  
      Returns:
          List: The formatted predictions.
      """
      # Collate preds scatters (tuple of dict to dict of list)
      preds = defaultdict(list)
      for pred in pred_dicts:
          for key in pred.keys():
              preds[key].append(pred[key])
  
      img_infos = self._vis_meta_info["images"]
      vid_infos = self._vis_meta_info["videos"]
      inds = [i for i, _ in enumerate(img_infos) if _["frame_id"] == 0]
      inds.append(len(img_infos))
      json_results = []
      video_id = vid_infos[-1]["id"]
      # collect data for each instances in a video.
      collect_data = dict()
      for frame_id, (masks, scores, labels, ids) in enumerate(
          zip(
              preds["masks"],
              preds["scores"],
              preds["labels"],
              preds["instances_id"],
          )
      ):
          assert len(masks) == len(labels)
          for j, id in enumerate(ids):
              if id not in collect_data:
                  collect_data[id] = dict(
                      category_ids=[], scores=[], segmentations=dict()
                  )
              collect_data[id]["category_ids"].append(labels[j])
              collect_data[id]["scores"].append(scores[j])
              if isinstance(masks[j]["counts"], bytes):
                  masks[j]["counts"] = masks[j]["counts"].decode()
              collect_data[id]["segmentations"][frame_id] = masks[j]
  
      # transform the collected data into official format
      for id, id_data in collect_data.items():
          output = dict()
          output["video_id"] = video_id
          output["score"] = np.array(id_data["scores"]).mean().item()
          # majority voting for sequence category
          output["category_id"] = (
              np.bincount(np.array(id_data["category_ids"]))
              .argmax()
              .item()
              + 1
          )
          output["segmentations"] = []
          for frame_id in range(inds[-1] - inds[-2]):
              if frame_id in id_data["segmentations"]:
                  output["segmentations"].append(
                      id_data["segmentations"][frame_id]
                  )
              else:
                  output["segmentations"].append(None)
          json_results.append(output)
  
      return json_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 6 for calling the YouTubeVISMetric obj's underlying member method code with example usage: obj._format_one_video_preds(pred_dicts) and returns: json_results