forked from Huangying-Zhan/DF-VO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·57 lines (49 loc) · 1.67 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
52
53
54
55
56
57
# Copyright (C) Huangying Zhan 2019. All rights reserved.
#
# This software is licensed under the terms of the DF-VO licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
import argparse
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
from vo_modules import VisualOdometry as VO
from libs.general.utils import *
from libs.utils import load_kitti_odom_intrinsics
""" Argument Parsing """
parser = argparse.ArgumentParser(description='VO system')
parser.add_argument("-s", "--seq", type=str,
default=None, help="sequence")
parser.add_argument("-c", "--configuration", type=str,
default=None,
help="custom configuration file")
parser.add_argument("-d", "--default_configuration", type=str,
default="options/kitti/kitti_default_configuration.yml",
help="default configuration files")
args = parser.parse_args()
""" Read configuration """
# Read configuration
default_config_file = args.default_configuration
config_files = [default_config_file, args.configuration]
cfg = merge_cfg(config_files)
if args.seq is not None:
cfg.seq = args.seq
cfg.seq = str(cfg.seq)
# Double check result directory
continue_flag = input("Save result in {}? [y/n]".format(cfg.result_dir))
if continue_flag == "y":
mkdir_if_not_exists(cfg.result_dir)
else:
exit()
""" basic setup """
# Random seed
SEED = cfg.seed
np.random.seed(SEED)
""" Main """
vo = VO(cfg)
vo.setup()
vo.main()
# Save configuration file
cfg_path = os.path.join(cfg.result_dir, "configuration_{}.yml".format(cfg.seq))
save_cfg(config_files, file_path=cfg_path)