Skip to content

Commit

Permalink
changing feasibility reporting; catching IndexErrors when checking fo…
Browse files Browse the repository at this point in the history
…r false positives
  • Loading branch information
naokiyokoyamabd committed Sep 2, 2023
1 parent 030bbe7 commit ee986fe
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions zsos/utils/episode_stats_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ def determine_failure_cause(infos: Dict) -> str:
Returns:
A string describing the cause of failure.
"""
if not infos["top_down_map"]["is_feasible"]:
return "infeasible"
elif infos["target_detected"]:
if infos["target_detected"]:
if was_false_positive(infos):
return "false_positive"
else:
Expand All @@ -77,9 +75,13 @@ def determine_failure_cause(infos: Dict) -> str:
return "false_negative"
else:
if infos["traveled_stairs"]:
return "never_saw_target_traveled_stairs"
cause = "never_saw_target_traveled_stairs"
else:
return "never_saw_target"
cause = "never_saw_target_did_not_travel_stairs"
if not infos["top_down_map"]["is_feasible"]:
return cause + "_likely_infeasible"
else:
return cause + "_feasible"


def was_target_seen(infos: Dict[str, Any]) -> bool:
Expand Down Expand Up @@ -116,7 +118,11 @@ def was_false_positive(infos: Dict[str, Any]) -> bool:
remove_duplicates=True,
)

return target_bboxes_mask[grid_xy[0, 0], grid_xy[0, 1]] == 0
try:
return target_bboxes_mask[grid_xy[0, 0], grid_xy[0, 1]] == 0
except IndexError:
# If the point goal is outside the map, assume it is a false positive
return True


def remove_numpy_arrays(d: Dict) -> Dict:
Expand Down

0 comments on commit ee986fe

Please sign in to comment.