Beispiel #1
0
    f1 = sklearn.metrics.f1_score(y_true, preds, average=None)
    conf_mat = sklearn.metrics.confusion_matrix(y_true, preds)
    return prec, rec, f1, conf_mat


env = DrivingSimulatorEnv(defs_obs=[('/training/image/compressed',
                                     CompressedImage)],
                          func_compile_obs=compile_obs,
                          defs_reward=[
                              ('/rl/has_obstacle_nearby', Bool),
                              ('/rl/distance_to_longestpath', Float32),
                              ('/rl/car_velocity', Float32),
                              ('/rl/last_on_opposite_path', Int16),
                              ('/rl/on_pedestrian', Bool)
                          ],
                          func_compile_reward=compile_reward,
                          defs_action=[('/autoDrive_KeyboardMode', Char)],
                          rate_action=10.0,
                          window_sizes={
                              'obs': 2,
                              'reward': 3
                          },
                          buffer_sizes={
                              'obs': 2,
                              'reward': 3
                          },
                          step_delay_target=0.4)

# def f_net(inputs):
#     l2 = 1e-3
#     state = inputs[0]
#     conv = hrl.utils.Network.conv2ds(state, shape=[(32, 4, 4), (64, 4, 4), (64, 2, 2)], out_flatten=True,
Beispiel #2
0
                           "/home/pirate03/PycharmProjects/hobotrl/playground/initialD/imitaion_learning/DrSim_resnet_rename_pi_q_opt_add_logitsadam",
                           """save tmp model""")


FLAGS = tf.app.flags.FLAGS

# What is the result's name?? Need check
env = DrivingSimulatorEnv(
    defs_obs=[('/training/image/compressed', CompressedImage),
              ('/decision_result', Int16)],
    func_compile_obs=compile_obs,
    defs_reward=[
        ('/rl/has_obstacle_nearby', Bool),
        ('/rl/distance_to_longestpath', Float32),
        ('/rl/car_velocity', Float32),
        ('/rl/last_on_opposite_path', Int16),
        ('/rl/on_pedestrian', Bool)],
    func_compile_reward=compile_reward,
    defs_action=[('/autoDrive_KeyboardMode', Char)],
    rate_action=10.0,
    window_sizes={'obs': 2, 'reward': 3},
    buffer_sizes={'obs': 2, 'reward': 3},
    step_delay_target=0.5
)
env.observation_space = Box(low=0, high=255, shape=(640, 640, 3))
env.action_space = Discrete(3)
env.reward_range = (-np.inf, np.inf)
env.metadata = {}
# env = FrameStack(env, 1)
ACTIONS = [(Char(ord(mode)),) for mode in ['s', 'd', 'a']]