forked from prs-eth/OverlapPredator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_benchmark_global.py
95 lines (81 loc) · 3.26 KB
/
run_benchmark_global.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os, shutil
from multiprocessing import Pool
from pathlib import Path
PY3="python3"
GPU = "0"
os.environ["CUDA_VISIBLE_DEVICES"] = GPU
BENCHMARK_DIR = "/benchmark/point_clouds_registration_benchmark/dataset_voxelgrid_0.025"
MODEL = "3DMatch"
N_POINTS = 5000
RESULTS_DIR = f"/benchmark/experiments/OverlapPredator/{MODEL}/features"
base_command = ( f'{PY3}' + f' scripts/predator_benchmark.py {MODEL} {N_POINTS}')
problem_txts = ['kaist/urban05_global.txt',
'eth/apartment_global.txt',
'eth/gazebo_summer_global.txt',
'eth/gazebo_winter_global.txt',
'eth/hauptgebaude_global.txt',
'eth/plain_global.txt',
'eth/stairs_global.txt',
'eth/wood_autumn_global.txt',
'eth/wood_summer_global.txt',
'tum/long_office_household_global.txt',
'tum/pioneer_slam_global.txt',
'tum/pioneer_slam3_global.txt',
'planetary/box_met_global.txt',
'planetary/p2at_met_global.txt',
'planetary/planetary_map_global.txt']
pcd_dirs = ['kaist/urban05/',
'eth/apartment/',
'eth/gazebo_summer/',
'eth/gazebo_winter/',
'eth/hauptgebaude/',
'eth/plain/',
'eth/stairs/',
'eth/wood_autumn/',
'eth/wood_summer/',
'tum/long_office_household/',
'tum/pioneer_slam/',
'tum/pioneer_slam3/',
'planetary/box_met/',
'planetary/p2at_met/',
'planetary/p2at_met/']
feature_dirs = ['kaist/urban05/',
'eth/apartment/',
'eth/gazebo_summer/',
'eth/gazebo_winter/',
'eth/hauptgebaude/',
'eth/plain/',
'eth/stairs/',
'eth/wood_autumn/',
'eth/wood_summer/',
'tum/long_office_household/',
'tum/pioneer_slam/',
'tum/pioneer_slam3/',
'planetary/box_met/',
'planetary/p2at_met/',
'planetary/planetary_map/']
commands = []
for problem_txt, pcd_dir, feature_dir in zip(problem_txts, pcd_dirs, feature_dirs):
full_command = (base_command +
f' --input_txt={BENCHMARK_DIR}/{problem_txt}' +
f' --input_pcd_dir={BENCHMARK_DIR}/{pcd_dir}' +
f' --output_dir={RESULTS_DIR}/{feature_dir}')
problem_name = Path(problem_txt).stem
time_command = f'command time --verbose -o {RESULTS_DIR}/{problem_name}_time.txt ' + full_command
nvidia_command = (f'nvidia-smi --query-gpu=timestamp,memory.used -i 0 --format=csv -lms 1 > {RESULTS_DIR}/{problem_name}_memory.txt')
full_command_stats = f'parallel -j2 --halt now,success=1 ::: \'{time_command}\' \'{nvidia_command}\''
commands.append(full_command_stats)
answer = input(f"Delete previous {RESULTS_DIR}? [Y/N] ")
if answer != "Y":
print("Quitting...")
exit()
# delete and recreate result directory
shutil.rmtree(RESULTS_DIR, ignore_errors=True)
os.makedirs(RESULTS_DIR)
# save config in result directory
txt_commands = os.path.join(RESULTS_DIR, "readme.md")
with open(txt_commands, 'w') as f:
for item in commands:
f.write("%s\n" % item)
pool = Pool(1)
pool.map(os.system, commands)