From edc6d6f19868ddb9c8fc57479628e795242449fe Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Sun, 12 Jan 2025 15:50:54 +0800 Subject: [PATCH] feat: NavGPT w/ our distance module(expr2) --- nav_src/agent.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nav_src/agent.py b/nav_src/agent.py index f24375d..d2e2e79 100644 --- a/nav_src/agent.py +++ b/nav_src/agent.py @@ -57,7 +57,7 @@ NOW_LOCATION = None FOUND_BBOX = "" LAST_VP = "" -THRESHOLD = 0.278 +THRESHOLD = 0.75 SCAN = "" MISSING_ACTION_AFTER_THOUGHT_ERROR_MESSAGE = ( @@ -70,9 +70,14 @@ FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE = ( "Parsing LLM output produced both a final answer and a parse-able action:" ) +print("Load GroundingDINO confidence file...") +confidences = load_json('../datasets/REVERIE/annotations/grounding_dino_confidence.json') +print("Loaded") +''' print("Load CLIP confidence file...") confidences = load_json('../datasets/REVERIE/annotations/confidence.json') print("Loaded") +''' print() print("Load distance file...") @@ -128,8 +133,8 @@ class NavGPTOutputParser(AgentOutputParser): found = False max_bbox, max_bbox_confidence = "", 0 - for bbox in confidences[SCAN][tool_input]: - confidence = confidences[SCAN][tool_input][bbox][CLIP_TARGET] + for bbox in confidences[SCAN][tool_input][CLIP_TARGET]: + confidence = bbox['score'] if confidence >= THRESHOLD and confidence >= max_bbox_confidence: max_bbox = bbox max_bbox_confidence = confidence @@ -401,7 +406,8 @@ class NavGPTAgent(BaseAgent): rel_viewpoint_heading = viewpoint_heading - heading_angle rel_viewpoint_heading = normalize_angle(rel_viewpoint_heading) rel_viewpoint_heading = angle_to_left_right(rel_viewpoint_heading) - vp_description = rel_viewpoint_heading + f', {viewpoint_data["distance"]:.2f}m' + # vp_description = rel_viewpoint_heading + f', {viewpoint_data["distance"]:.2f}m' + vp_description = rel_viewpoint_heading vp_description = vp_description + f', {viewpoint_data["wall_distance"]:.2f}m to the wall' # rel_range_idx = (vp_range_idx - range_idx) % 8 candidate_range.setdefault(vp_range_idx, {}).update({viewpoint_id: vp_description})