Skip to content

some xml file are wrong? #2

Description

@junliang230

when I use box coordinate labeled in the xml file to plot in the figure, such as 1011.xml, the visualization results look wrong, could you check it and update, thans your reply

code I use
`

tree = ET.parse(xml_path)
root = tree.getroot()
size = root.find('size')
width = int(size.find('width').text)
height = int(size.find('height').text)
for obj in root.findall('object'):
name = obj.find('name').text
label = '1'
difficult = None
bnd_box = obj.find('bndbox')
bbox = [
int(bnd_box.find('xmin').text),
int(bnd_box.find('ymin').text),
int(bnd_box.find('xmax').text),
int(bnd_box.find('ymax').text)
]

`

`

for bbox in bboxes:
bbox_int = bbox.astype(np.float).astype(np.int32)
left_top = (bbox_int[0], bbox_int[1])
right_bottom = (bbox_int[2], bbox_int[3])
cv2.rectangle(img, left_top, right_bottom, (0, 0, 255), thickness=2) # blue
cv2.imwrite('./', img)

`

1011

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