Skip to content

Commit 2952e13

Browse files
Finn BuschFinn Busch
authored andcommitted
Fresh start: single commit
0 parents  commit 2952e13

94 files changed

Lines changed: 10345 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
result*
2+
result*/

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
HM3D=LOCAL # LOCAL if already available, MINI if minival should be downloaded, FULL for val + training download.
2+
HM3D_PATH="/path/to/versioned_data/" # Only needed if you set HM3D to LOCAL, set to versioned_data
3+
MATTERPORT_ID=YOUR_ID
4+
MATTERPORT_SECRET=YOUR_SECRET

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ignore all .pngs
2+
*.png
3+
weights/*

Dockerfile

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
FROM dsalvat1/cudagl:12.3.1-runtime-ubuntu22.04
2+
3+
# Declare the HM3D argument
4+
ARG HM3D
5+
6+
ARG HM3D_PATH
7+
8+
ARG MATTERPORT_ID
9+
ARG MATTERPORT_SECRET
10+
11+
# Validate HM3D argument and show usage
12+
RUN if [ -z "${HM3D}" ]; then \
13+
echo -e "\e[31mERROR: HM3D argument is required to be set in the .env file. Please specify one of:\e[0m"; \
14+
echo -e "\e[36m - LOCAL: Requires additional HM3D_PATH argument pointing to local HM3D dataset\e[0m"; \
15+
echo -e "\e[36m - MINI: Downloads the HM3D mini_val dataset\e[0m"; \
16+
echo -e "\e[36m - FULL: Downloads the complete HM3D dataset\e[0m"; \
17+
exit 1; \
18+
elif [ "${HM3D}" = "LOCAL" ]; then \
19+
if [ -z "${HM3D_PATH}" ]; then \
20+
echo -e "\e[31mERROR: When using HM3D=LOCAL, you must provide HM3D_PATH argument\e[0m"; \
21+
echo -e "\e[36mUsage: docker build --build-arg HM3D=LOCAL --build-arg HM3D_PATH=/path/to/hm3d ...\e[0m"; \
22+
exit 1; \
23+
fi; \
24+
echo -e "\e[32mUsing local HM3D dataset from: ${HM3D_PATH}\e[0m"; \
25+
elif [ "${HM3D}" = "MINI" ]; then \
26+
echo -e "\e[32mWill download HM3D mini_val dataset\e[0m"; \
27+
elif [ "${HM3D}" = "FULL" ]; then \
28+
echo -e "\e[32mWill download complete HM3D dataset\e[0m"; \
29+
else \
30+
echo -e "\e[31mERROR: Invalid HM3D value '${HM3D}'. Must be one of: LOCAL, MINI, FULL\e[0m"; \
31+
exit 1; \
32+
fi
33+
34+
35+
WORKDIR /onemap
36+
37+
38+
RUN apt update && apt install -y --no-install-recommends \
39+
build-essential \
40+
git \
41+
curl \
42+
vim \
43+
ca-certificates \
44+
pkg-config \
45+
wget \
46+
zip \
47+
libeigen3-dev \
48+
ninja-build \
49+
python3.10-dev \
50+
python3-pip \
51+
python-is-python3\
52+
libjpeg-dev libglm-dev libgl1-mesa-glx libegl1-mesa-dev mesa-utils xorg-dev freeglut3-dev \
53+
unzip &&\
54+
rm -rf /var/lib/apt/lists/*
55+
56+
# #
57+
COPY requirements.txt .
58+
RUN python3 -m pip install gdown torch torchvision torchaudio meson
59+
RUN python3 -m pip install -r requirements.txt
60+
RUN python3 -m pip install --upgrade timm>=1.0.7
61+
# #
62+
# #
63+
RUN git clone https://github.com/WongKinYiu/yolov7
64+
RUN mkdir -p weights
65+
RUN gdown 1D_RE4lvA-CiwrP75wsL8Iu1a6NrtrP9T -O weights/clip.pth
66+
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt -O weights/yolov7-e6e.pt
67+
RUN wget https://github.com/ChaoningZhang/MobileSAM/raw/refs/heads/master/weights/mobile_sam.pt -O weights/mobile_sam.pt
68+
# #
69+
# # # Copy the project code
70+
COPY ./config ./config
71+
COPY ./eval ./eval
72+
COPY ./mapping ./mapping
73+
COPY ./planning ./planning
74+
COPY ./planning_cpp ./planning_cpp
75+
COPY ./spot_utils ./spot_utils
76+
COPY ./vision_models ./vision_models
77+
COPY ./eval_habitat.py .
78+
COPY ./eval_habitat_multi.py .
79+
COPY ./onemap_utils ./onemap_utils
80+
COPY ./habitat_test.py ./
81+
RUN python3 -m pip install ./planning_cpp/
82+
RUN mkdir datasets
83+
84+
ENV PYTHONPATH="${PYTHONPATH}:/onemap/"
85+
86+
RUN if [ "$HM3D" = "MINI" ] ; then python3 -m habitat_sim.utils.datasets_download \
87+
--username $MATTERPORT_ID --password $MATTERPORT_SECRET \
88+
--uids hm3d_minival_v0.2 \
89+
--data-path datasets ; fi
90+
#
91+
RUN if [ "$HM3D" = "FULL" ] ; then python3 -m habitat_sim.utils.datasets_download \
92+
--username $MATTERPORT_ID --password $MATTERPORT_SECRET \
93+
--uids hm3d_train_v0.2 \
94+
--data-path datasets && \
95+
python3 -m habitat_sim.utils.datasets_download \
96+
--username $MATTERPORT_ID --password $MATTERPORT_SECRET \
97+
--uids hm3d_val_v0.2 \
98+
--data-path datasets ; fi
99+
100+
# If we use the local dataset, symlinks get broken, we need to recreate a "local" symlink
101+
RUN if [ "$HM3D" = "LOCAL" ] ; then mkdir -p /onemap/datasets/scene_datasets/hm3d && \
102+
ln -s /onemap/datasets/versioned_data/hm3d-0.2/hm3d/train/hm3d_basis.scene_dataset_config.json /onemap/datasets/scene_datasets/hm3d/hm3d_basis.scene_dataset_config.json ; fi
103+
104+
RUN gdown 1lBpYxXRjj8mDSUTI66xv0PfNd-vdSbNj -O multiobject_episodes.zip
105+
RUN unzip multiobject_episodes.zip
106+
RUN mv multiobject_episodes datasets/ && rm multiobject_episodes.zip
107+
RUN wget https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/hm3d/v1/objectnav_hm3d_v1.zip
108+
RUN unzip objectnav_hm3d_v1.zip
109+
RUN mv objectnav_hm3d_v1 datasets/ && rm objectnav_hm3d_v1.zip
110+
111+
112+
ENTRYPOINT ["sh", "-c", "if [ \"$HM3D\" = \"LOCAL\" ]; then ln -s $(ls /onemap/datasets/versioned_data/hm3d-0.2/hm3d | grep -v \"hm3d_basis.scene_dataset_config.json\" | sed \"s#^#/onemap/datasets/versioned_data/hm3d-0.2/hm3d/#\") /onemap/datasets/scene_datasets/hm3d/; fi && exec \"$@\"", "--"]
113+
114+
CMD ["/bin/bash"]

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) 2025 Finn Lukas Busch
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: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
<p align="center">
2+
<img src="docs/sys.png" width="900", style="border-radius:10%">
3+
<h1 align="center">One Map to Find Them All: Real-time Open-Vocabulary Mapping for Zero-shot Multi-Object Navigation</h1>
4+
<h3 align="center">
5+
<a href="https://www.kth.se/profile/flbusch?l=en">Finn Lukas Busch</a>,
6+
<a href="https://www.kth.se/profile/timonh">Timon Homberger</a>,
7+
<a href="https://www.kth.se/profile/jgop">Jesús Ortega-Peimbert</a>,
8+
<a href="https://www.kth.se/profile/quantao?l=en">Quantao Yang</a>,
9+
<a href="https://www.kth.se/profile/olovand" style="white-space: nowrap;"> Olov Andersson</a>
10+
</h3>
11+
<p align="center">
12+
<a href="https://www.finnbusch.com/OneMap/">Project Website</a> , <a href="https://arxiv.org/pdf/2409.11764">Paper (arXiv)</a>
13+
</p>
14+
</p>
15+
16+
This repository contains the code for the paper "One Map to Find Them All: Real-time Open-Vocabulary Mapping for
17+
Zero-shot Multi-Object Navigation". We provide a [dockerized environment](#setup-docker) to run the code or
18+
you can [run it locally](#setup-local-without-docker).
19+
20+
In summary we open-source:
21+
- The OneMap mapping and navigation code
22+
- The evaluation code for single- and multi-object navigation
23+
- The multi-object navigation dataset and benchmark
24+
- The multi-object navigation dataset generation code, such that you can generate your own datasets
25+
26+
## Abstract
27+
The capability to efficiently search for objects in complex environments is fundamental for many real-world robot
28+
applications. Recent advances in open-vocabulary vision models have resulted in semantically-informed object navigation \
29+
methods that allow a robot to search for an arbitrary object without prior training. However, these
30+
zero-shot methods have so far treated the environment as unknown for each consecutive query.
31+
In this paper we introduce a new benchmark for zero-shot multi-object navigation, allowing the robot to leverage
32+
information gathered from previous searches to more efficiently find new objects. To address this problem we build a
33+
reusable open-vocabulary feature map tailored for real-time object search. We further propose a probabilistic-semantic
34+
map update that mitigates common sources of errors in semantic feature extraction and leverage this semantic uncertainty
35+
for informed multi-object exploration. We evaluate our method on a set of object navigation tasks in both simulation
36+
as well as with a real robot, running in real-time on a Jetson Orin AGX. We demonstrate that it outperforms existing
37+
state-of-the-art approaches both on single and multi-object navigation tasks.
38+
## Setup (Docker)
39+
### 0. Docker
40+
You will need to have Docker installed on your system. Follow the [official instructions](https://docs.docker.com/engine/install/ubuntu/) to install.
41+
You will also need to have the [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
42+
installed and configured as docker runtime on your system.
43+
44+
### 1. Clone the repository
45+
```
46+
git clone https://github.com/finnBsch/MON.git
47+
cd OneMap/
48+
```
49+
### 2. Build the Docker Image
50+
The docker image build process will build habitat-sim and download model weights. You can choose to let the container
51+
download the habitat scenes during build, or if you have them already downloaded, you can set `HM3D=LOCAL` and provide
52+
the absolute `HM3D_PATH` to the `versioned_data` directory on your machine in the `.env` file in the root of the repository.
53+
54+
If you want the container to download the scenes for you, set `HM3D=FULL` in the `.env` file and provide your
55+
Matterport credentials. You can get access for Matterport for free [here](https://matterport.com/partners/meta).
56+
You will not need to provide a `HM3D_PATH` then.
57+
Having configured the `.env` file, you can build the docker image in the root of the repository with:
58+
```
59+
docker compose build
60+
```
61+
The build will take a while as `habitat-sim` is built from source. You can launch the docker container with:
62+
```
63+
bash run_docker.sh
64+
```
65+
and open a new terminal in the container with:
66+
```
67+
docker exec -it onemap-onemap-1 bash
68+
```
69+
## Setup (Local, without Docker)
70+
71+
### 1. Clone the repository
72+
```
73+
git clone https://github.com/finnBsch/MON.git
74+
cd OneMap/
75+
```
76+
### 2. Install dependencies
77+
```
78+
python3 -m pip install gdown torch torchvision torchaudio meson
79+
python3 -m pip install -r requirements.txt
80+
```
81+
Manually install newer `timm` version:
82+
```
83+
python3 -m pip install --upgrade timm>=1.0.7
84+
```
85+
YOLOV7:
86+
```
87+
git clone https://github.com/WongKinYiu/yolov7
88+
```
89+
Build planning utilities:
90+
```
91+
python3 -m pip install ./planning_cpp/
92+
```
93+
### 3. Download the model weights
94+
```
95+
mkdir -p weights/
96+
```
97+
SED extracted weights:
98+
```
99+
gdown 1D_RE4lvA-CiwrP75wsL8Iu1a6NrtrP9T -O weights/clip.pth
100+
```
101+
YOLOV7 weights and MobileSAM weights:
102+
```
103+
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt -O weights/yolov7-e6e.pt
104+
wget https://github.com/ChaoningZhang/MobileSAM/raw/refs/heads/master/weights/mobile_sam.pt -O weights/mobile_sam.pt
105+
```
106+
### 4. Download the habitat data
107+
108+
109+
## Running the code
110+
### 1. Run the example
111+
You can run the code on an example, visualized in [rerun.io](https://rerun.io/) with:
112+
#### Docker
113+
You will need to have [rerun.io](https://rerun.io/) installed on the host for visualization.
114+
Ensure the docker is running and you are in the container as described in the [Docker setup](#setup-docker). Then launch
115+
the rerun viewer with:
116+
```
117+
rerun
118+
```
119+
and launch the example in the container with:
120+
```
121+
python3 habitat_test.py --config/mon/base_conf_sim.yaml
122+
```
123+
#### Local
124+
Open the rerun viewer and example from the root of the repository with:
125+
```
126+
rerun
127+
python3 habitat_test.py --config/mon/base_conf_sim.yaml
128+
```
129+
### 2. Run the evaluation
130+
You can reproduce the evaluation results from the paper for single- and multi-object navigation.
131+
#### Single-object navigation
132+
```
133+
python3 eval_habitat.py --config config/mon/eval_conf.yaml
134+
```
135+
This will run the evaluation and save the results in the `results/` directory. You can read the results with:
136+
```
137+
python3 read_results.py --config config/mon/eval_conf.yaml
138+
```
139+
#### Multi-object navigation
140+
```
141+
python3 eval_habitat_multi.py --config config/mon/eval_multi_conf.yaml
142+
```
143+
This will run the evaluation and save the results in the `results_multi/` directory. You can read the results with:
144+
```
145+
python3 read_results_multi.py --config config/mon/eval_multi_conf.yaml
146+
```
147+
#### Dataset generation
148+
While we provide the generated dataset for the evaluation of multi-object navigation, we also release the code to
149+
generate the datasets with varying parameters. You can generate the dataset with
150+
```
151+
python3 eval/dataset_utils/gen_multiobject_dataset.py
152+
```
153+
and change the parameters such as number of objects per episode in the corresponding file.
154+
155+
## Citation
156+
If you use this code in your research, please cite our paper:
157+
```
158+
@misc{busch2024mapallrealtimeopenvocabulary,
159+
title={One Map to Find Them All: Real-time Open-Vocabulary Mapping for Zero-shot Multi-Object Navigation},
160+
author={Finn Lukas Busch and Timon Homberger and Jesús Ortega-Peimbert and Quantao Yang and Olov Andersson},
161+
year={2024},
162+
eprint={2409.11764},
163+
archivePrefix={arXiv},
164+
primaryClass={cs.RO},
165+
url={https://arxiv.org/abs/2409.11764},
166+
}
167+
```

config/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
Contains the configuration classes for the different components. The configuration .yaml files are in the subdirectory.
3+
"""
4+
5+
__all__ = ["PlanningConf", "HabitatControllerConf", "MappingConf", "SpockBuilder",
6+
"ControllerChoice", "SpotControllerConf", "Conf", "load_config",
7+
"EvalConf", "load_eval_config"]
8+
9+
10+
from .planning_conf import PlanningConf
11+
12+
from .controller_confs import HabitatControllerConf, ControllerChoice, SpotControllerConf
13+
14+
from .mapping_conf import MappingConf
15+
16+
from spock import SpockBuilder
17+
18+
from .conf import Conf, load_config
19+
20+
from .eval_conf import EvalConf, load_eval_config

config/conf.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from enum import Enum
2+
3+
from spock import spock, SpockBuilder
4+
from config import HabitatControllerConf, SpotControllerConf, MappingConf, PlanningConf, ControllerChoice
5+
6+
7+
8+
@spock
9+
class Conf:
10+
controller: ControllerChoice
11+
mapping: MappingConf
12+
planner: PlanningConf
13+
log_rerun: bool
14+
15+
16+
def load_config():
17+
return SpockBuilder(Conf, HabitatControllerConf, PlanningConf, MappingConf, SpotControllerConf,
18+
desc='Default MON config.').generate()

config/controller_confs.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from enum import Enum
2+
3+
# numpy
4+
import numpy as np
5+
6+
from spock import spock
7+
8+
9+
@spock
10+
class HabitatControllerConf:
11+
control_freq: float
12+
max_vel: float
13+
max_ang_vel: float
14+
15+
16+
@spock
17+
class SpotControllerConf:
18+
max_vel: float
19+
max_ang_vel: float
20+
21+
22+
class ControllerChoice(Enum):
23+
habitat = HabitatControllerConf
24+
spot = SpotControllerConf

0 commit comments

Comments
 (0)