Ejemplo n.º 1
0
def run_weights():

    env = gym.make('Mario-Kart-Luigi-Raceway-v0')

    resolution = (120, 160)

    actions = [
        [-60, 0, 1, 0, 0],  # left
        [60, 0, 1, 0, 0],  # right
        [0, -80, 0, 1, 0],  # back
        [0, 0, 1, 0, 0]
    ]  # go straight
    # [  0,   0, 0, 1, 0]]             # brake

    # Load Model and Weights
    model = DQNModel(resolution=resolution,
                     nb_frames=test_param['nb_frames'],
                     actions=actions)

    model.load_weights(model_weights)

    agent = RLAgent(model, **test_param)

    agent.test(env)
Ejemplo n.º 2
0
# Initiates the env
env = gym.make('Mario-Kart-Luigi-Raceway-v0')

resolution = (120, 160)

actions = [
    [-60, 0, 1, 0, 0],  # left
    [60, 0, 1, 0, 0],  # right
    [0, -80, 0, 1, 0],  # back
    [0, 0, 1, 0, 0]
]  # go straight
# [  0,   0, 0, 1, 0]]             # brake

# Initiates Model
model = DQNModel(resolution=resolution,
                 nb_frames=learn_param['nb_frames'],
                 actions=actions)

# print("number of actions: ", len(doom.actions))   # 16

if model_weights:
    model.load_weights(model_weights)
else:
    print("Please provide a model_weights file")

agent = RLAgent(model, **learn_param)

# give a step number randomly to catch a random screen shot
agent.visualize(env)