class_docstr: Base video dataset for VID, MOT and VIS tasks.
class_docstr_tok: ["Base","video","dataset","for","VID",",","MOT","and","VIS","tasks","."]
docstr: Load annotations from an annotation file named as ``self.ann_file``.
  
  Returns:
      tuple(list[dict], list): A list of annotation and a list of
      valid data indices.
docstr_tok: ["Load","annotations","from","an","annotation","file","named","as","``","self.ann_file","``",".","Returns",":","tuple","(","list","[","dict","]",",","list",")",":","A","list","of","annotation","and","a","list","of","valid","data","indices","."]
code: def load_data_list(self) -> Tuple[List[dict], List]:
      """Load annotations from an annotation file named as ``self.ann_file``.
  
      Returns:
          tuple(list[dict], list): A list of annotation and a list of
          valid data indices.
      """
      with fileio.get_local_path(self.ann_file) as local_path:
          self.coco = COCO(local_path)
      # The order of returned `cat_ids` will not
      # change with the order of the classes
      self.cat_ids = self.coco.get_cat_ids(
          cat_names=self.metainfo["classes"]
      )
      self.cat2label = {
          cat_id: i for i, cat_id in enumerate(self.cat_ids)
      }
      self.cat_img_map = copy.deepcopy(self.coco.cat_img_map)
      # used in `filter_data`
      self.img_ids_with_ann = set()
  
      img_ids = self.coco.get_img_ids()
      total_ann_ids = []
      # if ``video_id`` is not in the annotation file, we will assign a big
      # unique video_id for this video.
      single_video_id = 100000
      videos = {}
      for img_id in img_ids:
          raw_img_info = self.coco.load_imgs([img_id])[0]
          raw_img_info["img_id"] = img_id
          if "video_id" not in raw_img_info:
              single_video_id = single_video_id + 1
              video_id = single_video_id
          else:
              video_id = raw_img_info["video_id"]
  
          if video_id not in videos:
              videos[video_id] = {
                  "video_id": video_id,
                  "images": [],
                  "video_length": 0,
              }
  
          videos[video_id]["video_length"] += 1
          ann_ids = self.coco.get_ann_ids(
              img_ids=[img_id], cat_ids=self.cat_ids
          )
          raw_ann_info = self.coco.load_anns(ann_ids)
          total_ann_ids.extend(ann_ids)
  
          parsed_data_info = self.parse_data_info(
              dict(raw_img_info=raw_img_info, raw_ann_info=raw_ann_info)
          )
  
          if len(parsed_data_info["instances"]) > 0:
              self.img_ids_with_ann.add(parsed_data_info["img_id"])
  
          videos[video_id]["images"].append(parsed_data_info)
  
      data_list = [v for v in videos.values()]
  
      if self.ANN_ID_UNIQUE:
          assert len(set(total_ann_ids)) == len(
              total_ann_ids
          ), f"Annotation ids in '{self.ann_file}' are not unique!"
  
      del self.coco
  
      return data_list
  
file_path: mmdetection/mmdet/datasets/base_video_dataset.py
imports: import copy
  import os.path
  from collections import defaultdict
  from typing import Any, List, Tuple
  import mmengine.fileio
  from mmengine.dataset import BaseDataset
  from mmengine.logging import print_log
  from mmdet.datasets.api_wrappers import COCO
  from mmdet.registry import DATASETS
label_desc: Use image node_id 2 for calling the BaseVideoDataset obj's underlying member method code with example usage: obj.load_data_list() and returns: data_list