detection_util_scripts icon indicating copy to clipboard operation
detection_util_scripts copied to clipboard

Tag name based matching from xml instead of indices

Open kberci opened this issue 4 years ago • 0 comments

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 https://github.com/douglasrizzo/detection_util_scripts/blob/50e862b047538d0f0a50bf3ebccda2b73c5448e1/generate_csv.py#L23-L30 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))```

kberci avatar Dec 17 '20 14:12 kberci