feat: NavGPT w/ our distance module(expr2)

This commit is contained in:
Ting-Jun Wang 2025-01-12 15:50:54 +08:00
parent 7e5abbca0e
commit edc6d6f198
Signed by: snsd0805
GPG Key ID: 48D331A3D6160354

View File

@ -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})