From 641b7169b3c86b01ee8f3af521dc8187705d94e5 Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Sun, 6 Oct 2024 18:16:16 +0800 Subject: [PATCH] fix: evaluation metrics for new reverie (path) it's a "new" new reverie, I only choose the front path & the back path > 1's instructions. --- map_nav_src/reverie/env.py | 27 +++++++++++++-------------- map_nav_src/scripts/run_reverie.sh | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/map_nav_src/reverie/env.py b/map_nav_src/reverie/env.py index 21d768d..fe96eca 100644 --- a/map_nav_src/reverie/env.py +++ b/map_nav_src/reverie/env.py @@ -392,27 +392,28 @@ class ReverieObjectNavBatch(object): gt_room_start_vp = None gt_back_path = [] gt_front_path = [] - exit_room = False for vp in gt_path[::-1]: - if node_region[scan][vp] == gt_stop_region and not exit_room: + if node_region[scan][vp] == gt_stop_region and gt_front_path == []: gt_back_path.append(vp) gt_room_start_vp = vp else: - exit_room = True gt_front_path.append(vp) - gt_front_path.reverse() - gt_back_path.reverse() + + gt_front_path = gt_front_path[::-1] + gt_back_path = gt_back_path[::-1] + assert (gt_front_path + gt_back_path) == gt_path, "Front path & Back path error" + gt_front_path += [gt_room_start_vp] + ''' if scores['success'] == 1.0: scores['found_success'] = float(pred_found == gt_found) else: scores['found_success'] = 0.0 ''' - gt_reach_length = np.sum([shortest_distances[a][b] for a, b in zip(gt_front_path[:-1], gt_front_path[1:])]) if len(gt_front_path) != 1 else 0.01 - gt_explore_length = np.sum([shortest_distances[a][b] for a, b in zip(gt_back_path[:-1], gt_back_path[1:])]) if len(gt_back_path) != 1 else 0.01 - + gt_reach_length = np.sum([shortest_distances[a][b] for a, b in zip(gt_front_path[:-1], gt_front_path[1:])]) + gt_explore_length = np.sum([shortest_distances[a][b] for a, b in zip(gt_back_path[:-1], gt_back_path[1:])]) if scores['room_success'] != 0.0: # corse-grained @@ -421,23 +422,21 @@ class ReverieObjectNavBatch(object): room_start_vp = None back_path = [] front_path = [] - exit_room = False for vp in path[::-1]: - if node_region[scan][vp] == gt_stop_region and not exit_room: + if node_region[scan][vp] == gt_stop_region and front_path == []: back_path.append(vp) room_start_vp = vp else: - exit_room = True front_path.append(vp) - front_path.reverse() - back_path.reverse() + + front_path = front_path[::-1] + back_path = back_path[::-1] assert (front_path + back_path) == path, "Front path & Back path error" # front_path = ... room_start_vp # back_path = room_start_vp ... front_path += [room_start_vp] - reach_length = np.sum([shortest_distances[a][b] for a, b in zip(front_path[:-1], front_path[1:])]) if len(front_path) != 1 else 0.01 explore_length = np.sum([shortest_distances[a][b] for a, b in zip(back_path[:-1], back_path[1:])]) if len(back_path) != 1 else 0.01 diff --git a/map_nav_src/scripts/run_reverie.sh b/map_nav_src/scripts/run_reverie.sh index 408c1b1..57b989f 100644 --- a/map_nav_src/scripts/run_reverie.sh +++ b/map_nav_src/scripts/run_reverie.sh @@ -10,7 +10,7 @@ obj_ft_dim=768 ngpus=1 seed=0 -name=${train_alg}-${features}-new-reverie-only-front-path +name=${train_alg}-${features}-new-reverie-all name=${name}-seed.${seed} #-${ngpus}gpus outdir=${DATA_ROOT}/REVERIE/exprs_map/finetune/${name}