From dd9f9e8c886aa346af5b2cb643b73aa212c4697b Mon Sep 17 00:00:00 2001 From: "Santhosh K. Ramakrishnan" Date: Sat, 6 Feb 2021 23:56:54 -0800 Subject: [PATCH 1/2] changed legacy baseline nomenclature to latest --- occant_baselines/rl/occant_exp_trainer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/occant_baselines/rl/occant_exp_trainer.py b/occant_baselines/rl/occant_exp_trainer.py index e710cf1..497ae63 100644 --- a/occant_baselines/rl/occant_exp_trainer.py +++ b/occant_baselines/rl/occant_exp_trainer.py @@ -338,7 +338,7 @@ def _create_mapper_rollout_inputs( "ego_map_gt_anticipated_at_t": batch["ego_map_gt_anticipated"], "action_at_t_1": batch["prev_actions"], } - if ans_cfg.OCCUPANCY_ANTICIPATOR.type == "baseline_gt_anticipation": + if ans_cfg.OCCUPANCY_ANTICIPATOR.type == "occant_ground_truth": mapper_rollout_inputs["ego_map_gt_anticipated_at_t_1"] = prev_batch[ "ego_map_gt_anticipated" ] @@ -806,7 +806,7 @@ def _create_mapper_rollouts(self, ppo_cfg, ans_cfg): ], "action_at_t_1": spaces.Box(low=0, high=4, shape=(1,), dtype=np.int32), } - if ans_cfg.OCCUPANCY_ANTICIPATOR.type == "baseline_gt_anticipation": + if ans_cfg.OCCUPANCY_ANTICIPATOR.type == "occant_ground_truth": mapper_observation_space[ "ego_map_gt_anticipated_at_t_1" ] = self.envs.observation_spaces[0].spaces["ego_map_gt_anticipated"] From 1f2af0c9e6f67c107ed64a79635673e67c7d8fd1 Mon Sep 17 00:00:00 2001 From: "Santhosh K. Ramakrishnan" Date: Thu, 1 Jul 2021 12:21:08 -0700 Subject: [PATCH 2/2] config bug fixes * add GT_EGO_MAP_ANTICIPATED sensor by default for occant_ground_truth * NOISY_POSE_SENSOR -> NOISE_FREE_POSE_SENSOR for noise_free configs --- configs/exploration/gibson_evaluate_noise_free.yaml | 2 +- configs/exploration/mp3d_evaluate_noise_free.yaml | 2 +- occant_baselines/rl/occant_exp_trainer.py | 5 +++++ occant_baselines/rl/occant_nav_trainer.py | 11 +++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configs/exploration/gibson_evaluate_noise_free.yaml b/configs/exploration/gibson_evaluate_noise_free.yaml index c82e89e..e59e693 100644 --- a/configs/exploration/gibson_evaluate_noise_free.yaml +++ b/configs/exploration/gibson_evaluate_noise_free.yaml @@ -21,7 +21,7 @@ SIMULATOR: TASK: TYPE: Exp-v0 POSSIBLE_ACTIONS: ["MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] - SENSORS: ['NOISY_POSE_SENSOR', 'GT_POSE_SENSOR', 'COLLISION_SENSOR'] + SENSORS: ['NOISE_FREE_POSE_SENSOR', 'GT_POSE_SENSOR', 'COLLISION_SENSOR'] MEASUREMENTS: ['GT_GLOBAL_MAP', 'TOP_DOWN_MAP_EXP'] GT_GLOBAL_MAP: MAP_SIZE: 961 diff --git a/configs/exploration/mp3d_evaluate_noise_free.yaml b/configs/exploration/mp3d_evaluate_noise_free.yaml index edf4553..12f88b7 100644 --- a/configs/exploration/mp3d_evaluate_noise_free.yaml +++ b/configs/exploration/mp3d_evaluate_noise_free.yaml @@ -21,7 +21,7 @@ SIMULATOR: TASK: TYPE: Exp-v0 POSSIBLE_ACTIONS: ["MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] - SENSORS: ['NOISY_POSE_SENSOR', 'GT_POSE_SENSOR', 'COLLISION_SENSOR'] + SENSORS: ['NOISE_FREE_POSE_SENSOR', 'GT_POSE_SENSOR', 'COLLISION_SENSOR'] MEASUREMENTS: ['GT_GLOBAL_MAP', 'TOP_DOWN_MAP_EXP'] GT_GLOBAL_MAP: MAP_SIZE: 2001 diff --git a/occant_baselines/rl/occant_exp_trainer.py b/occant_baselines/rl/occant_exp_trainer.py index 497ae63..384fa2d 100644 --- a/occant_baselines/rl/occant_exp_trainer.py +++ b/occant_baselines/rl/occant_exp_trainer.py @@ -150,6 +150,11 @@ def _synchronize_configs(self, config): config.TASK_CONFIG.TASK.GT_GLOBAL_MAP.MAP_SCALE = ( config.RL.ANS.MAPPER.map_scale ) + # Enable GT anticipation sensor for baseline evaluation + if config.RL.ANS.OCCUPANCY_ANTICIPATOR.type == "occant_ground_truth": + if 'GT_EGO_MAP_ANTICIPATED' not in config.TASK_CONFIG.TASK.SENSORS: + config.TASK_CONFIG.TASK.SENSORS.append('GT_EGO_MAP_ANTICIPATED') + config.freeze() def _setup_actor_critic_agent(self, ppo_cfg: Config, ans_cfg: Config) -> None: diff --git a/occant_baselines/rl/occant_nav_trainer.py b/occant_baselines/rl/occant_nav_trainer.py index fe8956d..255e503 100644 --- a/occant_baselines/rl/occant_nav_trainer.py +++ b/occant_baselines/rl/occant_nav_trainer.py @@ -95,6 +95,12 @@ def _synchronize_configs(self, config): ego_proj_config.camera_height = camera_height ego_proj_config.height_thresholds = height_thresholds config.RL.ANS.OCCUPANCY_ANTICIPATOR.EGO_PROJECTION = ego_proj_config + # Set the GT anticipation options + wall_fov = config.RL.ANS.OCCUPANCY_ANTICIPATOR.GP_ANTICIPATION.wall_fov + config.TASK_CONFIG.TASK.GT_EGO_MAP_ANTICIPATED.WALL_FOV = wall_fov + config.TASK_CONFIG.TASK.GT_EGO_MAP_ANTICIPATED.MAP_SIZE = map_size + config.TASK_CONFIG.TASK.GT_EGO_MAP_ANTICIPATED.MAP_SCALE = map_scale + config.TASK_CONFIG.TASK.GT_EGO_MAP_ANTICIPATED.MAX_SENSOR_RANGE = -1 # Set the correct image scaling values config.RL.ANS.MAPPER.image_scale_hw = config.RL.ANS.image_scale_hw config.RL.ANS.LOCAL_POLICY.image_scale_hw = config.RL.ANS.image_scale_hw @@ -105,6 +111,11 @@ def _synchronize_configs(self, config): config.RL.ANS.LOCAL_POLICY.AGENT_DYNAMICS.turn_angle = ( config.TASK_CONFIG.SIMULATOR.TURN_ANGLE ) + # Enable GT anticipation sensor for baseline evaluation + if config.RL.ANS.OCCUPANCY_ANTICIPATOR.type == "occant_ground_truth": + if 'GT_EGO_MAP_ANTICIPATED' not in config.TASK_CONFIG.TASK.SENSORS: + config.TASK_CONFIG.TASK.SENSORS.append('GT_EGO_MAP_ANTICIPATED') + config.freeze() def _setup_actor_critic_agent(self, ppo_cfg: Config, ans_cfg: Config) -> None: