def __parse_annotations(self, xml_root):
Parse all annotations under the xml_root.
boxes = np.zeros((0, 5))
for i, element in enumerate(xml_root.iter("object")):
try:
truncated, difficult, box = self.__parse_annotation(element)
After Change
def __parse_annotations(self, xml_root):
Parse all annotations under the xml_root.
annotations = {"labels": np.empty((len(xml_root.findall("object")),)), "bboxes": np.empty((len(xml_root.findall("object")), 4))}
for i, element in enumerate(xml_root.iter("object")):
try:
truncated, difficult, box, label = self.__parse_annotation(element)