From 160e098817fdb08d65e526948ca8c4229ea459d8 Mon Sep 17 00:00:00 2001 From: labintsev Date: Thu, 6 Jun 2024 13:13:01 +0300 Subject: [PATCH] fix: require --dir argument, unsupported in python3.9 commas, out_jpeg_images dir --- merge.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/merge.py b/merge.py index 87aaacd..67a3926 100644 --- a/merge.py +++ b/merge.py @@ -14,7 +14,6 @@ def parse_args() -> argparse.Namespace: ) parser.add_argument( '-d', '--dir', - required=True, type=str, help='Directory containing LADD files', default='dataset' @@ -64,7 +63,7 @@ def merge_datasets(dirs: list[str], outdir: str) -> None: names.append(new_name) new_annotation = os.path.join(out_annotations, f'{new_name}.xml') - new_image = os.path.join(out_images, f'{new_name}.jpg') + new_image = os.path.join(out_jpeg_images, f'{new_name}.jpg') shutil.copy(old_image, new_image) annotation_text = open(old_annotation, 'r').read() @@ -73,11 +72,11 @@ def merge_datasets(dirs: list[str], outdir: str) -> None: f'{new_name}' ) annotation_text = annotation_text.replace( - f'{old_name.replace('train_', '')}', + f"{old_name.replace('train_', '')}", f'{new_name}' ) annotation_text = annotation_text.replace( - f'{old_name.replace('test_', '')}', + f"{old_name.replace('test_', '')}", f'{new_name}' ) open(new_annotation, 'w').write(annotation_text)