Skip to content

xml_to_csv.py error index is out of range #130

@slashplusdash

Description

@slashplusdash

I got a dataset from roboflow and downloaded it in a PASCAL VOC format. I got the image and xml file but I get an error saying index is out of range. I get this error:

Traceback (most recent call last):
  File "/content/create_csv.py", line 36, in <module>
    main()
  File "/content/create_csv.py", line 32, in main
    xml_df = xml_to_csv(image_path)
  File "/content/create_csv.py", line 19, in xml_to_csv
    int(member[4][0].text),
IndexError: child index out of range

Here is an example of an XML file from roboflow that will cause an error.

<annotation>
	<folder></folder>
	<filename>93CZGI8230K5_jpg.rf.376be08df50f4850e6fd70f287a649cc.jpg</filename>
	<path>93CZGI8230K5_jpg.rf.376be08df50f4850e6fd70f287a649cc.jpg</path>
	<source>
		<database>roboflow.com</database>
	</source>
	<size>
		<width>416</width>
		<height>416</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>Bicycle</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<occluded>0</occluded>
		<bndbox>
			<xmin>31</xmin>
			<xmax>415</xmax>
			<ymin>92</ymin>
			<ymax>345</ymax>
		</bndbox>
	</object>
</annotation>

Any help on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions