diff --git a/atom_batch_execution/experiments/rrbot_example/template.yml.j2 b/atom_batch_execution/experiments/rrbot_example/template.yml.j2 index e70c418c..b531123d 100644 --- a/atom_batch_execution/experiments/rrbot_example/template.yml.j2 +++ b/atom_batch_execution/experiments/rrbot_example/template.yml.j2 @@ -30,13 +30,13 @@ experiments: rosrun atom_calibration calibrate -json {{ dataset_path }}/dataset.json \ -v -max_nfev 2 -ss {{ run }} \ -nig {{ e.nig_value }} {{ e.nig_value }} \ - -csf 'lambda x: int(x) in {{ fold[0] }}' \ + -csf 'lambda x: x in {{ fold[0] }}' \ && \ rosrun atom_evaluation rgb_to_rgb_evaluation \ -train_json {{ dataset_path }}/atom_calibration.json \ -test_json {{ dataset_path }}/dataset.json \ -ss rgb_left -st rgb_right \ - -csf 'lambda x: int(x) in {{ fold[1] }}' \ + -csf 'lambda x: x in {{ fold[1] }}' \ -sfr -sfrn /tmp/rgb_rgb_evaluation.csv files_to_collect: - '{{ dataset_path }}/atom_calibration.json' diff --git a/atom_batch_execution/experiments/softbot_example/template.yml.j2 b/atom_batch_execution/experiments/softbot_example/template.yml.j2 new file mode 100644 index 00000000..d4c3df42 --- /dev/null +++ b/atom_batch_execution/experiments/softbot_example/template.yml.j2 @@ -0,0 +1,77 @@ +# +# █████╗ ████████╗ ██████╗ ███╗ ███╗ +# ██╔══██╗╚══██╔══╝██╔═══██╗████╗ ████║ +# ███████║ ██║ ██║ ██║██╔████╔██║ +# ██╔══██║ ██║ ██║ ██║██║╚██╔╝██║ +# __ ██║ ██║ ██║ ╚██████╔╝██║ ╚═╝ ██║ _ +# / _| ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ | | +# | |_ _ __ __ _ _ __ ___ _____ _____ _ __| | __ +# | _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ / +# | | | | | (_| | | | | | | __/\ v v / (_) | | | < +# |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\ +# https://github.com/lardemua/atom + +# this yml file contains a set of commands to be run in batch. +# use jinja2 syntax for referencing variables + +# Preprocessing will run only once before all experiments. +preprocessing: + cmd: | + ls /tmp + +# Define batches to run +experiments: +{%- for e in experiments %} + {% for run in runs %} + {% set run_index = loop.index %} + {% for fold in folds %} + {{ e.name }}_run{{ '%03d' % run_index }}_fold{{ '%03d' % loop.index }}: + cmd: | + rosrun atom_calibration calibrate -json {{ dataset_path }}/dataset_corrected.json \ + -v -ss {{ run }} \ + -nig {{ e.nig_value }} {{ e.nig_value }} \ + -csf 'lambda x: x in {{ fold[0] }}' \ + -ntfv {{ e.ntfv_value }} {{ e.ntfv_value }} \ + -ntfl "world:base_footprint" \ + -sce \ + {%- if not e.calibrate_odom -%} + -atsf 'lambda name : name in []' \ + {%- endif %} + && \ + + # front_left_camera to front_right_camera evaluation + rosrun atom_evaluation rgb_to_rgb_evaluation \ + -train_json {{ dataset_path }}/atom_calibration.json \ + -test_json {{ dataset_path }}/dataset_corrected.json \ + -ss front_left_camera -st front_right_camera \ + -sfr -sfrn /tmp/rgb_rgb_evaluation.csv \ + -csf 'lambda x: x in {{ fold[1] }}' \ + && \ + + # front_left_camera to lidar3d evaluation + rosrun atom_evaluation lidar_to_rgb_evaluation -rs lidar3d -cs front_left_camera \ + -train_json {{ dataset_path }}/atom_calibration.json \ + -test_json {{ dataset_path }}/dataset_corrected.json \ + -csf 'lambda x: x in {{ fold[1] }}' \ + -sfr -sfrn /tmp/lidar3d_rgb_front_left_evaluation.csv \ + && \ + + # front_right_camera to lidar3d evaluation + rosrun atom_evaluation lidar_to_rgb_evaluation -rs lidar3d -cs front_right_camera \ + -train_json {{ dataset_path }}/atom_calibration.json \ + -test_json {{ dataset_path }}/dataset_corrected.json \ + -csf 'lambda x: x in {{ fold[1] }}' \ + -sfr -sfrn /tmp/lidar3d_rgb_front_right_evaluation.csv + + files_to_collect: + - '{{ dataset_path }}/atom_calibration.json' + - '{{ dataset_path }}/atom_calibration_params.yml' + - '{{ dataset_path }}/command_line_args.yml' + - '{{ dataset_path }}/calibration_errors.csv' + - '/tmp/rgb_rgb_evaluation.csv' + - '/tmp/lidar3d_rgb_front_left_evaluation.csv' + - '/tmp/lidar3d_rgb_front_right_evaluation.csv' + {%- endfor %} + {%- endfor %} +{%- endfor %} +# End the loop diff --git a/atom_batch_execution/scripts/batch_execution b/atom_batch_execution/scripts/batch_execution index 2821d27b..20822784 100755 --- a/atom_batch_execution/scripts/batch_execution +++ b/atom_batch_execution/scripts/batch_execution @@ -127,27 +127,14 @@ def main(): else: # Print error message if the cross validation type is not supported - folds = [(collection_keys, collection_keys)] + folds = [(range(len(collection_keys)), range(len(collection_keys)))] bprint('Running without any cross validation.') - # Generate a list of folds - fold_list_idxs = [[list(train), list(test)] for (train, test) in folds] + # Converting folds to a list, in order to iterate over it various times + folds = list(folds) - # Converting idx to collection key - fold_list = deepcopy(fold_list_idxs) - for i,fold in enumerate(fold_list): - for j,split in enumerate(fold): - for k,element in enumerate(split): - collection_list = list(dataset['collections'].keys()) - prev_idx = element - collection_number = int(collection_list[element]) - print(f'Idx {prev_idx} has now key {collection_number}') - - fold_list[i][j][k] = collection_number - - # print(fold_list_idxs) - # print('\n') - # print(fold_list) + # Transforming indexes of collections into collection keys + fold_list = [[[collection_keys[element] for element in split] for split in fold] for fold in folds] # Dataset is no longer needed del dataset