From b17795640fb78e4bde03be8d281131d1daa0fc83 Mon Sep 17 00:00:00 2001 From: Ali Amini Bagh Date: Sat, 25 Jun 2022 20:50:22 +0430 Subject: [PATCH] fix(yoloannotation): just last file extension be replaced with txt not all words are the same #9 --- preimutils/object_detection/yolo/coco2yolo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preimutils/object_detection/yolo/coco2yolo.py b/preimutils/object_detection/yolo/coco2yolo.py index 0a2a746..b67cc3e 100644 --- a/preimutils/object_detection/yolo/coco2yolo.py +++ b/preimutils/object_detection/yolo/coco2yolo.py @@ -79,7 +79,7 @@ def coco2yolo(self): def _save_txt(self, anno_dict): for k, v in anno_dict.items(): ext_name = v[0][0].split(".")[-1] - file_name = v[0][0].replace(ext_name, 'txt') + file_name = v[0][0][:-len(ext_name)] + 'txt' with open(os.path.join(self.output, file_name), 'w', encoding='utf-8') as f: for obj in v: cat_name = self.coco_id_name_map.get(obj[1])