Skip to content

Commit 5d76902

Browse files
Public Release
0 parents  commit 5d76902

36 files changed

Lines changed: 5119 additions & 0 deletions

.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# vim
132+
*.swo
133+
*.swp
134+
135+
.idea/
136+
.vscode/
137+
*.DS_Store
138+
139+
# Data and log folders
140+
saved/
141+
tmp/
142+
pretrained_models/
143+
data/
144+
data

Dockerfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
htop \
22+
tmux \
23+
unzip &&\
24+
rm -rf /var/lib/apt/lists/*
25+
26+
# Install conda
27+
RUN wget -O $HOME/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh &&\
28+
chmod +x ~/miniconda.sh &&\
29+
~/miniconda.sh -b -p /custom/conda &&\
30+
rm ~/miniconda.sh &&\
31+
/custom/conda/bin/conda install numpy pyyaml scipy ipython mkl mkl-include &&\
32+
/custom/conda/bin/conda clean -ya
33+
ENV PATH /custom/conda/bin:$PATH
34+
35+
# Install cmake
36+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh
37+
RUN mkdir /opt/cmake
38+
RUN sh /cmake-3.14.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
39+
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
40+
RUN cmake --version
41+
42+
# Setup habitat-sim
43+
RUN git clone https://github.com/facebookresearch/habitat-sim.git
44+
RUN /bin/bash -c "cd habitat-sim; git checkout tags/v0.1.5; pip install -r requirements.txt; python setup.py install --headless --with-cuda"
45+
46+
# Install challenge specific habitat-api
47+
RUN git clone https://github.com/facebookresearch/habitat-api.git
48+
RUN /bin/bash -c "cd habitat-api; git checkout tags/v0.1.5; pip install -e ."
49+
RUN /bin/bash -c "cd habitat-api; wget http://dl.fbaipublicfiles.com/habitat/habitat-test-scenes.zip; unzip habitat-test-scenes.zip"
50+
51+
# Silence habitat-sim logs
52+
ENV GLOG_minloglevel=2
53+
ENV MAGNUM_LOG="quiet"
54+
55+
# Install project specific packages
56+
RUN /bin/bash -c "apt-get update; apt-get install -y libsm6 libxext6 libxrender-dev; pip install opencv-python"
57+
RUN /bin/bash -c "pip install --upgrade cython numpy"
58+
RUN /bin/bash -c "pip install matplotlib seaborn==0.9.0 scikit-fmm==2019.1.30 scikit-image==0.15.0 imageio==2.6.0 scikit-learn==0.22.2.post1 ifcfg"
59+
60+
# Install pytorch and torch_scatter
61+
RUN conda install pytorch=1.6.0 torchvision=0.7.0 cudatoolkit=10.2 -c pytorch
62+
RUN /bin/bash -c "pip install torch_scatter"
63+
64+
# Install detectron2
65+
RUN /bin/bash -c "python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.6/index.html"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Devendra Chaplot
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.

README.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Object Goal Navigation using Goal-Oriented Semantic Exploration
2+
This is a PyTorch implementation of the NeurIPS-20 paper:
3+
4+
[Object Goal Navigation using Goal-Oriented Semantic Exploration](https://arxiv.org/pdf/2007.00643.pdf)<br />
5+
Devendra Singh Chaplot, Dhiraj Gandhi, Abhinav Gupta, Ruslan Salakhutdinov<br />
6+
Carnegie Mellon University, Facebook AI Research
7+
8+
Winner of the [CVPR 2020 Habitat ObjectNav Challenge](https://aihabitat.org/challenge/2020/).
9+
10+
Project Website: https://devendrachaplot.github.io/projects/semantic-exploration
11+
12+
![example](./docs/example.gif)
13+
14+
### Overview:
15+
The Goal-Oriented Semantic Exploration (SemExp) model consists of three modules: a Semantic Mapping Module, a Goal-Oriented Semantic Policy, and a deterministic Local Policy.
16+
As shown below, the Semantic Mapping model builds a semantic map over time. The Goal-Oriented Semantic Policy selects a long-term goal based on the semantic
17+
map to reach the given object goal efficiently. A deterministic local policy based on analytical planners is used to take low-level navigation actions to reach the long-term goal.
18+
19+
![overview](./docs/overview.jpg)
20+
21+
### This repository contains:
22+
- Episode train and test datasets for [Object Goal Navigation](https://arxiv.org/pdf/2007.00643.pdf) task for the Gibson dataset in the Habitat Simulator.
23+
- The code to train and evaluate the Semantic Exploration (SemExp) model on the Object Goal Navigation task.
24+
- Pretrained SemExp model.
25+
26+
## Installing Dependencies
27+
- We use earlier versions of [habitat-sim](https://github.com/facebookresearch/habitat-sim) and [habitat-lab](https://github.com/facebookresearch/habitat-lab) as specified below:
28+
29+
Installing habitat-sim:
30+
```
31+
git clone https://github.com/facebookresearch/habitat-sim.git
32+
cd habitat-sim; git checkout tags/v0.1.5;
33+
pip install -r requirements.txt;
34+
python setup.py install --headless
35+
python setup.py install # (for Mac OS)
36+
```
37+
38+
Installing habitat-lab:
39+
```
40+
git clone https://github.com/facebookresearch/habitat-lab.git
41+
cd habitat-lab; git checkout tags/v0.1.5;
42+
pip install -e .
43+
```
44+
Check habitat installation by running `python examples/benchmark.py` in the habitat-lab folder.
45+
46+
- Install [pytorch](https://pytorch.org/) according to your system configuration. The code is tested on pytorch v1.6.0 and cudatoolkit v10.2. If you are using conda:
47+
```
48+
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 #(Linux with GPU)
49+
conda install pytorch==1.6.0 torchvision==0.7.0 -c pytorch #(Mac OS)
50+
```
51+
52+
- Install [detectron2](https://github.com/facebookresearch/detectron2/) according to your system configuration. If you are using conda:
53+
```
54+
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.6/index.html #(Linux with GPU)
55+
CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' #(Mac OS)
56+
```
57+
58+
### Docker and Singularity images:
59+
We provide experimental [docker](https://www.docker.com/) and [singularity](https://sylabs.io/) images with all the dependencies installed, see [Docker Instructions](./docs/DOCKER_INSTRUCTIONS.md).
60+
61+
62+
## Setup
63+
Clone the repository and install other requirements:
64+
```
65+
git clone https://github.com/devendrachaplot/Object-Goal-Navigation/
66+
cd Object-Goal-Navigation/;
67+
pip install -r requirements.txt
68+
```
69+
70+
### Downloading scene dataset
71+
- Download the Gibson dataset using the instructions here: https://github.com/facebookresearch/habitat-lab#scenes-datasets (download the 11GB file `gibson_habitat_trainval.zip`)
72+
- Move the Gibson scene dataset or create a symlink at `data/scene_datasets/gibson_semantic`.
73+
74+
### Downloading episode dataset
75+
- Download the episode dataset:
76+
```
77+
wget --no-check-certificate 'https://drive.google.com/uc?export=download&id=1tslnZAkH8m3V5nP8pbtBmaR2XEfr8Rau' -O objectnav_gibson_v1.1.zip
78+
```
79+
- Unzip the dataset into `data/datasets/objectnav/gibson/v1.1/`
80+
81+
### Setting up datasets
82+
The code requires the datasets in a `data` folder in the following format (same as habitat-lab):
83+
```
84+
Object-Goal-Navigation/
85+
data/
86+
scene_datasets/
87+
gibson_semantic/
88+
Adrian.glb
89+
Adrian.navmesh
90+
...
91+
datasets/
92+
objectnav/
93+
gibson/
94+
v1.1/
95+
train/
96+
val/
97+
```
98+
99+
100+
### Test setup
101+
To verify that the data is setup correctly, run:
102+
```
103+
python test.py --agent random -n1 --num_eval_episodes 1 --auto_gpu_config 0
104+
```
105+
106+
## Usage
107+
108+
### Training:
109+
For training the SemExp model on the Object Goal Navigation task:
110+
```
111+
python main.py
112+
```
113+
114+
### Downloading pre-trained models
115+
```
116+
mkdir pretrained_models;
117+
wget --no-check-certificate 'https://drive.google.com/uc?export=download&id=171ZA7XNu5vi3XLpuKs8DuGGZrYyuSjL0' -O pretrained_models/sem_exp.pth
118+
```
119+
120+
### For evaluation:
121+
For evaluating the pre-trained model:
122+
```
123+
python main.py --split val --eval 1 --load pretrained_models/sem_exp.pth
124+
```
125+
126+
For visualizing the agent observations and predicted semantic map, add `-v 1` as an argument to the above command.
127+
128+
The pre-trained model should get 0.657 Success, 0.339 SPL and 1.474 DTG.
129+
130+
For more detailed instructions, see [INSTRUCTIONS](./docs/INSTRUCTIONS.md).
131+
132+
133+
## Cite as
134+
>Chaplot, D.S., Gandhi, D., Gupta, A. and Salakhutdinov, R., 2020. Object Goal Navigation using Goal-Oriented Semantic Exploration. In Neural Information Processing Systems (NeurIPS-20). ([PDF](https://arxiv.org/pdf/2007.00643.pdf))
135+
136+
### Bibtex:
137+
```
138+
@inproceedings{chaplot2020object,
139+
title={Object Goal Navigation using Goal-Oriented Semantic Exploration},
140+
author={Chaplot, Devendra Singh and Gandhi, Dhiraj and
141+
Gupta, Abhinav and Salakhutdinov, Ruslan},
142+
booktitle={In Neural Information Processing Systems (NeurIPS)},
143+
year={2020}
144+
}
145+
```
146+
147+
## Related Projects
148+
- This project builds on the [Active Neural SLAM](https://devendrachaplot.github.io/projects/Neural-SLAM) paper. The code and pretrained models for the Active Neural SLAM system are available at:
149+
https://github.com/devendrachaplot/Neural-SLAM.
150+
- The Semantic Mapping module is similar to the one used in [Semantic Curiosity](https://devendrachaplot.github.io/projects/SemanticCuriosity).
151+
152+
## Acknowledgements
153+
This repository uses [Habitat Lab](https://github.com/facebookresearch/habitat-lab) implementation for running the RL environment.
154+
The implementation of PPO is borrowed from [ikostrikov/pytorch-a2c-ppo-acktr-gail](https://github.com/ikostrikov/pytorch-a2c-ppo-acktr-gail/).
155+
The Mask-RCNN implementation is based on the [detectron2](https://github.com/facebookresearch/detectron2/) repository. We would also like to thank Shubham Tulsiani and Saurabh Gupta for their help in implementing some parts of the code.

0 commit comments

Comments
 (0)