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.
This commit is contained in:
Ting-Jun Wang 2024-10-06 18:16:16 +08:00
parent 36dbfed7e1
commit 641b7169b3
Signed by: snsd0805
GPG Key ID: 48D331A3D6160354
2 changed files with 14 additions and 15 deletions

View File

@ -392,27 +392,28 @@ class ReverieObjectNavBatch(object):
gt_room_start_vp = None gt_room_start_vp = None
gt_back_path = [] gt_back_path = []
gt_front_path = [] gt_front_path = []
exit_room = False
for vp in gt_path[::-1]: 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_back_path.append(vp)
gt_room_start_vp = vp gt_room_start_vp = vp
else: else:
exit_room = True
gt_front_path.append(vp) 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" assert (gt_front_path + gt_back_path) == gt_path, "Front path & Back path error"
gt_front_path += [gt_room_start_vp] gt_front_path += [gt_room_start_vp]
''' '''
if scores['success'] == 1.0: if scores['success'] == 1.0:
scores['found_success'] = float(pred_found == gt_found) scores['found_success'] = float(pred_found == gt_found)
else: else:
scores['found_success'] = 0.0 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_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 len(gt_back_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 scores['room_success'] != 0.0: if scores['room_success'] != 0.0:
# corse-grained # corse-grained
@ -421,23 +422,21 @@ class ReverieObjectNavBatch(object):
room_start_vp = None room_start_vp = None
back_path = [] back_path = []
front_path = [] front_path = []
exit_room = False
for vp in path[::-1]: 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) back_path.append(vp)
room_start_vp = vp room_start_vp = vp
else: else:
exit_room = True
front_path.append(vp) 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" assert (front_path + back_path) == path, "Front path & Back path error"
# front_path = ... room_start_vp # front_path = ... room_start_vp
# back_path = room_start_vp ... # back_path = room_start_vp ...
front_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 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 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

View File

@ -10,7 +10,7 @@ obj_ft_dim=768
ngpus=1 ngpus=1
seed=0 seed=0
name=${train_alg}-${features}-new-reverie-only-front-path name=${train_alg}-${features}-new-reverie-all
name=${name}-seed.${seed} #-${ngpus}gpus name=${name}-seed.${seed} #-${ngpus}gpus
outdir=${DATA_ROOT}/REVERIE/exprs_map/finetune/${name} outdir=${DATA_ROOT}/REVERIE/exprs_map/finetune/${name}