From 4ab093776e334d10028d604cd9328d5d3fba4c86 Mon Sep 17 00:00:00 2001 From: Antonio Miras Date: Sat, 31 Oct 2020 10:11:43 +0100 Subject: [PATCH] Case insensitive search on regex image extensions --- docs/source/scripts/partition_dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/scripts/partition_dataset.py b/docs/source/scripts/partition_dataset.py index a9d0c11..697d1a5 100644 --- a/docs/source/scripts/partition_dataset.py +++ b/docs/source/scripts/partition_dataset.py @@ -32,7 +32,7 @@ def iterate_dir(source, dest, ratio, copy_xml): os.makedirs(test_dir) images = [f for f in os.listdir(source) - if re.search(r'([a-zA-Z0-9\s_\\.\-\(\):])+(.jpg|.jpeg|.png)$', f)] + if re.search(r'([a-zA-Z0-9\s_\\.\-\(\):])+(?i)(.jpg|.jpeg|.png)$', f)] num_images = len(images) num_test_images = math.ceil(ratio*num_images) @@ -95,4 +95,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main()