Example #1
0
    print("Env has ", action_size, " actions.")
    measurement_size = 3  # [Battery, posion, food]
    timesteps = [1, 2, 4, 8, 16, 32]  # For long horizon: [4,8,16,32,64,128]
    goal_size = measurement_size * len(timesteps)

    img_rows, img_cols = 84, 84  #KOE: Think this is still correct.
    # Convert image into Black and white

    #KOETODO Not quite sure what happens here - I'm making images black/white, so what is the point?
    img_channels = 3  # KOE: If I want to change this, I have to also edit the frame stacking when forming s_t

    state_size = (img_rows, img_cols, img_channels)
    agent = DFPAgent(state_size, measurement_size, action_size, timesteps)

    agent.model = Networks.dfp_network(state_size, measurement_size, goal_size,
                                       action_size, len(timesteps),
                                       agent.learning_rate)

    #x_t = game_state.screen_buffer # 480 x 640
    #x_t = preprocessImg(initial_observation, size=(img_rows, img_cols))

    #np.save("input_output_examples/initial_obs.npy", initial_observation)
    #np.save("input_output_examples/preprocessed_obs.npy", x_t)
    #KOE: Preprocessing to get black and white.

    #KOE: Not sure what is going on here. 4 images in a row?
    #s_t = np.stack(([x_t]*4), axis=2) # It becomes 64x64x4
    s_t = initial_observation
    s_t = np.expand_dims(s_t, axis=0)  # 1x64x64x4

    #np.save("input_output_examples/stacked_obs.npy", s_t)