From 02679f3894ac2b92ef10bded35988ca7792f8711 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 5 Aug 2022 11:16:41 -0400 Subject: [PATCH] More efficient logic --- stages/splitmerge.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/stages/splitmerge.py b/stages/splitmerge.py index 51d48cf6..2649a624 100644 --- a/stages/splitmerge.py +++ b/stages/splitmerge.py @@ -26,20 +26,24 @@ class ODMSplitStage(types.ODM_Stage): tree = outputs['tree'] reconstruction = outputs['reconstruction'] photos = reconstruction.photos - - gps_info_available = False - # check for availability of either image_groups.txt (split-merge) or geotagged photos - image_groups_file = os.path.join(args.project_path, "image_groups.txt") - if 'split_image_groups_is_set' in args: - image_groups_file = os.path.abspath(args.split_image_groups) - if io.file_exists(image_groups_file) or reconstruction.has_geotagged_photos(): - gps_info_available = True + outputs['large'] = False should_split = len(photos) > args.split - if should_split and not gps_info_available: - log.ODM_WARNING('Could not perform split-merge as GPS information in photos or image_groups.txt is missing.') - outputs['large'] = should_split and gps_info_available + if should_split: + gps_info_available = False + + # check for availability of either image_groups.txt (split-merge) or geotagged photos + image_groups_file = os.path.join(args.project_path, "image_groups.txt") + if 'split_image_groups_is_set' in args: + image_groups_file = os.path.abspath(args.split_image_groups) + if io.file_exists(image_groups_file) or reconstruction.has_geotagged_photos(): + gps_info_available = True + + if gps_info_available: + outputs['large'] = True + else: + log.ODM_WARNING('Could not perform split-merge as GPS information in photos or image_groups.txt is missing.') if outputs['large']: # If we have a cluster address, we'll use a distributed workflow