Skip to content

Commit

Permalink
Merge branch 'bruno' of github.com:lardemua/atom into bruno
Browse files Browse the repository at this point in the history
  • Loading branch information
brunofavs committed May 8, 2024
2 parents a208edf + 913c5bf commit 411cf06
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
77 changes: 77 additions & 0 deletions atom_batch_execution/experiments/softbot_example/template.yml.j2
Original file line number Diff line number Diff line change
@@ -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
23 changes: 5 additions & 18 deletions atom_batch_execution/scripts/batch_execution
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 411cf06

Please sign in to comment.