TannerGilbert / Tutorials

Code for some of my articles

Home Page:https://gilberttanner.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

convert xml to csv

cesarriat opened this issue · comments

Can you give me more information about your problem because the xml_to_csv script I used in my video (https://www.youtube.com/watch?v=HjiBbChYRDw) works fine for me and without any specific error it's really hard to help you

Maybe you didn't change the main method if you only watched the video because I forgot to show it there.

Basically you need to replace the following lines:

Old:

def main():
image_path = os.path.join(os.getcwd(), 'annotations')
xml_df = xml_to_csv(image_path)
xml_df.to_csv('raccoon_labels.csv', index=None)
print('Successfully converted xml to csv.')

New:

def main():
for folder in ['train', 'test']:
image_path = os.path.join(os.getcwd(), ('images/' + folder))
xml_df = xml_to_csv(image_path)
xml_df.to_csv(('images/'+folder+'_labels.csv'), index=None)
print('Successfully converted xml to csv.')

thank now run