import xml.etree.ElementTree as ET
import os
box_path = r"C:\Users\Lenovo\Desktop\mbdata\VOCdevkit\VOC2012\Annotations"
box_pal_path = os.path.join(box_path, "Cell-Multi.533.xml")
tree = ET.parse(box_pal_path)
root = tree.getroot()
for obj in root.iter('object'):
clsname = obj.find('name').text
print(clsname)
xmlbox = obj.find('bndbox')
b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text),
float(xmlbox.find('ymax').text))
bb = [b[0], b[2], b[1], b[3]]
print(bb)