Skip to content

Tag name based matching from xml instead of indices #10

@kberci

Description

@kberci

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))```

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