-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath_constants.py
More file actions
65 lines (51 loc) · 2.24 KB
/
Copy pathpath_constants.py
File metadata and controls
65 lines (51 loc) · 2.24 KB
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
import os
import sys
from enum import Enum
from pathlib import Path
VSLAM_LAB_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
# Keep VSLAM_LAB_PATH equal to the repo root (same as VSLAM_LAB_DIR)
VSLAM_LAB_PATH = VSLAM_LAB_DIR
# Store benchmark/evaluation folders inside the repo, without using the parent directory
VSLAMLAB_BENCHMARK = VSLAM_LAB_DIR / "VSLAM-LAB-Benchmark"
VSLAMLAB_EVALUATION = VSLAM_LAB_DIR / "VSLAM-LAB-Evaluation"
VSLAMLAB_BASELINES = VSLAM_LAB_DIR / "Baselines"
VSLAMLAB_VIDEOS = VSLAMLAB_BENCHMARK / "VIDEOS"
COMPARISONS_YAML_DEFAULT = VSLAM_LAB_DIR / 'configs' / 'comp_complete.yaml'
EXP_YAML_DEFAULT = 'exp_debug.yaml'
CONFIG_DEFAULT = 'config_debug.yaml'
VSLAM_LAB_EVALUATION_FOLDER = 'vslamlab_evaluation'
RGB_BASE_FOLDER = 'rgb'
GROUNTRUTH_FILE = 'groundtruth.csv'
ABLATION_PARAMETERS_CSV = 'log_ablation_parameters.csv'
TRAJECTORY_FILE_NAME = 'KeyFrameTrajectory'
SCRIPT_LABEL = f"\033[95m[{os.path.basename(__file__)}]\033[0m "
class Retention(str, Enum):
MINIMAL="minimal"; STANDARD="standard"; FULL="full"
BENCHMARK_RETENTION = Retention.STANDARD
VSLAMLAB_VERBOSITY = 'LOW'
VerbosityManager = {
"HIGH": 3,
"MEDIUM": 2,
"LOW": 1,
"NONE": 0
}
def set_VSLAMLAB_path(new_path, file_path, target_line_start):
# Always write paths as Path(...) so callers can use "/" safely
new_line = f"{target_line_start} Path(\"{new_path}\")"
print(f"{SCRIPT_LABEL}Set {new_line}")
with open(file_path, 'r') as file:
lines = file.readlines()
with open(file_path, 'w') as file:
for line in lines:
if line.strip().startswith(target_line_start):
file.write(new_line + '\n')
else:
file.write(line)
if __name__ == "__main__":
if len(sys.argv) > 2:
function_name = sys.argv[1]
if function_name == 'set_VSLAMLAB_BENCHMARK_path':
set_VSLAMLAB_path(os.path.join(sys.argv[2], 'VSLAM-LAB-Benchmark'), __file__, "VSLAMLAB_BENCHMARK =")
set_VSLAMLAB_path(os.path.join(sys.argv[2], 'VSLAM-LAB-Benchmark', 'VIDEOS'), __file__, "VSLAMLAB_VIDEOS =")
if function_name == 'set_VSLAMLAB_EVALUATION_path':
set_VSLAMLAB_path(os.path.join(sys.argv[2], 'VSLAM-LAB-Evaluation'), __file__, "VSLAMLAB_EVALUATION =")