-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (38 loc) · 1.25 KB
/
main.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
from src.MainNode.Communication.communication import *
import settings
import socket
import threading
from src.SocialStudy import questions
from src.Pi.PiBot.PiBot2 import PiBot2
"""
determine if main or pi
"""
hostname = socket.gethostname()
print(hostname)
if hostname in settings.PI_HOST_NAMES:
IS_PI = True
# from src.DRL.run_session import train_and_test_bot
from src.DRL.train import train
from src.DRL.test import test
elif hostname == settings.PC:
IS_PI = False
# from src.MainNode.Utils.OverHead import OverHead
# from src.MainNode.Utils.stream_oh_inference import run
else:
raise Exception("Must configure this device in settings.py")
def main_train_and_test():
if not IS_PI: # main node
#oh_stream = OverHead()
# model = ('ssd_mobilenet_v2_320x320_coco17_tpu-8', 3)
# run(model, oh_stream)
threading.Thread(target=subscribe, args=()).start()
threading.Thread(target=questions.get_user_input, args=()).start()
else:
pibot = PiBot2()
steps = 200
train.train_session(pibot, steps, continue_prompt=True)
# publish_data(actions)
test.run_policy(pibot, steps, continue_prompt=True)
if __name__ == "__main__":
# main()
main_train_and_test()