From 770ebe972df440cc216f1c3bfa34f7f41bc5e35b Mon Sep 17 00:00:00 2001 From: OasisArtisan Date: Wed, 3 Sep 2025 09:00:06 -0400 Subject: [PATCH] Remove stale import, Add path error messages, fix path instructions. --- README.md | 6 ++++-- airsim_plugin/AirVLNSimulatorServerTool.py | 12 +++++++++--- scripts/eval_cliph.sh | 5 +++-- scripts/eval_fixed.sh | 5 +++-- scripts/eval_unfixed.sh | 5 +++-- scripts/metric.sh | 3 ++- src/env_uav.py | 3 +-- utils/classify_metric.py | 13 +++++++++++++ utils/env_utils_uav.py | 4 ++-- 9 files changed, 40 insertions(+), 16 deletions(-) mode change 100644 => 100755 scripts/metric.sh mode change 100644 => 100755 utils/classify_metric.py diff --git a/README.md b/README.md index 72edd85..f198831 100755 --- a/README.md +++ b/README.md @@ -86,10 +86,11 @@ Watch a full successful flight of our Aerial ObjectNav Agent in action: 1.First, you should launch the AirSim environment server. ```bash - python airsim_plugin/AirVLNSimulatorServerTool.py --port=30000 --root_path= "your workspace path" + python airsim_plugin/AirVLNSimulatorServerTool.py --port=30000 --root_path= "path to TRAIN_ENVS or TEST_ENVS" ``` - 2.Then, you can execute the bash script to run the simulator + 2.Then, you can execute the bash script to run the simulator. Make sure + the `dataset_path` and `eval_save_path` args in the scripts point to correct paths. ```bash #AOA-F/V @@ -98,6 +99,7 @@ Watch a full successful flight of our Aerial ObjectNav Agent in action: #CLIP-H bash scripts/eval_cliph.sh + # To compute metrics bash scripts/metric.sh ``` diff --git a/airsim_plugin/AirVLNSimulatorServerTool.py b/airsim_plugin/AirVLNSimulatorServerTool.py index 349142e..4b49880 100755 --- a/airsim_plugin/AirVLNSimulatorServerTool.py +++ b/airsim_plugin/AirVLNSimulatorServerTool.py @@ -440,8 +440,12 @@ def _open_scenes(self, ip: str , scen_id_gpu_list: list): if choose_env_exe_paths[index] is None: p_s.append(None) continue + elif not os.path.exists(choose_env_exe_paths[index]): + print(f"{choose_env_exe_paths[index]} not found ! failed to open scene.") + p_s.append(None) + continue else: - subprocess_execute = "bash {} -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} --settings={}".format( + subprocess_execute = "bash '{}' -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} --settings='{}'".format( choose_env_exe_paths[index], gpu_id, str(CWD_DIR / 'settings' / str(ports[index]) / 'settings.json'), @@ -480,9 +484,11 @@ def reopen_scene_from_port(self, port): scene_id, gpu_id = self.port_to_scene[port] env_info = env_exec_path_dict.get(scene_id) env_path = os.path.join(args.root_path, env_info['exec_path'], env_info['bash_name'] + '.sh') - + if not os.path.exists(env_path): + print(f"{env_path} not found ! failed to reopen scene.") + return - subprocess_execute = "bash {} -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} -settings={} ".format( + subprocess_execute = "bash '{}' -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} -settings='{}'".format( env_path, gpu_id, str(CWD_DIR / 'settings' / str(port) / 'settings.json'), diff --git a/scripts/eval_cliph.sh b/scripts/eval_cliph.sh index 59306c0..4b0d74f 100755 --- a/scripts/eval_cliph.sh +++ b/scripts/eval_cliph.sh @@ -1,11 +1,12 @@ cd "$(dirname "$0")/.." root_dir=. +workspace_dir=.. echo $PWD CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_cliph.py \ --maxActions 150 \ - --eval_save_path $root_dir/CLIP_logs/scene \ - --dataset_path your/dataset/path \ + --eval_save_path $workspace_dir/CLIP_logs/DownTown \ + --dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \ --is_fixed true\ --gpu_id 0 \ --batchSize 1 \ diff --git a/scripts/eval_fixed.sh b/scripts/eval_fixed.sh index 6e4792d..494b134 100755 --- a/scripts/eval_fixed.sh +++ b/scripts/eval_fixed.sh @@ -1,11 +1,12 @@ cd "$(dirname "$0")/.." root_dir=. +workspace_dir=.. echo $PWD CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_2.py \ --maxActions 150 \ - --eval_save_path $root_dir/logs/scene \ - --dataset_path your/dataset/path \ + --eval_save_path $workspace_dir/fixed_logs/DownTown \ + --dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \ --is_fixed true\ --gpu_id 0 \ --batchSize 1 \ diff --git a/scripts/eval_unfixed.sh b/scripts/eval_unfixed.sh index 79ee2bf..2f47373 100755 --- a/scripts/eval_unfixed.sh +++ b/scripts/eval_unfixed.sh @@ -1,11 +1,12 @@ cd "$(dirname "$0")/.." root_dir=. +workspace_dir=.. echo $PWD CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_2.py \ --maxActions 150 \ - --eval_save_path $root_dir/unfixed_logs/scene \ - --dataset_path your/dataset/path \ + --eval_save_path $workspace_dir/unfixed_logs/DownTown \ + --dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \ --is_fixed false\ --gpu_id 0 \ --batchSize 1 \ diff --git a/scripts/metric.sh b/scripts/metric.sh old mode 100644 new mode 100755 index 20e7eb1..1b57ef7 --- a/scripts/metric.sh +++ b/scripts/metric.sh @@ -1,6 +1,7 @@ cd "$(dirname "$0")/.." root_dir=. +workspace_dir=.. echo $PWD python -u $root_dir/utils/classify_metric.py \ - --base_path $root_dir/logs + --base_root $workspace_dir/CLIP_logs diff --git a/src/env_uav.py b/src/env_uav.py index e4abc10..0cdffc9 100755 --- a/src/env_uav.py +++ b/src/env_uav.py @@ -15,7 +15,6 @@ import tqdm from src.common.param import args from utils.logger import logger -from airsim_plugin.airsim_settings import AirsimActions sys.path.append(str(Path(str(os.getcwd())).resolve())) from airsim_plugin.AirVLNSimulatorClientTool import AirVLNSimulatorClientTool from utils.env_utils_uav import SimState, getNextPosition @@ -417,4 +416,4 @@ def _update_distance_to_target(self): distance = float(np.linalg.norm(curr - coords)) print(f'batch[{idx}/{len(self.batch)}]| distance: {round(distance, 2)}, position: {curr[0]}, {curr[1]}, {curr[2]}, target: {coords}') - \ No newline at end of file + diff --git a/utils/classify_metric.py b/utils/classify_metric.py old mode 100644 new mode 100755 index 3300203..8baeb4d --- a/utils/classify_metric.py +++ b/utils/classify_metric.py @@ -233,10 +233,19 @@ def get_termination_type(task_folder): if os.path.exists(success_dir): all_success_dirs.append(success_dir) + else: + print(f"Did not find success directory '{success_dir}' for scene '{scene}'") if os.path.exists(oracle_dir): all_oracle_dirs.append(oracle_dir) + else: + print(f"Did not find oracle directory '{oracle_dir}' for scene '{scene}'") if os.path.exists(fail_dir): all_fail_dirs.append(fail_dir) + else: + print(f"Did not find fail directory '{fail_dir}' for scene '{scene}'") + + + # ===== Task Count Statistics ===== success_tasks = sum(count_task_folder(d) for d in all_success_dirs) @@ -244,6 +253,10 @@ def get_termination_type(task_folder): fail_tasks = sum(count_task_folder(d) for d in all_fail_dirs) total_tasks = success_tasks + oracle_tasks + fail_tasks +if total_tasks == 0: + print(f"No tasks found. Make sure you have your log paths set up correctly.") + exit(1) + # ===== SR & OSR ===== sr = success_tasks / total_tasks if total_tasks > 0 else 0 osr = (oracle_tasks + success_tasks) / total_tasks if total_tasks > 0 else 0 diff --git a/utils/env_utils_uav.py b/utils/env_utils_uav.py index 99fbe40..a3d3438 100755 --- a/utils/env_utils_uav.py +++ b/utils/env_utils_uav.py @@ -5,7 +5,7 @@ import copy from src.common.param import args -from airsim_plugin.airsim_settings import AirsimActions, AirsimActionSettings +from airsim_plugin.airsim_settings import AirsimActionSettings from utils.logger import logger @@ -188,4 +188,4 @@ def getNextPosition(current_pose: airsim.Pose, action, step_size, is_fixed): airsim.Vector3r(new_position[0], new_position[1], new_position[2]), airsim.Quaternionr(x_val=new_orientation.x_val, y_val=new_orientation.y_val, z_val=new_orientation.z_val, w_val=new_orientation.w_val) ) - return (new_pose, fly_type) \ No newline at end of file + return (new_pose, fly_type)