class_docstr: Open Images dataset for detection.
  
  Args:
      ann_file (str): Annotation file path.
      label_file (str): File path of the label description file that
          maps the classes names in MID format to their short
          descriptions.
      meta_file (str): File path to get image metas.
      hierarchy_file (str): The file path of the class hierarchy.
      image_level_ann_file (str): Human-verified image level annotation,
          which is used in evaluation.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
docstr: Load annotations from an annotation file named as ``self.ann_file``
  
  Returns:
      List[dict]: A list of annotation.
docstr_tok: ["Load","annotations","from","an","annotation","file","named","as","``","self.ann_file","``","Returns",":","List","[","dict","]",":","A","list","of","annotation","."]
code: def load_data_list(self) -> List[dict]:
      """Load annotations from an annotation file named as ``self.ann_file``
  
      Returns:
          List[dict]: A list of annotation.
      """
      classes_names, label_id_mapping = self._parse_label_file(
          self.label_file
      )
      self._metainfo["classes"] = classes_names
      self.label_id_mapping = label_id_mapping
  
      if self.image_level_ann_file is not None:
          img_level_anns = self._parse_img_level_ann(
              self.image_level_ann_file
          )
      else:
          img_level_anns = None
  
      # OpenImagesMetric can get the relation matrix from the dataset meta
      relation_matrix = self._get_relation_matrix(self.hierarchy_file)
      self._metainfo["RELATION_MATRIX"] = relation_matrix
  
      data_list = []
      with get_local_path(
          self.ann_file, backend_args=self.backend_args
      ) as local_path:
          with open(local_path, "r") as f:
              reader = csv.reader(f)
              last_img_id = None
              instances = []
              for i, line in enumerate(reader):
                  if i == 0:
                      continue
                  img_id = line[0]
                  if last_img_id is None:
                      last_img_id = img_id
                  label_id = line[2]
                  assert label_id in self.label_id_mapping
                  label = int(self.label_id_mapping[label_id])
                  bbox = [
                      float(line[4]),  # xmin
                      float(line[6]),  # ymin
                      float(line[5]),  # xmax
                      float(line[7]),  # ymax
                  ]
                  is_occluded = True if int(line[8]) == 1 else False
                  is_truncated = True if int(line[9]) == 1 else False
                  is_group_of = True if int(line[10]) == 1 else False
                  is_depiction = True if int(line[11]) == 1 else False
                  is_inside = True if int(line[12]) == 1 else False
  
                  instance = dict(
                      bbox=bbox,
                      bbox_label=label,
                      ignore_flag=0,
                      is_occluded=is_occluded,
                      is_truncated=is_truncated,
                      is_group_of=is_group_of,
                      is_depiction=is_depiction,
                      is_inside=is_inside,
                  )
                  last_img_path = osp.join(
                      self.data_prefix["img"], f"{last_img_id}.jpg"
                  )
                  if img_id != last_img_id:
                      # switch to a new image, record previous image's data.
                      data_info = dict(
                          img_path=last_img_path,
                          img_id=last_img_id,
                          instances=instances,
                      )
                      data_list.append(data_info)
                      instances = []
                  instances.append(instance)
                  last_img_id = img_id
              data_list.append(
                  dict(
                      img_path=last_img_path,
                      img_id=last_img_id,
                      instances=instances,
                  )
              )
  
      # add image metas to data list
      img_metas = load(
          self.meta_file,
          file_format="pkl",
          backend_args=self.backend_args,
      )
      assert len(img_metas) == len(data_list)
      for i, meta in enumerate(img_metas):
          img_id = data_list[i]["img_id"]
          assert f"{img_id}.jpg" == osp.split(meta["filename"])[-1]
          h, w = meta["ori_shape"][:2]
          data_list[i]["height"] = h
          data_list[i]["width"] = w
          # denormalize bboxes
          for j in range(len(data_list[i]["instances"])):
              data_list[i]["instances"][j]["bbox"][0] *= w
              data_list[i]["instances"][j]["bbox"][2] *= w
              data_list[i]["instances"][j]["bbox"][1] *= h
              data_list[i]["instances"][j]["bbox"][3] *= h
          # add image-level annotation
          if img_level_anns is not None:
              img_labels = []
              confidences = []
              img_ann_list = img_level_anns.get(img_id, [])
              for ann in img_ann_list:
                  img_labels.append(int(ann["image_level_label"]))
                  confidences.append(float(ann["confidence"]))
              data_list[i]["image_level_labels"] = np.array(
                  img_labels, dtype=np.int64
              )
              data_list[i]["confidences"] = np.array(
                  confidences, dtype=np.float32
              )
      return data_list
  
imports: import csv
  import os.path
  from collections import defaultdict
  from typing import Dict, List, Optional
  import numpy
  from mmengine.fileio import get_local_path, load
  from mmengine.utils import is_abs
  from mmdet.registry import DATASETS
  from .base_det_dataset import BaseDetDataset
label_desc: Use image node_id 2 for calling the OpenImagesDataset obj's underlying member method code with example usage: obj.load_data_list() and returns: data_list