/
run.py
executable file
·51 lines (39 loc) · 1.34 KB
/
run.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
import argparse
import os
import random
import numpy as np
import torch
from src import config
from src.uncle_slam import UncleSlam
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.use_deterministic_algorithms(True, warn_only=True)
def main():
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
setup_seed(20)
parser = argparse.ArgumentParser(description="Arguments for running the UncLe-SLAM.")
parser.add_argument("config", type=str, help="Path to config file.")
parser.add_argument(
"--input_folder",
type=str,
help="input folder, this have higher priority, can overwrite the one in config file",
)
parser.add_argument(
"--output",
type=str,
help="output folder, this have higher priority, can overwrite the one in config file",
)
uncle_parser = parser.add_mutually_exclusive_group(required=False)
uncle_parser.add_argument("--uncle", dest="uncle", action="store_true")
parser.set_defaults(uncle=True)
args = parser.parse_args()
cfg = config.load_config(args.config, "configs/uncle_slam.yaml")
slam = UncleSlam(cfg, args)
slam.run()
if __name__ == "__main__":
main()