Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag name based matching from xml instead of indices #10

Open
kberci opened this issue Dec 17, 2020 · 0 comments
Open

Tag name based matching from xml instead of indices #10

kberci opened this issue Dec 17, 2020 · 0 comments

Comments

@kberci
Copy link

kberci commented Dec 17, 2020

Thanks for the code, it is very handy and useful!

One small suggestion is to change the reading from the xml annotations to a tag based approach instead of the current half tag-based, half index-based! I have been working with some data where the script does not work otherwise.

The update is to rewrite the relevant lines in function xml_to_csv

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))
to:

         value = (root.find('filename').text,
                  int(root.find('size').find('width').text),
                  int(root.find('size').find('height').text),
                  member.find('name').text,
                  int(member.find('bndbox').find('xmin').text),
                  int(member.find('bndbox').find('ymin').text),
                  int(member.find('bndbox').find('xmax').text),
                  int(member.find('bndbox').find('ymax').text))```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant