class_docstr: XML dataset for detection.
  
  Args:
      img_subdir (str): Subdir where images are stored. Default: JPEGImages.
      ann_subdir (str): Subdir where annotations are. Default: Annotations.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
docstr: Parse raw annotation to target format.
  
  Args:
      img_info (dict): Raw image information, usually it includes
          `img_id`, `file_name`, and `xml_path`.
  
  Returns:
      Union[dict, List[dict]]: Parsed annotation.
docstr_tok: ["Parse","raw","annotation","to","target","format",".","Args",":","img_info","(","dict",")",":","Raw","image","information",",","usually","it","includes","`","img_id","`",",","`","file_name","`",",","and","`","xml_path","`",".","Returns",":","Union","[","dict",",","List","[","dict","]","]",":","Parsed","annotation","."]
code: def parse_data_info(self, img_info: dict) -> Union[dict, List[dict]]:
      """Parse raw annotation to target format.
  
      Args:
          img_info (dict): Raw image information, usually it includes
              `img_id`, `file_name`, and `xml_path`.
  
      Returns:
          Union[dict, List[dict]]: Parsed annotation.
      """
      data_info = {}
      img_path = osp.join(self.sub_data_root, img_info["file_name"])
      data_info["img_path"] = img_path
      data_info["img_id"] = img_info["img_id"]
      data_info["xml_path"] = img_info["xml_path"]
  
      # deal with xml file
      with get_local_path(
          img_info["xml_path"], backend_args=self.backend_args
      ) as local_path:
          raw_ann_info = ET.parse(local_path)
      root = raw_ann_info.getroot()
      size = root.find("size")
      if size is not None:
          width = int(size.find("width").text)
          height = int(size.find("height").text)
      else:
          img_bytes = get(img_path, backend_args=self.backend_args)
          img = mmcv.imfrombytes(img_bytes, backend="cv2")
          height, width = img.shape[:2]
          del img, img_bytes
  
      data_info["height"] = height
      data_info["width"] = width
  
      data_info["instances"] = self._parse_instance_info(
          raw_ann_info, minus_one=True
      )
  
      return data_info
  
file_path: mmdetection/mmdet/datasets/xml_style.py
imports: import os.path
  import xml.etree.ElementTree
  from typing import List, Optional, Union
  import mmcv
  from mmengine.fileio import get, get_local_path, list_from_file
  from mmdet.registry import DATASETS
  from .base_det_dataset import BaseDetDataset
label_desc: Use image node_id 5 for calling the XMLDataset obj's underlying member method code with example usage: obj.parse_data_info(img_info) and returns: data_info