docstr: 将xml文件解析成字典形式，参考tensorflow的recursive_parse_xml_to_dict
  Args:
      xml: xml tree obtained by parsing XML file contents using lxml.etree
  
  Returns:
      Python dictionary holding XML contents.
docstr_tok: ["\u5c06xml\u6587\u4ef6\u89e3\u6790\u6210\u5b57\u5178\u5f62\u5f0f\uff0c\u53c2\u8003tensorflow\u7684recursive_parse_xml_to_dict","Args",":","xml",":","xml","tree","obtained","by","parsing","XML","file","contents","using","lxml.etree","Returns",":","Python","dictionary","holding","XML","contents","."]
code: def parse_xml_to_dict(self, xml):
      """
      将xml文件解析成字典形式，参考tensorflow的recursive_parse_xml_to_dict
      Args:
          xml: xml tree obtained by parsing XML file contents using lxml.etree
  
      Returns:
          Python dictionary holding XML contents.
      """
  
      if len(xml) == 0:  # 遍历到底层，直接返回tag对应的信息
          return {xml.tag: xml.text}
  
      result = {}
      for child in xml:
          child_result = self.parse_xml_to_dict(child)  # 递归遍历标签信息
          if child.tag != "object":
              result[child.tag] = child_result[child.tag]
          else:
              if child.tag not in result:  # 因为object可能有多个，所以需要放入列表里
                  result[child.tag] = []
              result[child.tag].append(child_result[child.tag])
      return {xml.tag: result}
  
file_path: deep-learning-for-image-processing/others_project/kmeans_anchors/read_voc.py
imports: import os
  from tqdm import tqdm
  from lxml import etree
label_desc: Use image node_id 3 for calling the VOCDataSet obj's underlying member method code with example usage: obj.parse_xml_to_dict(xml) and returns: dict, dict