Skip to content

Commit

Permalink
adding files from SemExp repo
Browse files Browse the repository at this point in the history
  • Loading branch information
naokiyokoyamabd committed Sep 7, 2023
1 parent 497e55d commit 6c2203f
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
44 changes: 44 additions & 0 deletions zsos/semexp_env/eval.py
Original file line number Diff line number Diff line change
@@ -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()
44 changes: 44 additions & 0 deletions zsos/semexp_env/objnav_gibson_zsos.yaml
Original file line number Diff line number Diff line change
@@ -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/"

0 comments on commit 6c2203f

Please sign in to comment.