feat: expr1

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

View File

@ -406,9 +406,7 @@ class NavGPTAgent(BaseAgent):
rel_viewpoint_heading = viewpoint_heading - heading_angle rel_viewpoint_heading = viewpoint_heading - heading_angle
rel_viewpoint_heading = normalize_angle(rel_viewpoint_heading) rel_viewpoint_heading = normalize_angle(rel_viewpoint_heading)
rel_viewpoint_heading = angle_to_left_right(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 # rel_range_idx = (vp_range_idx - range_idx) % 8
candidate_range.setdefault(vp_range_idx, {}).update({viewpoint_id: vp_description}) 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}' orientation = f'\nheading: {heading:.2f}, elevation: {elevation:.2f}'
navigable = cur_obs['candidate'] 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 if self.config.use_relative_angle: # True
feature = self.modify_heading_angles(heading, feature, navigable, objects) feature = self.modify_heading_angles(heading, feature, navigable, objects)
@ -552,9 +547,6 @@ class NavGPTAgent(BaseAgent):
new_heading = np.rad2deg(new_obs['heading']) new_heading = np.rad2deg(new_obs['heading'])
new_elevation = np.rad2deg(new_obs['elevation']) 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: if self.config.use_relative_angle:
new_feature = self.modify_heading_angles(new_heading, new_feature, new_navigable, new_objects) 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}' 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}' 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: if self.config.use_relative_angle:
new_feature = self.modify_heading_angles(new_heading, new_feature, new_navigable, new_objects) 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) self.init_trajecotry(obs)
# Load the instruction # Load the instruction
# instructions = [ob['instruction'] for ob in obs] instructions = [ob['instruction'] for ob in obs]
targets = [ob['target'] for ob in obs] targets = [ob['target'] for ob in obs]
@ -882,8 +868,8 @@ class NavGPTAgent(BaseAgent):
print(self.config.load_action_plan) print(self.config.load_action_plan)
if self.config.load_instruction: if self.config.load_instruction:
# action_plans = instructions action_plans = instructions
action_plans = targets # action_plans = targets
elif self.config.load_action_plan: elif self.config.load_action_plan:
action_plans = [ob['action_plan'] for ob in obs] action_plans = [ob['action_plan'] for ob in obs]
else: else:
@ -921,9 +907,6 @@ class NavGPTAgent(BaseAgent):
elevation = np.rad2deg(init_ob['elevation']) elevation = np.rad2deg(init_ob['elevation'])
orientation = f'\nheading: {heading:.2f}, elevation: {elevation:.2f}' 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_relative_angle)
print("use_relative_angle:", self.config.use_navigable) print("use_relative_angle:", self.config.use_navigable)

View File

@ -244,7 +244,7 @@ Instruction: {action_plan}
Initial Observation: {init_observation} Initial Observation: {init_observation}
Thought: I should start navigation according to the instruction, {agent_scratchpad}""" 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 room. You should have a good stratedy to check all the object in the shortest path in the room.
@ -254,14 +254,9 @@ 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. 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. 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 this room, and stop when you exploring all viewpoint in this 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'. 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'.
@ -296,3 +291,4 @@ Begin!
Instruction: {action_plan} Instruction: {action_plan}
Initial Observation: {init_observation} Initial Observation: {init_observation}
Thought: I should start navigation according to the instruction, {agent_scratchpad}""" Thought: I should start navigation according to the instruction, {agent_scratchpad}"""