From 0fe98db5a42dcd5c178b4c4205c1172904009c16 Mon Sep 17 00:00:00 2001 From: acribellier <antoine.cribellier@wur.nl> Date: Fri, 9 May 2025 13:56:02 +0200 Subject: [PATCH] Change condition for overwriting previous --- process/batch_processing.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/process/batch_processing.py b/process/batch_processing.py index 1f7adaa..58d1f4f 100755 --- a/process/batch_processing.py +++ b/process/batch_processing.py @@ -897,7 +897,10 @@ class BatchProcessing: if not overwrite_previous and os.path.exists(os.path.join(save_process_path, 'process_history.yaml')): if fn_name not in ['enhance_contrast', 'enhance_brightness', 'enhance_sharpness', 'enhance_color', - 'autocontrast', 'equalize', 'load_dlc', 'fit_skeleton']: + 'autocontrast', 'equalize', 'load_dlc', 'fit_skeleton']\ + or (fn_name == 'load_dlc' and len(glob.glob(os.path.join(save_process_path, '*' + model_name + '_full.pickle'))) >= 1)\ + or (fn_name == 'fit_skeleton' and len(glob.glob(os.path.join(save_process_path, '*' + model_name + '-3d_points.csv'))) >= 1): + print('>> {0} has been skipped because already processed and overwrite_previous = False'.format(main_rec_name)) continue @@ -1163,8 +1166,15 @@ class BatchProcessing: frames = {camn: recording.get(camn).get_numbers() for camn in range(1, self.nb_cam + 1)} if not overwrite_previous and os.path.exists(os.path.join(save_process_path, 'process_history.yaml')): - print('>> {0} had already been processed, and thus as been skipped (overwrite_previous = False)') - continue + if fn_name not in ['enhance_contrast', 'enhance_brightness', 'enhance_sharpness', 'enhance_color', + 'autocontrast', 'equalize', 'load_dlc', 'fit_skeleton'] \ + or (fn_name == 'load_dlc' and len( + glob.glob(os.path.join(save_process_path, '*' + model_name + '_full.pickle'))) >= 1) \ + or (fn_name == 'fit_skeleton' and len( + glob.glob(os.path.join(save_process_path, '*' + model_name + '-3d_points.csv'))) >= 1): + + print('>> {0} had already been processed, and thus as been skipped (overwrite_previous = False)') + continue if not os.path.exists(save_process_path): os.makedirs(save_process_path) -- GitLab