コード例 #1
0
 def collect_garbage(self):
     self.env = launch_env()
     self.change_model(self.seed)
from duckietown_rl.wrappers import NormalizeWrapper, ImgWrapper, \
    DtRewardWrapper, ActionWrapper, ResizeWrapper
import numpy as np

args = get_ddpg_args_test()

experiment = args.experiment
seed = args.seed
policy_name = "DDPG"

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

file_name = "{}_{}_{}".format(policy_name, experiment, seed)

# Launch the env with our helper function
env = launch_env()

# Wrappers
env = ResizeWrapper(env)
env = NormalizeWrapper(env)
env = ImgWrapper(env)  # to make the images from 160x120x3 into 3x160x120
env = ActionWrapper(env)
# env = DtRewardWrapper(env) # not during testing

state_dim = env.observation_space.shape
action_dim = env.action_space.shape[0]
max_action = float(env.action_space.high[0])

# Initialize policy
policy = DDPG(state_dim, action_dim, max_action, net_type="cnn")
コード例 #3
0
 def __init__(self):
     self.env = launch_env()
     self.observation = None
     self.seed = None
     self.preliminary_transformer = PreliminaryTransformer()