Skip to content

Commit 102eea2

Browse files
committed
šŸ› fix(label_converter): preserve provided image filename when VOC filename lacks extension (#1334)
1 parent 1cfb9f8 commit 102eea2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ā€Žanylabeling/views/labeling/label_converter.pyā€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,12 @@ def voc_to_custom(self, input_file, output_file, image_filename, mode):
666666

667667
filename_elem = root.find("filename")
668668
if filename_elem is not None and filename_elem.text:
669-
image_filename = filename_elem.text
669+
xml_image_filename = filename_elem.text
670+
if (
671+
osp.splitext(osp.basename(xml_image_filename))[1]
672+
or not image_filename
673+
):
674+
image_filename = xml_image_filename
670675

671676
self.custom_data["imagePath"] = image_filename
672677
self.custom_data["imageHeight"] = image_height

0 commit comments

Comments
Ā (0)