-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.py
43 lines (35 loc) · 1.09 KB
/
control.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
import sys, getopt, time
import tensorflow as tf
from model import create_model
from predict import Predict
import utils
model = tf.keras.models.load_model(utils.model_path)
opts, _ = getopt.getopt(sys.argv[1:], '', ['region=', 'image_box=', 'map_box=', 'use_map='])
region = utils.default_region
image_box = utils.default_image_box
map_box = utils.default_map_box
use_map = True
for opt, arg in opts:
if opt == '--region':
regions = arg.split(',')
region = []
for r in regions:
region.append(int(r))
elif opt == '--image_box':
boxs = arg.split(',')
image_box = []
for b in boxs:
image_box.append(int(b))
elif opt == '--map_box':
boxs = arg.split(',')
map_box = []
for b in boxs:
map_box.append(int(b))
elif opt == '--use_map':
use_map = int(arg) == 1
print("use navigation map? {}".format(use_map))
count_done = 10
for i in range(count_done):
print(i)
time.sleep(1)
Predict(region=region, image_box=image_box, map_box=map_box, model=model, use_map=use_map).start()