Example #1
0
def initiate():
    IM_SIZE = 2  # 80
    N_CHANEL = 9  # this is the representation of a block by 9 blocks
    K = 6  # env.action_space.n
    D = IM_SIZE * N_CHANEL
    hidden_layer_sizes = [128, 64, 32]
    gamma = 0.5

    # number of random test
    batch_sz = 32
    count = 0

    tf.reset_default_graph()

    model = Dueling_DQN_PER_2D(D=D, K=K, batch_sz=batch_sz, hidden_layer_sizes=hidden_layer_sizes,
                               gamma=gamma, lr=2.3e-6, N_CHANEL=N_CHANEL, IM_SIZE=IM_SIZE, scope="DDQN")

    print("DRL model loaded")

    init = tf.global_variables_initializer()
    sess = tf.InteractiveSession()
    sess.run(init)

    saver = tf.train.Saver()

    MODEL_PATH = "../logs/2d/save_models/2d_mean_std"

    saver.restore(sess, MODEL_PATH)
    model.set_session(sess)

    return model
Example #2
0
D = IM_SIZE * N_CHANEL
hidden_layer_sizes = [128, 64, 32]
gamma = 0.5
starting_pixel_loc_list = [[20, 340], [320, 15]]

# number of random test
batch_sz = 32
count = 0

#tf.reset_default_graph()

model = Dueling_DQN_PER_2D(D=D,
                           K=K,
                           batch_sz=batch_sz,
                           hidden_layer_sizes=hidden_layer_sizes,
                           gamma=gamma,
                           lr=2.3e-6,
                           N_CHANEL=N_CHANEL,
                           IM_SIZE=IM_SIZE,
                           scope="DDQN")

init = tf.global_variables_initializer()
sess = tf.InteractiveSession()
sess.run(init)

saver = tf.train.Saver()

MODEL_PATH = "../logs/2d/save_models/2d_mean_std"

saver.restore(sess, MODEL_PATH)
model.set_session(sess)