Skip to content

Commit

Permalink
Added Habitat challenge tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
mathfac committed Aug 18, 2020
1 parent 107a9e1 commit a96e0f4
Showing 1 changed file with 353 additions and 0 deletions.
353 changes: 353 additions & 0 deletions examples/tutorials/colabs/habitat_challenge.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,353 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "_IITeNkkkqPW"
},
"source": [
"# Habitat Challenge Tutorial\n",
"\n",
"## Challenge page: https://aihabitat.org/challenge/2020/\n",
"\n",
"## Challenge starter code: https://github.com/facebookresearch/habitat-challenge"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "q_jhuelCX8CC"
},
"source": [
"# Install dependencies:\n",
"\n",
"* git, wget, zip\n",
"* Nvidia drivers and CUDA\n",
"* Conda\n",
"* Docker\n",
"* Nvidia Docker v2\n",
"* EvalAI and auth token:\n",
"![set_token_screen](https://drive.google.com/uc?id=1LcJCIW6MNtvv52Gbs6VcqFWnJIGqvraI)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 4318
},
"colab_type": "code",
"id": "VV-s1jvpstej",
"outputId": "affb4ce9-d73a-478a-bd8c-6b760658bb6f"
},
"outputs": [],
"source": [
"# Install dependencies\n",
"!sudo apt-get update || true\n",
"!sudo apt-get install -y --no-install-recommends \\\n",
" build-essential \\\n",
" git \\\n",
" curl \\\n",
" vim \\\n",
" ca-certificates \\\n",
" pkg-config \\\n",
" wget \\\n",
" zip \\\n",
" unzip || true\n",
"\n",
"# Install nvidia drivers and cuda\n",
"!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb\n",
"!sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb\n",
"!sudo apt-get update || true\n",
"!sudo apt-get --yes --force-yes install cuda\n",
"!touch ./cuda_installed\n",
"!nvidia-smi\n",
"\n",
"# Install conda and dependencies\n",
"!curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
"!chmod +x ~/miniconda.sh\n",
"!~/miniconda.sh -b -p $HOME/miniconda\n",
"!rm ~/miniconda.sh\n",
"!export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH\n",
"!conda create -y -n habitat python=3.6\n",
"!. activate habitat\n",
"\n",
"# Install Docker\n",
"!export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH\n",
"!. activate habitat;\n",
"!curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n",
"!sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"\n",
"!sudo apt-get update\n",
"!sudo apt-get install -y docker-ce\n",
"!apt-cache policy docker-ce\n",
"\n",
"# Install Nvidia Docker\n",
"!curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -\n",
"!distribution=$(. /etc/os-release;echo $ID$VERSION_ID)\n",
"!curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \\\n",
" sudo tee /etc/apt/sources.list.d/nvidia-docker.list\n",
"!sudo apt-get update\n",
"!sudo apt-get install nvidia-docker2\n",
"!sudo pkill -SIGHUP dockerd\n",
"\n",
"\n",
"# EvlaAI install\n",
"!pip install \"evalai>=1.2.3\"\n",
"# Set EvalAI account token\n",
"!evalai set_token $EVALAI_TOKEN"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "qsFJHfS0X500"
},
"source": [
"# Clone habitat-challenge repo and download required data:\n",
"\n",
"* Clone https://github.com/facebookresearch/habitat-challenge\n",
"* Gibson scenes dataset from https://github.com/StanfordVL/GibsonEnv#database after signing an agreement.\n",
"* Task episodes dataset: PointNav v2 episodes for Gibson scenes\n",
"* DDPPO baseline pretrained checkpoint\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 2227
},
"colab_type": "code",
"id": "5i4MQULFGOip",
"outputId": "71790946-c57d-4a0c-a121-e2fd7d79b548"
},
"outputs": [],
"source": [
"%cd ~\n",
"!sudo rm -rf habitat-challenge\n",
"!git clone https://github.com/facebookresearch/habitat-challenge\n",
"%cd habitat-challenge\n",
"\n",
"# Download Gibson scenes dataset from https://github.com/StanfordVL/GibsonEnv#database after signing an agreement\n",
"!mkdir -p habitat-challenge-data/data/scene_datasets\n",
"!cp -r $PATH_TO_SCENE_DATASETS habitat-challenge-data/data/\n",
"\n",
"#Task episodes dataset: PointNav v2 episodes for Gibson\n",
"!mkdir -p habitat-challenge-data/data/datasets/pointnav/gibson\n",
"!wget -c https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/gibson/v2/pointnav_gibson_v2.zip && unzip -o pointnav_gibson_v2.zip -d habitat-challenge-data/data/datasets/pointnav/gibson\n",
"\n",
"# DDPPO baseline\n",
"!wget https://dl.fbaipublicfiles.com/habitat/data/baselines/v1/ddppo_pointnav_habitat2020_challenge_baseline_v1.pth\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Gzqn6wk_cSz_"
},
"source": [
"# Build Docker image Pointnav_DDPPO_baseline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 989
},
"colab_type": "code",
"id": "m9q24eQRVaf0",
"outputId": "5ff512a4-a03a-432b-d75e-a5c49e31059a"
},
"outputs": [],
"source": [
"!cat Pointnav_DDPPO_baseline.Dockerfile\n",
"!docker build . --file Pointnav_DDPPO_baseline.Dockerfile -t ddppo_pointnav_submission"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "b3KyhYAPcfZp"
},
"source": [
"# Run evaluation locally (takes 5 min)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"colab_type": "code",
"id": "BxsNRqokUYuQ",
"outputId": "301a8d0d-879b-4cc6-b301-e59e35539b87"
},
"outputs": [],
"source": [
"!./test_locally_pointnav_rgbd.sh --docker-name ddppo_pointnav_submission"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Ru5Itf1wd0Vr"
},
"source": [
"# Push docker image to EvalAI Validation mini_val stage (50 episodes)\n",
"Check results on [the PointGoalNav v2 Minival stage leaderboard](https://evalai.cloudcv.org/web/challenges/challenge-page/580/leaderboard/1630).\n",
"\n",
"![leaderboard](https://drive.google.com/uc?id=1cvdEfAkNrTRA9GLtfizgIylwk_tgHigU)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1686
},
"colab_type": "code",
"id": "RcE52oXnGY9e",
"outputId": "3cb8cda5-9343-4fb3-88a9-e1586fbee377"
},
"outputs": [],
"source": [
"!evalai push ddppo_pointnav_submission:latest --phase habitat20-pointnav-minival\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "CSC8uhwheY0P"
},
"source": [
"# Push docker image to EvalAI Test stage\n",
"*Can take up to 36 hours to get result.*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1632
},
"colab_type": "code",
"id": "KX_jNLEJZis3",
"outputId": "29c7158c-70d4-44de-8952-282ff960f4dc"
},
"outputs": [],
"source": [
"# Push docker image to EvalAI docker registry\n",
"!evalai push ddppo_pointnav_submission:latest --phase habitat20-pointnav-test-std"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 170
},
"colab_type": "code",
"id": "R1BEe2Mej_b9",
"outputId": "bcafddad-ebc8-4404-c555-eff52289c7da"
},
"outputs": [],
"source": [
"!evalai submission 94203"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "dpkAssTGkHdF"
},
"source": [
"# Happy hacking!"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "rnb8-GScZiuB"
},
"source": [
"\n",
"# Citing Habitat Challenge 2020\n",
"Please cite [the following paper](https://arxiv.org/abs/1912.06321) for details about the 2020 PointNav challenge:\n",
"\n",
"```\n",
"@inproceedings{habitat2020sim2real,\n",
" title = {Are {W}e {M}aking {R}eal {P}rogress in {S}imulated {E}nvironments? {M}easuring the {S}im2{R}eal {G}ap in {E}mbodied {V}isual {N}avigation},\n",
" author = {{Abhishek Kadian*} and {Joanne Truong*} and Aaron Gokaslan and Alexander Clegg and Erik Wijmans and Stefan Lee and Manolis Savva and Sonia Chernova and Dhruv Batra},\n",
" booktitle = {arXiv:1912.06321},\n",
" year = {2019}\n",
"}\n",
"```\n",
"\n",
"Please cite [the following paper](https://arxiv.org/abs/2006.13171) for details about the 2020 ObjectNav challenge:\n",
"```\n",
"@inproceedings{batra2020objectnav,\n",
" title = {Object{N}av {R}evisited: {O}n {E}valuation of {E}mbodied {A}gents {N}avigating to {O}bjects},\n",
" author = {Dhruv Batra and Aaron Gokaslan and Aniruddha Kembhavi and Oleksandr Maksymets and Roozbeh Mottaghi and Manolis Savva and Alexander Toshev and Erik Wijmans},\n",
" booktitle = {arXiv:2006.13171},\n",
" year = {2020}\n",
"}\n",
"```"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"name": "habitat_challenge.ipynb",
"provenance": []
},
"jupytext": {
"cell_metadata_filter": "-all",
"formats": "nb_python//py:percent,colabs//ipynb",
"main_language": "python",
"notebook_metadata_filter": "all"
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"metadata": {
"collapsed": false
},
"source": []
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}

0 comments on commit a96e0f4

Please sign in to comment.