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:
      gt_dicts (Tuple[dict]): Ground truth of the dataset.
  
  Returns:
      list: The formatted gts.
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",":","gt_dicts","(","Tuple","[","dict","]",")",":","Ground","truth","of","the","dataset",".","Returns",":","list",":","The","formatted","gts","."]
code: def _format_one_video_gts(self, gt_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:
          gt_dicts (Tuple[dict]): Ground truth of the dataset.
  
      Returns:
          list: The formatted gts.
      """
      video_infos = []
      image_infos = []
      instance_infos = defaultdict(list)
      len_videos = dict()  # mapping from instance_id to video_length
      vis_anns = []
  
      # get video infos
      for gt_dict in gt_dicts:
          frame_id = gt_dict["frame_id"]
          video_id = gt_dict["video_id"]
          img_id = gt_dict["img_id"]
          image_info = dict(
              id=img_id,
              width=gt_dict["width"],
              height=gt_dict["height"],
              frame_id=frame_id,
              file_name="",
          )
          image_infos.append(image_info)
          if frame_id == 0:
              video_info = dict(
                  id=video_id,
                  width=gt_dict["width"],
                  height=gt_dict["height"],
                  file_name="",
              )
              video_infos.append(video_info)
  
          for ann in gt_dict["anns"]:
              label = ann["bbox_label"]
              bbox = ann["bbox"]
              instance_id = ann["instance_id"]
              # update video length
              len_videos[instance_id] = gt_dict["video_length"]
              coco_bbox = [
                  bbox[0],
                  bbox[1],
                  bbox[2] - bbox[0],
                  bbox[3] - bbox[1],
              ]
  
              annotation = dict(
                  video_id=video_id,
                  frame_id=frame_id,
                  bbox=coco_bbox,
                  instance_id=instance_id,
                  iscrowd=ann.get("ignore_flag", 0),
                  category_id=int(label) + 1,
                  area=coco_bbox[2] * coco_bbox[3],
              )
              if ann.get("mask", None):
                  mask = ann["mask"]
                  # area = mask_util.area(mask)
                  if isinstance(mask, dict) and isinstance(
                      mask["counts"], bytes
                  ):
                      mask["counts"] = mask["counts"].decode()
                  annotation["segmentation"] = mask
  
              instance_infos[instance_id].append(annotation)
  
      # update vis meta info
      self._vis_meta_info["images"].extend(image_infos)
      self._vis_meta_info["videos"].extend(video_infos)
  
      for instance_id, ann_infos in instance_infos.items():
          cur_video_len = len_videos[instance_id]
          segm = [None] * cur_video_len
          bbox = [None] * cur_video_len
          area = [None] * cur_video_len
          # In the official format, no instances are represented by
          # 'None', however, only images with instances are recorded
          # in the current annotations, so we need to use 'None' to
          # initialize these lists.
          for ann_info in ann_infos:
              frame_id = ann_info["frame_id"]
              segm[frame_id] = ann_info["segmentation"]
              bbox[frame_id] = ann_info["bbox"]
              area[frame_id] = ann_info["area"]
          instance = dict(
              category_id=ann_infos[0]["category_id"],
              segmentations=segm,
              bboxes=bbox,
              video_id=ann_infos[0]["video_id"],
              areas=area,
              id=instance_id,
              iscrowd=ann_infos[0]["iscrowd"],
          )
          vis_anns.append(instance)
      return vis_anns
  
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 7 for calling the YouTubeVISMetric obj's underlying member method code with example usage: obj._format_one_video_gts(gt_dicts) and returns: vis_anns