From 4360d4f4bd95afd52f25d682601337b368be7243 Mon Sep 17 00:00:00 2001 From: Santosh Ray Date: Wed, 26 Jul 2023 10:54:07 +0530 Subject: [PATCH] Fix double split-text issue causing incorrect filename truncation Resolved an issue where using split-text twice resulted in incorrect truncation of filenames containing multiple dots. For instance, a file named '2018_01_Items_1-2-2018-2191.30.jpg' was being improperly shortened to '2018_01_Items_1-2-2018-2191.jpg'. --- mmocr/apis/inferencers/base_mmocr_inferencer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmocr/apis/inferencers/base_mmocr_inferencer.py b/mmocr/apis/inferencers/base_mmocr_inferencer.py index 02ac643d9..816239531 100644 --- a/mmocr/apis/inferencers/base_mmocr_inferencer.py +++ b/mmocr/apis/inferencers/base_mmocr_inferencer.py @@ -295,7 +295,7 @@ def visualize(self, img_name = osp.splitext(osp.basename(pred.img_path))[0] if save_vis and img_out_dir: - out_file = osp.splitext(img_name)[0] + out_file = img_name out_file = f'{out_file}.jpg' out_file = osp.join(img_out_dir, out_file) else: