title: IndexError: child index out of range
body: <p>I am trying to train a model for the tensorFlow object detection api. And when I try to convert the xml to csv I get the following error. I have 6300 train data and 700 test data. Can someone please point me out why Im getting this error? Thank you 
  //Tensorflow object detection</p>
  
  <p>Error </p>
  
  <pre><code>Traceback (most recent call last):
  File "xml_to_csv.py", line 35, in &lt;module&gt;
  main()
  File "xml_to_csv.py", line 31, in main
  xml_df = xml_to_csv(image_path)
  File "xml_to_csv.py", line 17, in xml_to_csv
  int(member[4][0].text),
  IndexError: child index out of range
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>import os
  import glob
  import pandas as pd
  import xml.etree.ElementTree as ET
  
  
  def xml_to_csv(path):
  xml_list = []
  for xml_file in glob.glob(path + '/*.xml'):
      tree = ET.parse(xml_file)
      root = tree.getroot()
      for member in root.findall('object'):
          value = (root.find('filename').text,
                   int(root.find('size')[0].text),
                   int(root.find('size')[1].text),
                   member[0].text,
                   int(member[4][0].text),
                   int(member[4][1].text),
                   int(member[4][2].text),
                   int(member[4][3].text)
                   )
          xml_list.append(value)
          column_name = ['filename', 'width', 'height', 'class', 'xmin', 'ymin', 'xmax', 'ymax']
          xml_df = pd.DataFrame(xml_list, columns=column_name)
          return xml_df
  
  
  def main():
      for directory in ['train','test']:
      image_path = os.path.join(os.getcwd(), 'images/{}'.format(directory))
      xml_df = xml_to_csv(image_path)
      xml_df.to_csv('data/{}_labels.csv'.format(directory), index=None)
      print('Successfully converted xml to csv.')
  
  main()
  </code></pre>
  
  <p>XML file</p>
  
  <pre><code>&lt;annotation&gt;
  &lt;folder&gt;JPEGImages&lt;/folder&gt;
  &lt;filename&gt;000001.jpg&lt;/filename&gt;
  &lt;path&gt;VOC2007/JPEGImages/000001.jpg&lt;/path&gt;
  &lt;source&gt;
      &lt;database&gt;Unknown&lt;/database&gt;
  &lt;/source&gt;
  &lt;size&gt;
      &lt;width&gt;1920&lt;/width&gt;
      &lt;height&gt;1080&lt;/height&gt;
      &lt;depth&gt;3&lt;/depth&gt;
  &lt;/size&gt;
  &lt;segmented&gt;0&lt;/segmented&gt;
  &lt;object&gt;
      &lt;name&gt;ore carrier&lt;/name&gt;
      &lt;pose&gt;Unspecified&lt;/pose&gt;
      &lt;truncated&gt;0&lt;/truncated&gt;
      &lt;bndbox&gt;
          &lt;xmin&gt;633&lt;/xmin&gt;
          &lt;ymin&gt;467&lt;/ymin&gt;
          &lt;xmax&gt;944&lt;/xmax&gt;
          &lt;ymax&gt;510&lt;/ymax&gt;
      &lt;/bndbox&gt;
  &lt;/object&gt;
  </code></pre>
  
  <p></p>