class_docstr: XML dataset for detection.
  
  Args:
      min_size (int | float, optional): The minimum size of bounding
          boxes in the images. If the size of a bounding box is less than
          ``min_size``, it would be add to ignored field.
docstr: Get annotation from XML file by index.
  
  Args:
      idx (int): Index of data.
  
  Returns:
      dict: Annotation info of specified index.
docstr_tok: ["Get","annotation","from","XML","file","by","index",".","Args",":","idx","(","int",")",":","Index","of","data",".","Returns",":","dict",":","Annotation","info","of","specified","index","."]
code: def get_ann_info(self, idx):
      """Get annotation from XML file by index.
  
      Args:
          idx (int): Index of data.
  
      Returns:
          dict: Annotation info of specified index.
      """
  
      img_id = self.data_infos[idx]["id"]
      xml_path = osp.join(
          self.img_prefix, "Annotations", f"{img_id}.xml"
      )
      tree = ET.parse(xml_path)
      root = tree.getroot()
      bboxes = []
      labels = []
      bboxes_ignore = []
      labels_ignore = []
      for obj in root.findall("object"):
          name = obj.find("name").text
          if name not in self.CLASSES:
              continue
          label = self.cat2label[name]
          difficult = int(obj.find("difficult").text)
          bnd_box = obj.find("bndbox")
          # TODO: check whether it is necessary to use int
          # Coordinates may be float type
          bbox = [
              int(float(bnd_box.find("xmin").text)),
              int(float(bnd_box.find("ymin").text)),
              int(float(bnd_box.find("xmax").text)),
              int(float(bnd_box.find("ymax").text)),
          ]
          ignore = False
          if self.min_size:
              assert not self.test_mode
              w = bbox[2] - bbox[0]
              h = bbox[3] - bbox[1]
              if w < self.min_size or h < self.min_size:
                  ignore = True
          if difficult or ignore:
              bboxes_ignore.append(bbox)
              labels_ignore.append(label)
          else:
              bboxes.append(bbox)
              labels.append(label)
      if not bboxes:
          bboxes = np.zeros((0, 4))
          labels = np.zeros((0,))
      else:
          bboxes = np.array(bboxes, ndmin=2) - 1
          labels = np.array(labels)
      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
          labels_ignore = np.array(labels_ignore)
      ann = dict(
          bboxes=bboxes.astype(np.float32),
          labels=labels.astype(np.int64),
          bboxes_ignore=bboxes_ignore.astype(np.float32),
          labels_ignore=labels_ignore.astype(np.int64),
      )
      return ann
  
file_path: insightface/detection/scrfd/mmdet/datasets/xml_style.py
imports: import os.path
  import xml.etree.ElementTree
  import mmcv
  import numpy
  from PIL import Image
  from .builder import DATASETS
  from .custom import CustomDataset
label_desc: Use image node_id 4 for calling the XMLDataset obj's underlying member method code with example usage: obj.get_ann_info(idx) and returns: ann