From 6c2203fd7802be2eb5ca773854a2637a9594f7b4 Mon Sep 17 00:00:00 2001 From: Naoki Yokoyama Date: Thu, 7 Sep 2023 13:55:33 -0400 Subject: [PATCH] adding files from SemExp repo --- zsos/semexp_env/eval.py | 44 +++++++++++++++++++++++++ zsos/semexp_env/objnav_gibson_zsos.yaml | 44 +++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 zsos/semexp_env/eval.py create mode 100644 zsos/semexp_env/objnav_gibson_zsos.yaml diff --git a/zsos/semexp_env/eval.py b/zsos/semexp_env/eval.py new file mode 100644 index 0000000..178f49e --- /dev/null +++ b/zsos/semexp_env/eval.py @@ -0,0 +1,44 @@ +import os + +import numpy as np +import torch +from arguments import get_args +from envs import make_vec_envs + +os.environ["OMP_NUM_THREADS"] = "1" + +args = get_args() +args.agent = "zsos" # Doesn't really matter as long as it's not "sem_exp" +args.split = "val" + +np.random.seed(args.seed) +torch.manual_seed(args.seed) + +if args.cuda: + torch.cuda.manual_seed(args.seed) + + +def main(): + num_episodes = int(args.num_eval_episodes) + args.device = torch.device("cuda:0" if args.cuda else "cpu") + + torch.set_num_threads(1) + envs = make_vec_envs(args) + obs, infos = envs.reset() + print(obs, infos) + + for ep_num in range(num_episodes): + for step in range(args.max_episode_length): + action = torch.randint(1, 3, (args.num_processes,)) + obs, rew, done, infos = envs.step(action) + print(obs.shape) + print(obs.device) + + if done: + break + + print("Test successfully completed") + + +if __name__ == "__main__": + main() diff --git a/zsos/semexp_env/objnav_gibson_zsos.yaml b/zsos/semexp_env/objnav_gibson_zsos.yaml new file mode 100644 index 0000000..eadfeeb --- /dev/null +++ b/zsos/semexp_env/objnav_gibson_zsos.yaml @@ -0,0 +1,44 @@ +ENVIRONMENT: + MAX_EPISODE_STEPS: 500 +SIMULATOR: + TURN_ANGLE: 30 + TILT_ANGLE: 30 + ACTION_SPACE_CONFIG: "v1" + AGENT_0: + SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR', 'SEMANTIC_SENSOR'] + HEIGHT: 0.88 + RADIUS: 0.18 + HABITAT_SIM_V0: + GPU_DEVICE_ID: 0 + ALLOW_SLIDING: True + SEMANTIC_SENSOR: + WIDTH: 640 + HEIGHT: 480 + HFOV: 79 + POSITION: [0, 0.88, 0] + RGB_SENSOR: + WIDTH: 640 + HEIGHT: 480 + HFOV: 79 + POSITION: [0, 0.88, 0] + DEPTH_SENSOR: + WIDTH: 640 + HEIGHT: 480 + HFOV: 79 + MIN_DEPTH: 0.5 + MAX_DEPTH: 5.0 + POSITION: [0, 0.88, 0] +TASK: + TYPE: ObjectNav-v1 + POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT", "LOOK_UP", "LOOK_DOWN"] + SENSORS: ['GPS_SENSOR', 'COMPASS_SENSOR'] + MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] + SUCCESS: + SUCCESS_DISTANCE: 0.2 + +DATASET: + TYPE: PointNav-v1 + SPLIT: train + DATA_PATH: "data/datasets/objectnav/gibson/v1/{split}/{split}.json.gz" + EPISODES_DIR: "data/datasets/objectnav/gibson/v1/{split}/" + SCENES_DIR: "data/scene_datasets/"