replace pool.map with pool.imap_unordered (#45)

This commit is contained in:
Wang Xin 2024-03-01 16:33:07 +08:00 committed by GitHub
parent 1e697c78e9
commit 6bc4e27231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -249,7 +249,7 @@ class Labelme2YOLO:
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()