feat: expr3

This commit is contained in:
Ting-Jun Wang 2025-01-12 17:17:04 +08:00
parent edc6d6f198
commit d2f7dc0798
Signed by: snsd0805
GPG Key ID: 48D331A3D6160354
2 changed files with 10 additions and 32 deletions

View File

@ -406,9 +406,7 @@ 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
vp_description = vp_description + f', {viewpoint_data["wall_distance"]:.2f}m to the wall'
vp_description = rel_viewpoint_heading + f', {viewpoint_data["distance"]:.2f}m'
# rel_range_idx = (vp_range_idx - range_idx) % 8
candidate_range.setdefault(vp_range_idx, {}).update({viewpoint_id: vp_description})
@ -508,9 +506,6 @@ class NavGPTAgent(BaseAgent):
orientation = f'\nheading: {heading:.2f}, elevation: {elevation:.2f}'
navigable = cur_obs['candidate']
for vp, data in navigable.items():
data['wall_distance'] = distances[cur_obs['scan']][cur_obs['viewpoint']][vp]
print(data['wall_distance'])
if self.config.use_relative_angle: # True
feature = self.modify_heading_angles(heading, feature, navigable, objects)
@ -552,9 +547,6 @@ class NavGPTAgent(BaseAgent):
new_heading = np.rad2deg(new_obs['heading'])
new_elevation = np.rad2deg(new_obs['elevation'])
for vp, data in new_navigable.items():
data['wall_distance'] = distances[new_obs['scan']][new_obs['viewpoint']][vp]
print(data['wall_distance'])
if self.config.use_relative_angle:
new_feature = self.modify_heading_angles(new_heading, new_feature, new_navigable, new_objects)
@ -640,9 +632,6 @@ class NavGPTAgent(BaseAgent):
orientation = f'\nheading: {heading:.2f}, elevation: {elevation:.2f}'
for vp, data in navigable.items():
data['wall_distance'] = distances[cur_obs['scan']][cur_obs['viewpoint']][vp]
print(data['wall_distance'])
@ -681,9 +670,6 @@ class NavGPTAgent(BaseAgent):
new_orientation = f'\nheading: {new_heading:.2f}, elevation: {new_elevation:.2f}'
for vp, data in new_navigable.items():
data['wall_distance'] = distances[new_obs['scan']][new_obs['viewpoint']][vp]
print(data['wall_distance'])
if self.config.use_relative_angle:
new_feature = self.modify_heading_angles(new_heading, new_feature, new_navigable, new_objects)
@ -874,7 +860,7 @@ class NavGPTAgent(BaseAgent):
self.init_trajecotry(obs)
# Load the instruction
# instructions = [ob['instruction'] for ob in obs]
instructions = [ob['instruction'] for ob in obs]
targets = [ob['target'] for ob in obs]
@ -882,8 +868,8 @@ class NavGPTAgent(BaseAgent):
print(self.config.load_action_plan)
if self.config.load_instruction:
# action_plans = instructions
action_plans = targets
action_plans = instructions
# action_plans = targets
elif self.config.load_action_plan:
action_plans = [ob['action_plan'] for ob in obs]
else:
@ -921,9 +907,6 @@ class NavGPTAgent(BaseAgent):
elevation = np.rad2deg(init_ob['elevation'])
orientation = f'\nheading: {heading:.2f}, elevation: {elevation:.2f}'
for vp, data in navigable.items():
data['wall_distance'] = distances[init_ob['scan']][init_ob['viewpoint']][vp]
print(data['wall_distance'])
print("use_relative_angle:", self.config.use_relative_angle)
print("use_relative_angle:", self.config.use_navigable)

View File

@ -244,9 +244,9 @@ Instruction: {action_plan}
Initial Observation: {init_observation}
Thought: I should start navigation according to the instruction, {agent_scratchpad}"""
VLN_GPT35_PROMPT = """As an intelligent embodied agent, you will navigate in an indoor environment to reach a target viewpoint to find the object based on a given instruction, performing the Vision and Language Navigation (VLN) task.
VLN_GPT35_PROMPT = """As an intelligent embodied agent, you will navigate in an indoor environment to reach a target viewpoint based on a given instruction, performing the Vision and Language Navigation (VLN) task.
The instruction will let you find all the target objects in a room. You should have a good stratedy to check all the object in the shortest path in the room.
The instruction will let you find all the target objects in a building.
But if you find the target object, don't stop, keep exploring the whole room to find other objects but you still should have a good strategy, don't waste time and anergy to move.
@ -254,19 +254,12 @@ You will move among static positions within a pre-defined graph, aiming for the
You will receive a trajectory instruction at the start and will have access to step history (your Thought, Action, Action Input and Obeservation after the Begin! sign) and current viewpoint observation (including scene descriptions, objects, and navigable directions/distances within 3 meters) during navigation. Orientations range from -180 to 180 degrees, with 0 being forward, right 90 rightward, right/left 180 backward, and left 90 leftward.
And we will calculate how many meters extend in the direction of each viewpoint before hitting a wall. We hope this distance information can help you understand the spatial layout of the room. Please plan an effective exploration strategy based on this distance information.
For example, if I have 2 viewpoints to choose (A: 1m, B: 5m) but I cannot find the target object so I better choose viewpoint B because I may have more exploration space to find the target.
Explore the environment while avoiding revisiting viewpoints by comparing current and previously visited IDs and the most important thing is that you should not leave the room so you better not move closed to the door.
Notice: You should have a good strategy to check whether the target object exists in this room, and stop when you exploring all viewpoint in this room.
- Notice: You should have a good strategy to check whether the target object exists in the target room, and stop when you exploring all viewpoint in the target room.
If you think you are moving in circles, please stop and think whether any other objects may be hiden. If no, please output 'Final Answer: Not found'.
Continue by considering your location and the next viewpoint based on the instruction, using the action_maker tool.
And if you explored all room(no other viewpoint to move to), stop and output 'Final Answer: Not found!'.
And if you explored all the target room(no other viewpoint to move to), stop and output 'Final Answer: Not found!'.
Show your reasoning in the Thought section.
Follow the given format and use provided tools.
@ -296,3 +289,5 @@ Begin!
Instruction: {action_plan}
Initial Observation: {init_observation}
Thought: I should start navigation according to the instruction, {agent_scratchpad}"""