Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from facebookresearch/fix_occant_ground_truth
Browse files Browse the repository at this point in the history
Fix training and evaluation for occant ground truth
  • Loading branch information
srama2512 authored Jul 1, 2021
2 parents 073651b + 1f2af0c commit aea6a2c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configs/exploration/gibson_evaluate_noise_free.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configs/exploration/mp3d_evaluate_noise_free.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions occant_baselines/rl/occant_exp_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -338,7 +343,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"
]
Expand Down Expand Up @@ -806,7 +811,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"]
Expand Down
11 changes: 11 additions & 0 deletions occant_baselines/rl/occant_nav_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit aea6a2c

Please sign in to comment.