├── .circleci └── config.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── feature-request.md │ └── questions-help-support.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .pre-commit-config.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MANIFEST.in ├── README.md ├── UNLICENSE ├── configs ├── datasets │ ├── eqa │ │ └── mp3d.yaml │ ├── imagenav │ │ ├── gibson.yaml │ │ └── mp3d.yaml │ ├── objectnav │ │ └── mp3d.yaml │ ├── pointnav │ │ ├── gibson.yaml │ │ ├── gibson_v2.yaml │ │ ├── habitat_test.yaml │ │ └── mp3d.yaml │ ├── single_episode.yaml │ └── vln │ │ └── mp3d_r2r.yaml ├── tasks │ ├── coverage.yaml │ ├── coverage_test.yaml │ ├── eqa_mp3d.yaml │ ├── gibson_coverage.yaml │ ├── imagenav.yaml │ ├── imagenav_gibson.yaml │ ├── objectnav_depth_only.yaml │ ├── objectnav_mini_semantic.yaml │ ├── objectnav_mp3d.yaml │ ├── objectnav_mp3d_ego.yaml │ ├── objectnav_mp3d_ego_2d_extreward.yaml │ ├── objectnav_mp3d_ego_d2g.yaml │ ├── objectnav_mp3d_ego_extreward.yaml │ ├── objectnav_mp3d_full.yaml │ ├── objectnav_mp3d_full_4a.yaml │ ├── objectnav_mp3d_full_4a_train.yaml │ ├── objectnav_mp3d_full_4a_train_s2.yaml │ ├── objectnav_mp3d_full_train.yaml │ ├── objectnav_mp3d_hfov.yaml │ ├── objectnav_mp3d_proper_fov.yaml │ ├── objectnav_v1action.yaml │ ├── pointnav.yaml │ ├── pointnav_challenge.yaml │ ├── pointnav_gc.yaml │ ├── pointnav_gc2.yaml │ ├── pointnav_gc2_cover.yaml │ ├── pointnav_gibson.yaml │ ├── pointnav_mp3d.yaml │ ├── pointnav_rgbd.yaml │ ├── pointnav_viz.yaml │ └── vln_r2r.yaml └── test │ ├── habitat_all_sensors_test.yaml │ ├── habitat_mp3d_eqa_test.yaml │ ├── habitat_mp3d_object_nav_test.yaml │ ├── habitat_r2r_vln_test.yaml │ └── new_keys_test.yaml ├── docs ├── .gitignore ├── build-public.sh ├── build.sh ├── conf-public.py ├── conf.py ├── docs.rst └── pages │ ├── habitat-lab-demo.png │ ├── habitat-lab-demo.rst │ ├── habitat-sim-demo.png │ ├── habitat-sim-demo.rst │ ├── index.rst │ ├── quickstart.png │ ├── quickstart.rst │ ├── view-transform-warp.png │ └── view-transform-warp.rst ├── environment.yml ├── examples ├── __init__.py ├── benchmark.py ├── coverage_viz.py ├── example.py ├── new_actions.py ├── register_new_sensors_and_measures.py ├── shortest_path_follower_example.py ├── visualization_examples.py ├── vln_benchmark.py └── vln_reference_path_follower_example.py ├── habitat ├── __init__.py ├── config │ ├── __init__.py │ └── default.py ├── core │ ├── __init__.py │ ├── agent.py │ ├── benchmark.py │ ├── challenge.py │ ├── dataset.py │ ├── embodied_task.py │ ├── env.py │ ├── logging.py │ ├── registry.py │ ├── simulator.py │ ├── spaces.py │ ├── utils.py │ └── vector_env.py ├── datasets │ ├── __init__.py │ ├── eqa │ │ ├── __init__.py │ │ └── mp3d_eqa_dataset.py │ ├── object_nav │ │ ├── __init__.py │ │ └── object_nav_dataset.py │ ├── pointnav │ │ ├── __init__.py │ │ ├── pointnav_dataset.py │ │ └── pointnav_generator.py │ ├── registration.py │ ├── utils.py │ └── vln │ │ ├── __init__.py │ │ └── r2r_vln_dataset.py ├── py.typed ├── sims │ ├── __init__.py │ ├── habitat_simulator │ │ ├── __init__.py │ │ ├── actions.py │ │ └── habitat_simulator.py │ ├── pyrobot │ │ ├── __init__.py │ │ └── pyrobot.py │ └── registration.py ├── tasks │ ├── __init__.py │ ├── coverage │ │ ├── __init__.py │ │ └── coverage.py │ ├── eqa │ │ ├── __init__.py │ │ └── eqa.py │ ├── nav │ │ ├── __init__.py │ │ ├── nav.py │ │ ├── object_nav_task.py │ │ └── shortest_path_follower.py │ ├── registration.py │ ├── utils.py │ └── vln │ │ ├── __init__.py │ │ └── vln.py ├── utils │ ├── __init__.py │ ├── geometry_utils.py │ ├── profiling_utils.py │ ├── test_utils.py │ └── visualizations │ │ ├── __init__.py │ │ ├── assets │ │ └── maps_topdown_agent_sprite │ │ │ └── 100x100.png │ │ ├── fog_of_war.py │ │ ├── maps.py │ │ └── utils.py └── version.py ├── habitat_baselines ├── README.md ├── __init__.py ├── agents │ ├── __init__.py │ ├── ppo_agents.py │ ├── simple_agents.py │ └── slam_agents.py ├── common │ ├── auxiliary_tasks │ │ ├── __init__.py │ │ ├── aux_utils.py │ │ ├── auxiliary_tasks.py │ │ └── supervised_auxiliary_tasks.py │ ├── base_trainer.py │ ├── baseline_registry.py │ ├── env_utils.py │ ├── environments.py │ ├── obs_transformers.py │ ├── rollout_storage.py │ ├── running_mean_and_var.py │ ├── tensorboard_utils.py │ └── utils.py ├── config │ ├── __init__.py │ ├── default.py │ ├── imagenav │ │ ├── ddppo_imagenav_example.yaml │ │ ├── ddppo_imagenav_gibson.yaml │ │ └── ppo_imagenav_example.yaml │ ├── objectnav │ │ ├── full │ │ │ ├── aux_sge.on.yaml │ │ │ ├── aux_sge2.on.yaml │ │ │ ├── base.on.yaml │ │ │ ├── base4.on.yaml │ │ │ ├── base4_rednet.on.yaml │ │ │ ├── base_rednet.on.yaml │ │ │ ├── no_adp.on.yaml │ │ │ ├── no_aux.on.yaml │ │ │ ├── no_cp.on.yaml │ │ │ ├── no_gid.on.yaml │ │ │ ├── no_sge.on.yaml │ │ │ ├── pt_sparse.on.yaml │ │ │ ├── pt_sparse4.on.yaml │ │ │ ├── split_clamp.on.yaml │ │ │ ├── split_rednet.on.yaml │ │ │ └── test.on.yaml │ │ └── obj_base.on.yaml │ └── test │ │ ├── ddppo_imagenav_test.yaml │ │ ├── ddppo_pointnav_test.yaml │ │ ├── ppo_imagenav_test.yaml │ │ └── ppo_pointnav_test.yaml ├── py.typed ├── rl │ ├── __init__.py │ ├── ddppo │ │ ├── README.md │ │ ├── __init__.py │ │ ├── algo │ │ │ ├── __init__.py │ │ │ ├── ddp_utils.py │ │ │ ├── ddppo.py │ │ │ └── ddppo_trainer.py │ │ ├── data_generation │ │ │ ├── create_gibson_large_dataset.py │ │ │ └── gibson_dset_with_qual.json │ │ ├── multi_node_slurm.sh │ │ ├── policy │ │ │ ├── __init__.py │ │ │ └── resnet_policy.py │ │ ├── requirements.txt │ │ └── single_node.sh │ ├── models │ │ ├── __init__.py │ │ ├── rednet.py │ │ ├── resnet.py │ │ ├── rnn_state_encoder.py │ │ ├── rnn_state_encoder_jit.py │ │ └── simple_cnn.py │ ├── ppo │ │ ├── __init__.py │ │ ├── belief_ddppo_trainer.py │ │ ├── belief_policy.py │ │ ├── curiosity.py │ │ ├── encoder_dict.py │ │ ├── multipolicy.py │ │ ├── policy.py │ │ ├── ppo.py │ │ └── ppo_trainer.py │ └── requirements.txt ├── run.py └── slambased │ ├── README.md │ ├── data │ ├── mp3d3_small1k.yaml │ └── slam-based-agent.png │ ├── install_deps.sh │ ├── mappers.py │ ├── monodepth.py │ ├── path_planners.py │ ├── reprojection.py │ ├── requirements.txt │ └── utils.py ├── pyproject.toml ├── requirements.txt ├── res └── img │ ├── habitat_compressed.gif │ ├── habitat_lab_structure.png │ ├── habitat_logo_with_text_horizontal_blue.png │ └── tensorboard_video_demo.gif ├── scripts ├── analyze_utils.py ├── curvature.py ├── dataset_single.py ├── dataset_slicer.py ├── ddppo_8gpu.sh ├── ddppo_8gpu_noconstraint.sh ├── eval_checker.py ├── eval_cron.sh ├── eval_local.sh ├── eval_obj_stats.py ├── eval_on.sh ├── fixed_points_specific.py ├── fp_anlaysis.py ├── fp_finder.py ├── fp_plotter.py ├── fpf_utils.py ├── goal_embedding.py ├── launch_fp_finder.sh ├── mv_rednet.py ├── obj_consts.py ├── plot_obj.py ├── pretty_plot_obj.py ├── probes.py ├── qual_plot.py ├── qualtative_coding.py ├── train_no_ckpt.sh ├── train_on_suffix.sh └── wipe_on.sh ├── setup.cfg ├── setup.py └── test ├── data ├── habitat-sim_trajectory_data.json └── test-sim-geodesic-distance-test-golden.json ├── test_baseline_agents.py ├── test_baseline_trainers.py ├── test_config.py ├── test_dataset.py ├── test_demo_notebook.py ├── test_habitat_env.py ├── test_habitat_example.py ├── test_habitat_sim.py ├── test_habitat_task.py ├── test_install.py ├── test_mp3d_eqa.py ├── test_object_nav_task.py ├── test_pointnav_dataset.py ├── test_profiling_utils.py ├── test_pyrobot.py ├── test_r2r_vln.py ├── test_sensors.py ├── test_spaces.py └── test_visual_utils.py /.editorconfig: -------------------------------------------------------------------------------- 1 | # See https://editorconfig.org/ for more info :) 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | # isort can't parse [*.{py, rst}], so specifying it separately 11 | # https://github.com/timothycrosley/isort/issues/830 12 | [*.rst] 13 | indent_size = 4 14 | [*.py] 15 | indent_size = 4 16 | max_line_length = 79 17 | multi_line_output = 3 18 | force_grid_wrap = false 19 | include_trailing_comma = true 20 | ensure_newline_before_comments=true 21 | use_parentheses = true 22 | known_first_party = habitat,habitat_sim,habitat_baselines,version 23 | known_third_party = PIL,attr,conf,gym,ifcfg,imageio,matplotlib,mock,numba,numpy,orbslam2,pyrobot,pytest,quaternion,requests,scipy,setuptools,torch,torchvision,tqdm,yacs 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug Report" 3 | about: Submit a bug report to help us improve Habitat 4 | 5 | --- 6 | 7 | ## 🐛 Bug 8 | 9 | 10 | 11 | ## Command 12 | 13 | ## To Reproduce 14 | 15 | Steps to reproduce the behavior: 16 | 17 | 18 | 19 | 1. 20 | 2. 21 | 3. 22 | 23 | 24 | 25 | ## Expected behavior 26 | 27 | 28 | 29 | ## Additional context 30 | 31 | 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680Feature Request" 3 | about: Submit a proposal/request for a new Habitat feature 4 | 5 | --- 6 | 7 | ## 🚀 Feature 8 | 9 | 10 | ## Motivation 11 | 12 | 13 | 14 | ## Pitch 15 | 16 | 17 | 18 | ## Alternatives 19 | 20 | 21 | 22 | ## Additional context 23 | 24 | 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/questions-help-support.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "❓Questions/Help/Support" 3 | about: Do you need support? 4 | 5 | --- 6 | 7 | ## ❓ Questions and Help 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Motivation and Context 2 | 3 | 4 | 5 | 6 | 7 | ## How Has This Been Tested 8 | 9 | 10 | 11 | ## Types of changes 12 | 13 | 14 | - Docs change / refactoring / dependency upgrade 15 | - Bug fix (non-breaking change which fixes an issue) 16 | - New feature (non-breaking change which adds functionality) 17 | - Breaking change (fix or feature that would cause existing functionality to change) 18 | 19 | ## Checklist 20 | 21 | 22 | 23 | - [ ] My code follows the code style of this project. 24 | - [ ] My change requires a change to the documentation. 25 | - [ ] I have updated the documentation accordingly. 26 | - [ ] I have read the **CONTRIBUTING** document. 27 | - [ ] I have completed my CLA (see **CONTRIBUTING**) 28 | - [ ] I have added tests to cover my changes. 29 | - [ ] All new and existing tests passed. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pth 2 | runs/videos 3 | logs.* 4 | *.out 5 | *.note 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | 10 | # C extensions 11 | *.so 12 | 13 | tb/ 14 | watch/ 15 | slurm_logs/ 16 | cron* 17 | *.png 18 | *.pdf 19 | *.csv 20 | # Distribution / packaging 21 | .Python 22 | */env/ 23 | build/ 24 | develop-eggs/ 25 | dist/ 26 | downloads/ 27 | eggs/ 28 | .eggs/ 29 | lib/ 30 | lib64/ 31 | parts/ 32 | sdist/ 33 | var/ 34 | *.egg-info/ 35 | .installed.cfg 36 | *.egg 37 | 38 | # PyInstaller 39 | # Usually these files are written by a python script from a template 40 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 41 | *.manifest 42 | *.spec 43 | 44 | # Installer logs 45 | pip-log.txt 46 | pip-delete-this-directory.txt 47 | 48 | # Unit test / coverage reports 49 | htmlcov/ 50 | .tox/ 51 | .coverage 52 | .coverage.* 53 | .cache 54 | nosetests.xml 55 | coverage.xml 56 | *,cover 57 | examples/images 58 | 59 | # Translations 60 | *.mo 61 | *.pot 62 | 63 | # Django stuff: 64 | *.log 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # DotEnv configuration 73 | .env 74 | 75 | # Database 76 | *.db 77 | *.rdb 78 | 79 | # Pycharm 80 | .idea 81 | 82 | # VS Code 83 | .vscode/ 84 | 85 | # Spyder 86 | .spyproject/ 87 | 88 | # Jupyter NB Checkpoints 89 | .ipynb_checkpoints/ 90 | 91 | # exclude data from source control by default 92 | data 93 | 94 | # Mac OS-specific storage files 95 | .DS_Store 96 | 97 | # mypy 98 | .mypy_cache/ 99 | 100 | # vim 101 | *.swp 102 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | exclude: 'build|src/deps|src/obsolete' 2 | 3 | default_language_version: 4 | python: python3 5 | 6 | repos: 7 | - repo: https://github.com/pre-commit/pre-commit-hooks 8 | rev: v3.1.0 9 | hooks: 10 | - id: trailing-whitespace 11 | - id: check-added-large-files 12 | args: ['--maxkb=2000'] 13 | - id: end-of-file-fixer 14 | - id: check-toml 15 | - id: debug-statements 16 | - id: check-case-conflict 17 | - id: check-merge-conflict 18 | 19 | - repo: https://github.com/asottile/seed-isort-config 20 | rev: v2.2.0 21 | hooks: 22 | - id: seed-isort-config 23 | language_version: python3 24 | 25 | - repo: https://github.com/pre-commit/mirrors-isort 26 | rev: v5.0.7 27 | hooks: 28 | - id: isort 29 | exclude: docs/ 30 | additional_dependencies: [toml] 31 | 32 | - repo: https://github.com/ambv/black 33 | rev: stable 34 | hooks: 35 | - id: black 36 | exclude: ^examples/tutorials/(nb_python|colabs) 37 | 38 | - repo: https://github.com/kynan/nbstripout 39 | rev: master 40 | hooks: 41 | - id: nbstripout 42 | files: ".ipynb" 43 | 44 | - repo: local 45 | hooks: 46 | - id: jupytext-sync 47 | name: Sync scripts and notebooks 48 | files: '^examples/tutorials/(colabs|nb_python)/(.*\.py|.*\.ipynb)$' 49 | entry: jupytext --update-metadata '{"jupytext":{"notebook_metadata_filter":"all", "cell_metadata_filter":"-all"}, "accelerator":"GPU"}' --set-formats 'nb_python//py:percent,colabs//ipynb' --pipe black --pipe "sed s/[[:space:]]*\#[[:space:]]\%\%/\#\%\%/g" --pipe 'isort -' --pipe-fmt 'py:percent' --sync 50 | pass_filenames: true 51 | additional_dependencies: 52 | - 'jupytext==1.5.2' 53 | - black 54 | - isort 55 | always_run: false 56 | language: python 57 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. 4 | Please read the [full text](https://code.fb.com/codeofconduct/) 5 | so that you can understand what actions will and will not be tolerated. 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to habitat-lab 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Pull Requests 6 | We actively welcome your pull requests. 7 | 8 | 1. Fork the repo and create your branch from `master`. 9 | 2. If you've added code that should be tested, add tests. 10 | 3. If you've changed APIs, update the documentation. 11 | 4. Ensure the test suite passes. 12 | 5. Make sure your code lints. 13 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 14 | 7. We have adopted squash-and-merge as the policy for incorporating PRs into the master branch. We encourage more smaller/focused PRs rather than big PRs with many independent changes. This also enables faster development by merging PRs into master quickly and reducing the need to rebase due to changes on master. 15 | 16 | 17 | ## Contributor License Agreement ("CLA") 18 | In order to accept your pull request, we need you to submit a CLA. You only need 19 | to do this once to work on any of Facebook's open source projects. 20 | 21 | Complete your CLA here: 22 | 23 | ## Versioning / release workflow 24 | We use [semantic versioning](https://semver.org/). To prepare a release: 25 | 1. Update version numbers. 26 | 2. Update the change log. 27 | 3. Make sure all tests are passing. 28 | 4. Create a release tag with change log summary using the github release interface (release tag should follow semantic versioning as described above) 29 | 30 | Stable versions are regularly assigned by Habitat core team after rigorous testing. 31 | 32 | ## Issues 33 | We use [GitHub issues](../../issues) to track public bugs. Please ensure your description is 34 | clear and has sufficient instructions to be able to reproduce the issue. 35 | 36 | ## Test 37 | We use pytest testing framework and testing data that needs to be downloaded, please make sure that test are passing: 38 | ``` 39 | pytest 40 | ``` 41 | 42 | ## Check typing 43 | We use mypy to check Python typing and guard API consistency, please make sure next command doesn't complain prior to submission: 44 | ``` 45 | mypy . --ignore-missing-imports 46 | ``` 47 | 48 | ## Coding Style 49 | - We follow PEP8 and use [typing](https://docs.python.org/3/library/typing.html). 50 | - Use `black` for style enforcement and linting. Install black through `pip install black`. 51 | 52 | We also use pre-commit hooks to ensure linting and style enforcement. Install the pre-commit hooks with `pip install pre-commit && pre-commit install`. 53 | 54 | ## Documentation 55 | - Our documentation style is based on Magnum / Corrade and uses [a similar build system](https://mcss.mosra.cz/documentation/doxygen/). 56 | - Documentation of PRs is highly encouraged! 57 | 58 | ## License 59 | By contributing to habitat-lab, you agree that your contributions will be licensed 60 | under the LICENSE file in the root directory of this source tree. 61 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Base image 2 | FROM nvidia/cudagl:10.1-devel-ubuntu16.04 3 | 4 | # Setup basic packages 5 | RUN apt-get update && apt-get install -y --no-install-recommends \ 6 | build-essential \ 7 | git \ 8 | curl \ 9 | vim \ 10 | ca-certificates \ 11 | libjpeg-dev \ 12 | libpng-dev \ 13 | libglfw3-dev \ 14 | libglm-dev \ 15 | libx11-dev \ 16 | libomp-dev \ 17 | libegl1-mesa-dev \ 18 | pkg-config \ 19 | wget \ 20 | zip \ 21 | unzip &&\ 22 | rm -rf /var/lib/apt/lists/* 23 | 24 | # Install conda 25 | RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh &&\ 26 | chmod +x ~/miniconda.sh &&\ 27 | ~/miniconda.sh -b -p /opt/conda &&\ 28 | rm ~/miniconda.sh &&\ 29 | /opt/conda/bin/conda install numpy pyyaml scipy ipython mkl mkl-include &&\ 30 | /opt/conda/bin/conda clean -ya 31 | ENV PATH /opt/conda/bin:$PATH 32 | 33 | # Install cmake 34 | RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh 35 | RUN mkdir /opt/cmake 36 | RUN sh /cmake-3.14.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license 37 | RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake 38 | RUN cmake --version 39 | 40 | # Conda environment 41 | RUN conda create -n habitat python=3.6 cmake=3.14.0 42 | 43 | # Setup habitat-sim 44 | RUN git clone --branch stable https://github.com/facebookresearch/habitat-sim.git 45 | RUN /bin/bash -c ". activate habitat; cd habitat-sim; pip install -r requirements.txt; python setup.py install --headless" 46 | 47 | # Install challenge specific habitat-lab 48 | RUN git clone --branch stable https://github.com/facebookresearch/habitat-lab.git 49 | RUN /bin/bash -c ". activate habitat; cd habitat-lab; pip install -e ." 50 | 51 | # Silence habitat-sim logs 52 | ENV GLOG_minloglevel=2 53 | ENV MAGNUM_LOG="quiet" 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Facebook, Inc. and its affiliates. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft habitat/utils/visualizations/assets 2 | include habitat/py.typed 3 | include habitat_baselines/py.typed 4 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to -------------------------------------------------------------------------------- /configs/datasets/eqa/mp3d.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: MP3DEQA-v1 3 | SPLIT: train 4 | DATA_PATH: "data/datasets/eqa/mp3d/v1/{split}/{split}.json.gz" 5 | SCENES_DIR: "data/scene_datasets/" 6 | -------------------------------------------------------------------------------- /configs/datasets/imagenav/gibson.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: PointNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/pointnav/gibson/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/imagenav/mp3d.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: PointNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/pointnav/mp3d/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/objectnav/mp3d.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: ObjectNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/pointnav/gibson.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: PointNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/pointnav/gibson/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/pointnav/gibson_v2.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | HEIGHT: 0.88 6 | RADIUS: 0.18 7 | 8 | DATASET: 9 | TYPE: PointNav-v1 10 | SPLIT: train 11 | DATA_PATH: data/datasets/pointnav/gibson/v2/{split}/{split}.json.gz 12 | -------------------------------------------------------------------------------- /configs/datasets/pointnav/habitat_test.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: PointNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/pointnav/habitat-test-scenes/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/pointnav/mp3d.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: PointNav-v1 3 | SPLIT: train 4 | DATA_PATH: data/datasets/pointnav/mp3d/v1/{split}/{split}.json.gz 5 | -------------------------------------------------------------------------------- /configs/datasets/single_episode.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | ITERATOR_OPTIONS: 3 | GROUP_BY_SCENE: True 4 | NUM_EPISODE_SAMPLE: 1 5 | SHUFFLE: False 6 | -------------------------------------------------------------------------------- /configs/datasets/vln/mp3d_r2r.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | TYPE: R2RVLN-v1 3 | SPLIT: train 4 | DATA_PATH: "data/datasets/vln/mp3d/r2r/v1/{split}/{split}.json.gz" 5 | SCENES_DIR: "data/scene_datasets/" 6 | -------------------------------------------------------------------------------- /configs/tasks/coverage.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 250 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | # DEPTH_SENSOR: 12 | # WIDTH: 256 13 | # HEIGHT: 256 14 | TASK: 15 | TYPE: Coverage-v0 16 | SENSORS: [] 17 | MEASUREMENTS: ['COVERAGE'] 18 | TOP_DOWN_MAP: 19 | DRAW_SHORTEST_PATH: False 20 | DRAW_SOURCE_AND_TARGET: False 21 | FOG_OF_WAR: 22 | DRAW: False 23 | COVERAGE: 24 | TYPE: Coverage 25 | GRID_DELTA: 1.0 26 | GOAL_SENSOR_UUID: no_sensor 27 | DATASET: 28 | TYPE: PointNav-v1 29 | SPLIT: train 30 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 31 | -------------------------------------------------------------------------------- /configs/tasks/coverage_test.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 250 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | TASK: 12 | TYPE: Coverage-v0 13 | SENSORS: [] 14 | MEASUREMENTS: ['COVERAGE'] 15 | TOP_DOWN_MAP: 16 | DRAW_SHORTEST_PATH: False 17 | DRAW_SOURCE_AND_TARGET: False 18 | FOG_OF_WAR: 19 | DRAW: False 20 | COVERAGE: 21 | TYPE: Coverage 22 | GRID_DELTA: 1.0 23 | DATASET: 24 | TYPE: PointNav-v1 25 | SPLIT: train 26 | DATA_PATH: data/datasets/pointnav/habitat-test-scenes/v1/{split}/{split}.json.gz 27 | -------------------------------------------------------------------------------- /configs/tasks/eqa_mp3d.yaml: -------------------------------------------------------------------------------- 1 | TASK: 2 | TYPE: EQA-v0 3 | SENSORS: ['QUESTION_SENSOR'] 4 | POSSIBLE_ACTIONS: ['MOVE_FORWARD', 'TURN_LEFT', 'TURN_RIGHT', 'ANSWER'] 5 | MEASUREMENTS: ['EPISODE_INFO', 'DISTANCE_TO_GOAL', 'ANSWER_ACCURACY'] 6 | 7 | ENVIRONMENT: 8 | MAX_EPISODE_STEPS: 500 9 | 10 | SIMULATOR: 11 | AGENT_0: 12 | SENSORS: ['RGB_SENSOR'] 13 | HABITAT_SIM_V0: 14 | GPU_DEVICE_ID: 0 15 | RGB_SENSOR: 16 | WIDTH: 256 17 | HEIGHT: 256 18 | DEPTH_SENSOR: 19 | WIDTH: 256 20 | HEIGHT: 256 21 | 22 | DATASET: 23 | TYPE: MP3DEQA-v1 24 | SPLIT: train 25 | DATA_PATH: "data/datasets/eqa/mp3d/v1/{split}/{split}.json.gz" 26 | SCENES_DIR: "data/scene_datasets/" 27 | -------------------------------------------------------------------------------- /configs/tasks/gibson_coverage.yaml: -------------------------------------------------------------------------------- 1 | # Used for objectnav pretraining 2 | ENVIRONMENT: 3 | MAX_EPISODE_STEPS: 500 4 | 5 | SIMULATOR: 6 | TURN_ANGLE: 30 7 | TILT_ANGLE: 30 8 | ACTION_SPACE_CONFIG: "v0" # "v1" 9 | AGENT_0: 10 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 11 | HEIGHT: 0.88 12 | RADIUS: 0.18 13 | HABITAT_SIM_V0: 14 | GPU_DEVICE_ID: 0 15 | ALLOW_SLIDING: False 16 | SEMANTIC_SENSOR: 17 | WIDTH: 256 # 640 18 | HEIGHT: 256 # 480 19 | HFOV: 79 20 | POSITION: [0, 0.88, 0] 21 | RGB_SENSOR: 22 | WIDTH: 256 # 640 23 | HEIGHT: 256 # 480 24 | HFOV: 79 25 | POSITION: [0, 0.88, 0] 26 | DEPTH_SENSOR: 27 | WIDTH: 256 # 640 28 | HEIGHT: 256 # 480 29 | HFOV: 79 30 | MIN_DEPTH: 0.5 31 | MAX_DEPTH: 5.0 32 | POSITION: [0, 0.88, 0] 33 | TASK: 34 | TYPE: Coverage-v0 35 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 36 | SENSORS: ['COMPASS_SENSOR', 'GPS_SENSOR'] 37 | MEASUREMENTS: 38 | - 'COVERAGE' 39 | - 'COVERAGE_REWARD' 40 | COVERAGE: 41 | GRID_DELTA: 2.5 42 | EGOCENTRIC: True 43 | GPS_SENSOR: 44 | DIMENSIONALITY: 3 45 | GOAL_SENSOR_UUID: no_sensor 46 | DATASET: 47 | TYPE: PointNav-v1 48 | SPLIT: train 49 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v2/{split}/{split}.json.gz 50 | -------------------------------------------------------------------------------- /configs/tasks/imagenav.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 1000 3 | 4 | SIMULATOR: 5 | AGENT_0: 6 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 7 | HABITAT_SIM_V0: 8 | GPU_DEVICE_ID: 0 9 | RGB_SENSOR: 10 | WIDTH: 256 11 | HEIGHT: 256 12 | DEPTH_SENSOR: 13 | WIDTH: 256 14 | HEIGHT: 256 15 | 16 | TASK: 17 | TYPE: Nav-v0 18 | SUCCESS_DISTANCE: 1. 19 | 20 | SENSORS: ['IMAGEGOAL_SENSOR'] 21 | 22 | MEASUREMENTS: ["DISTANCE_TO_GOAL", "SUCCESS", "SPL", "SOFT_SPL"] 23 | SUCCESS: 24 | SUCCESS_DISTANCE: 1. 25 | -------------------------------------------------------------------------------- /configs/tasks/imagenav_gibson.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 1000 3 | ITERATOR_OPTIONS: 4 | MAX_SCENE_REPEAT_STEPS: 50000 5 | SIMULATOR: 6 | AGENT_0: 7 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 8 | HABITAT_SIM_V0: 9 | GPU_DEVICE_ID: 0 10 | RGB_SENSOR: 11 | WIDTH: 256 12 | HEIGHT: 256 13 | DEPTH_SENSOR: 14 | WIDTH: 256 15 | HEIGHT: 256 16 | TASK: 17 | TYPE: Nav-v0 18 | SUCCESS_DISTANCE: 1. 19 | 20 | SENSORS: ['IMAGEGOAL_SENSOR'] 21 | 22 | MEASUREMENTS: ["DISTANCE_TO_GOAL", "SUCCESS", "SPL", "SOFT_SPL"] 23 | SUCCESS: 24 | SUCCESS_DISTANCE: 1. 25 | 26 | DATASET: 27 | TYPE: PointNav-v1 28 | SPLIT: train 29 | DATA_PATH: data/datasets/pointnav/gibson/v1/{split}/{split}.json.gz 30 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_depth_only.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: ['COVERAGE', 'DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 41 | SUCCESS: 42 | SUCCESS_DISTANCE: 0.1 43 | DISTANCE_TO_GOAL: 44 | DISTANCE_TO: VIEW_POINTS 45 | COVERAGE: 46 | GRID_DELTA: 2.5 47 | 48 | DATASET: 49 | TYPE: ObjectNav-v1 50 | SPLIT: train 51 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 52 | SCENES_DIR: "data/scene_datasets/" 53 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mini_semantic.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 64 # 640 17 | HEIGHT: 64 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: ['COVERAGE', 'DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 41 | SUCCESS: 42 | SUCCESS_DISTANCE: 0.1 43 | DISTANCE_TO_GOAL: 44 | DISTANCE_TO: VIEW_POINTS 45 | COVERAGE: 46 | GRID_DELTA: 2.5 47 | 48 | DATASET: 49 | TYPE: ObjectNav-v1 50 | SPLIT: train 51 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 52 | SCENES_DIR: "data/scene_datasets/" 53 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL', 'COVERAGE', 'SOFT_SPL'] 41 | 42 | SUCCESS: 43 | SUCCESS_DISTANCE: 0.1 44 | DISTANCE_TO_GOAL: 45 | DISTANCE_TO: VIEW_POINTS 46 | COVERAGE: 47 | GRID_DELTA: 2.5 48 | 49 | DATASET: 50 | TYPE: ObjectNav-v1 51 | SPLIT: train 52 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 53 | SCENES_DIR: "data/scene_datasets/" 54 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_ego.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL', 'COVERAGE', 'SOFT_SPL'] 41 | 42 | SUCCESS: 43 | SUCCESS_DISTNCE: 0.1 44 | DISTANCE_TO_GOAL: 45 | DISTANCE_TO: VIEW_POINTS 46 | COVERAGE: 47 | GRID_DELTA: 2.5 48 | EGOCENTRIC: True 49 | GPS_SENSOR: 50 | DIMENSIONALITY: 3 51 | DATASET: 52 | TYPE: ObjectNav-v1 53 | SPLIT: train 54 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 55 | SCENES_DIR: "data/scene_datasets/" 56 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_ego_2d_extreward.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: 41 | - 'DISTANCE_TO_GOAL' 42 | - 'SUCCESS' 43 | - 'SPL' 44 | - 'COVERAGE' 45 | - 'SOFT_SPL' 46 | - 'COVERAGE_REWARD' 47 | - 'OBJNAV_REWARD' 48 | - 'OBJNAV_REWARD_A' 49 | SUCCESS: 50 | SUCCESS_DISTANCE: 0.1 51 | DISTANCE_TO_GOAL: 52 | DISTANCE_TO: VIEW_POINTS 53 | COVERAGE: 54 | GRID_DELTA: 2.5 55 | EGOCENTRIC: True 56 | GPS_SENSOR: 57 | DIMENSIONALITY: 2 58 | COVERAGE_REWARD: 59 | ATTENUATION: 0.995 60 | DATASET: 61 | TYPE: ObjectNav-v1 62 | SPLIT: train 63 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 64 | SCENES_DIR: "data/scene_datasets/" 65 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_ego_d2g.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: 41 | - 'DISTANCE_TO_GOAL' 42 | - 'SUCCESS' 43 | - 'SPL' 44 | - 'COVERAGE' 45 | - 'SOFT_SPL' 46 | - 'COVERAGE_REWARD' 47 | - 'D2G_REWARD' 48 | SUCCESS: 49 | SUCCESS_DISTANCE: 0.1 50 | DISTANCE_TO_GOAL: 51 | DISTANCE_TO: VIEW_POINTS 52 | COVERAGE: 53 | GRID_DELTA: 2.5 54 | EGOCENTRIC: True 55 | GPS_SENSOR: 56 | DIMENSIONALITY: 3 57 | COVERAGE_REWARD: 58 | ATTENUATION: 0.995 59 | DATASET: 60 | TYPE: ObjectNav-v1 61 | SPLIT: train 62 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 63 | SCENES_DIR: "data/scene_datasets/" 64 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_ego_extreward.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: 41 | - 'DISTANCE_TO_GOAL' 42 | - 'SUCCESS' 43 | - 'SPL' 44 | - 'COVERAGE' 45 | - 'SOFT_SPL' 46 | - 'COVERAGE_REWARD' 47 | - 'OBJNAV_REWARD' 48 | - 'OBJNAV_REWARD_A' 49 | SUCCESS: 50 | SUCCESS_DISTANCE: 0.1 51 | DISTANCE_TO_GOAL: 52 | DISTANCE_TO: VIEW_POINTS 53 | COVERAGE: 54 | GRID_DELTA: 2.5 55 | EGOCENTRIC: True 56 | GPS_SENSOR: 57 | DIMENSIONALITY: 3 58 | COVERAGE_REWARD: 59 | ATTENUATION: 0.995 60 | DATASET: 61 | TYPE: ObjectNav-v1 62 | SPLIT: train 63 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 64 | SCENES_DIR: "data/scene_datasets/" 65 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_full.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | TURN_ANGLE: 30 5 | TILT_ANGLE: 30 6 | ACTION_SPACE_CONFIG: "v1" 7 | AGENT_0: 8 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 9 | HEIGHT: 0.88 10 | RADIUS: 0.18 11 | HABITAT_SIM_V0: 12 | GPU_DEVICE_ID: 0 13 | ALLOW_SLIDING: False 14 | SEMANTIC_SENSOR: 15 | WIDTH: 640 16 | HEIGHT: 480 17 | HFOV: 79 18 | POSITION: [0, 0.88, 0] 19 | RGB_SENSOR: 20 | WIDTH: 640 21 | HEIGHT: 480 22 | HFOV: 79 23 | POSITION: [0, 0.88, 0] 24 | DEPTH_SENSOR: 25 | WIDTH: 640 26 | HEIGHT: 480 27 | HFOV: 79 28 | MIN_DEPTH: 0.5 29 | MAX_DEPTH: 5.0 30 | POSITION: [0, 0.88, 0] 31 | TASK: 32 | TYPE: ObjectNav-v1 33 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT", "LOOK_UP", "LOOK_DOWN"] 34 | SUCCESS_DISTANCE: 0.1 35 | 36 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 37 | GOAL_SENSOR_UUID: objectgoal 38 | 39 | MEASUREMENTS: 40 | - 'DISTANCE_TO_GOAL' 41 | - 'SUCCESS' 42 | - 'SPL' 43 | - 'COVERAGE' 44 | - 'SOFT_SPL' 45 | - 'COVERAGE_REWARD' 46 | - 'OBJNAV_REWARD' 47 | - 'OBJNAV_REWARD_A' 48 | SUCCESS: 49 | SUCCESS_DISTANCE: 0.1 50 | DISTANCE_TO_GOAL: 51 | DISTANCE_TO: VIEW_POINTS 52 | COVERAGE: 53 | GRID_DELTA: 2.5 54 | EGOCENTRIC: True 55 | GPS_SENSOR: 56 | DIMENSIONALITY: 3 57 | COVERAGE_REWARD: 58 | ATTENUATION: 0.995 59 | DATASET: 60 | TYPE: ObjectNav-v1 61 | SPLIT: train 62 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 63 | SCENES_DIR: "data/scene_datasets/" 64 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_full_4a.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | # ACTION_SPACE_CONFIG: "v1" 8 | ACTION_SPACE_CONFIG: "v0" # "v1" 9 | AGENT_0: 10 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 11 | HEIGHT: 0.88 12 | RADIUS: 0.18 13 | HABITAT_SIM_V0: 14 | GPU_DEVICE_ID: 0 15 | ALLOW_SLIDING: False 16 | SEMANTIC_SENSOR: 17 | WIDTH: 640 18 | HEIGHT: 480 19 | HFOV: 79 20 | POSITION: [0, 0.88, 0] 21 | RGB_SENSOR: 22 | WIDTH: 640 23 | HEIGHT: 480 24 | HFOV: 79 25 | POSITION: [0, 0.88, 0] 26 | DEPTH_SENSOR: 27 | WIDTH: 640 28 | HEIGHT: 480 29 | HFOV: 79 30 | MIN_DEPTH: 0.5 31 | MAX_DEPTH: 5.0 32 | POSITION: [0, 0.88, 0] 33 | TASK: 34 | TYPE: ObjectNav-v1 35 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 36 | # POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 37 | SUCCESS_DISTANCE: 0.1 38 | 39 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 40 | GOAL_SENSOR_UUID: objectgoal 41 | 42 | MEASUREMENTS: 43 | - 'DISTANCE_TO_GOAL' 44 | - 'SUCCESS' 45 | - 'SPL' 46 | - 'COVERAGE' 47 | - 'SOFT_SPL' 48 | - 'COVERAGE_REWARD' 49 | - 'OBJNAV_REWARD' 50 | - 'OBJNAV_REWARD_A' 51 | SUCCESS: 52 | SUCCESS_DISTANCE: 0.1 53 | DISTANCE_TO_GOAL: 54 | DISTANCE_TO: VIEW_POINTS 55 | COVERAGE: 56 | GRID_DELTA: 2.5 57 | EGOCENTRIC: True 58 | GPS_SENSOR: 59 | DIMENSIONALITY: 3 60 | COVERAGE_REWARD: 61 | ATTENUATION: 0.995 62 | DATASET: 63 | TYPE: ObjectNav-v1 64 | SPLIT: train 65 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 66 | SCENES_DIR: "data/scene_datasets/" 67 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_full_4a_train.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | # ACTION_SPACE_CONFIG: "v1" 8 | ACTION_SPACE_CONFIG: "v0" # "v1" 9 | AGENT_0: 10 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 11 | HEIGHT: 0.88 12 | RADIUS: 0.18 13 | HABITAT_SIM_V0: 14 | GPU_DEVICE_ID: 0 15 | ALLOW_SLIDING: False 16 | SEMANTIC_SENSOR: 17 | WIDTH: 320 18 | HEIGHT: 240 19 | HFOV: 79 20 | POSITION: [0, 0.88, 0] 21 | RGB_SENSOR: 22 | WIDTH: 320 23 | HEIGHT: 240 24 | HFOV: 79 25 | POSITION: [0, 0.88, 0] 26 | DEPTH_SENSOR: 27 | WIDTH: 320 28 | HEIGHT: 240 29 | HFOV: 79 30 | MIN_DEPTH: 0.5 31 | MAX_DEPTH: 5.0 32 | POSITION: [0, 0.88, 0] 33 | TASK: 34 | TYPE: ObjectNav-v1 35 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 36 | # POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 37 | SUCCESS_DISTANCE: 0.1 38 | 39 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 40 | GOAL_SENSOR_UUID: objectgoal 41 | 42 | MEASUREMENTS: 43 | - 'DISTANCE_TO_GOAL' 44 | - 'SUCCESS' 45 | - 'SPL' 46 | - 'COVERAGE' 47 | - 'SOFT_SPL' 48 | - 'COVERAGE_REWARD' 49 | - 'OBJNAV_REWARD' 50 | - 'OBJNAV_REWARD_A' 51 | SUCCESS: 52 | SUCCESS_DISTANCE: 0.1 53 | DISTANCE_TO_GOAL: 54 | DISTANCE_TO: VIEW_POINTS 55 | COVERAGE: 56 | GRID_DELTA: 2.5 57 | EGOCENTRIC: True 58 | GPS_SENSOR: 59 | DIMENSIONALITY: 3 60 | COVERAGE_REWARD: 61 | ATTENUATION: 0.995 62 | DATASET: 63 | TYPE: ObjectNav-v1 64 | SPLIT: train 65 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 66 | SCENES_DIR: "data/scene_datasets/" 67 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_full_4a_train_s2.yaml: -------------------------------------------------------------------------------- 1 | SEED: 2 2 | ENVIRONMENT: 3 | MAX_EPISODE_STEPS: 500 4 | 5 | SIMULATOR: 6 | TURN_ANGLE: 30 7 | TILT_ANGLE: 30 8 | # ACTION_SPACE_CONFIG: "v1" 9 | ACTION_SPACE_CONFIG: "v0" # "v1" 10 | AGENT_0: 11 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 12 | HEIGHT: 0.88 13 | RADIUS: 0.18 14 | HABITAT_SIM_V0: 15 | GPU_DEVICE_ID: 0 16 | ALLOW_SLIDING: False 17 | SEMANTIC_SENSOR: 18 | WIDTH: 320 19 | HEIGHT: 240 20 | HFOV: 79 21 | POSITION: [0, 0.88, 0] 22 | RGB_SENSOR: 23 | WIDTH: 320 24 | HEIGHT: 240 25 | HFOV: 79 26 | POSITION: [0, 0.88, 0] 27 | DEPTH_SENSOR: 28 | WIDTH: 320 29 | HEIGHT: 240 30 | HFOV: 79 31 | MIN_DEPTH: 0.5 32 | MAX_DEPTH: 5.0 33 | POSITION: [0, 0.88, 0] 34 | TASK: 35 | TYPE: ObjectNav-v1 36 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 37 | # POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 38 | SUCCESS_DISTANCE: 0.1 39 | 40 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 41 | GOAL_SENSOR_UUID: objectgoal 42 | 43 | MEASUREMENTS: 44 | - 'DISTANCE_TO_GOAL' 45 | - 'SUCCESS' 46 | - 'SPL' 47 | - 'COVERAGE' 48 | - 'SOFT_SPL' 49 | - 'COVERAGE_REWARD' 50 | - 'OBJNAV_REWARD' 51 | - 'OBJNAV_REWARD_A' 52 | SUCCESS: 53 | SUCCESS_DISTANCE: 0.1 54 | DISTANCE_TO_GOAL: 55 | DISTANCE_TO: VIEW_POINTS 56 | COVERAGE: 57 | GRID_DELTA: 2.5 58 | EGOCENTRIC: True 59 | GPS_SENSOR: 60 | DIMENSIONALITY: 3 61 | COVERAGE_REWARD: 62 | ATTENUATION: 0.995 63 | DATASET: 64 | TYPE: ObjectNav-v1 65 | SPLIT: train 66 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 67 | SCENES_DIR: "data/scene_datasets/" 68 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_full_train.yaml: -------------------------------------------------------------------------------- 1 | # Half resolution for training 2 | ENVIRONMENT: 3 | MAX_EPISODE_STEPS: 500 4 | 5 | SIMULATOR: 6 | TURN_ANGLE: 30 7 | TILT_ANGLE: 30 8 | ACTION_SPACE_CONFIG: "v1" 9 | # ACTION_SPACE_CONFIG: "v0" # "v1" 10 | AGENT_0: 11 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 12 | HEIGHT: 0.88 13 | RADIUS: 0.18 14 | HABITAT_SIM_V0: 15 | GPU_DEVICE_ID: 0 16 | ALLOW_SLIDING: False 17 | SEMANTIC_SENSOR: 18 | WIDTH: 320 19 | HEIGHT: 240 20 | HFOV: 79 21 | POSITION: [0, 0.88, 0] 22 | RGB_SENSOR: 23 | WIDTH: 320 24 | HEIGHT: 240 25 | HFOV: 79 26 | POSITION: [0, 0.88, 0] 27 | DEPTH_SENSOR: 28 | WIDTH: 320 29 | HEIGHT: 240 30 | HFOV: 79 31 | MIN_DEPTH: 0.5 32 | MAX_DEPTH: 5.0 33 | POSITION: [0, 0.88, 0] 34 | TASK: 35 | TYPE: ObjectNav-v1 36 | # POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 37 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT", "LOOK_UP", "LOOK_DOWN"] 38 | SUCCESS_DISTANCE: 0.1 39 | 40 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 41 | GOAL_SENSOR_UUID: objectgoal 42 | 43 | MEASUREMENTS: 44 | - 'DISTANCE_TO_GOAL' 45 | - 'SUCCESS' 46 | - 'SPL' 47 | - 'COVERAGE' 48 | - 'SOFT_SPL' 49 | - 'COVERAGE_REWARD' 50 | - 'OBJNAV_REWARD' 51 | - 'OBJNAV_REWARD_A' 52 | SUCCESS: 53 | SUCCESS_DISTANCE: 0.1 54 | DISTANCE_TO_GOAL: 55 | DISTANCE_TO: VIEW_POINTS 56 | COVERAGE: 57 | GRID_DELTA: 2.5 58 | EGOCENTRIC: True 59 | GPS_SENSOR: 60 | DIMENSIONALITY: 3 61 | COVERAGE_REWARD: 62 | ATTENUATION: 0.995 63 | DATASET: 64 | TYPE: ObjectNav-v1 65 | SPLIT: train 66 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 67 | SCENES_DIR: "data/scene_datasets/" 68 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_hfov.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v0" # "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 63.453048375 # ! 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 63.453048375 # ! 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 63.453048375 # ! 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: 41 | - 'DISTANCE_TO_GOAL' 42 | - 'SUCCESS' 43 | - 'SPL' 44 | - 'COVERAGE' 45 | - 'SOFT_SPL' 46 | - 'COVERAGE_REWARD' 47 | - 'OBJNAV_REWARD' 48 | - 'OBJNAV_REWARD_A' 49 | SUCCESS: 50 | SUCCESS_DISTANCE: 0.1 51 | DISTANCE_TO_GOAL: 52 | DISTANCE_TO: VIEW_POINTS 53 | COVERAGE: 54 | GRID_DELTA: 2.5 55 | EGOCENTRIC: True 56 | GPS_SENSOR: 57 | DIMENSIONALITY: 3 58 | COVERAGE_REWARD: 59 | ATTENUATION: 0.995 60 | DATASET: 61 | TYPE: ObjectNav-v1 62 | SPLIT: train 63 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 64 | SCENES_DIR: "data/scene_datasets/" 65 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_mp3d_proper_fov.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | # ! DEBUG 4 | ITERATOR_OPTIONS: 5 | SHUFFLE: False 6 | SIMULATOR: 7 | TURN_ANGLE: 30 8 | TILT_ANGLE: 30 9 | ACTION_SPACE_CONFIG: "v0" # "v1" 10 | AGENT_0: 11 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 12 | HEIGHT: 0.88 13 | RADIUS: 0.18 14 | HABITAT_SIM_V0: 15 | GPU_DEVICE_ID: 0 16 | ALLOW_SLIDING: False 17 | SEMANTIC_SENSOR: 18 | WIDTH: 640 19 | HEIGHT: 480 20 | HFOV: 79 21 | POSITION: [0, 0.88, 0] 22 | RGB_SENSOR: 23 | WIDTH: 640 24 | HEIGHT: 480 25 | HFOV: 79 26 | POSITION: [0, 0.88, 0] 27 | DEPTH_SENSOR: 28 | WIDTH: 640 29 | HEIGHT: 480 30 | HFOV: 79 31 | MIN_DEPTH: 0.5 32 | MAX_DEPTH: 5.0 33 | POSITION: [0, 0.88, 0] 34 | TASK: 35 | TYPE: ObjectNav-v1 36 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"] # , "LOOK_UP", "LOOK_DOWN"] 37 | SUCCESS_DISTANCE: 0.1 38 | 39 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 40 | GOAL_SENSOR_UUID: objectgoal 41 | 42 | MEASUREMENTS: 43 | - 'DISTANCE_TO_GOAL' 44 | - 'SUCCESS' 45 | - 'SPL' 46 | - 'COVERAGE' 47 | - 'SOFT_SPL' 48 | - 'COVERAGE_REWARD' 49 | - 'OBJNAV_REWARD' 50 | - 'OBJNAV_REWARD_A' 51 | SUCCESS: 52 | SUCCESS_DISTANCE: 0.1 53 | DISTANCE_TO_GOAL: 54 | DISTANCE_TO: VIEW_POINTS 55 | COVERAGE: 56 | GRID_DELTA: 2.5 57 | EGOCENTRIC: True 58 | GPS_SENSOR: 59 | DIMENSIONALITY: 3 60 | COVERAGE_REWARD: 61 | ATTENUATION: 0.995 62 | DATASET: 63 | TYPE: ObjectNav-v1 64 | SPLIT: train 65 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 66 | SCENES_DIR: "data/scene_datasets/" 67 | -------------------------------------------------------------------------------- /configs/tasks/objectnav_v1action.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | 4 | SIMULATOR: 5 | TURN_ANGLE: 30 6 | TILT_ANGLE: 30 7 | ACTION_SPACE_CONFIG: "v1" 8 | AGENT_0: 9 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 10 | HEIGHT: 0.88 11 | RADIUS: 0.18 12 | HABITAT_SIM_V0: 13 | GPU_DEVICE_ID: 0 14 | ALLOW_SLIDING: False 15 | SEMANTIC_SENSOR: 16 | WIDTH: 256 # 640 17 | HEIGHT: 256 # 480 18 | HFOV: 79 19 | POSITION: [0, 0.88, 0] 20 | RGB_SENSOR: 21 | WIDTH: 256 # 640 22 | HEIGHT: 256 # 480 23 | HFOV: 79 24 | POSITION: [0, 0.88, 0] 25 | DEPTH_SENSOR: 26 | WIDTH: 256 # 640 27 | HEIGHT: 256 # 480 28 | HFOV: 79 29 | MIN_DEPTH: 0.5 30 | MAX_DEPTH: 5.0 31 | POSITION: [0, 0.88, 0] 32 | TASK: 33 | TYPE: ObjectNav-v1 34 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT", "LOOK_UP", "LOOK_DOWN"] 35 | SUCCESS_DISTANCE: 0.1 36 | 37 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 38 | GOAL_SENSOR_UUID: objectgoal 39 | 40 | MEASUREMENTS: ['COVERAGE', 'DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 41 | SUCCESS: 42 | SUCCESS_DISTANCE: 0.1 43 | DISTANCE_TO_GOAL: 44 | DISTANCE_TO: VIEW_POINTS 45 | COVERAGE: 46 | GRID_DELTA: 2.0 47 | 48 | DATASET: 49 | TYPE: ObjectNav-v1 50 | SPLIT: train 51 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 52 | SCENES_DIR: "data/scene_datasets/" 53 | -------------------------------------------------------------------------------- /configs/tasks/pointnav.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_SENSOR'] 19 | GOAL_SENSOR_UUID: pointgoal 20 | 21 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 22 | SUCCESS: 23 | SUCCESS_DISTANCE: 0.2 24 | DATASET: 25 | TYPE: PointNav-v1 26 | SPLIT: train 27 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 28 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_challenge.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | HEIGHT: 0.88 7 | RADIUS: 0.18 8 | HABITAT_SIM_V0: 9 | GPU_DEVICE_ID: 0 10 | # ALLOW_SLIDING: False 11 | RGB_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | DEPTH_SENSOR: 15 | WIDTH: 256 16 | HEIGHT: 256 17 | # RGB_SENSOR: 18 | # WIDTH: 640 19 | # HEIGHT: 360 20 | # HFOV: 70 21 | # POSITION: [0, 0.88, 0] 22 | # NOISE_MODEL: "GaussianNoiseModel" 23 | # NOISE_MODEL_KWARGS: 24 | # intensity_constant: 0.1 25 | 26 | # DEPTH_SENSOR: 27 | # WIDTH: 640 28 | # HEIGHT: 360 29 | # HFOV: 70 30 | # MIN_DEPTH: 0.1 31 | # MAX_DEPTH: 10.0 32 | # POSITION: [0, 0.88, 0] 33 | # NOISE_MODEL: "RedwoodDepthNoiseModel" 34 | 35 | # ACTION_SPACE_CONFIG: 'pyrobotnoisy' 36 | # NOISE_MODEL: 37 | # ROBOT: "LoCoBot" 38 | # CONTROLLER: 'Proportional' 39 | # NOISE_MULTIPLIER: 0.5 40 | 41 | TASK: 42 | TYPE: Nav-v0 43 | SUCCESS_DISTANCE: 0.36 44 | SENSORS: ['POINTGOAL_SENSOR'] 45 | POINTGOAL_SENSOR: 46 | GOAL_FORMAT: POLAR 47 | DIMENSIONALITY: 2 48 | GOAL_SENSOR_UUID: pointgoal 49 | MEASUREMENTS: ['DISTANCE_TO_GOAL', "SUCCESS", 'SPL'] 50 | SUCCESS: 51 | SUCCESS_DISTANCE: 0.36 52 | 53 | DATASET: 54 | TYPE: PointNav-v1 55 | SPLIT: train 56 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 57 | SCENES_DIR: "data/scene_datasets/" 58 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_gc.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 25 | SPL: 26 | TYPE: SPL 27 | SUCCESS_DISTANCE: 0.2 28 | DATASET: 29 | TYPE: PointNav-v1 30 | SPLIT: train 31 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 32 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_gc2.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | ALLOW_SLIDING: False 9 | RGB_SENSOR: 10 | WIDTH: 256 # 640 # 256 11 | HEIGHT: 256 # 360 # 256 12 | HFOV: 70 13 | POSITION: [0, 0.88, 0] 14 | NOISE_MODEL: "GaussianNoiseModel" 15 | NOISE_MODEL_KWARGS: 16 | intensity_constant: 0.1 17 | 18 | DEPTH_SENSOR: 19 | WIDTH: 256 # 640 20 | HEIGHT: 256 # 360 21 | HFOV: 70 22 | MIN_DEPTH: 0.1 23 | MAX_DEPTH: 10.0 24 | POSITION: [0, 0.88, 0] 25 | NOISE_MODEL: "RedwoodDepthNoiseModel" 26 | 27 | ACTION_SPACE_CONFIG: 'pyrobotnoisy' 28 | NOISE_MODEL: 29 | ROBOT: "LoCoBot" 30 | CONTROLLER: 'Proportional' 31 | NOISE_MULTIPLIER: 0.5 32 | 33 | 34 | TASK: 35 | TYPE: Nav-v0 36 | SUCCESS_DISTANCE: 0.36 37 | SENSORS: ['POINTGOAL_SENSOR'] 38 | POINTGOAL_SENSOR: 39 | GOAL_FORMAT: POLAR 40 | DIMENSIONALITY: 2 41 | GOAL_SENSOR_UUID: pointgoal 42 | MEASUREMENTS: ['DISTANCE_TO_GOAL', "SUCCESS", 'SPL'] 43 | SUCCESS: 44 | SUCCESS_DISTANCE: 0.36 45 | 46 | DATASET: 47 | TYPE: PointNav-v1 48 | SPLIT: train 49 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 50 | SCENES_DIR: "data/scene_datasets/" -------------------------------------------------------------------------------- /configs/tasks/pointnav_gc2_cover.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | ALLOW_SLIDING: False 9 | RGB_SENSOR: 10 | WIDTH: 256 # 640 # 256 11 | HEIGHT: 256 # 360 # 256 12 | HFOV: 70 13 | POSITION: [0, 0.88, 0] 14 | NOISE_MODEL: "GaussianNoiseModel" 15 | NOISE_MODEL_KWARGS: 16 | intensity_constant: 0.1 17 | 18 | DEPTH_SENSOR: 19 | WIDTH: 256 # 640 20 | HEIGHT: 256 # 360 21 | HFOV: 70 22 | MIN_DEPTH: 0.1 23 | MAX_DEPTH: 10.0 24 | POSITION: [0, 0.88, 0] 25 | NOISE_MODEL: "RedwoodDepthNoiseModel" 26 | 27 | ACTION_SPACE_CONFIG: 'pyrobotnoisy' 28 | NOISE_MODEL: 29 | ROBOT: "LoCoBot" 30 | CONTROLLER: 'Proportional' 31 | NOISE_MULTIPLIER: 0.5 32 | 33 | 34 | TASK: 35 | TYPE: Nav-v0 36 | SUCCESS_DISTANCE: 0.36 37 | SENSORS: ['POINTGOAL_SENSOR'] 38 | POINTGOAL_SENSOR: 39 | GOAL_FORMAT: POLAR 40 | DIMENSIONALITY: 2 41 | GOAL_SENSOR_UUID: pointgoal 42 | MEASUREMENTS: ['COVERAGE', 'DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 43 | SUCCESS: 44 | SUCCESS_DISTANCE: 0.36 45 | 46 | DATASET: 47 | TYPE: PointNav-v1 48 | SPLIT: train 49 | DATA_PATH: /srv/share/datasets/habitat-sim-datasets/pointnav/gibson/v1/{split}/{split}.json.gz 50 | SCENES_DIR: "data/scene_datasets/" -------------------------------------------------------------------------------- /configs/tasks/pointnav_gibson.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 25 | SUCCESS: 26 | SUCCESS_DISTANCE: 0.2 27 | 28 | DATASET: 29 | TYPE: PointNav-v1 30 | SPLIT: train 31 | DATA_PATH: data/datasets/pointnav/gibson/v1/{split}/{split}.json.gz 32 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_mp3d.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 25 | SUCCESS: 26 | SUCCESS_DISTANCE: 0.2 27 | DATASET: 28 | TYPE: PointNav-v1 29 | SPLIT: train 30 | DATA_PATH: data/datasets/pointnav/mp3d/v1/{split}/{split}.json.gz 31 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_rgbd.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 25 | SUCCESS: 26 | SUCCESS_DISTANCE: 0.2 27 | -------------------------------------------------------------------------------- /configs/tasks/pointnav_viz.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR'] 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | TASK: 15 | TYPE: Nav-v0 16 | SUCCESS_DISTANCE: 0.2 17 | 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | 24 | MEASUREMENTS: ['SPL'] 25 | SPL: 26 | TYPE: SPL 27 | SUCCESS_DISTANCE: 0.2 28 | DATASET: 29 | TYPE: PointNav-v1 30 | SPLIT: all 31 | DATA_PATH: /nethome/jye72/projects/data/datasets/pointnav/gibson/scene_viz/{split}/{split}.json.gz 32 | -------------------------------------------------------------------------------- /configs/tasks/vln_r2r.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | AGENT_0: 5 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 6 | FORWARD_STEP_SIZE: 0.25 7 | TURN_ANGLE: 15 8 | HABITAT_SIM_V0: 9 | GPU_DEVICE_ID: 0 10 | RGB_SENSOR: 11 | WIDTH: 256 12 | HEIGHT: 256 13 | HFOV: 90 14 | TYPE: HabitatSimRGBSensor 15 | DEPTH_SENSOR: 16 | WIDTH: 256 17 | HEIGHT: 256 18 | TASK: 19 | TYPE: VLN-v0 20 | SUCCESS_DISTANCE: 3.0 21 | SENSORS: ['INSTRUCTION_SENSOR'] 22 | INSTRUCTION_SENSOR_UUID: instruction 23 | POSSIBLE_ACTIONS: ['STOP', 'MOVE_FORWARD', 'TURN_LEFT', 'TURN_RIGHT'] 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCESS', 'SPL'] 25 | SUCESS: 26 | SUCCESS_DISTANCE: 3.0 27 | DATASET: 28 | TYPE: R2RVLN-v1 29 | SPLIT: train 30 | DATA_PATH: "data/datasets/vln/mp3d/r2r/v1/{split}/{split}.json.gz" 31 | SCENES_DIR: "data/scene_datasets/" 32 | -------------------------------------------------------------------------------- /configs/test/habitat_all_sensors_test.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 10 3 | ITERATOR_OPTIONS: 4 | SHUFFLE: False 5 | SIMULATOR: 6 | AGENT_0: 7 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | DEPTH_SENSOR: 12 | WIDTH: 256 13 | HEIGHT: 256 14 | DATASET: 15 | TYPE: PointNav-v1 16 | SPLIT: train 17 | DATA_PATH: data/datasets/pointnav/habitat-test-scenes/v1/{split}/{split}.json.gz 18 | TASK: 19 | TYPE: Nav-v0 20 | SUCCESS_DISTANCE: 0.2 21 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR'] 22 | POSSIBLE_ACTIONS: ['STOP', 'MOVE_FORWARD', 'TURN_LEFT', 'TURN_RIGHT', 'TELEPORT'] 23 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 24 | GOAL_FORMAT: "POLAR" 25 | DIMENSIONALITY: 2 26 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 27 | 28 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL', 'SOFT_SPL'] 29 | SUCCESS: 30 | SUCCESS_DISTANCE: 0.2 31 | -------------------------------------------------------------------------------- /configs/test/habitat_mp3d_eqa_test.yaml: -------------------------------------------------------------------------------- 1 | TASK: 2 | TYPE: EQA-v0 3 | SENSORS: ['QUESTION_SENSOR'] 4 | POSSIBLE_ACTIONS: ['MOVE_FORWARD', 'TURN_LEFT', 'TURN_RIGHT', 'ANSWER'] 5 | MEASUREMENTS: ['EPISODE_INFO', 'DISTANCE_TO_GOAL', 'ANSWER_ACCURACY'] 6 | 7 | ENVIRONMENT: 8 | ITERATOR_OPTIONS: 9 | SHUFFLE: False 10 | 11 | SIMULATOR: 12 | SCENE: data/scene_datasets/mp3d/17DRP5sb8fy/17DRP5sb8fy.glb 13 | FORWARD_STEP_SIZE: 0.1 14 | TURN_ANGLE: 9 15 | AGENT_0: 16 | ANGULAR_ACCELERATION: 15.7 17 | ANGULAR_FRICTION: 1.0 18 | COEFFICIENT_OF_RESTITUTION: 0.15707963267 19 | LINEAR_ACCELERATION: 10.0 20 | LINEAR_FRICTION: 1.0 21 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR', 'SEMANTIC_SENSOR'] 22 | RGB_SENSOR: 23 | HEIGHT: 512 24 | WIDTH: 512 25 | HFOV: 45 26 | POSITION: [0, 1.09, 0] 27 | TYPE: HabitatSimRGBSensor 28 | 29 | DATASET: 30 | TYPE: MP3DEQA-v1 31 | SPLIT: val 32 | DATA_PATH: "data/datasets/eqa/mp3d/v1/{split}/{split}.json.gz" 33 | SCENES_DIR: "data/scene_datasets/" 34 | -------------------------------------------------------------------------------- /configs/test/habitat_mp3d_object_nav_test.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | TURN_ANGLE: 30 5 | TILT_ANGLE: 30 6 | ACTION_SPACE_CONFIG: "v1" 7 | AGENT_0: 8 | SENSORS: ['RGB_SENSOR', 'DEPTH_SENSOR'] 9 | HEIGHT: 0.88 10 | RADIUS: 0.2 11 | HABITAT_SIM_V0: 12 | GPU_DEVICE_ID: 0 13 | SEMANTIC_SENSOR: 14 | WIDTH: 640 15 | HEIGHT: 480 16 | HFOV: 79 17 | POSITION: [0, 0.88, 0] 18 | RGB_SENSOR: 19 | WIDTH: 640 20 | HEIGHT: 480 21 | HFOV: 79 22 | POSITION: [0, 0.88, 0] 23 | DEPTH_SENSOR: 24 | WIDTH: 640 25 | HEIGHT: 480 26 | HFOV: 79 27 | MIN_DEPTH: 0.5 28 | MAX_DEPTH: 5.0 29 | POSITION: [0, 0.88, 0] 30 | TASK: 31 | TYPE: ObjectNav-v1 32 | POSSIBLE_ACTIONS: ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT", "LOOK_UP", "LOOK_DOWN"] 33 | SUCCESS_DISTANCE: 0.1 34 | 35 | SENSORS: ['OBJECTGOAL_SENSOR', 'COMPASS_SENSOR', 'GPS_SENSOR'] 36 | GOAL_SENSOR_UUID: objectgoal 37 | 38 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 39 | SUCCESS: 40 | SUCCESS_DISTANCE: 0.2 41 | DISTANCE_TO_GOAL: 42 | DISTANCE_TO: VIEW_POINTS 43 | 44 | DATASET: 45 | TYPE: ObjectNav-v1 46 | SPLIT: val 47 | CONTENT_SCENES: ["*"] 48 | DATA_PATH: "data/datasets/objectnav/mp3d/v1/{split}/{split}.json.gz" 49 | SCENES_DIR: "data/scene_datasets/" 50 | -------------------------------------------------------------------------------- /configs/test/habitat_r2r_vln_test.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | MAX_EPISODE_STEPS: 500 3 | SIMULATOR: 4 | FORWARD_STEP_SIZE: 0.25 5 | TURN_ANGLE: 15 6 | HABITAT_SIM_V0: 7 | GPU_DEVICE_ID: 0 8 | RGB_SENSOR: 9 | WIDTH: 256 10 | HEIGHT: 256 11 | HFOV: 90 12 | TYPE: HabitatSimRGBSensor 13 | DEPTH_SENSOR: 14 | WIDTH: 256 15 | HEIGHT: 256 16 | TASK: 17 | TYPE: VLN-v0 18 | SENSORS: ['POINTGOAL_WITH_GPS_COMPASS_SENSOR', 'INSTRUCTION_SENSOR'] 19 | POINTGOAL_WITH_GPS_COMPASS_SENSOR: 20 | GOAL_FORMAT: "POLAR" 21 | DIMENSIONALITY: 2 22 | GOAL_SENSOR_UUID: pointgoal_with_gps_compass 23 | INSTRUCTION_SENSOR_UUID: instruction 24 | MEASUREMENTS: ['DISTANCE_TO_GOAL', 'SUCCESS', 'SPL'] 25 | SUCCESS: 26 | SUCCESS_DISTANCE: 3.0 27 | DATASET: 28 | TYPE: R2RVLN-v1 29 | SPLIT: val_seen 30 | DATA_PATH: "data/datasets/vln/mp3d/r2r/v1/{split}/{split}.json.gz" 31 | SCENES_DIR: "data/scene_datasets/" 32 | -------------------------------------------------------------------------------- /configs/test/new_keys_test.yaml: -------------------------------------------------------------------------------- 1 | ENVIRONMENT: 2 | NEW_KEY: 20 3 | ITERATOR_OPTIONS: 4 | MY_PARAM: "test" 5 | TASK: 6 | MY_NEW_TASK_PARAM: test 7 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | m.math.cache 2 | -------------------------------------------------------------------------------- /docs/build-public.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Propagate failures properly 4 | set -e 5 | 6 | mcss_path=../../habitat-sim/docs/m.css 7 | 8 | # Regenerate the compiled CSS file (yes, in the sim repository, to allow fast 9 | # iterations from here as well) 10 | $mcss_path/css/postprocess.py \ 11 | ../../habitat-sim/docs/theme.css \ 12 | $mcss_path/css/m-grid.css \ 13 | $mcss_path/css/m-components.css \ 14 | $mcss_path/css/m-layout.css \ 15 | ../../habitat-sim/docs/pygments-pastie.css \ 16 | $mcss_path/css/pygments-console.css \ 17 | $mcss_path/css/m-documentation.css \ 18 | -o ../../habitat-sim/docs/theme.compiled.css 19 | 20 | $mcss_path/documentation/python.py conf-public.py 21 | 22 | # The file:// URLs are usually clickable in the terminal, directly opening a 23 | # browser 24 | echo "------------------------------------------------------------------------" 25 | echo "Public docs were successfully generated to the following location. Note" 26 | echo "that the search functionality requires a web server in this case." 27 | echo 28 | echo "file://$(pwd)/../../habitat-sim/build/docs-public/habitat-lab/index.html" 29 | -------------------------------------------------------------------------------- /docs/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Propagate failures properly 4 | set -e 5 | 6 | if [[ $# -eq 1 ]]; then 7 | export mcss_path=$1 8 | elif [[ $# -ne 0 ]]; then 9 | echo "usage: ./build.sh [path-to-m.css]" 10 | exit 1 11 | else 12 | if [ ! -d ../../habitat-sim/docs/m.css ]; then 13 | echo "m.css submodule not found in the sim repository, please run git submodule update --init there or specify the path to it" 14 | exit 1 15 | fi 16 | mcss_path=../../habitat-sim/docs/m.css 17 | fi 18 | 19 | # Regenerate the compiled CSS file (yes, in the sim repository, to allow fast 20 | # iterations from here as well) 21 | $mcss_path/css/postprocess.py \ 22 | ../../habitat-sim/docs/theme.css \ 23 | $mcss_path/css/m-grid.css \ 24 | $mcss_path/css/m-components.css \ 25 | $mcss_path/css/m-layout.css \ 26 | ../../habitat-sim/docs/pygments-pastie.css \ 27 | $mcss_path/css/pygments-console.css \ 28 | $mcss_path/css/m-documentation.css \ 29 | -o ../../habitat-sim/docs/theme.compiled.css 30 | 31 | $mcss_path/documentation/python.py conf.py 32 | 33 | # The file:// URLs are usually clickable in the terminal, directly opening a 34 | # browser 35 | echo "------------------------------------------------------------------------" 36 | echo "Docs were successfully generated. Open the following link to view them:" 37 | echo 38 | echo "file://$(pwd)/../../habitat-sim/build/docs/habitat-lab/index.html" 39 | -------------------------------------------------------------------------------- /docs/conf-public.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # This source code is licensed under the MIT license found in the 3 | # LICENSE file in the root directory of this source tree. 4 | 5 | import os 6 | import sys 7 | 8 | sys.path.append(os.path.dirname(os.path.realpath(__file__))) 9 | 10 | # Inherit everything from the local config 11 | from conf import * # isort:skip 12 | 13 | OUTPUT = "../../habitat-sim/build/docs-public/habitat-lab/" 14 | 15 | HTML_HEADER = """ 16 | 17 | 23 | """ 24 | 25 | SEARCH_DOWNLOAD_BINARY = "searchdata-v1.bin" 26 | SEARCH_BASE_URL = "https://aihabitat.org/docs/habitat-lab/" 27 | SEARCH_EXTERNAL_URL = "https://google.com/search?q=site:aihabitat.org+{query}" 28 | 29 | M_SPHINX_INVENTORIES = [ 30 | ( 31 | "../../habitat-sim/docs/python.inv", 32 | "https://docs.python.org/3/", 33 | [], 34 | ["m-doc-external"], 35 | ), 36 | ( 37 | "../../habitat-sim/docs/numpy.inv", 38 | "https://docs.scipy.org/doc/numpy/", 39 | [], 40 | ["m-doc-external"], 41 | ), 42 | ( 43 | "../../habitat-sim/build/docs-public/habitat-sim/objects.inv", 44 | "../habitat-sim/", 45 | [], 46 | ["m-doc-external"], 47 | ), 48 | ] 49 | -------------------------------------------------------------------------------- /docs/docs.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Stuff defined here gets set globally for everything else: 3 | 4 | - use :py:`code` for inline code with highlighted Python syntax 5 | .. 6 | 7 | .. role:: py(code) 8 | :language: py 9 | 10 | .. due to current limitations in m.css, all underscored members have to be 11 | listed here in order to be visible, it's not enough to list them in a class 12 | / module docstring. All underscored members are otherwise treated as 13 | private and not exposed in the docs 14 | 15 | .. py:data:: habitat.core.embodied_task.Measure._metric 16 | -------------------------------------------------------------------------------- /docs/pages/habitat-lab-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/docs/pages/habitat-lab-demo.png -------------------------------------------------------------------------------- /docs/pages/habitat-sim-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/docs/pages/habitat-sim-demo.png -------------------------------------------------------------------------------- /docs/pages/index.rst: -------------------------------------------------------------------------------- 1 | Habitat Lab Documentation 2 | ######################### 3 | 4 | A modular high-level library to train embodied AI agents across a variety of 5 | tasks, environments, and simulators. 6 | 7 | `Tutorials`_ 8 | ============ 9 | 10 | - :ref:`Quickstart ` 11 | - :ref:`Habitat Sim Demo ` 12 | - :ref:`Habitat Lab Demo ` 13 | - :ref:`View, Transform and Warp ` 14 | 15 | `Package reference`_ 16 | ==================== 17 | 18 | - :ref:`habitat.core.env` 19 | - :ref:`habitat.core.embodied_task` 20 | - :ref:`habitat.core.dataset` 21 | - :ref:`habitat.core.simulator` 22 | - :ref:`habitat.core.vector_env` 23 | - :ref:`habitat.Agent` 24 | - :ref:`habitat.Benchmark` 25 | -------------------------------------------------------------------------------- /docs/pages/quickstart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/docs/pages/quickstart.png -------------------------------------------------------------------------------- /docs/pages/view-transform-warp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/docs/pages/view-transform-warp.png -------------------------------------------------------------------------------- /examples/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | -------------------------------------------------------------------------------- /examples/benchmark.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import argparse 8 | 9 | import habitat 10 | from habitat.sims.habitat_simulator.actions import HabitatSimActions 11 | 12 | 13 | class ForwardOnlyAgent(habitat.Agent): 14 | def reset(self): 15 | pass 16 | 17 | def act(self, observations): 18 | action = HabitatSimActions.MOVE_FORWARD 19 | return {"action": action} 20 | 21 | 22 | def main(): 23 | parser = argparse.ArgumentParser() 24 | parser.add_argument( 25 | "--task-config", type=str, default="configs/tasks/pointnav.yaml" 26 | ) 27 | args = parser.parse_args() 28 | 29 | agent = ForwardOnlyAgent() 30 | benchmark = habitat.Benchmark(args.task_config) 31 | metrics = benchmark.evaluate(agent, num_episodes=10) 32 | 33 | for k, v in metrics.items(): 34 | print("{}: {:.3f}".format(k, v)) 35 | 36 | 37 | if __name__ == "__main__": 38 | main() 39 | -------------------------------------------------------------------------------- /examples/example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import habitat 8 | 9 | 10 | def example(): 11 | # Note: Use with for the example testing, doesn't need to be like this on the README 12 | 13 | with habitat.Env( 14 | config=habitat.get_config("configs/tasks/pointnav.yaml") 15 | ) as env: 16 | print("Environment creation successful") 17 | observations = env.reset() 18 | 19 | print("Agent stepping around inside environment.") 20 | count_steps = 0 21 | while not env.episode_over: 22 | observations = env.step(env.action_space.sample()) 23 | count_steps += 1 24 | print("Episode finished after {} steps.".format(count_steps)) 25 | 26 | env.close() 27 | 28 | 29 | if __name__ == "__main__": 30 | example() 31 | -------------------------------------------------------------------------------- /examples/shortest_path_follower_example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import os 8 | import shutil 9 | 10 | import numpy as np 11 | 12 | import habitat 13 | from habitat.core.utils import try_cv2_import 14 | from habitat.tasks.nav.shortest_path_follower import ShortestPathFollower 15 | from habitat.utils.visualizations import maps 16 | from habitat.utils.visualizations.utils import images_to_video 17 | 18 | cv2 = try_cv2_import() 19 | 20 | IMAGE_DIR = os.path.join("examples", "images") 21 | if not os.path.exists(IMAGE_DIR): 22 | os.makedirs(IMAGE_DIR) 23 | 24 | 25 | class SimpleRLEnv(habitat.RLEnv): 26 | def get_reward_range(self): 27 | return [-1, 1] 28 | 29 | def get_reward(self, observations): 30 | return 0 31 | 32 | def get_done(self, observations): 33 | return self.habitat_env.episode_over 34 | 35 | def get_info(self, observations): 36 | return self.habitat_env.get_metrics() 37 | 38 | 39 | def draw_top_down_map(info, output_size): 40 | return maps.colorize_draw_agent_and_fit_to_height( 41 | info["top_down_map"], output_size 42 | ) 43 | 44 | 45 | def shortest_path_example(): 46 | config = habitat.get_config(config_paths="configs/tasks/pointnav.yaml") 47 | config.defrost() 48 | config.TASK.MEASUREMENTS.append("TOP_DOWN_MAP") 49 | config.freeze() 50 | with SimpleRLEnv(config=config) as env: 51 | goal_radius = env.episodes[0].goals[0].radius 52 | if goal_radius is None: 53 | goal_radius = config.SIMULATOR.FORWARD_STEP_SIZE 54 | follower = ShortestPathFollower( 55 | env.habitat_env.sim, goal_radius, False 56 | ) 57 | 58 | print("Environment creation successful") 59 | for episode in range(3): 60 | env.reset() 61 | dirname = os.path.join( 62 | IMAGE_DIR, "shortest_path_example", "%02d" % episode 63 | ) 64 | if os.path.exists(dirname): 65 | shutil.rmtree(dirname) 66 | os.makedirs(dirname) 67 | print("Agent stepping around inside environment.") 68 | images = [] 69 | while not env.habitat_env.episode_over: 70 | best_action = follower.get_next_action( 71 | env.habitat_env.current_episode.goals[0].position 72 | ) 73 | if best_action is None: 74 | break 75 | 76 | observations, reward, done, info = env.step(best_action) 77 | im = observations["rgb"] 78 | top_down_map = draw_top_down_map(info, im.shape[0]) 79 | output_im = np.concatenate((im, top_down_map), axis=1) 80 | images.append(output_im) 81 | images_to_video(images, dirname, "trajectory") 82 | print("Episode finished") 83 | 84 | 85 | def main(): 86 | shortest_path_example() 87 | 88 | 89 | if __name__ == "__main__": 90 | main() 91 | -------------------------------------------------------------------------------- /examples/vln_benchmark.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import argparse 8 | import sys 9 | from collections import defaultdict 10 | 11 | import habitat 12 | from habitat.config.default import get_config 13 | from habitat.sims.habitat_simulator.actions import HabitatSimActions 14 | from habitat.tasks.nav.shortest_path_follower import ShortestPathFollower 15 | 16 | 17 | def reference_path_benchmark(config, num_episodes=None): 18 | """ 19 | Custom benchmark for the reference path agent because it requires access 20 | to habitat_env during each episode. Agent follows the ground truth 21 | reference path by navigating to intermediate viewpoints en route to goal. 22 | Args: 23 | config: Config 24 | num_episodes: Count of episodes to evaluate on. 25 | """ 26 | with habitat.Env(config=config) as env: 27 | if num_episodes is None: 28 | num_episodes = len(env.episodes) 29 | 30 | follower = ShortestPathFollower( 31 | env.sim, goal_radius=0.5, return_one_hot=False 32 | ) 33 | follower.mode = "geodesic_path" 34 | 35 | agg_metrics: Dict = defaultdict(float) 36 | for i in range(num_episodes): 37 | env.reset() 38 | 39 | for point in env.current_episode.reference_path: 40 | while not env.episode_over: 41 | best_action = follower.get_next_action(point) 42 | if best_action == None: 43 | break 44 | env.step(best_action) 45 | 46 | while not env.episode_over: 47 | best_action = follower.get_next_action( 48 | env.current_episode.goals[0].position 49 | ) 50 | if best_action == None: 51 | best_action = HabitatSimActions.STOP 52 | env.step(best_action) 53 | 54 | for m, v in env.get_metrics().items(): 55 | agg_metrics[m] += v 56 | 57 | avg_metrics = {k: v / num_episodes for k, v in agg_metrics.items()} 58 | return avg_metrics 59 | 60 | 61 | def main(): 62 | parser = argparse.ArgumentParser() 63 | parser.add_argument( 64 | "--task-config", type=str, default="configs/tasks/vln_r2r.yaml" 65 | ) 66 | args = parser.parse_args() 67 | config = get_config(args.task_config) 68 | 69 | metrics = reference_path_benchmark(config, num_episodes=10) 70 | 71 | print("Benchmark for Reference Path Follower agent:") 72 | for k, v in metrics.items(): 73 | print("{}: {:.3f}".format(k, v)) 74 | 75 | 76 | if __name__ == "__main__": 77 | main() 78 | -------------------------------------------------------------------------------- /habitat/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.config import Config, get_config 8 | from habitat.core.agent import Agent 9 | from habitat.core.benchmark import Benchmark 10 | from habitat.core.challenge import Challenge 11 | from habitat.core.dataset import Dataset 12 | from habitat.core.embodied_task import EmbodiedTask, Measure, Measurements 13 | from habitat.core.env import Env, RLEnv 14 | from habitat.core.logging import logger 15 | from habitat.core.registry import registry 16 | from habitat.core.simulator import Sensor, SensorSuite, SensorTypes, Simulator 17 | from habitat.core.vector_env import ThreadedVectorEnv, VectorEnv 18 | from habitat.datasets import make_dataset 19 | from habitat.version import VERSION as __version__ # noqa 20 | 21 | __all__ = [ 22 | "Agent", 23 | "Benchmark", 24 | "Challenge", 25 | "Config", 26 | "Dataset", 27 | "EmbodiedTask", 28 | "Env", 29 | "get_config", 30 | "logger", 31 | "make_dataset", 32 | "Measure", 33 | "Measurements", 34 | "RLEnv", 35 | "Sensor", 36 | "SensorSuite", 37 | "SensorTypes", 38 | "Simulator", 39 | "ThreadedVectorEnv", 40 | "VectorEnv", 41 | ] 42 | -------------------------------------------------------------------------------- /habitat/core/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | -------------------------------------------------------------------------------- /habitat/core/agent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | r"""Base implementation of agent inside habitat. To build agents inside habitat 7 | the user should subclass ``habitat.Agent`` and implement the ``act()`` 8 | and ``reset()`` methods. 9 | """ 10 | 11 | from typing import Any, Dict, Union 12 | 13 | from habitat.core.simulator import Observations 14 | 15 | 16 | class Agent: 17 | r"""Abstract class for defining agents which act inside :ref:`core.env.Env`. 18 | 19 | This abstract class standardizes agents to allow seamless benchmarking. 20 | """ 21 | 22 | def reset(self) -> None: 23 | r"""Called before starting a new episode in environment. 24 | """ 25 | raise NotImplementedError 26 | 27 | def act( 28 | self, observations: Observations 29 | ) -> Union[int, str, Dict[str, Any]]: 30 | r"""Called to produce an action to perform in an environment. 31 | 32 | :param observations: observations coming in from environment to be 33 | used by agent to decide action. 34 | :return: action to be taken inside the environment and optional action 35 | arguments. 36 | """ 37 | raise NotImplementedError 38 | -------------------------------------------------------------------------------- /habitat/core/challenge.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import os 8 | 9 | from habitat.core.benchmark import Benchmark 10 | from habitat.core.logging import logger 11 | 12 | 13 | class Challenge(Benchmark): 14 | def __init__(self, eval_remote=False): 15 | config_paths = os.environ["CHALLENGE_CONFIG_FILE"] 16 | super().__init__(config_paths, eval_remote=eval_remote) 17 | 18 | def submit(self, agent): 19 | metrics = super().evaluate(agent) 20 | for k, v in metrics.items(): 21 | logger.info("{}: {}".format(k, v)) 22 | -------------------------------------------------------------------------------- /habitat/core/logging.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import logging 8 | 9 | 10 | class HabitatLogger(logging.Logger): 11 | def __init__( 12 | self, 13 | name, 14 | level, 15 | filename=None, 16 | filemode="a", 17 | stream=None, 18 | format=None, 19 | dateformat=None, 20 | style="%", 21 | ): 22 | super().__init__(name, level) 23 | if filename is not None: 24 | handler = logging.FileHandler(filename, filemode) 25 | else: 26 | handler = logging.StreamHandler(stream) 27 | self._formatter = logging.Formatter(format, dateformat, style) 28 | handler.setFormatter(self._formatter) 29 | super().addHandler(handler) 30 | 31 | def add_filehandler(self, log_filename): 32 | filehandler = logging.FileHandler(log_filename) 33 | filehandler.setFormatter(self._formatter) 34 | self.addHandler(filehandler) 35 | 36 | 37 | logger = HabitatLogger( 38 | name="habitat", level=logging.INFO, format="%(asctime)-15s %(message)s" 39 | ) 40 | -------------------------------------------------------------------------------- /habitat/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.datasets.registration import make_dataset 8 | -------------------------------------------------------------------------------- /habitat/datasets/eqa/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.dataset import Dataset 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_mp3d_eqa_dataset(): 12 | try: 13 | from habitat.datasets.eqa.mp3d_eqa_dataset import Matterport3dDatasetV1 14 | 15 | has_mp3deqa = True 16 | except ImportError as e: 17 | has_mp3deqa = False 18 | mp3deqa_import_error = e 19 | 20 | if has_mp3deqa: 21 | from habitat.datasets.eqa.mp3d_eqa_dataset import Matterport3dDatasetV1 22 | else: 23 | 24 | @registry.register_dataset(name="MP3DEQA-v1") 25 | class Matterport3dDatasetImportError(Dataset): 26 | def __init__(self, *args, **kwargs): 27 | raise mp3deqa_import_error 28 | -------------------------------------------------------------------------------- /habitat/datasets/object_nav/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.dataset import Dataset 8 | from habitat.core.registry import registry 9 | 10 | 11 | # TODO(akadian): This is a result of moving SimulatorActions away from core 12 | # and into simulators specifically. As a result of that the connection points 13 | # for our tasks and datasets for actions is coming from inside habitat-sim 14 | # which makes it impossible for anyone to use habitat-lab without having 15 | # habitat-sim installed. In a future PR we will implement a base simulator 16 | # action class which will be the connection point for tasks and datasets. 17 | # Post that PR we would no longer need try register blocks. 18 | def _try_register_objectnavdatasetv1(): 19 | try: 20 | from habitat.datasets.object_nav.object_nav_dataset import ( 21 | ObjectNavDatasetV1, 22 | ) 23 | 24 | has_pointnav = True 25 | except ImportError as e: 26 | has_pointnav = False 27 | pointnav_import_error = e 28 | 29 | if has_pointnav: 30 | from habitat.datasets.object_nav.object_nav_dataset import ( 31 | ObjectNavDatasetV1, 32 | ) 33 | else: 34 | 35 | @registry.register_dataset(name="ObjectNav-v1") 36 | class ObjectNavDatasetImportError(Dataset): 37 | def __init__(self, *args, **kwargs): 38 | raise pointnav_import_error 39 | -------------------------------------------------------------------------------- /habitat/datasets/pointnav/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.dataset import Dataset 8 | from habitat.core.registry import registry 9 | 10 | 11 | # TODO(akadian): This is a result of moving SimulatorActions away from core 12 | # and into simulators specifically. As a result of that the connection points 13 | # for our tasks and datasets for actions is coming from inside habitat-sim 14 | # which makes it impossible for anyone to use habitat-lab without having 15 | # habitat-sim installed. In a future PR we will implement a base simulator 16 | # action class which will be the connection point for tasks and datasets. 17 | # Post that PR we would no longer need try register blocks. 18 | def _try_register_pointnavdatasetv1(): 19 | try: 20 | from habitat.datasets.pointnav.pointnav_dataset import ( 21 | PointNavDatasetV1, 22 | ) 23 | 24 | has_pointnav = True 25 | except ImportError as e: 26 | has_pointnav = False 27 | pointnav_import_error = e 28 | 29 | if has_pointnav: 30 | from habitat.datasets.pointnav.pointnav_dataset import ( 31 | PointNavDatasetV1, 32 | ) 33 | else: 34 | 35 | @registry.register_dataset(name="PointNav-v1") 36 | class PointnavDatasetImportError(Dataset): 37 | def __init__(self, *args, **kwargs): 38 | raise pointnav_import_error 39 | -------------------------------------------------------------------------------- /habitat/datasets/registration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.logging import logger 8 | from habitat.core.registry import registry 9 | from habitat.datasets.eqa import _try_register_mp3d_eqa_dataset 10 | from habitat.datasets.object_nav import _try_register_objectnavdatasetv1 11 | from habitat.datasets.pointnav import _try_register_pointnavdatasetv1 12 | from habitat.datasets.vln import _try_register_r2r_vln_dataset 13 | 14 | 15 | def make_dataset(id_dataset, **kwargs): 16 | logger.info("Initializing dataset {}".format(id_dataset)) 17 | _dataset = registry.get_dataset(id_dataset) 18 | assert _dataset is not None, "Could not find dataset {}".format(id_dataset) 19 | 20 | return _dataset(**kwargs) 21 | 22 | 23 | _try_register_objectnavdatasetv1() 24 | _try_register_mp3d_eqa_dataset() 25 | _try_register_pointnavdatasetv1() 26 | _try_register_r2r_vln_dataset() 27 | -------------------------------------------------------------------------------- /habitat/datasets/vln/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.dataset import Dataset 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_r2r_vln_dataset(): 12 | try: 13 | from habitat.datasets.vln.r2r_vln_dataset import VLNDatasetV1 14 | 15 | has_r2r_vln = True 16 | except ImportError as e: 17 | has_r2r_vln = False 18 | r2r_vln_import_error = e 19 | 20 | if has_r2r_vln: 21 | from habitat.datasets.vln.r2r_vln_dataset import VLNDatasetV1 22 | else: 23 | 24 | @registry.register_dataset(name="R2RVLN-v1") 25 | class R2RDatasetImportError(Dataset): 26 | def __init__(self, *args, **kwargs): 27 | raise r2r_vln_import_error 28 | -------------------------------------------------------------------------------- /habitat/datasets/vln/r2r_vln_dataset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import gzip 8 | import json 9 | import os 10 | from typing import List, Optional 11 | 12 | from habitat.config import Config 13 | from habitat.core.dataset import Dataset 14 | from habitat.core.registry import registry 15 | from habitat.datasets.utils import VocabDict 16 | from habitat.tasks.nav.nav import NavigationGoal 17 | from habitat.tasks.vln.vln import InstructionData, VLNEpisode 18 | 19 | DEFAULT_SCENE_PATH_PREFIX = "data/scene_datasets/" 20 | 21 | 22 | @registry.register_dataset(name="R2RVLN-v1") 23 | class VLNDatasetV1(Dataset): 24 | r"""Class inherited from Dataset that loads a Vision and Language 25 | Navigation dataset. 26 | """ 27 | 28 | episodes: List[VLNEpisode] 29 | instruction_vocab: VocabDict 30 | 31 | @staticmethod 32 | def check_config_paths_exist(config: Config) -> bool: 33 | return os.path.exists( 34 | config.DATA_PATH.format(split=config.SPLIT) 35 | ) and os.path.exists(config.SCENES_DIR) 36 | 37 | def __init__(self, config: Optional[Config] = None) -> None: 38 | self.episodes = [] 39 | 40 | if config is None: 41 | return 42 | 43 | dataset_filename = config.DATA_PATH.format(split=config.SPLIT) 44 | with gzip.open(dataset_filename, "rt") as f: 45 | self.from_json(f.read(), scenes_dir=config.SCENES_DIR) 46 | 47 | self.episodes = list( 48 | filter(self.build_content_scenes_filter(config), self.episodes) 49 | ) 50 | 51 | def from_json( 52 | self, json_str: str, scenes_dir: Optional[str] = None 53 | ) -> None: 54 | 55 | deserialized = json.loads(json_str) 56 | self.instruction_vocab = VocabDict( 57 | word_list=deserialized["instruction_vocab"]["word_list"] 58 | ) 59 | 60 | for episode in deserialized["episodes"]: 61 | episode = VLNEpisode(**episode) 62 | 63 | if scenes_dir is not None: 64 | if episode.scene_id.startswith(DEFAULT_SCENE_PATH_PREFIX): 65 | episode.scene_id = episode.scene_id[ 66 | len(DEFAULT_SCENE_PATH_PREFIX) : 67 | ] 68 | 69 | episode.scene_id = os.path.join(scenes_dir, episode.scene_id) 70 | 71 | episode.instruction = InstructionData(**episode.instruction) 72 | for g_index, goal in enumerate(episode.goals): 73 | episode.goals[g_index] = NavigationGoal(**goal) 74 | self.episodes.append(episode) 75 | -------------------------------------------------------------------------------- /habitat/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561. This tells mypy that the package uses inline types. 2 | -------------------------------------------------------------------------------- /habitat/sims/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.sims.registration import make_sim 8 | -------------------------------------------------------------------------------- /habitat/sims/habitat_simulator/__init__.py: -------------------------------------------------------------------------------- 1 | from habitat.core.registry import registry 2 | from habitat.core.simulator import Simulator 3 | 4 | # from habitat.sims.habitat_simulator.actions import ( 5 | # HabitatSimV1ActionSpaceConfiguration, 6 | # ) 7 | 8 | 9 | def _try_register_habitat_sim(): 10 | try: 11 | import habitat_sim 12 | 13 | has_habitat_sim = True 14 | except ImportError as e: 15 | has_habitat_sim = False 16 | habitat_sim_import_error = e 17 | 18 | if has_habitat_sim: 19 | from habitat.sims.habitat_simulator.actions import ( 20 | HabitatSimV1ActionSpaceConfiguration, 21 | ) 22 | from habitat.sims.habitat_simulator.habitat_simulator import HabitatSim 23 | else: 24 | 25 | @registry.register_simulator(name="Sim-v0") 26 | class HabitatSimImportError(Simulator): 27 | def __init__(self, *args, **kwargs): 28 | raise habitat_sim_import_error 29 | -------------------------------------------------------------------------------- /habitat/sims/pyrobot/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.registry import registry 8 | from habitat.core.simulator import Simulator 9 | 10 | 11 | def _try_register_pyrobot(): 12 | try: 13 | import pyrobot 14 | 15 | has_pyrobot = True 16 | except ImportError as e: 17 | has_pyrobot = False 18 | pyrobot_import_error = e 19 | 20 | if has_pyrobot: 21 | from habitat.sims.pyrobot.pyrobot import PyRobot 22 | else: 23 | 24 | @registry.register_simulator(name="PyRobot-v0") 25 | class PyRobotImportError(Simulator): 26 | def __init__(self, *args, **kwargs): 27 | raise pyrobot_import_error 28 | -------------------------------------------------------------------------------- /habitat/sims/registration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.logging import logger 8 | from habitat.core.registry import registry 9 | from habitat.sims.habitat_simulator import _try_register_habitat_sim 10 | from habitat.sims.pyrobot import _try_register_pyrobot 11 | 12 | 13 | def make_sim(id_sim, **kwargs): 14 | logger.info("initializing sim {}".format(id_sim)) 15 | _sim = registry.get_simulator(id_sim) 16 | assert _sim is not None, "Could not find simulator with name {}".format( 17 | id_sim 18 | ) 19 | return _sim(**kwargs) 20 | 21 | 22 | _try_register_habitat_sim() 23 | _try_register_pyrobot() 24 | -------------------------------------------------------------------------------- /habitat/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.tasks.registration import make_task -------------------------------------------------------------------------------- /habitat/tasks/coverage/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.embodied_task import EmbodiedTask 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_coverage_task(): 12 | try: 13 | from habitat.tasks.coverage.coverage import CoverageTask 14 | 15 | has_covtask = True 16 | except ImportError as e: 17 | has_covtask = False 18 | coverage_task_import_error = e 19 | 20 | if has_covtask: 21 | from habitat.tasks.coverage.coverage import CoverageTask 22 | else: 23 | 24 | @registry.register_task(name="CoverageTask") 25 | class CoverageTaskImportError(EmbodiedTask): 26 | def __init__(self, *args, **kwargs): 27 | raise coverage_task_import_error 28 | # import pdb 29 | # pdb.set_trace() -------------------------------------------------------------------------------- /habitat/tasks/eqa/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.embodied_task import EmbodiedTask 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_eqa_task(): 12 | try: 13 | from habitat.tasks.eqa.eqa import EQATask 14 | 15 | has_eqatask = True 16 | except ImportError as e: 17 | has_eqatask = False 18 | eqatask_import_error = e 19 | 20 | if has_eqatask: 21 | from habitat.tasks.eqa.eqa import EQATask 22 | else: 23 | 24 | @registry.register_task(name="EQA-v0") 25 | class EQATaskImportError(EmbodiedTask): 26 | def __init__(self, *args, **kwargs): 27 | raise eqatask_import_error 28 | -------------------------------------------------------------------------------- /habitat/tasks/nav/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.embodied_task import EmbodiedTask 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_nav_task(): 12 | try: 13 | from habitat.tasks.nav.nav import NavigationTask 14 | 15 | has_navtask = True 16 | except ImportError as e: 17 | has_navtask = False 18 | navtask_import_error = e 19 | 20 | if has_navtask: 21 | from habitat.tasks.nav.nav import NavigationTask 22 | else: 23 | 24 | @registry.register_task(name="Nav-v0") 25 | class NavigationTaskImportError(EmbodiedTask): 26 | def __init__(self, *args, **kwargs): 27 | raise navtask_import_error 28 | -------------------------------------------------------------------------------- /habitat/tasks/nav/shortest_path_follower.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import warnings 8 | from typing import Optional, Union 9 | 10 | import numpy as np 11 | 12 | import habitat_sim 13 | from habitat.sims.habitat_simulator.actions import HabitatSimActions 14 | from habitat.sims.habitat_simulator.habitat_simulator import HabitatSim 15 | 16 | 17 | def action_to_one_hot(action: int) -> np.array: 18 | one_hot = np.zeros(len(HabitatSimActions), dtype=np.float32) 19 | one_hot[action] = 1 20 | return one_hot 21 | 22 | 23 | class ShortestPathFollower: 24 | r"""Utility class for extracting the action on the shortest path to the 25 | goal. 26 | 27 | :param sim: HabitatSim instance. 28 | :param goal_radius: Distance between the agent and the goal for it to be 29 | considered successful. 30 | :param return_one_hot: If true, returns a one-hot encoding of the action 31 | (useful for training ML agents). If false, returns the 32 | SimulatorAction. 33 | :param stop_on_error: Return stop if the follower is unable to determine a 34 | suitable action to take next. If false, will raise 35 | a habitat_sim.errors.GreedyFollowerError instead 36 | """ 37 | 38 | def __init__( 39 | self, 40 | sim: HabitatSim, 41 | goal_radius: float, 42 | return_one_hot: bool = True, 43 | stop_on_error: bool = True, 44 | ): 45 | 46 | self._return_one_hot = return_one_hot 47 | self._sim = sim 48 | self._goal_radius = goal_radius 49 | self._follower = None 50 | self._current_scene = None 51 | self._stop_on_error = stop_on_error 52 | 53 | def _build_follower(self): 54 | if self._current_scene != self._sim.habitat_config.SCENE: 55 | self._follower = self._sim.make_greedy_follower( 56 | 0, 57 | self._goal_radius, 58 | stop_key=HabitatSimActions.STOP, 59 | forward_key=HabitatSimActions.MOVE_FORWARD, 60 | left_key=HabitatSimActions.TURN_LEFT, 61 | right_key=HabitatSimActions.TURN_RIGHT, 62 | ) 63 | self._current_scene = self._sim.habitat_config.SCENE 64 | 65 | def _get_return_value(self, action) -> Union[int, np.array]: 66 | if self._return_one_hot: 67 | return action_to_one_hot(action) 68 | else: 69 | return action 70 | 71 | def get_next_action( 72 | self, goal_pos: np.array 73 | ) -> Optional[Union[int, np.array]]: 74 | """Returns the next action along the shortest path. 75 | """ 76 | self._build_follower() 77 | try: 78 | next_action = self._follower.next_action_along(goal_pos) 79 | except habitat_sim.errors.GreedyFollowerError as e: 80 | if self._stop_on_error: 81 | next_action = HabitatSimActions.STOP 82 | else: 83 | raise e 84 | 85 | return self._get_return_value(next_action) 86 | 87 | @property 88 | def mode(self): 89 | warnings.warn(".mode is depricated", DeprecationWarning) 90 | return "" 91 | 92 | @mode.setter 93 | def mode(self, new_mode: str): 94 | warnings.warn(".mode is depricated", DeprecationWarning) 95 | -------------------------------------------------------------------------------- /habitat/tasks/registration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.logging import logger 8 | from habitat.core.registry import registry 9 | from habitat.tasks.eqa import _try_register_eqa_task 10 | from habitat.tasks.nav import _try_register_nav_task 11 | from habitat.tasks.coverage import _try_register_coverage_task 12 | from habitat.tasks.vln import _try_register_vln_task 13 | 14 | 15 | def make_task(id_task, **kwargs): 16 | logger.info("Initializing task {}".format(id_task)) 17 | _task = registry.get_task(id_task) 18 | assert _task is not None, "Could not find task with name {}".format( 19 | id_task 20 | ) 21 | 22 | return _task(**kwargs) 23 | 24 | 25 | _try_register_eqa_task() 26 | _try_register_nav_task() 27 | _try_register_coverage_task() 28 | _try_register_vln_task() 29 | -------------------------------------------------------------------------------- /habitat/tasks/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import numpy as np 8 | import quaternion # noqa # pylint: disable=unused-import 9 | 10 | 11 | def quaternion_to_rotation(q_r, q_i, q_j, q_k): 12 | r""" 13 | ref: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation 14 | """ 15 | s = 1 # unit quaternion 16 | rotation_mat = np.array( 17 | [ 18 | [ 19 | 1 - 2 * s * (q_j ** 2 + q_k ** 2), 20 | 2 * s * (q_i * q_j - q_k * q_r), 21 | 2 * s * (q_i * q_k + q_j * q_r), 22 | ], 23 | [ 24 | 2 * s * (q_i * q_j + q_k * q_r), 25 | 1 - 2 * s * (q_i ** 2 + q_k ** 2), 26 | 2 * s * (q_j * q_k - q_i * q_r), 27 | ], 28 | [ 29 | 2 * s * (q_i * q_k - q_j * q_r), 30 | 2 * s * (q_j * q_k + q_i * q_r), 31 | 1 - 2 * s * (q_i ** 2 + q_j ** 2), 32 | ], 33 | ], 34 | dtype=np.float32, 35 | ) 36 | return rotation_mat 37 | 38 | 39 | def cartesian_to_polar(x, y): 40 | rho = np.sqrt(x ** 2 + y ** 2) 41 | phi = np.arctan2(y, x) 42 | return rho, phi 43 | 44 | 45 | def compute_pixel_coverage(instance_seg, object_id): 46 | cand_mask = instance_seg == object_id 47 | score = cand_mask.sum().astype(np.float64) / cand_mask.size 48 | return score 49 | -------------------------------------------------------------------------------- /habitat/tasks/vln/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.core.embodied_task import EmbodiedTask 8 | from habitat.core.registry import registry 9 | 10 | 11 | def _try_register_vln_task(): 12 | try: 13 | from habitat.tasks.vln.vln import VLNTask 14 | 15 | has_vlntask = True 16 | except ImportError as e: 17 | has_vlntask = False 18 | vlntask_import_error = e 19 | 20 | if has_vlntask: 21 | from habitat.tasks.vln.vln import VLNTask 22 | else: 23 | 24 | @registry.register_task(name="VLN-v0") 25 | class VLNTaskImportError(EmbodiedTask): 26 | def __init__(self, *args, **kwargs): 27 | raise vlntask_import_error 28 | -------------------------------------------------------------------------------- /habitat/tasks/vln/vln.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Owners/maintainers of the Vision and Language Navigation task: 4 | # @jacobkrantz: Jacob Krantz 5 | # @koshyanand: Anand Koshy 6 | 7 | # Copyright (c) Facebook, Inc. and its affiliates. 8 | # This source code is licensed under the MIT license found in the 9 | # LICENSE file in the root directory of this source tree. 10 | 11 | from typing import Any, Dict, List, Optional 12 | 13 | import attr 14 | from gym import spaces 15 | 16 | from habitat.core.registry import registry 17 | from habitat.core.simulator import Observations, Sensor 18 | from habitat.core.utils import not_none_validator 19 | from habitat.tasks.nav.nav import NavigationEpisode, NavigationTask 20 | 21 | 22 | @attr.s(auto_attribs=True) 23 | class InstructionData: 24 | instruction_text: str 25 | instruction_tokens: Optional[List[str]] = None 26 | 27 | 28 | @attr.s(auto_attribs=True, kw_only=True) 29 | class VLNEpisode(NavigationEpisode): 30 | r"""Specification of episode that includes initial position and rotation 31 | of agent, goal specifications, instruction specifications, reference path, 32 | and optional shortest paths. 33 | 34 | Args: 35 | episode_id: id of episode in the dataset 36 | scene_id: id of scene inside the simulator. 37 | start_position: numpy ndarray containing 3 entries for (x, y, z). 38 | start_rotation: numpy ndarray with 4 entries for (x, y, z, w) 39 | elements of unit quaternion (versor) representing agent 3D 40 | orientation. 41 | goals: list of goals specifications 42 | reference_path: List of (x, y, z) positions which gives the reference 43 | path to the goal that aligns with the instruction. 44 | instruction: single natural language instruction guide to goal. 45 | trajectory_id: id of ground truth trajectory path. 46 | """ 47 | reference_path: List[List[float]] = attr.ib( 48 | default=None, validator=not_none_validator 49 | ) 50 | instruction: InstructionData = attr.ib( 51 | default=None, validator=not_none_validator 52 | ) 53 | trajectory_id: int = attr.ib(default=None, validator=not_none_validator) 54 | 55 | 56 | @registry.register_sensor(name="InstructionSensor") 57 | class InstructionSensor(Sensor): 58 | def __init__(self, **kwargs): 59 | self.uuid = "instruction" 60 | self.observation_space = spaces.Discrete(0) 61 | 62 | def _get_uuid(self, *args: Any, **kwargs: Any) -> str: 63 | return self.uuid 64 | 65 | def _get_observation( 66 | self, 67 | observations: Dict[str, Observations], 68 | episode: VLNEpisode, 69 | **kwargs 70 | ): 71 | return { 72 | "text": episode.instruction.instruction_text, 73 | "tokens": episode.instruction.instruction_tokens, 74 | "trajectory_id": episode.trajectory_id, 75 | } 76 | 77 | def get_observation(self, **kwargs): 78 | return self._get_observation(**kwargs) 79 | 80 | 81 | @registry.register_task(name="VLN-v0") 82 | class VLNTask(NavigationTask): 83 | r"""Vision and Language Navigation Task 84 | Goal: An agent must navigate to a goal location in a 3D environment 85 | specified by a natural language instruction. 86 | Metric: Success weighted by Path Length (SPL) 87 | Usage example: 88 | examples/vln_reference_path_follower_example.py 89 | """ 90 | 91 | def __init__(self, **kwargs) -> None: 92 | super().__init__(**kwargs) 93 | -------------------------------------------------------------------------------- /habitat/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | from habitat.utils import geometry_utils 7 | 8 | __all__ = ["visualizations", "geometry_utils", "profiling_utils"] 9 | -------------------------------------------------------------------------------- /habitat/utils/profiling_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | r"""Helper functions for profiling. Profilers like Nvidia Nsight can capture the 7 | time spent in annotated ranges. 8 | 9 | Example usage for marking ranges. For convenience, there are three syntax 10 | options; they're all functionally equivalent: 11 | 12 | # use the decorator to mark an entire function as a range 13 | @profiling_utils.RangeContext("my_function") 14 | def my_function(): 15 | 16 | # use range_push/range_pop explicitly 17 | range_push("create and sort widgets") 18 | create_widgets() 19 | sort_widgets() 20 | range_pop() 21 | 22 | # use RangeContext and a with statement 23 | with profiling_utils.RangeContext("print and save widgets"): 24 | print_widgets() 25 | save_widgets() 26 | 27 | Example of capturing an Nsight Systems profile: 28 | apt-get install nvidia-nsight 29 | export HABITAT_PROFILING=1 30 | path/to/nvidia/nsight-systems/bin/nsys profile --sample=none --trace=cuda,nvtx 31 | --trace-fork-before-exec=true --output=my_profile python my_program.py 32 | # look for my_profile.qdrep in working directory 33 | """ 34 | import os 35 | from contextlib import ContextDecorator 36 | 37 | from habitat.core.logging import logger 38 | 39 | env_var = os.environ.get("HABITAT_PROFILING", "0") 40 | enable_profiling = env_var != "0" 41 | if enable_profiling: 42 | logger.info("HABITAT_PROFILING={}".format(env_var)) 43 | logger.info( 44 | "profiling_utils.py range_push/range_pop annotation is enabled" 45 | ) 46 | from torch.cuda import nvtx 47 | 48 | 49 | def range_push(msg: str): 50 | r"""Annotates the start of a range for profiling. Requires HABITAT_PROFILING 51 | environment variable to be set, otherwise the function is a no-op. Pushes a 52 | range onto a stack of nested ranges. Every range_push should have a 53 | corresponding range_pop. Attached profilers can capture the time spent in 54 | ranges." 55 | """ 56 | if enable_profiling: 57 | nvtx.range_push(msg) 58 | 59 | 60 | def range_pop(): 61 | r"""Annotates the end of a range for profiling. See also range_push. 62 | """ 63 | if enable_profiling: 64 | nvtx.range_pop() 65 | 66 | 67 | class RangeContext(ContextDecorator): 68 | r"""Annotate a range for profiling. Use as a function decorator or in a with 69 | statement. See also range_push. 70 | """ 71 | 72 | def __init__(self, msg: str): 73 | self._msg = msg 74 | 75 | def __enter__(self): 76 | range_push(self._msg) 77 | return self 78 | 79 | def __exit__(self, *exc): 80 | range_pop() 81 | return False 82 | -------------------------------------------------------------------------------- /habitat/utils/test_utils.py: -------------------------------------------------------------------------------- 1 | from habitat.tasks.nav.nav import StopAction 2 | 3 | 4 | def sample_non_stop_action(action_space, num_samples=1): 5 | samples = [] 6 | for i in range(num_samples): 7 | action = action_space.sample() 8 | while action["action"] == StopAction.name: 9 | action = action_space.sample() 10 | samples.append({"action": action}) 11 | 12 | if num_samples == 1: 13 | return samples[0]["action"] 14 | else: 15 | return samples 16 | -------------------------------------------------------------------------------- /habitat/utils/visualizations/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.utils.visualizations import maps, utils 8 | 9 | __all__ = ["maps", "utils"] 10 | -------------------------------------------------------------------------------- /habitat/utils/visualizations/assets/maps_topdown_agent_sprite/100x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat/utils/visualizations/assets/maps_topdown_agent_sprite/100x100.png -------------------------------------------------------------------------------- /habitat/version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | VERSION = "0.1.5" 8 | -------------------------------------------------------------------------------- /habitat_baselines/README.md: -------------------------------------------------------------------------------- 1 | baselines 2 | ============================== 3 | ### Installation 4 | 5 | The `habitat_baselines` sub-package is NOT included upon installation by default. To install `habitat_baselines`, use the following command instead: 6 | ```bash 7 | pip install -r requirements.txt 8 | python setup.py develop --all 9 | ``` 10 | This will also install additional requirements for each sub-module in `habitat_baselines/`, which are specified in `requirements.txt` files located in the sub-module directory. 11 | 12 | 13 | ### Reinforcement Learning (RL) 14 | 15 | **Proximal Policy Optimization (PPO)** 16 | 17 | **paper**: [https://arxiv.org/abs/1707.06347](https://arxiv.org/abs/1707.06347) 18 | 19 | **code**: majority of the PPO implementation is taken from 20 | [pytorch-a2c-ppo-acktr](https://github.com/ikostrikov/pytorch-a2c-ppo-acktr). 21 | 22 | **dependencies**: pytorch 1.0, for installing refer to [pytorch.org](https://pytorch.org/) 23 | 24 | For training on sample data please follow steps in the repository README. You should download the sample [test scene data](http://dl.fbaipublicfiles.com/habitat/habitat-test-scenes.zip), extract it under the main repo (`habitat-lab/`, extraction will create a data folder at `habitat-lab/data`) and run the below training command. 25 | 26 | **train**: 27 | ```bash 28 | python -u habitat_baselines/run.py --exp-config habitat_baselines/config/pointnav/ppo_pointnav_example.yaml --run-type train 29 | ``` 30 | 31 | **test**: 32 | ```bash 33 | python -u habitat_baselines/run.py --exp-config habitat_baselines/config/pointnav/ppo_pointnav_example.yaml --run-type eval 34 | ``` 35 | 36 | We also provide trained RGB, RGBD, Blind PPO models. 37 | To use them download pre-trained pytorch models from [link](https://dl.fbaipublicfiles.com/habitat/data/baselines/v1/habitat_baselines_v1.zip) and unzip and specify model path [here](agents/ppo_agents.py#L132). 38 | 39 | The `habitat_baselines/config/pointnav/ppo_pointnav.yaml` config has better hyperparamters for large scale training and loads the [Gibson PointGoal Navigation Dataset](/README.md#task-datasets) instead of the test scenes. 40 | Change the field `task_config` in `habitat_baselines/config/pointnav/ppo_pointnav.yaml` to `configs/tasks/pointnav_mp3d.yaml` for training on [MatterPort3D PointGoal Navigation Dataset](/README.md#task-datasets). 41 | 42 | ### Classic 43 | 44 | **SLAM based** 45 | 46 | - [Handcrafted agent baseline](slambased/README.md) adopted from the paper 47 | "Benchmarking Classic and Learned Navigation in Complex 3D Environments". 48 | ### Additional Utilities 49 | 50 | **Episode iterator options**: 51 | Coming very soon 52 | 53 | **Tensorboard and video generation support** 54 | 55 | Enable tensorboard by changing `tensorboard_dir` field in `habitat_baselines/config/pointnav/ppo_pointnav.yaml`. 56 | 57 | Enable video generation for `eval` mode by changing `video_option`: `tensorboard,disk` (for displaying on tensorboard and for saving videos on disk, respectively) 58 | 59 | Generated navigation episode recordings should look like this on tensorboard: 60 |

61 | 62 |

63 | -------------------------------------------------------------------------------- /habitat_baselines/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat_baselines.common.base_trainer import BaseRLTrainer, BaseTrainer 8 | from habitat_baselines.rl.ddppo import DDPPOTrainer 9 | from habitat_baselines.rl.ppo.ppo_trainer import PPOTrainer, RolloutStorage 10 | from habitat_baselines.rl.ppo.belief_ddppo_trainer import BeliefDDPPOTrainer 11 | 12 | __all__ = ["BaseTrainer", "BaseRLTrainer", "PPOTrainer", "BeliefDDPPOTrainer", "RolloutStorage"] 13 | -------------------------------------------------------------------------------- /habitat_baselines/agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat_baselines/agents/__init__.py -------------------------------------------------------------------------------- /habitat_baselines/common/auxiliary_tasks/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | import torch.nn as nn 3 | 4 | from habitat_baselines.common.baseline_registry import baseline_registry 5 | 6 | def get_aux_task_class(aux_task_name: str) -> Type[nn.Module]: 7 | r"""Return auxiliary task class based on name. 8 | 9 | Args: 10 | aux_task_name: name of task. 11 | 12 | Returns: 13 | Type[nn.Module]: aux task class. 14 | """ 15 | return baseline_registry.get_aux_task(aux_task_name) 16 | 17 | def get_aux_task_classes(cfg) -> Type[nn.Module]: 18 | r"""Return auxiliary task classes based on list of names. 19 | 20 | Args: 21 | cfg: aux_cfg 22 | 23 | Returns: 24 | Type[nn.Module]: aux task class list and sensor encoders, if necessary. 25 | """ 26 | return baseline_registry.get_aux_tasks(cfg) 27 | 28 | from habitat_baselines.common.auxiliary_tasks.aux_utils import ACTION_EMBEDDING_DIM, RolloutAuxTask 29 | import habitat_baselines.common.auxiliary_tasks.supervised_auxiliary_tasks 30 | import habitat_baselines.common.auxiliary_tasks.auxiliary_tasks 31 | -------------------------------------------------------------------------------- /habitat_baselines/common/auxiliary_tasks/aux_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | import abc 7 | from typing import Dict, List, Optional 8 | 9 | import torch 10 | import torch.nn as nn 11 | 12 | ACTION_EMBEDDING_DIM = 4 13 | 14 | def subsampled_mean(x, p: float=0.1): 15 | return torch.masked_select(x, torch.rand_like(x) < p).mean() 16 | 17 | def hard_mining_mean(x, p: float=0.1, across_batches: bool=False): 18 | flat_dim = min(0 if across_batches else 1, len(x.size()) - 1) 19 | x_flat = x.flatten(start_dim=flat_dim) 20 | loss_sort = torch.argsort(x_flat, dim=flat_dim, descending=True) # batch being first dim 21 | sorted_by_hard = x_flat[loss_sort] 22 | end_index = int(sorted_by_hard.size(flat_dim) * p) 23 | if flat_dim == 0: 24 | return sorted_by_hard[:end_index].mean() 25 | return sorted_by_hard[:, :end_index].mean() 26 | 27 | SUBSAMPLER = { 28 | "random": subsampled_mean, 29 | "hard": hard_mining_mean 30 | } 31 | 32 | class RolloutAuxTask(nn.Module): 33 | r""" Rollout-based self-supervised auxiliary task base class. 34 | """ 35 | 36 | def __init__(self, cfg, aux_cfg, task_cfg, device, hidden_size=None, **kwargs): 37 | super().__init__() 38 | self.cfg = cfg 39 | self.aux_cfg = aux_cfg 40 | self.task_cfg = task_cfg # Mainly tracked for actions 41 | self.device = device 42 | self.aux_hidden_size = hidden_size if hidden_size is not None else cfg.hidden_size 43 | self.loss_factor = getattr(aux_cfg, "loss_factor", 0.1) # absent for dummy 44 | self.subsample_rate = getattr(aux_cfg, "subsample_rate", 0.1) 45 | self.strategy = getattr(aux_cfg, "sample", "random") 46 | 47 | def forward(self): 48 | raise NotImplementedError 49 | 50 | @torch.jit.export 51 | @abc.abstractmethod 52 | def get_loss(self, 53 | observations: Dict[str, torch.Tensor], 54 | actions, 55 | sensor_embeddings: Dict[str, torch.Tensor], 56 | final_belief_state, 57 | belief_features, 58 | metrics: Dict[str, torch.Tensor], 59 | n: int, 60 | t: int, 61 | env_zeros: List[List[int]] 62 | ): 63 | pass 64 | 65 | @staticmethod 66 | def get_required_sensors(*args): 67 | # Encoders required to function (not habitat sensors, those are specified elsewhere) 68 | return [] 69 | 70 | def masked_sample_and_scale(self, x, mask: Optional[torch.Tensor]=None): 71 | if mask is not None: 72 | x = torch.masked_select(x, mask) 73 | # strat_name = getattr(cfg, "sample", "random") 74 | # sampler = SUBSAMPLER.get(self.strategy, "random") 75 | # Drop support for hard mining 76 | return subsampled_mean(x, p=self.subsample_rate) * self.loss_factor -------------------------------------------------------------------------------- /habitat_baselines/common/tensorboard_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from typing import Any 8 | 9 | import numpy as np 10 | import torch 11 | from torch.utils.tensorboard import SummaryWriter 12 | 13 | 14 | class TensorboardWriter: 15 | def __init__(self, log_dir: str, *args: Any, **kwargs: Any): 16 | r"""A Wrapper for tensorboard SummaryWriter. It creates a dummy writer 17 | when log_dir is empty string or None. It also has functionality that 18 | generates tb video directly from numpy images. 19 | 20 | Args: 21 | log_dir: Save directory location. Will not write to disk if 22 | log_dir is an empty string. 23 | *args: Additional positional args for SummaryWriter 24 | **kwargs: Additional keyword args for SummaryWriter 25 | """ 26 | self.writer = None 27 | if log_dir is not None and len(log_dir) > 0: 28 | self.writer = SummaryWriter(log_dir, *args, **kwargs) 29 | 30 | def __getattr__(self, item): 31 | if self.writer: 32 | return self.writer.__getattribute__(item) 33 | else: 34 | return lambda *args, **kwargs: None 35 | 36 | def __enter__(self): 37 | return self 38 | 39 | def __exit__(self, exc_type, exc_val, exc_tb): 40 | if self.writer: 41 | self.writer.close() 42 | 43 | def add_video_from_np_images( 44 | self, video_name: str, step_idx: int, images: np.ndarray, fps: int = 10 45 | ) -> None: 46 | r"""Write video into tensorboard from images frames. 47 | 48 | Args: 49 | video_name: name of video string. 50 | step_idx: int of checkpoint index to be displayed. 51 | images: list of n frames. Each frame is a np.ndarray of shape. 52 | fps: frame per second for output video. 53 | 54 | Returns: 55 | None. 56 | """ 57 | if not self.writer: 58 | return 59 | # initial shape of np.ndarray list: N * (H, W, 3) 60 | frame_tensors = [ 61 | torch.from_numpy(np_arr).unsqueeze(0) for np_arr in images 62 | ] 63 | video_tensor = torch.cat(tuple(frame_tensors)) 64 | video_tensor = video_tensor.permute(0, 3, 1, 2).unsqueeze(0) 65 | # final shape of video tensor: (1, n, 3, H, W) 66 | self.writer.add_video( 67 | video_name, video_tensor, fps=fps, global_step=step_idx 68 | ) 69 | -------------------------------------------------------------------------------- /habitat_baselines/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat_baselines/config/__init__.py -------------------------------------------------------------------------------- /habitat_baselines/config/imagenav/ddppo_imagenav_example.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/imagenav.yaml" 2 | TRAINER_NAME: "ddppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: [] 7 | TENSORBOARD_DIR: "tb" 8 | VIDEO_DIR: "video_dir" 9 | TEST_EPISODE_COUNT: -1 10 | EVAL_CKPT_PATH_DIR: "data/new_checkpoints" 11 | NUM_PROCESSES: 4 12 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 13 | CHECKPOINT_FOLDER: "data/new_checkpoints" 14 | NUM_UPDATES: 10000 15 | LOG_INTERVAL: 10 16 | CHECKPOINT_INTERVAL: 50 17 | 18 | 19 | RL: 20 | SUCCESS_REWARD: 2.5 21 | SLACK_REWARD: -1e-4 22 | 23 | POLICY: 24 | name: "PointNavResNetPolicy" 25 | 26 | PPO: 27 | # ppo params 28 | clip_param: 0.2 29 | ppo_epoch: 2 30 | num_mini_batch: 2 31 | value_loss_coef: 0.5 32 | entropy_coef: 0.01 33 | lr: 2.5e-4 34 | eps: 1e-5 35 | max_grad_norm: 0.2 36 | num_steps: 64 37 | use_gae: True 38 | gamma: 0.99 39 | tau: 0.95 40 | use_linear_clip_decay: False 41 | use_linear_lr_decay: False 42 | reward_window_size: 50 43 | 44 | use_normalized_advantage: False 45 | 46 | hidden_size: 512 47 | DDPPO: 48 | sync_frac: 0.6 49 | # The PyTorch distributed backend to use 50 | distrib_backend: GLOO 51 | # Visual encoder backbone 52 | pretrained_weights: data/ddppo-models/gibson-2plus-resnet50.pth 53 | # Initialize with pretrained weights 54 | pretrained: False 55 | # Initialize just the visual encoder backbone with pretrained weights 56 | pretrained_encoder: False 57 | # Whether or not the visual encoder backbone will be trained. 58 | train_encoder: True 59 | # Whether or not to reset the critic linear layer 60 | reset_critic: True 61 | 62 | # Model parameters 63 | backbone: resnet50 64 | rnn_type: LSTM 65 | num_recurrent_layers: 2 66 | -------------------------------------------------------------------------------- /habitat_baselines/config/imagenav/ddppo_imagenav_gibson.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/imagenav_gibson.yaml" 2 | TRAINER_NAME: "ddppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: [] 7 | TENSORBOARD_DIR: "tb" 8 | VIDEO_DIR: "video_dir" 9 | TEST_EPISODE_COUNT: -1 10 | EVAL_CKPT_PATH_DIR: "data/new_checkpoints" 11 | NUM_PROCESSES: 4 12 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 13 | CHECKPOINT_FOLDER: "data/new_checkpoints" 14 | NUM_UPDATES: 500000 15 | LOG_INTERVAL: 100 16 | CHECKPOINT_INTERVAL: 1000 17 | 18 | RL: 19 | SUCCESS_REWARD: 2.5 20 | SLACK_REWARD: -1e-4 21 | 22 | POLICY: 23 | name: "PointNavResNetPolicy" 24 | 25 | PPO: 26 | # ppo params 27 | clip_param: 0.2 28 | ppo_epoch: 2 29 | num_mini_batch: 2 30 | value_loss_coef: 0.5 31 | entropy_coef: 0.01 32 | lr: 2.5e-4 33 | eps: 1e-5 34 | max_grad_norm: 0.2 35 | num_steps: 64 36 | use_gae: True 37 | gamma: 0.99 38 | tau: 0.95 39 | use_linear_clip_decay: False 40 | use_linear_lr_decay: False 41 | reward_window_size: 50 42 | 43 | use_normalized_advantage: False 44 | 45 | hidden_size: 512 46 | DDPPO: 47 | sync_frac: 0.6 48 | # The PyTorch distributed backend to use 49 | distrib_backend: GLOO 50 | # Visual encoder backbone 51 | pretrained_weights: data/ddppo-models/gibson-2plus-resnet50.pth 52 | # Initialize with pretrained weights 53 | pretrained: False 54 | # Initialize just the visual encoder backbone with pretrained weights 55 | pretrained_encoder: False 56 | # Whether or not the visual encoder backbone will be trained. 57 | train_encoder: True 58 | # Whether or not to reset the critic linear layer 59 | reset_critic: True 60 | 61 | # Model parameters 62 | backbone: resnet50 63 | rnn_type: LSTM 64 | num_recurrent_layers: 2 65 | -------------------------------------------------------------------------------- /habitat_baselines/config/imagenav/ppo_imagenav_example.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/imagenav.yaml" 2 | TRAINER_NAME: "ppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: ["disk", "tensorboard"] 7 | TENSORBOARD_DIR: "tb" 8 | VIDEO_DIR: "video_dir" 9 | TEST_EPISODE_COUNT: 2 10 | EVAL_CKPT_PATH_DIR: "data/new_checkpoints" 11 | NUM_PROCESSES: 1 12 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 13 | CHECKPOINT_FOLDER: "data/new_checkpoints" 14 | NUM_UPDATES: 10000 15 | LOG_INTERVAL: 10 16 | CHECKPOINT_INTERVAL: 50 17 | 18 | RL: 19 | PPO: 20 | # ppo params 21 | clip_param: 0.1 22 | ppo_epoch: 4 23 | num_mini_batch: 1 24 | value_loss_coef: 0.5 25 | entropy_coef: 0.01 26 | lr: 2.5e-4 27 | eps: 1e-5 28 | max_grad_norm: 0.5 29 | num_steps: 128 30 | hidden_size: 512 31 | use_gae: True 32 | gamma: 0.99 33 | tau: 0.95 34 | use_linear_clip_decay: True 35 | use_linear_lr_decay: True 36 | reward_window_size: 50 37 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/aux_sge.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 4 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 5 | RL: 6 | fp16_mode: "autocast" 7 | POLICIES: 8 | - "coverage_explore_reward" # head 1 9 | - "objnav_sparse_reward" # head 1 10 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 11 | POLICY: 12 | FULL_VISION: True # Hack to load the right rednet. 13 | OBS_TRANSFORMS: 14 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 15 | RESIZE_SHORTEST_EDGE: 16 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 17 | PPO: 18 | hidden_size: 196 19 | ROLLOUT: 20 | METRICS: ['reached', 'mini_reached', 'visit_count', 'goal_vis'] 21 | POLICY: 22 | name: "AttentiveBeliefPolicy" 23 | USE_SEMANTICS: True 24 | EVAL_GT_SEMANTICS: True 25 | input_drop: 0.1 26 | output_drop: 0.1 27 | embed_sge: False # Cmon, no point in not doing this anymore. 28 | BELIEFS: 29 | NUM_BELIEFS: 6 30 | AUX_MAP: [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5] 31 | DOUBLE_PREPROCESS_BUG: False 32 | jit: True 33 | FULL_RESNET: True 34 | AUX_TASKS: 35 | tasks: 36 | - "CPCA" 37 | - "PBL" 38 | - "CPCA_B" 39 | - "GID" 40 | - "CoveragePrediction" 41 | - "ActionDist_A" 42 | - "SemanticGoalExists" 43 | - "SemanticGoalExists" 44 | - "SemanticGoalExists" 45 | - "SemanticGoalExists" 46 | - "SemanticGoalExists" 47 | - "SemanticGoalExists" 48 | required_sensors: ["SEMANTIC_SENSOR"] 49 | CoveragePrediction: 50 | key: "mini_reached" 51 | hidden_size: 32 52 | loss_factor: 0.025 53 | regression: False -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/aux_sge2.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 4 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 5 | RL: 6 | fp16_mode: "autocast" 7 | POLICIES: 8 | - "coverage_explore_reward" # head 1 9 | - "objnav_sparse_reward" # head 1 10 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 11 | POLICY: 12 | FULL_VISION: True # Hack to load the right rednet. 13 | OBS_TRANSFORMS: 14 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 15 | RESIZE_SHORTEST_EDGE: 16 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 17 | PPO: 18 | hidden_size: 196 19 | ROLLOUT: 20 | METRICS: ['reached', 'mini_reached', 'visit_count', 'goal_vis'] 21 | POLICY: 22 | name: "AttentiveBeliefPolicy" 23 | USE_SEMANTICS: True 24 | EVAL_GT_SEMANTICS: True 25 | input_drop: 0.1 26 | output_drop: 0.1 27 | embed_sge: False # Cmon, no point in not doing this anymore. 28 | BELIEFS: 29 | NUM_BELIEFS: 6 30 | AUX_MAP: [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5] 31 | DOUBLE_PREPROCESS_BUG: False 32 | jit: True 33 | FULL_RESNET: True 34 | AUX_TASKS: 35 | tasks: 36 | - "CPCA" 37 | - "PBL" 38 | - "CPCA_B" 39 | - "GID" 40 | - "CoveragePrediction" 41 | - "ActionDist_A" 42 | - "SemanticGoalExists" 43 | - "SemanticGoalExists" 44 | - "SemanticGoalExists" 45 | - "SemanticGoalExists" 46 | - "SemanticGoalExists" 47 | - "SemanticGoalExists" 48 | required_sensors: ["SEMANTIC_SENSOR"] 49 | CoveragePrediction: 50 | key: "mini_reached" 51 | hidden_size: 32 52 | loss_factor: 0.025 53 | regression: False -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/base.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution (we'll resize on evalai) 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 5 | 6 | # ! Pay careful attention to eval settings. 7 | EVAL: 8 | # restrict_gps: False 9 | # SPLIT: "val_300" 10 | SPLIT: "val_mini" 11 | # PROJECT_OUT: -1 # control 12 | # PROJECT_OUT: 0 # increase steps/coverage (low SPL) 13 | # PROJECT_OUT: 200 # = test 0 - 450. Center of mass is around prediction. 14 | # PROJECT_OUT: 400 # At this point all agents should be giving up/panicking (300-500) 15 | # PROJECT_OUT: 500 16 | # PROJECTION_PATH: '/srv/share/jye72/base-full_timesteps.pth' 17 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_0_timesteps.pth' 18 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_1_timesteps.pth' 19 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_2_timesteps.pth' 20 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_3_timesteps.pth' 21 | 22 | RL: 23 | fp16_mode: "autocast" 24 | POLICIES: 25 | - "coverage_explore_reward" # head 1 26 | - "objnav_sparse_reward" # head 1 27 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 28 | POLICY: 29 | FULL_VISION: True # Hack to load the right rednet. 30 | OBS_TRANSFORMS: 31 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 32 | RESIZE_SHORTEST_EDGE: 33 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 34 | PPO: 35 | hidden_size: 196 36 | entropy_coef: 0.0075 # We have more actions, scaling this down. 37 | ROLLOUT: 38 | METRICS: ['reached', 'mini_reached', 'visit_count'] 39 | POLICY: 40 | name: "AttentiveBeliefPolicy" 41 | USE_SEMANTICS: True 42 | EVAL_GT_SEMANTICS: True 43 | input_drop: 0.1 44 | output_drop: 0.1 45 | embed_sge: True # Cmon, no point in not doing this anymore. 46 | DOUBLE_PREPROCESS_BUG: False 47 | jit: True 48 | FULL_RESNET: True 49 | AUX_TASKS: 50 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 51 | required_sensors: ["SEMANTIC_SENSOR"] 52 | CoveragePrediction: 53 | key: "mini_reached" 54 | hidden_size: 32 55 | loss_factor: 0.025 56 | regression: False 57 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/base4.on.yaml: -------------------------------------------------------------------------------- 1 | sTRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 4 | 5 | # ! Pay careful attention to eval settings. 6 | # EVAL: 7 | # restrict_gps: False 8 | EVAL: 9 | SPLIT: "val_300" 10 | # SPLIT: "val_mini" 11 | # PROJECT_OUT: -1 # control 12 | # PROJECT_OUT: 0 # increase steps/coverage (low SPL) 13 | # PROJECT_OUT: 200 # = test 0 - 450. Center of mass is around prediction. 14 | # PROJECT_OUT: 500 # At this point all agents should be giving up/panicking (300-500) 15 | 16 | # PROJECT_OUT: 50 # spoof 50 = test 0-150. this should increase coverage...? 17 | # PROJECT_OUT: 100 # = test 0 - 200. 18 | # PROJECTION_PATH: '/srv/share/jye72/base4-full_timesteps.pth' 19 | # PROJECTION_PATH: '/srv/share/jye72/base4-full_random_0_timesteps.pth' 20 | # PROJECTION_PATH: '/srv/share/jye72/base4-full_random_1_timesteps.pth' 21 | # PROJECTION_PATH: '/srv/share/jye72/base4-full_random_2_timesteps.pth' 22 | # PROJECTION_PATH: '/srv/share/jye72/base4-full_random_3_timesteps.pth' 23 | 24 | # EVAL: 25 | # DETERMINISTIC: True 26 | # SPLIT: "val_mini" 27 | # SPLIT: "val_22" 28 | # SPLIT: "val_100" 29 | # SPLIT: "val_300" 30 | 31 | RL: 32 | fp16_mode: "autocast" 33 | POLICIES: 34 | - "coverage_explore_reward" # head 1 35 | - "objnav_sparse_reward" # head 1 36 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 37 | POLICY: 38 | FULL_VISION: True # Hack to load the right rednet. 39 | OBS_TRANSFORMS: 40 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 41 | RESIZE_SHORTEST_EDGE: 42 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 43 | PPO: 44 | hidden_size: 196 45 | ROLLOUT: 46 | METRICS: ['reached', 'mini_reached', 'visit_count'] 47 | POLICY: 48 | name: "AttentiveBeliefPolicy" 49 | USE_SEMANTICS: True 50 | EVAL_GT_SEMANTICS: True 51 | input_drop: 0.1 52 | output_drop: 0.1 53 | embed_sge: True # Cmon, no point in not doing this anymore. 54 | DOUBLE_PREPROCESS_BUG: False 55 | jit: True 56 | FULL_RESNET: True 57 | AUX_TASKS: 58 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 59 | required_sensors: ["SEMANTIC_SENSOR"] 60 | CoveragePrediction: 61 | key: "mini_reached" 62 | hidden_size: 32 63 | loss_factor: 0.025 64 | regression: False 65 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/base4_rednet.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 5 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 6 | 7 | # EVAL: 8 | # SPLIT: "val_300" 9 | 10 | RL: 11 | fp16_mode: "autocast" 12 | POLICIES: 13 | - "coverage_explore_reward" # head 1 14 | - "objnav_sparse_reward" # head 1 15 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 16 | POLICY: 17 | FULL_VISION: True # Hack to load the right rednet. 18 | 19 | PRETRAINED_CKPT: "/srv/share/jye72/objectnav/base4-full/base4-full.35.pth" 20 | TRAIN_PRED_SEMANTICS: True 21 | 22 | OBS_TRANSFORMS: 23 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 24 | RESIZE_SHORTEST_EDGE: 25 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 26 | PPO: 27 | hidden_size: 196 28 | ROLLOUT: 29 | METRICS: ['reached', 'mini_reached', 'visit_count'] 30 | POLICY: 31 | name: "AttentiveBeliefPolicy" 32 | USE_SEMANTICS: True 33 | EVAL_GT_SEMANTICS: True 34 | input_drop: 0.1 35 | output_drop: 0.1 36 | embed_sge: True # Cmon, no point in not doing this anymore. 37 | DOUBLE_PREPROCESS_BUG: False 38 | jit: True 39 | FULL_RESNET: True 40 | 41 | AUX_TASKS: 42 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 43 | required_sensors: ["SEMANTIC_SENSOR"] 44 | CoveragePrediction: 45 | key: "mini_reached" 46 | hidden_size: 32 47 | loss_factor: 0.025 48 | regression: False 49 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/base_rednet.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution (we'll resize on evalai) 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 5 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full.yaml" 6 | RL: 7 | fp16_mode: "autocast" 8 | POLICIES: 9 | - "coverage_explore_reward" # head 1 10 | - "objnav_sparse_reward" # head 1 11 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 12 | POLICY: 13 | FULL_VISION: True # Hack to load the right rednet. 14 | 15 | PRETRAINED_CKPT: "/srv/share/jye72/objectnav/base-full/base-full.35.pth" 16 | TRAIN_PRED_SEMANTICS: True 17 | 18 | OBS_TRANSFORMS: 19 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 20 | RESIZE_SHORTEST_EDGE: 21 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 22 | PPO: 23 | hidden_size: 196 24 | entropy_coef: 0.0075 # We have more actions, scaling this down. 25 | ROLLOUT: 26 | METRICS: ['reached', 'mini_reached', 'visit_count'] 27 | POLICY: 28 | name: "AttentiveBeliefPolicy" 29 | USE_SEMANTICS: True 30 | EVAL_GT_SEMANTICS: True 31 | input_drop: 0.1 32 | output_drop: 0.1 33 | embed_sge: True # Cmon, no point in not doing this anymore. 34 | DOUBLE_PREPROCESS_BUG: False 35 | jit: True 36 | FULL_RESNET: True 37 | AUX_TASKS: 38 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 39 | required_sensors: ["SEMANTIC_SENSOR"] 40 | CoveragePrediction: 41 | key: "mini_reached" 42 | hidden_size: 32 43 | loss_factor: 0.025 44 | regression: False 45 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/no_adp.on.yaml: -------------------------------------------------------------------------------- 1 | # 4 action, not split. 2 | TRAINER_NAME: "belief-ddppo" 3 | ENV_NAME: "DummyRLEnv" 4 | # ! Train on half resolution 5 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 6 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 7 | RL: 8 | fp16_mode: "autocast" 9 | POLICIES: 10 | - "coverage_explore_reward" # head 1 11 | - "objnav_sparse_reward" # head 1 12 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 13 | POLICY: 14 | FULL_VISION: True # Hack to load the right rednet. 15 | OBS_TRANSFORMS: 16 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 17 | RESIZE_SHORTEST_EDGE: 18 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 19 | PPO: 20 | hidden_size: 196 21 | ROLLOUT: 22 | METRICS: ['reached', 'mini_reached', 'visit_count'] 23 | POLICY: 24 | # ! NOTE THIS 25 | EVAL_SEMANTICS_CKPT: "/srv/share/jye72/rednet/rednet_semmap_mp3d_40.pth" 26 | 27 | name: "AttentiveBeliefPolicy" 28 | USE_SEMANTICS: True 29 | EVAL_GT_SEMANTICS: True 30 | input_drop: 0.1 31 | output_drop: 0.1 32 | embed_sge: True # Cmon, no point in not doing this anymore. 33 | DOUBLE_PREPROCESS_BUG: False 34 | jit: True 35 | FULL_RESNET: True 36 | AUX_TASKS: 37 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "Dummy"] 38 | required_sensors: ["SEMANTIC_SENSOR"] 39 | CoveragePrediction: 40 | key: "mini_reached" 41 | hidden_size: 32 42 | loss_factor: 0.025 43 | regression: False 44 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/no_aux.on.yaml: -------------------------------------------------------------------------------- 1 | # 4 action, not split. 2 | TRAINER_NAME: "belief-ddppo" 3 | ENV_NAME: "DummyRLEnv" 4 | # ! Train on half resolution 5 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 6 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 7 | RL: 8 | fp16_mode: "autocast" 9 | POLICIES: 10 | - "coverage_explore_reward" # head 1 11 | - "objnav_sparse_reward" # head 1 12 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 13 | POLICY: 14 | FULL_VISION: True # Hack to load the right rednet. 15 | OBS_TRANSFORMS: 16 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 17 | RESIZE_SHORTEST_EDGE: 18 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 19 | PPO: 20 | hidden_size: 512 21 | ROLLOUT: 22 | METRICS: ['reached', 'mini_reached', 'visit_count'] 23 | POLICY: 24 | name: "BeliefPolicy" 25 | USE_SEMANTICS: True 26 | EVAL_GT_SEMANTICS: True 27 | input_drop: 0.1 28 | output_drop: 0.1 29 | embed_sge: True # Cmon, no point in not doing this anymore. 30 | DOUBLE_PREPROCESS_BUG: False 31 | jit: True 32 | FULL_RESNET: True 33 | AUX_TASKS: 34 | tasks: ["Dummy"] 35 | required_sensors: ["SEMANTIC_SENSOR"] 36 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/no_cp.on.yaml: -------------------------------------------------------------------------------- 1 | # 4 action, not split. 2 | TRAINER_NAME: "belief-ddppo" 3 | ENV_NAME: "DummyRLEnv" 4 | # ! Train on half resolution 5 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 6 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 7 | RL: 8 | fp16_mode: "autocast" 9 | POLICIES: 10 | - "coverage_explore_reward" # head 1 11 | - "objnav_sparse_reward" # head 1 12 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 13 | POLICY: 14 | FULL_VISION: True # Hack to load the right rednet. 15 | OBS_TRANSFORMS: 16 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 17 | RESIZE_SHORTEST_EDGE: 18 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 19 | PPO: 20 | hidden_size: 196 21 | POLICY: 22 | # ! NOTE THIS 23 | EVAL_SEMANTICS_CKPT: "/srv/share/jye72/rednet/rednet_semmap_mp3d_40.pth" 24 | 25 | name: "AttentiveBeliefPolicy" 26 | USE_SEMANTICS: True 27 | EVAL_GT_SEMANTICS: True 28 | input_drop: 0.1 29 | output_drop: 0.1 30 | embed_sge: True # Cmon, no point in not doing this anymore. 31 | DOUBLE_PREPROCESS_BUG: False 32 | jit: True 33 | FULL_RESNET: True 34 | AUX_TASKS: 35 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "Dummy", "ActionDist_A"] 36 | required_sensors: ["SEMANTIC_SENSOR"] 37 | CoveragePrediction: 38 | key: "mini_reached" 39 | hidden_size: 32 40 | loss_factor: 0.025 41 | regression: False 42 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/no_gid.on.yaml: -------------------------------------------------------------------------------- 1 | # 4 action, not split. 2 | TRAINER_NAME: "belief-ddppo" 3 | ENV_NAME: "DummyRLEnv" 4 | # ! Train on half resolution 5 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 6 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 7 | RL: 8 | fp16_mode: "autocast" 9 | POLICIES: 10 | - "coverage_explore_reward" # head 1 11 | - "objnav_sparse_reward" # head 1 12 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 13 | POLICY: 14 | FULL_VISION: True # Hack to load the right rednet. 15 | OBS_TRANSFORMS: 16 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 17 | RESIZE_SHORTEST_EDGE: 18 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 19 | PPO: 20 | hidden_size: 196 21 | ROLLOUT: 22 | METRICS: ['reached', 'mini_reached', 'visit_count'] 23 | POLICY: 24 | # ! NOTE THIS 25 | # EVAL_SEMANTICS_CKPT: "/srv/share/jye72/rednet/rednet_semmap_mp3d_40.pth" 26 | 27 | name: "AttentiveBeliefPolicy" 28 | USE_SEMANTICS: True 29 | EVAL_GT_SEMANTICS: True 30 | input_drop: 0.1 31 | output_drop: 0.1 32 | embed_sge: True # Cmon, no point in not doing this anymore. 33 | DOUBLE_PREPROCESS_BUG: False 34 | jit: True 35 | FULL_RESNET: True 36 | AUX_TASKS: 37 | tasks: ["CPCA", "PBL", "CPCA_B", "Dummy", "CoveragePrediction", "ActionDist_A"] 38 | required_sensors: ["SEMANTIC_SENSOR"] 39 | CoveragePrediction: 40 | key: "mini_reached" 41 | hidden_size: 32 42 | loss_factor: 0.025 43 | regression: False 44 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/no_sge.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 5 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 6 | 7 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_proper_fov.yaml" 8 | 9 | # EVAL: 10 | # SPLIT: "val_mini" 11 | 12 | RL: 13 | fp16_mode: "autocast" 14 | POLICIES: 15 | - "coverage_explore_reward" # head 1 16 | - "objnav_sparse_reward" # head 1 17 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 18 | POLICY: 19 | FULL_VISION: True # Hack to load the right rednet. 20 | OBS_TRANSFORMS: 21 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 22 | RESIZE_SHORTEST_EDGE: 23 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 24 | PPO: 25 | hidden_size: 196 26 | ROLLOUT: 27 | METRICS: ['reached', 'mini_reached', 'visit_count'] 28 | POLICY: 29 | # ! NOTE THIS 30 | # EVAL_SEMANTICS_CKPT: "/srv/share/jye72/rednet/rednet_semmap_mp3d_40.pth" 31 | 32 | name: "AttentiveBeliefPolicy" 33 | USE_SEMANTICS: True 34 | EVAL_GT_SEMANTICS: True 35 | input_drop: 0.1 36 | output_drop: 0.1 37 | embed_sge: False 38 | DOUBLE_PREPROCESS_BUG: False 39 | jit: True 40 | FULL_RESNET: True 41 | AUX_TASKS: 42 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 43 | required_sensors: ["SEMANTIC_SENSOR"] 44 | CoveragePrediction: 45 | key: "mini_reached" 46 | hidden_size: 32 47 | loss_factor: 0.025 48 | regression: False 49 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/pt_sparse.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution (we'll resize on evalai) 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 5 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full.yaml" 6 | RL: 7 | fp16_mode: "autocast" 8 | # * only train with sparse reward 9 | POLICIES: 10 | # - "coverage_explore_reward" # Cancelled 11 | - "objnav_sparse_reward" # head 1 12 | SLACK_REWARD: 0.0 13 | # SLACK_REWARD: -0.0001 # Cancelled 14 | POLICY: 15 | PRETRAINED_CKPT: "/srv/share/jye72/objectnav/base-full/base-full.28.pth" 16 | FULL_VISION: True # Hack to load the right rednet. 17 | OBS_TRANSFORMS: 18 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 19 | RESIZE_SHORTEST_EDGE: 20 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 21 | PPO: 22 | hidden_size: 196 23 | entropy_coef: 0.0075 # We have more actions, scaling this down. 24 | ROLLOUT: 25 | METRICS: ['reached', 'mini_reached', 'visit_count'] 26 | POLICY: 27 | # ! NOTE THIS 28 | EVAL_SEMANTICS_CKPT: "/srv/share/jye72/rednet/rednet_semmap_mp3d_40.pth" 29 | 30 | name: "AttentiveBeliefPolicy" 31 | USE_SEMANTICS: True 32 | EVAL_GT_SEMANTICS: True 33 | input_drop: 0.1 34 | output_drop: 0.1 35 | embed_sge: True # Cmon, no point in not doing this anymore. 36 | DOUBLE_PREPROCESS_BUG: False 37 | jit: True 38 | FULL_RESNET: True 39 | AUX_TASKS: 40 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 41 | required_sensors: ["SEMANTIC_SENSOR"] 42 | CoveragePrediction: 43 | key: "mini_reached" 44 | hidden_size: 32 45 | loss_factor: 0.025 46 | regression: False 47 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/pt_sparse4.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a_train.yaml" 5 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_4a.yaml" 6 | RL: 7 | fp16_mode: "autocast" 8 | POLICIES: 9 | # - "coverage_explore_reward" # head 1 10 | - "objnav_sparse_reward" # head 1 11 | SLACK_REWARD: 0.0 # Only applied on first head (with coverage) 12 | # SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 13 | POLICY: 14 | PRETRAINED_CKPT: "/srv/share/jye72/objectnav/base4-full/base4-full.28.pth" 15 | FULL_VISION: True # Hack to load the right rednet. 16 | OBS_TRANSFORMS: 17 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 18 | RESIZE_SHORTEST_EDGE: 19 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 20 | PPO: 21 | hidden_size: 196 22 | ROLLOUT: 23 | METRICS: ['reached', 'mini_reached', 'visit_count'] 24 | POLICY: 25 | name: "AttentiveBeliefPolicy" 26 | USE_SEMANTICS: True 27 | EVAL_GT_SEMANTICS: True 28 | input_drop: 0.1 29 | output_drop: 0.1 30 | embed_sge: True # Cmon, no point in not doing this anymore. 31 | DOUBLE_PREPROCESS_BUG: False 32 | jit: True 33 | FULL_RESNET: True 34 | AUX_TASKS: 35 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 36 | required_sensors: ["SEMANTIC_SENSOR"] 37 | CoveragePrediction: 38 | key: "mini_reached" 39 | hidden_size: 32 40 | loss_factor: 0.025 41 | regression: False 42 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/split_clamp.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 5 | 6 | # ! Pay careful attention to eval settings. 7 | EVAL: 8 | # restrict_gps: False 9 | # SPLIT: "val_mini" 10 | # SPLIT: "val_22" 11 | SPLIT: "val_300" 12 | # SPLIT: "val_100" 13 | 14 | RL: 15 | fp16_mode: "autocast" 16 | POLICIES: 17 | - "coverage_explore_reward" # head 1 18 | - "objnav_sparse_reward" # head 1 19 | - "objnav_sparse_reward_a" # head 2 (only last reward is used in head 2) 20 | REWARD_FUSION: 21 | STRATEGY: "SPLIT" 22 | ENV_ON_ALL: False 23 | SPLIT: 24 | TRANSITION: 1e8 25 | IMPORTANCE_WEIGHT: True 26 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 27 | POLICY: 28 | FULL_VISION: True # Hack to load the right rednet. 29 | OBS_TRANSFORMS: 30 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 31 | RESIZE_SHORTEST_EDGE: 32 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 33 | PPO: 34 | SPLIT_IW_BOUNDS: [0.01, 1.0] 35 | hidden_size: 196 36 | entropy_coef: 0.0075 # We have more actions, scaling this down. (doesn't learn without scaling down) 37 | ROLLOUT: 38 | METRICS: ['reached', 'mini_reached', 'visit_count'] 39 | POLICY: 40 | name: "AttentiveBeliefMultiPolicy" 41 | USE_SEMANTICS: True 42 | EVAL_GT_SEMANTICS: True 43 | input_drop: 0.1 44 | output_drop: 0.1 45 | embed_sge: True # Cmon, no point in not doing this anymore. 46 | DOUBLE_PREPROCESS_BUG: False 47 | jit: True 48 | FULL_RESNET: True 49 | AUX_TASKS: 50 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 51 | required_sensors: ["SEMANTIC_SENSOR"] 52 | CoveragePrediction: 53 | key: "mini_reached" 54 | hidden_size: 32 55 | loss_factor: 0.025 56 | regression: False 57 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/split_rednet.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | 4 | # ! EDITS FOR EVALAI TESTING 5 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 6 | # BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full.yaml" 7 | RL: 8 | fp16_mode: "autocast" 9 | POLICIES: 10 | - "coverage_explore_reward" # head 1 11 | - "objnav_sparse_reward" # head 1 12 | - "objnav_sparse_reward_a" # head 2 (only last reward is used in head 2) 13 | REWARD_FUSION: 14 | STRATEGY: "SPLIT" 15 | ENV_ON_ALL: False 16 | SPLIT: 17 | TRANSITION: 1e8 18 | IMPORTANCE_WEIGHT: True 19 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 20 | POLICY: 21 | FULL_VISION: True # Hack to load the right rednet. 22 | 23 | PRETRAINED_CKPT: "/srv/share/jye72/objectnav/split_clamp-full/split_clamp-full.35.pth" 24 | TRAIN_PRED_SEMANTICS: True 25 | 26 | OBS_TRANSFORMS: 27 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 28 | RESIZE_SHORTEST_EDGE: 29 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 30 | PPO: 31 | SPLIT_IW_BOUNDS: [0.01, 1.0] 32 | hidden_size: 196 33 | entropy_coef: 0.0075 # We have more actions, scaling this down. (doesn't learn without scaling down) 34 | ROLLOUT: 35 | METRICS: ['reached', 'mini_reached', 'visit_count'] 36 | POLICY: 37 | name: "AttentiveBeliefMultiPolicy" 38 | USE_SEMANTICS: True 39 | EVAL_GT_SEMANTICS: True 40 | # EVAL_SEMANTICS_STABILIZE: True # ! EDIT 41 | input_drop: 0.1 42 | output_drop: 0.1 43 | embed_sge: True # Cmon, no point in not doing this anymore. 44 | DOUBLE_PREPROCESS_BUG: False 45 | jit: True 46 | FULL_RESNET: True 47 | AUX_TASKS: 48 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 49 | required_sensors: ["SEMANTIC_SENSOR"] 50 | CoveragePrediction: 51 | key: "mini_reached" 52 | hidden_size: 32 53 | loss_factor: 0.025 54 | regression: False 55 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/full/test.on.yaml: -------------------------------------------------------------------------------- 1 | TRAINER_NAME: "belief-ddppo" 2 | ENV_NAME: "DummyRLEnv" 3 | # ! Train on half resolution (we'll resize on evalai) 4 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d_full_train.yaml" 5 | 6 | # ! Pay careful attention to eval settings. 7 | EVAL: 8 | # restrict_gps: False 9 | # SPLIT: "val_300" 10 | SPLIT: "val_mini" 11 | # PROJECT_OUT: -1 # control 12 | # PROJECT_OUT: 0 # increase steps/coverage (low SPL) 13 | # PROJECT_OUT: 200 # = test 0 - 450. Center of mass is around prediction. 14 | # PROJECT_OUT: 400 # At this point all agents should be giving up/panicking (300-500) 15 | # PROJECT_OUT: 500 16 | # PROJECTION_PATH: '/srv/share/jye72/base-full_timesteps.pth' 17 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_0_timesteps.pth' 18 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_1_timesteps.pth' 19 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_2_timesteps.pth' 20 | # PROJECTION_PATH: '/srv/share/jye72/base-full_random_3_timesteps.pth' 21 | 22 | RL: 23 | fp16_mode: "autocast" 24 | POLICIES: 25 | - "coverage_explore_reward" # head 1 26 | - "objnav_sparse_reward" # head 1 27 | SLACK_REWARD: -0.0001 # Only applied on first head (with coverage) 28 | POLICY: 29 | FULL_VISION: True # Hack to load the right rednet. 30 | OBS_TRANSFORMS: 31 | ENABLED_TRANSFORMS: ["ResizeShortestEdge"] # 480 x 640 -> 240 x 320 -> 20 32 | RESIZE_SHORTEST_EDGE: 33 | SIZE: 240 # -> 240 x 320. try 228 x 300, which is must closer to 256 x 256 area, but is not very round. or 210 x 280 34 | PPO: 35 | hidden_size: 196 36 | entropy_coef: 0.0075 # We have more actions, scaling this down. 37 | ROLLOUT: 38 | METRICS: ['reached', 'mini_reached', 'visit_count'] 39 | POLICY: 40 | name: "AttentiveBeliefPolicy" 41 | USE_SEMANTICS: True 42 | EVAL_GT_SEMANTICS: True 43 | input_drop: 0.1 44 | output_drop: 0.1 45 | embed_sge: True # Cmon, no point in not doing this anymore. 46 | DOUBLE_PREPROCESS_BUG: False 47 | jit: True 48 | FULL_RESNET: True 49 | AUX_TASKS: 50 | tasks: ["CPCA", "PBL", "CPCA_B", "GID", "CoveragePrediction", "ActionDist_A"] 51 | required_sensors: ["SEMANTIC_SENSOR"] 52 | CoveragePrediction: 53 | key: "mini_reached" 54 | hidden_size: 32 55 | loss_factor: 0.025 56 | regression: False 57 | -------------------------------------------------------------------------------- /habitat_baselines/config/objectnav/obj_base.on.yaml: -------------------------------------------------------------------------------- 1 | CHECKPOINT_FOLDER: "/srv/share/jye72/objectnav/" 2 | LOG_FILE: "runs/objectnav/" 3 | TENSORBOARD_DIR: "tb/objectnav/" 4 | VIDEO_DIR: "/srv/share/jye72/vis/videos/objectnav/" 5 | 6 | BASE_TASK_CONFIG_PATH: "configs/tasks/objectnav_mp3d.yaml" 7 | SIMULATOR_GPU_ID: 0 8 | TORCH_GPU_ID: 0 9 | VIDEO_OPTION: [] 10 | NUM_PROCESSES: 4 11 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 12 | NUM_UPDATES: 100000 13 | LOG_INTERVAL: 50 14 | CHECKPOINT_INTERVAL: 1000 15 | TEST_EPISODE_COUNT: 2184 # 312 # 2184 ~ 2 mins per episode - 500 steps, 250 / min, 4 fps??? 16 | 17 | RL: 18 | SUCCESS_REWARD: 2.5 19 | SLACK_REWARD: -0.001 20 | PPO: 21 | clip_param: 0.2 22 | ppo_epoch: 4 23 | num_mini_batch: 2 24 | value_loss_coef: 0.5 25 | entropy_coef: 0.01 26 | lr: 2.5e-4 27 | eps: 1e-5 28 | max_grad_norm: 0.5 29 | num_steps: 128 30 | use_gae: True 31 | gamma: 0.99 32 | tau: 0.95 33 | use_linear_clip_decay: False 34 | use_linear_lr_decay: False 35 | use_normalized_advantage: False 36 | reward_window_size: 50 37 | POLICY: 38 | name: "BeliefPolicy" 39 | use_mean_and_var: True 40 | pretrained_encoder: True 41 | pretrained_weights: "/srv/share/ewijmans3/resnet-18-mp3d-rgbd-100m.pth" 42 | TRANSFORMER: 43 | num_heads: 4 44 | num_layers: 1 45 | dropout_p: 0.2 46 | AUX_TASKS: 47 | entropy_coef: 0.075 48 | CPCA: 49 | num_steps: 4 50 | CPCA_A: 51 | num_steps: 16 52 | CPCA_B: 53 | num_steps: 32 54 | GID: 55 | loss_factor: 0.1 56 | num_steps: 4 57 | ActionDist: 58 | loss_factor: 0.25 59 | num_steps: -4 60 | ActionDist_A: 61 | loss_factor: 0.25 62 | num_steps: 6 63 | CoveragePrediction: 64 | loss_factor: 0.25 65 | num_steps: 16 66 | subsample_rate: 0.4 67 | PBL: 68 | num_steps: 8 69 | 70 | -------------------------------------------------------------------------------- /habitat_baselines/config/test/ddppo_imagenav_test.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/imagenav.yaml" 2 | TRAINER_NAME: "ddppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: [] 7 | TENSORBOARD_DIR: "" 8 | VIDEO_DIR: "" 9 | SENSORS: ["RGB_SENSOR", "DEPTH_SENSOR"] 10 | EVAL_CKPT_PATH_DIR: "data/test_checkpoints/ddppo/imagenav/ckpt.0.pth" 11 | NUM_PROCESSES: 1 12 | CHECKPOINT_FOLDER: "data/test_checkpoints/ddppo/imagenav/" 13 | NUM_UPDATES: 2 14 | LOG_INTERVAL: 100 15 | CHECKPOINT_INTERVAL: 1 16 | 17 | 18 | RL: 19 | SUCCESS_REWARD: 2.5 20 | 21 | POLICY: 22 | name: "PointNavResNetPolicy" 23 | 24 | PPO: 25 | # ppo params 26 | clip_param: 0.2 27 | ppo_epoch: 2 28 | num_mini_batch: 1 29 | value_loss_coef: 0.5 30 | entropy_coef: 0.01 31 | lr: 2.5e-4 32 | eps: 1e-5 33 | max_grad_norm: 0.2 34 | num_steps: 16 35 | use_gae: True 36 | gamma: 0.99 37 | tau: 0.95 38 | use_linear_clip_decay: False 39 | use_linear_lr_decay: False 40 | reward_window_size: 50 41 | 42 | use_normalized_advantage: False 43 | 44 | hidden_size: 512 45 | 46 | DDPPO: 47 | sync_frac: 0.6 48 | # The PyTorch distributed backend to use 49 | distrib_backend: GLOO 50 | # Visual encoder backbone 51 | pretrained_weights: data/ddppo-models/gibson-2plus-resnet50.pth 52 | # Initialize with pretrained weights 53 | pretrained: False 54 | # Initialize just the visual encoder backbone with pretrained weights 55 | pretrained_encoder: False 56 | # Whether or not the visual encoder backbone will be trained. 57 | train_encoder: True 58 | # Whether or not to reset the critic linear layer 59 | reset_critic: True 60 | 61 | # Model parameters 62 | backbone: resnet50 63 | rnn_type: LSTM 64 | num_recurrent_layers: 2 65 | -------------------------------------------------------------------------------- /habitat_baselines/config/test/ddppo_pointnav_test.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/pointnav.yaml" 2 | TRAINER_NAME: "ddppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: [] 7 | TENSORBOARD_DIR: "" 8 | EVAL_CKPT_PATH_DIR: "data/test_checkpoints/ddppo/pointnav/ckpt.0.pth" 9 | NUM_PROCESSES: 1 10 | CHECKPOINT_FOLDER: "data/test_checkpoints/ddppo/pointnav/" 11 | NUM_UPDATES: 2 12 | LOG_INTERVAL: 100 13 | CHECKPOINT_INTERVAL: 1 14 | 15 | RL: 16 | SUCCESS_REWARD: 2.5 17 | 18 | POLICY: 19 | name: "PointNavResNetPolicy" 20 | 21 | PPO: 22 | # ppo params 23 | clip_param: 0.2 24 | ppo_epoch: 2 25 | num_mini_batch: 1 26 | value_loss_coef: 0.5 27 | entropy_coef: 0.01 28 | lr: 2.5e-4 29 | eps: 1e-5 30 | max_grad_norm: 0.2 31 | num_steps: 16 32 | use_gae: True 33 | gamma: 0.99 34 | tau: 0.95 35 | use_linear_clip_decay: False 36 | use_linear_lr_decay: False 37 | reward_window_size: 50 38 | 39 | use_normalized_advantage: False 40 | 41 | hidden_size: 512 42 | 43 | DDPPO: 44 | sync_frac: 0.6 45 | # The PyTorch distributed backend to use 46 | distrib_backend: GLOO 47 | # Visual encoder backbone 48 | pretrained_weights: data/ddppo-models/gibson-2plus-resnet50.pth 49 | # Initialize with pretrained weights 50 | pretrained: False 51 | # Initialize just the visual encoder backbone with pretrained weights 52 | pretrained_encoder: False 53 | # Whether or not the visual encoder backbone will be trained. 54 | train_encoder: True 55 | # Whether or not to reset the critic linear layer 56 | reset_critic: True 57 | 58 | # Model parameters 59 | backbone: resnet50 60 | rnn_type: LSTM 61 | num_recurrent_layers: 2 62 | -------------------------------------------------------------------------------- /habitat_baselines/config/test/ppo_imagenav_test.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/imagenav.yaml" 2 | TRAINER_NAME: "ppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: [] 7 | TENSORBOARD_DIR: "" 8 | EVAL_CKPT_PATH_DIR: "data/test_checkpoints/ppo/imagenav/ckpt.0.pth" 9 | NUM_PROCESSES: 1 10 | CHECKPOINT_FOLDER: "data/test_checkpoints/ppo/imagenav/" 11 | NUM_UPDATES: 10 12 | LOG_INTERVAL: 100 13 | CHECKPOINT_INTERVAL: 1 14 | 15 | RL: 16 | PPO: 17 | # ppo params 18 | clip_param: 0.1 19 | ppo_epoch: 4 20 | num_mini_batch: 1 21 | value_loss_coef: 0.5 22 | entropy_coef: 0.01 23 | lr: 2.5e-4 24 | eps: 1e-5 25 | max_grad_norm: 0.5 26 | num_steps: 128 27 | hidden_size: 512 28 | use_gae: True 29 | gamma: 0.99 30 | tau: 0.95 31 | use_linear_clip_decay: True 32 | use_linear_lr_decay: True 33 | reward_window_size: 50 34 | -------------------------------------------------------------------------------- /habitat_baselines/config/test/ppo_pointnav_test.yaml: -------------------------------------------------------------------------------- 1 | BASE_TASK_CONFIG_PATH: "configs/tasks/pointnav.yaml" 2 | TRAINER_NAME: "ppo" 3 | ENV_NAME: "NavRLEnv" 4 | SIMULATOR_GPU_ID: 0 5 | TORCH_GPU_ID: 0 6 | VIDEO_OPTION: ["DISK"] 7 | VIDEO_DIR: "data/test_checkpoints/ppo/pointnav/video" 8 | TENSORBOARD_DIR: "" 9 | EVAL_CKPT_PATH_DIR: "data/test_checkpoints/ppo/pointnav/ckpt.0.pth" 10 | NUM_PROCESSES: 1 11 | CHECKPOINT_FOLDER: "data/test_checkpoints/ppo/pointnav/" 12 | NUM_UPDATES: 10 13 | LOG_INTERVAL: 100 14 | CHECKPOINT_INTERVAL: 1 15 | 16 | RL: 17 | PPO: 18 | # ppo params 19 | clip_param: 0.1 20 | ppo_epoch: 4 21 | num_mini_batch: 1 22 | value_loss_coef: 0.5 23 | entropy_coef: 0.01 24 | lr: 2.5e-4 25 | eps: 1e-5 26 | max_grad_norm: 0.5 27 | num_steps: 128 28 | hidden_size: 512 29 | use_gae: True 30 | gamma: 0.99 31 | tau: 0.95 32 | use_linear_clip_decay: True 33 | use_linear_lr_decay: True 34 | reward_window_size: 50 35 | -------------------------------------------------------------------------------- /habitat_baselines/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561. This tells mypy that the package uses inline types. 2 | -------------------------------------------------------------------------------- /habitat_baselines/rl/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat_baselines.rl.ddppo.algo import DDPPOTrainer 8 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/algo/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat_baselines.rl.ddppo.algo.ddppo_trainer import DDPPOTrainer 8 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/multi_node_slurm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=ddppo 3 | #SBATCH --output=logs.ddppo.out 4 | #SBATCH --error=logs.ddppo.err 5 | #SBATCH --gres gpu:1 6 | #SBATCH --nodes 1 7 | #SBATCH --cpus-per-task 10 8 | #SBATCH --ntasks-per-node 1 9 | #SBATCH --mem=60GB 10 | #SBATCH --time=12:00 11 | #SBATCH --signal=USR1@600 12 | #SBATCH --partition=dev 13 | 14 | export GLOG_minloglevel=2 15 | export MAGNUM_LOG=quiet 16 | 17 | export MASTER_ADDR=$(srun --ntasks=1 hostname 2>&1 | tail -n1) 18 | 19 | set -x 20 | srun python -u -m habitat_baselines.run \ 21 | --exp-config habitat_baselines/config/pointnav/ddppo_pointnav.yaml \ 22 | --run-type train 23 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/policy/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | 8 | from .resnet_policy import PointNavResNetPolicy 9 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/requirements.txt: -------------------------------------------------------------------------------- 1 | ifcfg 2 | -------------------------------------------------------------------------------- /habitat_baselines/rl/ddppo/single_node.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | export GLOG_minloglevel=2 4 | export MAGNUM_LOG=quiet 5 | 6 | set -x 7 | python -u -m torch.distributed.launch \ 8 | --use_env \ 9 | --nproc_per_node 2 \ 10 | habitat_baselines/run.py \ 11 | --exp-config habitat_baselines/config/pointnav/ddppo_pointnav.yaml \ 12 | --run-type train 13 | -------------------------------------------------------------------------------- /habitat_baselines/rl/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat_baselines/rl/models/__init__.py -------------------------------------------------------------------------------- /habitat_baselines/rl/ppo/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from typing import Dict 8 | from habitat_baselines.rl.ppo.policy import ( 9 | Net, Policy, PointNavBaselinePolicy 10 | ) 11 | from habitat_baselines.rl.ppo.belief_policy import ( 12 | BeliefPolicy, AttentiveBeliefPolicy 13 | ) 14 | 15 | from habitat_baselines.rl.ppo.multipolicy import ( 16 | AttentiveBeliefMultiPolicy 17 | ) 18 | 19 | from habitat_baselines.rl.ppo.ppo import PPO 20 | 21 | __all__ = [ 22 | "PPO", "Policy", "Net" 23 | ] 24 | -------------------------------------------------------------------------------- /habitat_baselines/rl/requirements.txt: -------------------------------------------------------------------------------- 1 | moviepy>=1.0.1 2 | torch>=1.3.1 3 | # full tensorflow required for tensorboard video support 4 | tensorflow==1.13.1 5 | tb-nightly 6 | -------------------------------------------------------------------------------- /habitat_baselines/slambased/README.md: -------------------------------------------------------------------------------- 1 | ### Handcrafted agent baseline adopted from the paper "Benchmarking Classic and Learned Navigation in Complex 3D Environments" 2 | 3 | Project website: https://sites.google.com/view/classic-vs-learned-navigation 4 | Paper: https://arxiv.org/abs/1901.10915 5 | 6 |

7 | 8 |

9 | 10 | If you use this code or the provided environments in your research, please cite the following: 11 | 12 | @ARTICLE{Navigation2019, 13 | author = {{Mishkin}, Dmytro and {Dosovitskiy}, Alexey and {Koltun}, Vladlen}, 14 | title = "{Benchmarking Classic and Learned Navigation in Complex 3D Environments}", 15 | year = 2019, 16 | month = Jan, 17 | archivePrefix = {arXiv}, 18 | eprint = {1901.10915}, 19 | } 20 | 21 | 22 | 23 | ## Dependencies: 24 | 25 | - conda 26 | - numpy 27 | - pytorch 28 | - ORBSLAM2 29 | 30 | 31 | ## Tested with: 32 | - Ubuntu 16.04 33 | - python 3.6 34 | - pytorch 0.4, 1.0 35 | 36 | 37 | - Install Anaconda https://www.anaconda.com/download/#linux 38 | 39 | - Install dependencies via ./install_deps.sh. It should install everything except the datasets. 40 | 41 | Simple example of working with agents is shown in (../handcrafted-agent-example.ipynb) 42 | -------------------------------------------------------------------------------- /habitat_baselines/slambased/data/mp3d3_small1k.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | #For resolution 256x256, FOV 90 deg 9 | Camera.fx: 128.0 10 | Camera.fy: 128.0 11 | Camera.cx: 127.0 12 | Camera.cy: 127.0 13 | 14 | 15 | Camera.k1: 0.0 16 | Camera.k2: 0.0 17 | Camera.p1: 0.0 18 | Camera.p2: 0.0 19 | 20 | # Camera frames per second 21 | Camera.fps: 30.0 22 | 23 | # IR projector baseline times fx (aprox.) 24 | Camera.bf: 50.0 25 | 26 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 27 | Camera.RGB: 1 28 | 29 | # Close/Far threshold. Baseline times. 30 | #ThDepth: 40.0 31 | ThDepth: 70.0 32 | 33 | # Deptmap values factor 34 | DepthMapFactor: 1.0 35 | 36 | #-------------------------------------------------------------------------------------------- 37 | # ORB Parameters 38 | #-------------------------------------------------------------------------------------------- 39 | 40 | # ORB Extractor: Number of features per image 41 | ORBextractor.nFeatures: 1000 42 | 43 | # ORB Extractor: Scale factor between levels in the scale pyramid 44 | ORBextractor.scaleFactor: 1.2 45 | 46 | # ORB Extractor: Number of levels in the scale pyramid 47 | ORBextractor.nLevels: 8 48 | 49 | # ORB Extractor: Fast threshold 50 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 51 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 52 | # You can lower these values if your images have low contrast 53 | ORBextractor.iniThFAST: 5 54 | ORBextractor.minThFAST: 1 55 | 56 | #-------------------------------------------------------------------------------------------- 57 | # Viewer Parameters 58 | #-------------------------------------------------------------------------------------------- 59 | Viewer.KeyFrameSize: 0.1 60 | Viewer.KeyFrameLineWidth: 1 61 | Viewer.GraphLineWidth: 1 62 | Viewer.PointSize:2 63 | Viewer.CameraSize: 0.15 64 | Viewer.CameraLineWidth: 2 65 | Viewer.ViewpointX: 0 66 | Viewer.ViewpointY: -10 67 | Viewer.ViewpointZ: -0.1 68 | Viewer.ViewpointF: 2000 69 | -------------------------------------------------------------------------------- /habitat_baselines/slambased/data/slam-based-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat_baselines/slambased/data/slam-based-agent.png -------------------------------------------------------------------------------- /habitat_baselines/slambased/install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | DIR1=$(pwd) 8 | MAINDIR=$(pwd)/3rdparty 9 | mkdir ${MAINDIR} 10 | cd ${MAINDIR} 11 | #conda create -y -n "HandcraftedAgents" python=3.6 12 | source activate HandcraftedAgents 13 | conda install opencv -y 14 | conda install pytorch torchvision -c pytorch -y 15 | conda install -c conda-forge imageio -y 16 | conda install ffmpeg -c conda-forge -y 17 | cd ${MAINDIR} 18 | mkdir eigen3 19 | cd eigen3 20 | wget http://bitbucket.org/eigen/eigen/get/3.3.5.tar.gz 21 | tar -xzf 3.3.5.tar.gz 22 | cd eigen-eigen-b3f3d4950030 23 | mkdir build 24 | cd build 25 | cmake .. -DCMAKE_INSTALL_PREFIX=${MAINDIR}/eigen3_installed/ 26 | make install 27 | cd ${MAINDIR} 28 | wget https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip 29 | unzip glew-2.1.0.zip 30 | cd glew-2.1.0/ 31 | cd build 32 | cmake ./cmake -DCMAKE_INSTALL_PREFIX=${MAINDIR}/glew_installed 33 | make -j4 34 | make install 35 | cd ${MAINDIR} 36 | #pip install numpy --upgrade 37 | rm Pangolin -rf 38 | git clone https://github.com/stevenlovegrove/Pangolin.git 39 | cd Pangolin 40 | mkdir build 41 | cd build 42 | cmake .. -DCMAKE_PREFIX_PATH=${MAINDIR}/glew_installed/ -DCMAKE_LIBRARY_PATH=${MAINDIR}/glew_installed/lib/ -DCMAKE_INSTALL_PREFIX=${MAINDIR}/pangolin_installed 43 | cmake --build . 44 | cd ${MAINDIR} 45 | rm ORB_SLAM2 -rf 46 | rm ORB_SLAM2-PythonBindings -rf 47 | git clone https://github.com/ducha-aiki/ORB_SLAM2 48 | git clone https://github.com/ducha-aiki/ORB_SLAM2-PythonBindings 49 | cd ${MAINDIR}/ORB_SLAM2 50 | sed -i "s,cmake .. -DCMAKE_BUILD_TYPE=Release,cmake .. -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=${MAINDIR}/eigen3_installed/include/eigen3/ -DCMAKE_INSTALL_PREFIX=${MAINDIR}/ORBSLAM2_installed ,g" build.sh 51 | ln -s ${MAINDIR}/eigen3_installed/include/eigen3/Eigen ${MAINDIR}/ORB_SLAM2/Thirdparty/g2o/g2o/core/Eigen 52 | ./build.sh 53 | cd build 54 | make install 55 | cd ${MAINDIR} 56 | cd ORB_SLAM2-PythonBindings/src 57 | ln -s ${MAINDIR}/eigen3_installed/include/eigen3/Eigen Eigen 58 | cd ${MAINDIR}/ORB_SLAM2-PythonBindings 59 | mkdir build 60 | cd build 61 | CONDA_DIR=$(dirname $(dirname $(which conda))) 62 | sed -i "s,lib/python3.5/dist-packages,${CONDA_DIR}/envs/HandcraftedAgents/lib/python3.6/site-packages/,g" ../CMakeLists.txt 63 | cmake .. -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")/libpython3.6m.so -DPYTHON_EXECUTABLE:FILEPATH=`which python` -DCMAKE_LIBRARY_PATH=${MAINDIR}/ORBSLAM2_installed/lib -DCMAKE_INCLUDE_PATH=${MAINDIR}/ORBSLAM2_installed/include;${MAINDIR}/eigen3_installed/include/eigen3 -DCMAKE_INSTALL_PREFIX=${MAINDIR}/pyorbslam2_installed 64 | make 65 | make install 66 | cp ${MAINDIR}/ORB_SLAM2/Vocabulary/ORBvoc.txt ${DIR1}/data/ 67 | -------------------------------------------------------------------------------- /habitat_baselines/slambased/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/habitat_baselines/slambased/requirements.txt -------------------------------------------------------------------------------- /habitat_baselines/slambased/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import time 8 | 9 | import numpy as np 10 | import torch 11 | from PIL import Image 12 | 13 | 14 | def generate_2dgrid(h, w, centered=False): 15 | if centered: 16 | x = torch.linspace(-w / 2 + 1, w / 2, w) 17 | y = torch.linspace(-h / 2 + 1, h / 2, h) 18 | else: 19 | x = torch.linspace(0, w - 1, w) 20 | y = torch.linspace(0, h - 1, h) 21 | grid2d = torch.stack( 22 | [y.repeat(w, 1).t().contiguous().view(-1), x.repeat(h)], 1 23 | ) 24 | return grid2d.view(1, h, w, 2).permute(0, 3, 1, 2) 25 | 26 | 27 | def str2bool(v): 28 | if v.lower() in ("yes", "true", "t", "y", "1"): 29 | return True 30 | elif v.lower() in ("no", "false", "f", "n", "0"): 31 | return False 32 | 33 | 34 | def resize_pil(np_img, size=128): 35 | im1 = Image.fromarray(np_img) 36 | im1.thumbnail((size, size)) 37 | return np.array(im1) 38 | 39 | 40 | def find_map_size(h, w): 41 | map_size_in_meters = int(0.1 * 3 * max(h, w)) 42 | if map_size_in_meters % 10 != 0: 43 | map_size_in_meters = map_size_in_meters + ( 44 | 10 - (map_size_in_meters % 10) 45 | ) 46 | return map_size_in_meters 47 | 48 | 49 | def gettimestr(): 50 | return time.strftime("%Y-%m-%d--%H_%M_%S", time.gmtime()) 51 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line_length = 79 3 | exclude = ''' 4 | ( 5 | /( 6 | \.eggs # exclude a few common directories in the 7 | | \.git # root of the project 8 | | \.hg 9 | | \.mypy_cache 10 | | \.tox 11 | | \.venv 12 | | _build 13 | | buck-out 14 | | ^examples/tutorials/colabs 15 | | ^examples/tutorials/nb_python 16 | | build 17 | | dist 18 | | obselete 19 | | deps 20 | )/ 21 | ) 22 | ''' 23 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | gym==0.10.9 2 | numpy>=1.16.1 3 | yacs>=0.1.5 4 | numpy-quaternion>=2019.3.18.14.33.20 5 | attrs>=19.1.0 6 | opencv-python>=3.3.0 7 | # visualization optional dependencies 8 | imageio>=2.2.0 9 | imageio-ffmpeg>=0.2.0 10 | scipy>=1.0.0 11 | tqdm>=4.0.0 12 | numba>=0.44.0 13 | -------------------------------------------------------------------------------- /res/img/habitat_compressed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/res/img/habitat_compressed.gif -------------------------------------------------------------------------------- /res/img/habitat_lab_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/res/img/habitat_lab_structure.png -------------------------------------------------------------------------------- /res/img/habitat_logo_with_text_horizontal_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/res/img/habitat_logo_with_text_horizontal_blue.png -------------------------------------------------------------------------------- /res/img/tensorboard_video_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joel99/objectnav/c4d8b7cf12e8fd57ef0546688c7175a25457ec6f/res/img/tensorboard_video_demo.gif -------------------------------------------------------------------------------- /scripts/dataset_single.py: -------------------------------------------------------------------------------- 1 | #%% 2 | # Extract single episodes into new datasets 3 | 4 | from pathlib import Path 5 | import shutil 6 | import gzip 7 | import json 8 | import numpy as np 9 | 10 | root_dir = Path('/srv/share/datasets/objectnav/mp3d/v1') 11 | seed = 0 12 | np.random.seed(seed) 13 | split = 'val' # source 14 | new_key = 'test' 15 | source = root_dir.joinpath(split) 16 | target = root_dir.joinpath(new_key) 17 | # Copy everything first, then we'll reduce 18 | if target.exists(): 19 | # pass 20 | raise Exception('target directory exists') 21 | else: 22 | shutil.copytree(source, target) 23 | 24 | target = target.joinpath('content') 25 | jsongzs = list(target.glob('*.json.gz')) 26 | num_scenes = len([x for x in jsongzs if x.is_file()]) 27 | slice_scenes = [size // num_scenes] * num_scenes 28 | for i in range(size % num_scenes): 29 | slice_scenes[i] += 1 30 | #%% 31 | for i, jsongz in enumerate(jsongzs): 32 | with gzip.open(jsongz, "rt") as f: # ref-ing `pointnav_dataset` 33 | data = json.loads(f.read()) 34 | num_eps = len(data['episodes']) 35 | slice_eps = np.random.choice(np.arange(num_eps), size=slice_scenes[i], replace=False) 36 | new_eps = [data['episodes'][i] for i in slice_eps] 37 | # new_eps = list(filter(lambda i, ep: i in slice_eps, data['episodes'])) 38 | data['episodes'] = new_eps 39 | with gzip.open(jsongz, 'wt') as f: 40 | json.dump(data, f) 41 | -------------------------------------------------------------------------------- /scripts/dataset_slicer.py: -------------------------------------------------------------------------------- 1 | #%% 2 | # Make objectnav data-subsets for detailed evaluation. 3 | 4 | from pathlib import Path 5 | import shutil 6 | import gzip 7 | import json 8 | import numpy as np 9 | 10 | root_dir = Path('/srv/share/datasets/objectnav/mp3d/v1') 11 | seed = 0 12 | np.random.seed(seed) 13 | split = 'val' 14 | # split = 'train' 15 | size = 22 16 | size = 100 17 | # size = 300 18 | source = root_dir.joinpath(split) 19 | target = root_dir.joinpath(f'{split}_{size}') 20 | # Copy everything first, then we'll reduce 21 | if target.exists(): 22 | # pass 23 | raise Exception('target directory exists') 24 | else: 25 | shutil.copytree(source, target) 26 | 27 | target = target.joinpath('content') 28 | jsongzs = list(target.glob('*.json.gz')) 29 | num_scenes = len([x for x in jsongzs if x.is_file()]) 30 | slice_scenes = [size // num_scenes] * num_scenes 31 | for i in range(size % num_scenes): 32 | slice_scenes[i] += 1 33 | #%% 34 | for i, jsongz in enumerate(jsongzs): 35 | with gzip.open(jsongz, "rt") as f: # ref-ing `pointnav_dataset` 36 | data = json.loads(f.read()) 37 | num_eps = len(data['episodes']) 38 | slice_eps = np.random.choice(np.arange(num_eps), size=slice_scenes[i], replace=False) 39 | new_eps = [data['episodes'][i] for i in slice_eps] 40 | # new_eps = list(filter(lambda i, ep: i in slice_eps, data['episodes'])) 41 | data['episodes'] = new_eps 42 | with gzip.open(jsongz, 'wt') as f: 43 | json.dump(data, f) 44 | -------------------------------------------------------------------------------- /scripts/ddppo_8gpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=on_ddppo 3 | #SBATCH --gres gpu:8 4 | #SBATCH --nodes 1 5 | #SBATCH --cpus-per-task 5 6 | #SBATCH --ntasks-per-node 8 7 | #SBATCH --partition=long 8 | #SBATCH --constraint=titan_x 9 | #SBATCH --output=slurm_logs/ddppo-%j.out 10 | #SBATCH --error=slurm_logs/ddppo-%j.err 11 | 12 | export GLOG_minloglevel=2 13 | export MAGNUM_LOG=quiet 14 | 15 | # Unused? 16 | # SBATCH --mem=60GB 17 | # SBATCH --time=12:00 18 | # SBATCH --signal=USR1@600 19 | 20 | hostname 21 | export MASTER_ADDR=$(srun --ntasks=1 hostname 2>&1 | tail -n1) 22 | 23 | set -x 24 | if [[ $# -lt 2 ]] 25 | then 26 | echo "Expect two args to specify config file and suffix" 27 | elif [[ $# -eq 2 ]] 28 | then 29 | srun -u python -u -m habitat_baselines.run \ 30 | --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 \ 31 | --run-type train 32 | elif [[ $# -eq 3 ]] 33 | then 34 | srun -u python -u -m habitat_baselines.run \ 35 | --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 \ 36 | --ckpt-path ~/share/objectnav/$1/$1.$3.pth 37 | fi 38 | -------------------------------------------------------------------------------- /scripts/ddppo_8gpu_noconstraint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=on_ddppo 3 | #SBATCH --gres gpu:8 4 | #SBATCH --nodes 1 5 | #SBATCH --cpus-per-task 7 6 | #SBATCH --ntasks-per-node 8 7 | #SBATCH --partition=long 8 | #SBATCH --output=slurm_logs/ddppo-%j.out 9 | #SBATCH --error=slurm_logs/ddppo-%j.err 10 | 11 | export GLOG_minloglevel=2 12 | export MAGNUM_LOG=quiet 13 | 14 | # Unused? 15 | # SBATCH --mem=60GB 16 | # SBATCH --time=12:00 17 | # SBATCH --signal=USR1@600 18 | 19 | hostname 20 | export MASTER_ADDR=$(srun --ntasks=1 hostname 2>&1 | tail -n1) 21 | 22 | set -x 23 | if [[ $# -lt 2 ]] 24 | then 25 | echo "Expect two args to specify config file and suffix" 26 | elif [[ $# -eq 2 ]] 27 | then 28 | srun -u python -u -m habitat_baselines.run \ 29 | --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 \ 30 | --run-type train 31 | elif [[ $# -eq 3 ]] 32 | then 33 | srun -u python -u -m habitat_baselines.run \ 34 | --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 \ 35 | --ckpt-path ~/share/objectnav/$1/$1.$3.pth 36 | fi 37 | -------------------------------------------------------------------------------- /scripts/eval_cron.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | all_args=("$@") 4 | echo $all_args 5 | rest_args=("${all_args[@]:3}") 6 | echo ${rest_args[@]} 7 | echo "0 */6 * * * /srv/flash1/jye72/projects/embodied-recall/scripts/eval_checker.py -v $1 -s $2 -c $3 ${rest_args[@]} >> /srv/flash1/jye72/cron.log 2>&1" > crontab-fragment.txt 8 | crontab -l | cat - crontab-fragment.txt >crontab.txt && crontab crontab.txt 9 | -------------------------------------------------------------------------------- /scripts/eval_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=eval_obj 3 | #SBATCH --gres gpu:1 4 | #SBATCH -p long,user-overcap,overcap 5 | #SBATCH -A overcap 6 | #SBATCH --output=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/ddppo-eval-%j.out 7 | #SBATCH --error=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/ddppo-eval-%j.err 8 | 9 | hostname 10 | # Nope, not SBATCH --account overcap 11 | # stripped down for convenience. only supports suffix, single ckpt 12 | # specify 5 arguments 13 | if [[ $# -eq 3 ]] 14 | then 15 | all_args=("$@") 16 | echo $all_args 17 | python -u /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/run.py \ 18 | --run-type eval \ 19 | --exp-config /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/config/objectnav/$1.on.yaml \ 20 | --run-suffix $2 \ 21 | --ckpt-path /srv/share/jye72/objectnav/$1/$1.$3.pth 22 | elif [[ $# -ge 4 ]] 23 | then 24 | all_args=("$@") 25 | echo $all_args 26 | rest_args=("${all_args[@]:3}") 27 | echo ${rest_args[@]} 28 | python -u /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/run.py \ 29 | --run-type eval \ 30 | --exp-config /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/config/objectnav/$1.on.yaml \ 31 | --run-suffix $2 \ 32 | --ckpt-path /srv/share/jye72/objectnav/$1/$1.$3.pth ${rest_args[@]} 33 | else 34 | echo "Invalid config" 35 | fi 36 | -------------------------------------------------------------------------------- /scripts/eval_on.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=eval_obj 3 | #SBATCH --gres gpu:1 4 | #SBATCH -p short 5 | #SBATCH --output=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/ddppo-eval-%j.out 6 | #SBATCH --error=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/ddppo-eval-%j.err 7 | 8 | hostname 9 | 10 | # * We hardcode a python exe here to get cronjob working. A more straightforward script is available in `eval_local.sh` 11 | if [[ $# -eq 3 ]] 12 | then 13 | all_args=("$@") 14 | echo $all_args 15 | /srv/flash1/jye72/anaconda3/envs/habitat2/bin/python -u /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/run.py \ 16 | --run-type eval \ 17 | --exp-config /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/config/objectnav/$1.on.yaml \ 18 | --run-suffix $2 \ 19 | --ckpt-path /srv/share/jye72/objectnav/$1/$1.$3.pth 20 | elif [[ $# -ge 4 ]] 21 | then 22 | all_args=("$@") 23 | echo $all_args 24 | rest_args=("${all_args[@]:3}") 25 | echo ${rest_args[@]} 26 | /srv/flash1/jye72/anaconda3/envs/habitat2/bin/python -u /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/run.py \ 27 | --run-type eval \ 28 | --exp-config /srv/flash1/jye72/projects/embodied-recall/habitat_baselines/config/objectnav/$1.on.yaml \ 29 | --run-suffix $2 \ 30 | --ckpt-path /srv/share/jye72/objectnav/$1/$1.$3.pth ${rest_args[@]} 31 | else 32 | echo "Invalid config" 33 | fi 34 | -------------------------------------------------------------------------------- /scripts/launch_fp_finder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=fp_finder 3 | #SBATCH --gres gpu:1 4 | #SBATCH -p short,user-overcap,overcap 5 | #SBATCH -A overcap 6 | #SBATCH --output=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/fp_finder-%j.out 7 | #SBATCH --error=/srv/flash1/jye72/projects/embodied-recall/slurm_logs/fp_finder-%j.err 8 | all_args=("$@") 9 | echo ${all_args[@]} 10 | python -u fp_finder.py ${all_args[@]} 11 | -------------------------------------------------------------------------------- /scripts/mv_rednet.py: -------------------------------------------------------------------------------- 1 | #%% 2 | # Move files around for rednet 3 | from pathlib import Path 4 | from shutil import move 5 | 6 | detailed_paths = Path('/srv/flash1/jye72/share/objectnav_detailed') 7 | eval_paths = Path('/srv/flash1/jye72/share/objectnav_eval') 8 | 9 | KEY = 'gt_False.pth' 10 | NEW_KEY = 'gt_False_21.pth' 11 | for var_path in eval_paths.glob("*"): 12 | # for var_path in detailed_paths.glob("*"): 13 | for ckpt in var_path.glob("*"): 14 | for val in ckpt.glob("*"): 15 | val = str(val) 16 | if KEY in val: 17 | new_path = val[:-len(KEY)] + NEW_KEY 18 | move(val, new_path) 19 | 20 | -------------------------------------------------------------------------------- /scripts/obj_consts.py: -------------------------------------------------------------------------------- 1 | variant_labels = { 2 | # "split-curric": "Split", 3 | "split_120-curric": "Split", 4 | } 5 | 6 | leaf_labels = { 7 | "pred_sem": "Predict Sem", 8 | "gt_sem": "GT Sem", 9 | } 10 | 11 | def get_variant_labels(variant, labels=variant_labels, is_gt=False): 12 | stem_leaf = variant.split('/') 13 | stem = stem_leaf[0] 14 | leaf = "/".join(stem_leaf[1:]) 15 | stem_label = labels.get(stem, variant) 16 | if len(leaf) == 0: 17 | leaf_label = leaf_labels['gt_sem' if is_gt else 'pred_sem'] 18 | else: 19 | leaf_label = leaf_labels.get(leaf, leaf) 20 | return f"{stem_label} - {leaf_label}" 21 | 22 | key_labels = { "spl": "SPL - Train", 23 | "success": "Success - Train", 24 | "eval_spl": "SPL - Val", 25 | "eval_success": "Success - Val", 26 | "eval_coverage": "Coverage - Val", 27 | "eval_steps": "Steps - Val", 28 | 'eval_distance_to_goal': "D2G - Val" 29 | } 30 | axis_labels = { 31 | "spl": "SPL", 32 | "eval_spl": "SPL", 33 | "success": "Success", 34 | "eval_success": "Success", 35 | "eval_coverage": "Coverage" 36 | } 37 | 38 | plot_key_folder_dict = { 39 | 'eval_spl': 'eval_metrics_spl/', 40 | 'eval_success': 'eval_metrics_success/', 41 | 'eval_distance_to_goal': 'eval_metrics_distance_to_goal/', 42 | 'eval_coverage': 'eval_metrics_coverage.reached/', 43 | 'eval_steps': 'eval_metrics_coverage.step/', 44 | 'eval_': 'eval_metrics_coverage.steps/', 45 | } 46 | 47 | def get_obj_label(key): 48 | words = key.split("_") 49 | return " ".join(map(lambda w: str(w[0]).upper() + w[1:], words)) 50 | -------------------------------------------------------------------------------- /scripts/train_no_ckpt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=gc 3 | #SBATCH --gres gpu:1 4 | #SBATCH -p long 5 | 6 | hostname 7 | if [[ $# -lt 2 ]] 8 | then 9 | echo "Expect two args to specify config file and suffix" 10 | elif [[ $# -eq 2 ]] 11 | then 12 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 13 | elif [[ $# -ge 3 ]] 14 | then 15 | all_args=("$@") 16 | rest_args=("${all_args[@]:2}") 17 | echo ${rest_args[@]} 18 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 ${rest_args[@]} 19 | fi 20 | -------------------------------------------------------------------------------- /scripts/train_on_suffix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=gc 3 | #SBATCH --gres gpu:1 4 | #SBATCH -p long 5 | 6 | hostname 7 | if [[ $# -lt 2 ]] 8 | then 9 | echo "Expect two args to specify config file and suffix" 10 | elif [[ $# -eq 2 ]] 11 | then 12 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 13 | elif [[ $# -eq 3 ]] 14 | then 15 | python -u -m habitat_baselines.run \ 16 | --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 \ 17 | --ckpt-path ~/share/objectnav/$1/$1.$3.pth 18 | elif [[ $# -ge 4 ]] 19 | then 20 | all_args=("$@") 21 | rest_args=("${all_args[@]:2}") 22 | echo ${rest_args[@]} 23 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 ${rest_args[@]} 24 | fi -------------------------------------------------------------------------------- /scripts/wipe_on.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=gc 3 | #SBATCH --gres gpu:1 4 | hostname 5 | if [[ $# -lt 2 ]] 6 | then 7 | echo "Expect two args to specify config file and suffix" 8 | elif [[ $# -eq 2 ]] 9 | then 10 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 --wipe-only True 11 | elif [[ $# -eq 3 ]] 12 | then 13 | python -u habitat_baselines/run.py --run-type train --exp-config habitat_baselines/config/objectnav/$1.on.yaml --run-suffix $2 --ckpt-path ~/share/objectnav/$1/$1.$3.pth --wipe-only True 14 | fi -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | test=pytest 3 | 4 | [tool:pytest] 5 | addopts = --verbose -rsxX -q --cov-report=xml --cov=./ 6 | testpaths = test 7 | -------------------------------------------------------------------------------- /test/test_baseline_agents.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import os 8 | 9 | import pytest 10 | 11 | import habitat 12 | from habitat.config import Config as CN 13 | 14 | try: 15 | from habitat_baselines.agents import ppo_agents, simple_agents 16 | 17 | baseline_installed = True 18 | except ImportError: 19 | baseline_installed = False 20 | 21 | CFG_TEST = "configs/test/habitat_all_sensors_test.yaml" 22 | 23 | 24 | @pytest.mark.skipif( 25 | not baseline_installed, reason="baseline sub-module not installed" 26 | ) 27 | def test_ppo_agents(): 28 | 29 | agent_config = ppo_agents.get_default_config() 30 | agent_config.MODEL_PATH = "" 31 | agent_config.defrost() 32 | config_env = habitat.get_config(config_paths=CFG_TEST) 33 | if not os.path.exists(config_env.SIMULATOR.SCENE): 34 | pytest.skip("Please download Habitat test data to data folder.") 35 | 36 | benchmark = habitat.Benchmark(config_paths=CFG_TEST) 37 | 38 | for input_type in ["blind", "rgb", "depth", "rgbd"]: 39 | for resolution in [256, 384]: 40 | config_env.defrost() 41 | config_env.SIMULATOR.AGENT_0.SENSORS = [] 42 | if input_type in ["rgb", "rgbd"]: 43 | config_env.SIMULATOR.AGENT_0.SENSORS += ["RGB_SENSOR"] 44 | agent_config.RESOLUTION = resolution 45 | config_env.SIMULATOR.RGB_SENSOR.WIDTH = resolution 46 | config_env.SIMULATOR.RGB_SENSOR.HEIGHT = resolution 47 | if input_type in ["depth", "rgbd"]: 48 | config_env.SIMULATOR.AGENT_0.SENSORS += ["DEPTH_SENSOR"] 49 | agent_config.RESOLUTION = resolution 50 | config_env.SIMULATOR.DEPTH_SENSOR.WIDTH = resolution 51 | config_env.SIMULATOR.DEPTH_SENSOR.HEIGHT = resolution 52 | 53 | config_env.freeze() 54 | 55 | del benchmark._env 56 | benchmark._env = habitat.Env(config=config_env) 57 | agent_config.INPUT_TYPE = input_type 58 | 59 | agent = ppo_agents.PPOAgent(agent_config) 60 | habitat.logger.info(benchmark.evaluate(agent, num_episodes=10)) 61 | 62 | 63 | @pytest.mark.skipif( 64 | not baseline_installed, reason="baseline sub-module not installed" 65 | ) 66 | def test_simple_agents(): 67 | config_env = habitat.get_config(config_paths=CFG_TEST) 68 | 69 | if not os.path.exists(config_env.SIMULATOR.SCENE): 70 | pytest.skip("Please download Habitat test data to data folder.") 71 | 72 | benchmark = habitat.Benchmark(config_paths=CFG_TEST) 73 | 74 | for agent_class in [ 75 | simple_agents.ForwardOnlyAgent, 76 | simple_agents.GoalFollower, 77 | simple_agents.RandomAgent, 78 | simple_agents.RandomForwardAgent, 79 | ]: 80 | agent = agent_class( 81 | config_env.TASK.SUCCESS_DISTANCE, config_env.TASK.GOAL_SENSOR_UUID 82 | ) 83 | habitat.logger.info(agent_class.__name__) 84 | habitat.logger.info(benchmark.evaluate(agent, num_episodes=100)) 85 | 86 | benchmark._env.close() 87 | -------------------------------------------------------------------------------- /test/test_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from habitat.config.default import get_config 8 | 9 | CFG_TEST = "configs/test/habitat_all_sensors_test.yaml" 10 | CFG_EQA = "configs/test/habitat_mp3d_eqa_test.yaml" 11 | CFG_NEW_KEYS = "configs/test/new_keys_test.yaml" 12 | MAX_TEST_STEPS_LIMIT = 3 13 | 14 | 15 | def test_merged_configs(): 16 | test_config = get_config(CFG_TEST) 17 | eqa_config = get_config(CFG_EQA) 18 | merged_config = get_config("{},{}".format(CFG_TEST, CFG_EQA)) 19 | assert merged_config.TASK.TYPE == eqa_config.TASK.TYPE 20 | assert ( 21 | merged_config.ENVIRONMENT.MAX_EPISODE_STEPS 22 | == test_config.ENVIRONMENT.MAX_EPISODE_STEPS 23 | ) 24 | 25 | 26 | def test_new_keys_merged_configs(): 27 | test_config = get_config(CFG_TEST) 28 | new_keys_config = get_config(CFG_NEW_KEYS) 29 | merged_config = get_config("{},{}".format(CFG_TEST, CFG_NEW_KEYS)) 30 | assert ( 31 | merged_config.TASK.MY_NEW_TASK_PARAM 32 | == new_keys_config.TASK.MY_NEW_TASK_PARAM 33 | ) 34 | assert ( 35 | merged_config.ENVIRONMENT.MAX_EPISODE_STEPS 36 | == test_config.ENVIRONMENT.MAX_EPISODE_STEPS 37 | ) 38 | 39 | 40 | def test_overwrite_options(): 41 | for steps_limit in range(MAX_TEST_STEPS_LIMIT): 42 | config = get_config( 43 | config_paths=CFG_TEST, 44 | opts=["ENVIRONMENT.MAX_EPISODE_STEPS", steps_limit], 45 | ) 46 | assert ( 47 | config.ENVIRONMENT.MAX_EPISODE_STEPS == steps_limit 48 | ), "Overwriting of config options failed." 49 | -------------------------------------------------------------------------------- /test/test_demo_notebook.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | import gc 7 | 8 | import pytest 9 | 10 | import habitat 11 | from habitat.datasets.pointnav.pointnav_dataset import PointNavDatasetV1 12 | 13 | 14 | def test_demo_notebook(): 15 | config = habitat.get_config("configs/tasks/pointnav_mp3d.yaml") 16 | config.defrost() 17 | config.DATASET.SPLIT = "val" 18 | 19 | if not PointNavDatasetV1.check_config_paths_exist(config.DATASET): 20 | pytest.skip( 21 | "Please download the Matterport3D PointNav val dataset and Matterport3D val scenes" 22 | ) 23 | else: 24 | pytest.main(["--nbval-lax", "notebooks/habitat-lab-demo.ipynb"]) 25 | 26 | # NB: Force a gc collect run as it can take a little bit for 27 | # the cleanup to happen after the notebook and we get 28 | # a double context crash! 29 | gc.collect() 30 | -------------------------------------------------------------------------------- /test/test_habitat_example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import pytest 8 | 9 | import habitat 10 | from examples import ( 11 | new_actions, 12 | register_new_sensors_and_measures, 13 | shortest_path_follower_example, 14 | visualization_examples, 15 | ) 16 | from examples.example import example 17 | from habitat.datasets.pointnav.pointnav_dataset import PointNavDatasetV1 18 | 19 | 20 | def test_readme_example(): 21 | if not PointNavDatasetV1.check_config_paths_exist( 22 | config=habitat.get_config().DATASET 23 | ): 24 | pytest.skip("Please download Habitat test data to data folder.") 25 | example() 26 | 27 | 28 | def test_visualizations_example(): 29 | if not PointNavDatasetV1.check_config_paths_exist( 30 | config=habitat.get_config().DATASET 31 | ): 32 | pytest.skip("Please download Habitat test data to data folder.") 33 | visualization_examples.main() 34 | 35 | 36 | def test_shortest_path_follower_example(): 37 | if not PointNavDatasetV1.check_config_paths_exist( 38 | config=habitat.get_config().DATASET 39 | ): 40 | pytest.skip("Please download Habitat test data to data folder.") 41 | shortest_path_follower_example.main() 42 | 43 | 44 | def test_register_new_sensors_and_measures(): 45 | if not PointNavDatasetV1.check_config_paths_exist( 46 | config=habitat.get_config().DATASET 47 | ): 48 | pytest.skip("Please download Habitat test data to data folder.") 49 | 50 | register_new_sensors_and_measures.main() 51 | 52 | 53 | def test_new_actions(): 54 | if not PointNavDatasetV1.check_config_paths_exist( 55 | config=habitat.get_config().DATASET 56 | ): 57 | pytest.skip("Please download Habitat test data to data folder.") 58 | 59 | new_actions.main() 60 | -------------------------------------------------------------------------------- /test/test_install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import habitat 8 | from habitat.core.logging import logger 9 | 10 | 11 | def test_habitat_install(): 12 | r"""dummy test for testing installation 13 | """ 14 | logger.info(str(habitat)) 15 | -------------------------------------------------------------------------------- /test/test_profiling_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | 8 | import importlib 9 | import os 10 | import sys 11 | 12 | from habitat.utils import profiling_utils 13 | 14 | env_var_name = "HABITAT_PROFILING" 15 | 16 | # Based on the env var, reloading the profiling_utils module should set 17 | # profiling_utils.enable_profiling to True or False. 18 | def test_env_var_enable(): 19 | 20 | # test with env var not set 21 | os.environ.pop(env_var_name, None) 22 | importlib.reload(profiling_utils) 23 | assert not profiling_utils.enable_profiling 24 | # We also call range_push/range_pop to verify they run without error. 25 | profiling_utils.range_push("test, env var not set") 26 | profiling_utils.range_pop() 27 | 28 | # test with env var set to "0". This is equivalent to 29 | # `export HABITAT_PROFILING=0` on the command line. 30 | os.environ[env_var_name] = "0" 31 | importlib.reload(profiling_utils) 32 | assert not profiling_utils.enable_profiling 33 | profiling_utils.range_push("test, HABITAT_PROFILING='0'") 34 | profiling_utils.range_pop() 35 | 36 | # test with env var set to "1" 37 | os.environ[env_var_name] = "1" 38 | importlib.reload(profiling_utils) 39 | assert profiling_utils.enable_profiling 40 | profiling_utils.range_push("test, HABITAT_PROFILING=True") 41 | profiling_utils.range_pop() 42 | 43 | 44 | # Create nested ranges and verify the code runs without error. 45 | def test_nested_range_push_pop(): 46 | # Unfortunately, there isn't a way to verify correct behavior here. Ranges 47 | # get recorded in the Nvidia driver/profiler. Documentation for 48 | # torch.cuda.nvtx.range_push claims that it returns range stack depth, so I 49 | # hoped to use it as a behavior checker, but it seems to just return -1 or 50 | # -2 in practice. 51 | 52 | os.environ[env_var_name] = "1" 53 | importlib.reload(profiling_utils) 54 | 55 | profiling_utils.range_push("A") 56 | profiling_utils.range_push("B") 57 | profiling_utils.range_push("C") 58 | profiling_utils.range_pop() 59 | profiling_utils.range_pop() 60 | profiling_utils.range_pop() 61 | 62 | 63 | # Create ranges via RangeContext and verify the code runs without error. 64 | def test_range_context(): 65 | 66 | os.environ[env_var_name] = "1" 67 | importlib.reload(profiling_utils) 68 | 69 | with profiling_utils.RangeContext("A"): 70 | pass 71 | 72 | @profiling_utils.RangeContext("B") 73 | def my_example_profiled_function(): 74 | pass 75 | 76 | my_example_profiled_function() 77 | 78 | with profiling_utils.RangeContext("C"): 79 | my_example_profiled_function() 80 | with profiling_utils.RangeContext("D"): 81 | my_example_profiled_function() 82 | -------------------------------------------------------------------------------- /test/test_pyrobot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | import sys 6 | 7 | import mock 8 | import numpy as np 9 | 10 | from habitat.config.default import get_config 11 | from habitat.sims import make_sim 12 | 13 | 14 | class CameraMock: 15 | def get_rgb(self): 16 | return np.zeros((256, 256, 3)) 17 | 18 | def get_depth(self): 19 | return np.zeros((256, 256, 1)) 20 | 21 | def reset(self): 22 | pass 23 | 24 | def step(self, *args, **kwargs): 25 | pass 26 | 27 | 28 | class RobotMock: 29 | def __init__(self, *args, **kwargs): 30 | self.camera = CameraMock() 31 | self.base = BaseMock() 32 | 33 | 34 | class BaseMock: 35 | def __init__(self, *args, **kwargs): 36 | self.base_state = mock.MagicMock() 37 | self.base_state.bumper = False 38 | 39 | def go_to_relative(self, *args, **kwargs): 40 | pass 41 | 42 | 43 | def test_pyrobot(mocker): 44 | if "pyrobot" not in sys.modules: 45 | # Mock pyrobot package if it is not installed 46 | mock_pyrobot = mocker.MagicMock() 47 | mock_pyrobot.Robot = RobotMock 48 | sys.modules["pyrobot"] = mock_pyrobot 49 | 50 | # Re-register pyrobot with mock 51 | from habitat.sims.registration import _try_register_pyrobot 52 | 53 | _try_register_pyrobot() 54 | 55 | config = get_config() 56 | with make_sim("PyRobot-v0", config=config.PYROBOT) as reality: 57 | 58 | observations = reality.reset() 59 | observations = reality.step( 60 | "go_to_relative", 61 | { 62 | "xyt_position": [0, 0, (10 / 180) * np.pi], 63 | "use_map": False, 64 | "close_loop": True, 65 | "smooth": False, 66 | }, 67 | ) 68 | -------------------------------------------------------------------------------- /test/test_spaces.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import gym 8 | import pytest 9 | 10 | from habitat.core.spaces import ActionSpace, EmptySpace, ListSpace 11 | 12 | 13 | def test_empty_space(): 14 | space = EmptySpace() 15 | assert space.contains(space.sample()) 16 | assert space.contains(None) 17 | assert not space.contains(0) 18 | 19 | 20 | def test_action_space(): 21 | space = ActionSpace( 22 | { 23 | "move": gym.spaces.Dict( 24 | { 25 | "position": gym.spaces.Discrete(2), 26 | "velocity": gym.spaces.Discrete(3), 27 | } 28 | ), 29 | "move_forward": EmptySpace(), 30 | } 31 | ) 32 | assert space.contains(space.sample()) 33 | assert space.contains( 34 | {"action": "move", "action_args": {"position": 0, "velocity": 1}} 35 | ) 36 | assert space.contains({"action": "move_forward"}) 37 | assert not space.contains([0, 1, 2]) 38 | assert not space.contains({"zero": None}) 39 | assert not space.contains({"action": "bad"}) 40 | assert not space.contains({"action": "move"}) 41 | assert not space.contains( 42 | {"action": "move", "action_args": {"position": 0}} 43 | ) 44 | assert not space.contains( 45 | {"action": "move_forward", "action_args": {"position": 0}} 46 | ) 47 | 48 | 49 | def test_list_space(): 50 | space = ListSpace(gym.spaces.Discrete(2), 5, 10) 51 | assert space.contains(space.sample()) 52 | assert not space.contains(0) 53 | assert not space.contains([0] * 4) 54 | assert not space.contains([2] * 5) 55 | assert not space.contains([1] * 11) 56 | -------------------------------------------------------------------------------- /test/test_visual_utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import numpy as np 8 | 9 | from habitat.utils.visualizations.utils import observations_to_image 10 | 11 | 12 | def test_observations_to_image(): 13 | observations = { 14 | "rgb": np.random.rand(200, 400, 3), 15 | "depth": np.random.rand(200, 400, 1), 16 | } 17 | info = { 18 | "collisions": {"is_collision": True}, 19 | "top_down_map": { 20 | "map": np.random.randint(low=0, high=255, size=(300, 300)), 21 | "fog_of_war_mask": np.random.randint( 22 | low=0, high=1, size=(300, 300) 23 | ), 24 | "agent_map_coord": (10, 10), 25 | "agent_angle": np.random.random(), 26 | }, 27 | } 28 | image = observations_to_image(observations, info) 29 | assert image.shape == ( 30 | 200, 31 | 1000, 32 | 3, 33 | ), "Resulted image resolution doesn't match." 34 | --------------------------------------------------------------------------------