net_params=net_params, binarize=0.000) paddle_model.set_parameters(params) # ball_model_net_params_path = 'ObjectRecognition/net_params/attn_base.json' ball_model_net_params_path = 'ObjectRecognition/net_params/attn_softmax.json' net_params = json.loads(open(ball_model_net_params_path).read()) params = load_param('results/cmaes_soln/focus_self/ball.pth') # params = load_param('ObjectRecognition/models/atari/42531_2_smooth_3_2.pth') ball_model = ModelFocusCNN(image_shape=(84, 84), net_params=net_params, binarize=0.0) ball_model.set_parameters(params) model = ModelCollectionDAG() model.add_model('Paddle', paddle_model, [], augment_fn=util.RemoveMeanMemory(nb_size=(8, 8))) f1 = util.LowIntensityFiltering(6.0) f2 = util.JumpFiltering(3, 0.05) def f(x, y): return f2(x, f1(x, y)) # model.add_model('train', r_model, ['premise'], augment_pt=f) model.add_model('Ball', ball_model, ['Paddle'], augment_pt=f) #,augment_pt=util.JumpFiltering(2, 0.05)) #### if args.true_environment: model = None print(args.true_environment, args.env) if args.env == 'SelfPusher': if args.true_environment:
params = load_param('ObjectRecognition/models/paddle_bin_long_smooth_2.pth') paddle_model = ModelFocusCNN( image_shape=(84, 84), net_params=net_params, ) paddle_model.set_parameters(params) ball_model_net_params_path = 'ObjectRecognition/net_params/two_layer.json' net_params = json.loads(open(ball_model_net_params_path).read()) params = load_param('ObjectRecognition/models/ball.npy') ball_model = ModelFocusCNN( image_shape=(84, 84), net_params=net_params, ) ball_model.set_parameters(params) model = ModelCollectionDAG() model.add_model('Paddle', paddle_model, [], augment_fn=util.RemoveMeanMemory(nb_size=(3, 9))) model.add_model('Ball', ball_model, ['Paddle']) #### true_environment = FocusEnvironment(model) dataset_path = args.record_rollouts changepoint_path = args.changepoint_dir option_chain = OptionChain(true_environment, args.changepoint_dir, args.train_edge, args) reward_paths = glob.glob(os.path.join(option_chain.save_dir, "*rwd.pkl")) print(reward_paths) reward_paths.sort(key=lambda x: int(x.split("__")[2])) head, tail = get_edge(args.train_edge) reward_classes = [load_from_pickle(pth) for pth in reward_paths] # train_models = MultiOption(1, BasicModel)