docstr: Get COCO annotation by index.
  
  Args:
      idx (int): Index of data.
  
  Returns:
      dict: Annotation info of specified index.
docstr_tok: ["Get","COCO","annotation","by","index",".","Args",":","idx","(","int",")",":","Index","of","data",".","Returns",":","dict",":","Annotation","info","of","specified","index","."]
code: def get_ann_info(self, idx):
      """Get COCO annotation by index.
  
      Args:
          idx (int): Index of data.
  
      Returns:
          dict: Annotation info of specified index.
      """
      data_info = self.data_infos[idx]
  
      bboxes = []
      keypointss = []
      labels = []
      bboxes_ignore = []
      labels_ignore = []
      for obj in data_info["objs"]:
          label = self.cat2label[obj["cat"]]
          bbox = obj["bbox"]
          keypoints = obj["kps"]
          ignore = obj["ignore"]
          if ignore:
              bboxes_ignore.append(bbox)
              labels_ignore.append(label)
          else:
              bboxes.append(bbox)
              labels.append(label)
              keypointss.append(keypoints)
      if not bboxes:
          bboxes = np.zeros((0, 4))
          labels = np.zeros((0,))
          keypointss = np.zeros((0, self.NK, 3))
      else:
          # bboxes = np.array(bboxes, ndmin=2) - 1
          bboxes = np.array(bboxes, ndmin=2)
          labels = np.array(labels)
          keypointss = np.array(keypointss, ndmin=3)
      if not bboxes_ignore:
          bboxes_ignore = np.zeros((0, 4))
          labels_ignore = np.zeros((0,))
      else:
          # bboxes_ignore = np.array(bboxes_ignore, ndmin=2) - 1
          bboxes_ignore = np.array(bboxes_ignore, ndmin=2)
          labels_ignore = np.array(labels_ignore)
      ann = dict(
          bboxes=bboxes.astype(np.float32),
          labels=labels.astype(np.int64),
          keypointss=keypointss.astype(np.float32),
          bboxes_ignore=bboxes_ignore.astype(np.float32),
          labels_ignore=labels_ignore.astype(np.int64),
      )
      return ann
  
file_path: insightface/detection/scrfd/mmdet/datasets/retinaface.py
imports: import itertools
  import logging
  import os.path
  import tempfile
  from collections import OrderedDict
  import mmcv
  import numpy
  from mmcv.utils import print_log
  from terminaltables import AsciiTable
  from mmdet.core import eval_recalls
  from .builder import DATASETS
  from .custom import CustomDataset
label_desc: Use image node_id 4 for calling the RetinaFaceDataset obj's underlying member method code with example usage: obj.get_ann_info(idx) and returns: ann