From d51b3a0ac280036409647b0d1547d6eed4ac9018 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Fri, 1 Mar 2024 16:29:46 +0800 Subject: [PATCH] replace pool.map with pool.imap_unordered --- src/labelme2yolo/l2y.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/labelme2yolo/l2y.py b/src/labelme2yolo/l2y.py index 74d57e5..d70f17a 100644 --- a/src/labelme2yolo/l2y.py +++ b/src/labelme2yolo/l2y.py @@ -249,7 +249,7 @@ def convert(self, val_size, test_size): with Pool(os.cpu_count() - 1) as pool, Progress() as progress: task = progress.add_task("[cyan]Converting...", total=len(json_names)) func = partial(self.covert_json_to_text, target_dir) - for _ in pool.map(func, json_names): + for _ in pool.imap_unordered(func, json_names): progress.update(task, advance=1) self._save_dataset_yaml()