raccoon_dataset icon indicating copy to clipboard operation
raccoon_dataset copied to clipboard

Suggested change to xml_to_csv.py

Open alanm101 opened this issue 6 years ago • 4 comments

Hi,

I'm not knowledgeable enough to GitHub. Hopefully you will consider a small change to the master of xml_to_csv.py. I struggled several hours because some XML files were generated by labelImg and others by another tool. The other tool uses a different order for xmin, ymin, xmax, ymax. This small change will solve the issue and hopefully save other people a lot of time.

from: int(member[4][0].text), int(member[4][1].text), int(member[4][2].text), int(member[4][3].text) to: member[4].findall('xmin')[0].text, member[4].findall('ymin')[0].text, member[4].findall('xmax')[0].text, member[4].findall('ymax')[0].text)

Thanks, Alan.

alanm101 avatar Nov 19 '18 08:11 alanm101

Hi, exactly on those lines of code I have the following error

IndexError: list index out of range

with or without the above suggestion. Why number 4 is so special ?

algila avatar Mar 28 '19 21:03 algila

yeah it is still giving this error, how can we solve that?

asparmar14 avatar Feb 15 '23 05:02 asparmar14

Now it worked when I did this change; from=> member[4].findall('xmin')[0].text, member[4].findall('ymin')[0].text, member[4].findall('xmax')[0].text, member[4].findall('ymax')[0].text)

to=> member[5].findall('xmin')[0].text, member[5].findall('ymin')[0].text, member[5].findall('xmax')[0].text, member[5].findall('ymax')[0].text)

asparmar14 avatar Feb 15 '23 05:02 asparmar14