Theivaprakasham Hari
commited on
Commit
·
5a1000a
1
Parent(s):
e71a089
corrected
Browse files
app.py
CHANGED
@@ -104,14 +104,13 @@ def draw_detections(image: np.ndarray, results, labels, keypoint_threshold: floa
|
|
104 |
|
105 |
def generate_xml(filename: str, width: int, height: int, keypoints: list[tuple[float, float, str]]):
|
106 |
"""Generate an XML annotation file for a single image."""
|
107 |
-
base_name = Path(filename).stem
|
108 |
annotations = ET.Element("annotations")
|
109 |
image_tag = ET.SubElement(annotations, "image", filename=filename,
|
110 |
width=str(width), height=str(height))
|
111 |
for idx, (x, y, label) in enumerate(keypoints):
|
112 |
ET.SubElement(image_tag, "point", id=str(idx), x=str(x), y=str(y), label=label)
|
113 |
tree = ET.ElementTree(annotations)
|
114 |
-
xml_filename = f"{
|
115 |
xml_path = ANNOTATIONS_DIR / xml_filename
|
116 |
tree.write(str(xml_path), encoding="utf-8", xml_declaration=True)
|
117 |
return xml_path
|
|
|
104 |
|
105 |
def generate_xml(filename: str, width: int, height: int, keypoints: list[tuple[float, float, str]]):
|
106 |
"""Generate an XML annotation file for a single image."""
|
|
|
107 |
annotations = ET.Element("annotations")
|
108 |
image_tag = ET.SubElement(annotations, "image", filename=filename,
|
109 |
width=str(width), height=str(height))
|
110 |
for idx, (x, y, label) in enumerate(keypoints):
|
111 |
ET.SubElement(image_tag, "point", id=str(idx), x=str(x), y=str(y), label=label)
|
112 |
tree = ET.ElementTree(annotations)
|
113 |
+
xml_filename = f"{filename}.xml"
|
114 |
xml_path = ANNOTATIONS_DIR / xml_filename
|
115 |
tree.write(str(xml_path), encoding="utf-8", xml_declaration=True)
|
116 |
return xml_path
|