envodat 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
envodat/__init__.py ADDED
@@ -0,0 +1,31 @@
1
+ """EnvoDat toolkit: download, load, train on and evaluate the EnvoDat dataset.
2
+
3
+ Typical use::
4
+
5
+ import envodat as ed
6
+
7
+ ed.init("./envodat_data") # where data is stored
8
+ ed.list_scenes() # scenes on the Hugging Face Hub
9
+ ed.download("mu-hall") # training-ready scene (YOLO + πŸ€— datasets)
10
+ loader = ed.dataloader("mu-hall", split="train", batch_size=8)
11
+ ed.train_yolo("mu-hall", model="yolo11n.pt", epochs=100)
12
+
13
+ Heavy dependencies (torch, ultralytics, datasets, evo) are imported only when the
14
+ function that needs them is called.
15
+ """
16
+
17
+ from ._config import init, root
18
+ from .catalog import SCENES, scene_ids
19
+ from .cps import cps_list, download_raw
20
+ from .hub import class_names, data_yaml, download, info, list_scenes, load, scene_dir
21
+ from .slam import evaluate_traj, get_traj_np, to_tum
22
+ from .torch_data import EnvoDatDetection, dataloader
23
+ from .train import train_yolo
24
+
25
+ __version__ = "0.1.0"
26
+
27
+ __all__ = [
28
+ "init", "root", "SCENES", "scene_ids", "list_scenes", "info", "download", "download_raw",
29
+ "cps_list", "load", "data_yaml", "scene_dir", "class_names", "dataloader",
30
+ "EnvoDatDetection", "train_yolo", "get_traj_np", "to_tum", "evaluate_traj",
31
+ ]
envodat/_config.py ADDED
@@ -0,0 +1,29 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ HF_REPO_ID = os.environ.get("ENVODAT_HF_REPO", "Linpen/EnvoDat")
5
+ CPS_SHARE_URL = os.environ.get(
6
+ "ENVODAT_CPS_SHARE", "https://cloud.cps.unileoben.ac.at/index.php/s/cs7qF4Qq5bZbt9k")
7
+
8
+ _state = {"root": Path(os.environ.get("ENVODAT_ROOT", "./envodat_data"))}
9
+
10
+
11
+ def init(root_path):
12
+ """Set the local root folder where EnvoDat data is downloaded and read from.
13
+
14
+ Args:
15
+ root_path: Folder for all EnvoDat data. Created if it does not exist.
16
+ Can also be set with the ``ENVODAT_ROOT`` environment variable.
17
+
18
+ Returns:
19
+ The resolved root path.
20
+ """
21
+ root = Path(root_path).expanduser().resolve()
22
+ root.mkdir(parents=True, exist_ok=True)
23
+ _state["root"] = root
24
+ return root
25
+
26
+
27
+ def root():
28
+ """Return the current data root (see :func:`init`)."""
29
+ return Path(_state["root"]).expanduser().resolve()
envodat/catalog.py ADDED
@@ -0,0 +1,73 @@
1
+ """Static catalog of the EnvoDat scenes (13 environments).
2
+
3
+ Scene ids are lower-case and match the config names on the Hugging Face Hub.
4
+ """
5
+
6
+ INDOOR, OUTDOOR, SUBTERRANEAN = "indoor", "outdoor", "subterranean"
7
+
8
+ #: Scene catalog: ``{scene_id: {name, title, environment, sequences, description}}``.
9
+ SCENES = {
10
+ "mu-hall": dict(name="MU-Hall", title="Exhibition hall", environment=INDOOR,
11
+ sequences=["01", "02", "03"],
12
+ description="Mid-large exhibition hall with many dynamic and static features "
13
+ "(moving people, exhibition furniture)."),
14
+ "mu-cor": dict(name="MU-Cor", title="Long corridor", environment=INDOOR,
15
+ sequences=["01", "02", "03"],
16
+ description="Highly symmetric passageway of roughly 6 x 120 m with tables and mixed "
17
+ "artificial/natural lighting; recorded morning, afternoon and evening."),
18
+ "mu-txn": dict(name="MU-TXN", title="Glass building", environment=INDOOR,
19
+ sequences=["01", "02", "03"],
20
+ description="Student study centre with large transparent and reflective surfaces "
21
+ "and moving objects."),
22
+ "mu-cps": dict(name="MU-CPS", title="Office layout", environment=INDOOR,
23
+ sequences=["01", "02", "03"],
24
+ description="Office layout with multiple occlusions, furniture, daylight and "
25
+ "artificial light, and numerous loop closures."),
26
+ "leo-str": dict(name="Leo-Str", title="Leoben campus street", environment=OUTDOOR,
27
+ sequences=["01", "02"],
28
+ description="Feature-sparse street with pedestrians, vehicles and buildings; "
29
+ "recorded morning and afternoon."),
30
+ "leo-for": dict(name="Leo-For", title="Leoben forest path", environment=OUTDOOR,
31
+ sequences=["01", "02"],
32
+ description="Vegetated, unstructured terrain with dense canopies, varying light "
33
+ "penetration and dynamic shadows."),
34
+ "subt-zab-01": dict(name="SubT-ZAB-01", title="Underground tunnel", environment=SUBTERRANEAN,
35
+ sequences=["01", "02"], description="Underground tunnel."),
36
+ "subt-zab-02": dict(name="SubT-ZAB-02", title="Underground tunnel", environment=SUBTERRANEAN,
37
+ sequences=["01"], description="Underground tunnel."),
38
+ "subt-zab-03": dict(name="SubT-ZAB-03", title="Underground tunnel", environment=SUBTERRANEAN,
39
+ sequences=["01", "02"], description="Underground tunnel.",
40
+ aliases=["subt-zab-lid-03"]),
41
+ "subt-zab-04": dict(name="SubT-ZAB-04", title="Underground tunnel", environment=SUBTERRANEAN,
42
+ sequences=["01", "02"], description="Underground tunnel."),
43
+ "subt-zab-05": dict(name="SubT-ZAB-05", title="Underground tunnel", environment=SUBTERRANEAN,
44
+ sequences=["01", "02"], description="Underground tunnel."),
45
+ "subt-sbe-01": dict(name="SubT-SBe-01", title="Underground tunnel", environment=SUBTERRANEAN,
46
+ sequences=["01"], description="Underground tunnel."),
47
+ "subt-sbe-02": dict(name="SubT-SBe-02", title="Underground tunnel", environment=SUBTERRANEAN,
48
+ sequences=["01"], description="Underground tunnel."),
49
+ # Annotation set only: the SubT-ZAB tunnels are annotated together, not per scene.
50
+ "subt-zab": dict(name="SubT-ZAB", title="Underground tunnels (annotations)",
51
+ environment=SUBTERRANEAN, sequences=[],
52
+ description="Annotated frames of the SubT-ZAB tunnels, released as one set."),
53
+ }
54
+
55
+
56
+ def scene_ids(environment=None):
57
+ """Return the catalog scene ids, optionally filtered by environment type."""
58
+ return [k for k, v in SCENES.items() if environment in (None, v["environment"])]
59
+
60
+
61
+ def match_scene(text):
62
+ """Return the catalog scene id contained in ``text`` (a path or name), or None.
63
+
64
+ Matching ignores case and separators, so "MU-Hall", "mu_hall_yolov8" and
65
+ "Indoors/MU-Hall/annotations" all resolve to ``"mu-hall"``.
66
+ """
67
+ import re
68
+ norm = "-" + re.sub(r"[^a-z0-9]+", "-", str(text).lower()).strip("-") + "-"
69
+ names = [(a, sid) for sid, v in SCENES.items() for a in [sid] + v.get("aliases", [])]
70
+ for name, sid in sorted(names, key=lambda x: len(x[0]), reverse=True):
71
+ if f"-{name}-" in norm:
72
+ return sid
73
+ return None
envodat/cli.py ADDED
@@ -0,0 +1,113 @@
1
+ """Command-line interface: ``envodat <command>``."""
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ from . import _config, catalog, cps, hub, slam, train
7
+
8
+
9
+ def _scenes(args):
10
+ print(f"{'id':<13} {'name':<12} {'environment':<13} sequences description")
11
+ for sid, s in catalog.SCENES.items():
12
+ print(f"{sid:<13} {s['name']:<12} {s['environment']:<13} {','.join(s['sequences']) or '-':<10} "
13
+ f"{s['description']}")
14
+
15
+
16
+ def _list(args):
17
+ for s in hub.list_scenes(args.format, args.revision):
18
+ print(s)
19
+
20
+
21
+ def _download(args):
22
+ if args.config:
23
+ res = hub.download(config=args.config)
24
+ else:
25
+ res = hub.download("all" if args.all else args.scene, args.format,
26
+ args.revision)
27
+ for s, d in res.items():
28
+ print(f"{s}\t{d}")
29
+
30
+
31
+ def _raw(args):
32
+ files = cps.download_raw(args.include, args.exclude, args.out, dry_run=args.dry_run)
33
+ if args.dry_run:
34
+ for f in files:
35
+ print(f"{f.size / 1e9:10.3f} GB {f.path}")
36
+
37
+
38
+ def _train(args):
39
+ extra = dict(kv.split("=", 1) for kv in args.extra)
40
+ for k, v in extra.items():
41
+ try:
42
+ extra[k] = float(v) if "." in v else int(v)
43
+ except ValueError:
44
+ pass
45
+ train.train_yolo(args.scene, args.model, args.epochs, args.imgsz, args.batch, **extra)
46
+
47
+
48
+ def _eval(args):
49
+ r = slam.evaluate_traj(args.est, args.gt, args.align, args.delta)
50
+ print(f"ATE (mean/std): {r['ate'][0]} / {r['ate'][1]} m")
51
+ print(f"RPE (mean/std): {r['rpe'][0]} / {r['rpe'][1]} m")
52
+ if r["sd"]:
53
+ print(f"SD (mean/std): {r['sd'][0]} / {r['sd'][1]}")
54
+
55
+
56
+ def main(argv=None):
57
+ ap = argparse.ArgumentParser(prog="envodat", description="EnvoDat dataset toolkit")
58
+ ap.add_argument("--root", help="Data root (default ./envodat_data or $ENVODAT_ROOT)")
59
+ sub = ap.add_subparsers(dest="cmd", required=True)
60
+
61
+ sub.add_parser("scenes", help="Show the scene catalog").set_defaults(fn=_scenes)
62
+
63
+ p = sub.add_parser("list", help="List scenes available on the Hugging Face Hub")
64
+ p.add_argument("--format", default="yolo")
65
+ p.add_argument("--revision")
66
+ p.set_defaults(fn=_list)
67
+
68
+ p = sub.add_parser("download", help="Download annotated scenes from the Hub")
69
+ p.add_argument("scene", nargs="*", help="Scene ids, e.g. mu-hall leo-str")
70
+ p.add_argument("--all", action="store_true", help="Download every scene")
71
+ p.add_argument("--format", default="yolo")
72
+ p.add_argument("--revision", help="Branch, tag or commit to pin")
73
+ p.add_argument("--config", help="YAML file with root/scenes/format/revision")
74
+ p.set_defaults(fn=_download)
75
+
76
+ p = sub.add_parser("raw", help="Download raw data (bags, LiDAR, RGB-D, IMU, poses) "
77
+ "from the CPS server")
78
+ p.add_argument("include", nargs="+", help="Glob(s) on the share path, e.g. '*mu-hall*.bag'")
79
+ p.add_argument("--exclude", nargs="*")
80
+ p.add_argument("--out", help="Target folder (default <root>/raw)")
81
+ p.add_argument("--dry-run", action="store_true", help="Only list matches and sizes")
82
+ p.set_defaults(fn=_raw)
83
+
84
+ p = sub.add_parser("train", help="Train a YOLO detector on a scene",
85
+ epilog="Extra Ultralytics args as key=value, e.g. lr0=0.01 device=0")
86
+ p.add_argument("scene")
87
+ p.add_argument("extra", nargs="*", metavar="key=value")
88
+ p.add_argument("--model", default="yolo11n.pt")
89
+ p.add_argument("--epochs", type=int, default=100)
90
+ p.add_argument("--imgsz", type=int, default=640)
91
+ p.add_argument("--batch", type=int, default=16)
92
+ p.set_defaults(fn=_train)
93
+
94
+ p = sub.add_parser("eval", help="ATE/RPE/scale drift of a trajectory vs ground truth")
95
+ p.add_argument("est", help="Estimated trajectory (TUM)")
96
+ p.add_argument("gt", help="Ground truth (gt-poses-*.csv or TUM)")
97
+ p.add_argument("--align", choices=["none", "se3", "sim3"], default="se3")
98
+ p.add_argument("--delta", type=int, default=1)
99
+ p.set_defaults(fn=_eval)
100
+
101
+ args = ap.parse_args(argv)
102
+ if args.root:
103
+ _config.init(args.root)
104
+ if args.cmd == "download" and not (args.scene or args.all or args.config):
105
+ ap.error("download: give scene ids, --all or --config")
106
+ try:
107
+ args.fn(args)
108
+ except (ImportError, FileNotFoundError, ConnectionError, ValueError) as exc:
109
+ sys.exit(f"error: {exc}")
110
+
111
+
112
+ if __name__ == "__main__":
113
+ main()
envodat/cps.py ADDED
@@ -0,0 +1,222 @@
1
+ """Raw data from the EnvoDat share on the CPS server (Nextcloud public link).
2
+
3
+ Uses the share's WebDAV interface, so listing and downloading need nothing beyond
4
+ the standard library. Downloads resume after interruptions and are checked
5
+ against the size reported by the server.
6
+ """
7
+
8
+ import base64
9
+ import fnmatch
10
+ import os
11
+ import shutil
12
+ import socket
13
+ import sys
14
+ import time
15
+ import urllib.error
16
+ import urllib.request
17
+ import xml.etree.ElementTree as ET
18
+ from dataclasses import dataclass
19
+ from pathlib import Path
20
+ from urllib.parse import quote, unquote, urlparse
21
+
22
+ from . import _config
23
+
24
+ _PROPFIND = (b'<?xml version="1.0"?><d:propfind xmlns:d="DAV:"><d:prop>'
25
+ b"<d:resourcetype/><d:getcontentlength/><d:getlastmodified/>"
26
+ b"</d:prop></d:propfind>")
27
+ _NS = {"d": "DAV:"}
28
+ TIMEOUT = 120 # seconds per request
29
+ RETRIES = 4 # extra attempts after a timeout or 5xx/429 answer
30
+
31
+
32
+ @dataclass
33
+ class RemoteFile:
34
+ """A file on the CPS share."""
35
+ path: str # relative to the share root, '/'-separated
36
+ size: int
37
+
38
+
39
+ class CPSShare:
40
+ """Client for a Nextcloud public share.
41
+
42
+ Args:
43
+ share_url: Public link, e.g. ``https://host/index.php/s/<token>``.
44
+ password: Share password, if the link is protected.
45
+ """
46
+
47
+ def __init__(self, share_url=None, password=""):
48
+ url = urlparse(share_url or _config.CPS_SHARE_URL)
49
+ self.host = f"{url.scheme}://{url.netloc}"
50
+ self.token = url.path.rstrip("/").rsplit("/", 1)[-1]
51
+ self.password = password or os.environ.get("ENVODAT_CPS_PASSWORD", "")
52
+ self._base = None # (dav_root_url, auth_header) once detected
53
+
54
+ # -- protocol ---------------------------------------------------------
55
+ def _candidates(self):
56
+ # Nextcloud >= 29 serves unprotected shares without auth; protected ones use
57
+ # "anonymous:<password>". Older releases use "<token>:<password>".
58
+ new_auth = ("anonymous:" + self.password) if self.password else None
59
+ old_auth = self.token + ":" + self.password
60
+ return [
61
+ (f"{self.host}/public.php/dav/files/{self.token}", new_auth), # Nextcloud >= 29
62
+ (f"{self.host}/public.php/webdav", old_auth), # older releases
63
+ ]
64
+
65
+ def _request(self, url, auth, method="GET", headers=None, data=None):
66
+ # Nextcloud rejects public-share WebDAV requests without this header (401).
67
+ h = {"User-Agent": "envodat", "X-Requested-With": "XMLHttpRequest"}
68
+ if auth:
69
+ h["Authorization"] = "Basic " + base64.b64encode(auth.encode()).decode()
70
+ h.update(headers or {})
71
+ req = urllib.request.Request(url, data=data, headers=h, method=method)
72
+ # Retry timeouts, dropped connections and server-side errors (busy server);
73
+ # 4xx answers such as 401/404 are final and raised at once.
74
+ for attempt in range(RETRIES + 1):
75
+ try:
76
+ return urllib.request.urlopen(req, timeout=TIMEOUT)
77
+ except urllib.error.HTTPError as exc:
78
+ if exc.code < 500 and exc.code != 429 or attempt == RETRIES:
79
+ raise
80
+ except (urllib.error.URLError, socket.timeout, ConnectionError) as exc:
81
+ if attempt == RETRIES:
82
+ raise urllib.error.URLError(getattr(exc, "reason", exc)) from exc
83
+ wait = 10 * (attempt + 1)
84
+ print(f" server busy or unreachable, retrying in {wait} s ...", file=sys.stderr)
85
+ time.sleep(wait)
86
+
87
+ def _propfind(self, rel):
88
+ bases = [self._base] if self._base else self._candidates()
89
+ last = None
90
+ for base, auth in bases:
91
+ url = base + "/" + quote(rel.strip("/"))
92
+ try:
93
+ with self._request(url, auth, "PROPFIND",
94
+ {"Depth": "1", "Content-Type": "application/xml"},
95
+ _PROPFIND) as r:
96
+ body = r.read()
97
+ self._base = (base, auth)
98
+ return base, body
99
+ except urllib.error.HTTPError as exc:
100
+ last = exc # try the next endpoint flavour
101
+ except urllib.error.URLError as exc:
102
+ raise ConnectionError(f"Cannot reach {self.host}: {exc.reason}") from exc
103
+ hint = ""
104
+ if getattr(last, "code", None) == 401:
105
+ hint = (" The share may be password-protected: pass --password (or set "
106
+ "ENVODAT_CPS_PASSWORD)." if not self.password else
107
+ " Check the share password.")
108
+ raise ConnectionError(f"WebDAV listing of '{rel or '/'}' failed: {last}.{hint}")
109
+
110
+ # -- public API -------------------------------------------------------
111
+ def listdir(self, path=""):
112
+ """List one folder. Returns (subfolders, files) with share-relative paths."""
113
+ base, body = self._propfind(path)
114
+ prefix = unquote(urlparse(base).path).rstrip("/") + "/"
115
+ dirs, files = [], []
116
+ for resp in ET.fromstring(body).findall("d:response", _NS):
117
+ href = unquote(urlparse(resp.findtext("d:href", "", _NS)).path)
118
+ rel = href[len(prefix):].strip("/") if href.startswith(prefix) else href.strip("/")
119
+ if rel == path.strip("/"):
120
+ continue # the folder itself
121
+ prop = resp.find("d:propstat/d:prop", _NS)
122
+ if prop is not None and prop.find("d:resourcetype/d:collection", _NS) is not None:
123
+ dirs.append(rel)
124
+ else:
125
+ size = prop.findtext("d:getcontentlength", "0", _NS) if prop is not None else "0"
126
+ files.append(RemoteFile(rel, int(size or 0)))
127
+ return dirs, files
128
+
129
+ def walk(self, path=""):
130
+ """Yield every file below ``path`` (recursive, one listing per folder)."""
131
+ dirs, files = self.listdir(path)
132
+ yield from files
133
+ for d in dirs:
134
+ yield from self.walk(d)
135
+
136
+ def download_file(self, remote, dest, quiet=False):
137
+ """Download one :class:`RemoteFile` to ``dest``, resuming a partial ``.part`` file."""
138
+ if self._base is None:
139
+ self._propfind("")
140
+ base, auth = self._base
141
+ dest = Path(dest)
142
+ dest.parent.mkdir(parents=True, exist_ok=True)
143
+ if dest.exists() and dest.stat().st_size == remote.size:
144
+ return dest
145
+ part = dest.with_name(dest.name + ".part")
146
+ have = part.stat().st_size if part.exists() else 0
147
+ headers = {"Range": f"bytes={have}-"} if have else {}
148
+ url = base + "/" + quote(remote.path)
149
+ with self._request(url, auth, headers=headers) as r, open(part, "ab" if have else "wb") as f:
150
+ if have and r.status != 206: # server ignored the range: start over
151
+ f.seek(0), f.truncate()
152
+ have = 0
153
+ done = have
154
+ while True:
155
+ chunk = r.read(1 << 22)
156
+ if not chunk:
157
+ break
158
+ f.write(chunk)
159
+ done += len(chunk)
160
+ if not quiet and remote.size:
161
+ print(f"\r {100 * done // remote.size:3d}% {remote.path}", end="",
162
+ file=sys.stderr, flush=True)
163
+ if not quiet:
164
+ print(file=sys.stderr)
165
+ if remote.size and part.stat().st_size != remote.size:
166
+ raise IOError(f"Incomplete download of {remote.path}; rerun to resume.")
167
+ part.replace(dest)
168
+ return dest
169
+
170
+
171
+ def _matches(path, include, exclude):
172
+ p = path.lower()
173
+ ok = any(fnmatch.fnmatch(p, pat.lower()) for pat in include) if include else True
174
+ return ok and not any(fnmatch.fnmatch(p, pat.lower()) for pat in exclude or [])
175
+
176
+
177
+ def cps_list(include=None, exclude=None, path="", share_url=None, password=""):
178
+ """List files on the CPS share, optionally filtered by glob patterns.
179
+
180
+ Patterns match the share-relative path, case-insensitively, e.g.
181
+ ``"*mu-hall*/*.bag"`` or ``"*yolo*"``.
182
+
183
+ Returns:
184
+ List of :class:`RemoteFile`.
185
+ """
186
+ share = CPSShare(share_url, password)
187
+ return [f for f in share.walk(path) if _matches(f.path, _as_list(include), _as_list(exclude))]
188
+
189
+
190
+ def download_raw(include, exclude=None, out=None, dry_run=False, share_url=None, password=""):
191
+ """Download raw files (ROS bags, LiDAR, RGB-D, IMU, poses) from the CPS server.
192
+
193
+ Args:
194
+ include: Glob pattern(s) on the share-relative path, e.g.
195
+ ``"*mu-hall*seq01*.bag"`` or ``["*leo-str*/gt-poses*", "*leo-str*/imu-*"]``.
196
+ exclude: Glob pattern(s) to skip.
197
+ out: Target folder (default ``<root>/raw``). The share's folder structure is kept.
198
+ dry_run: Only list what would be downloaded and the total size.
199
+
200
+ Returns:
201
+ List of local paths (or of :class:`RemoteFile` when ``dry_run``).
202
+ """
203
+ share = CPSShare(share_url, password)
204
+ files = [f for f in share.walk() if _matches(f.path, _as_list(include), _as_list(exclude))]
205
+ total = sum(f.size for f in files)
206
+ print(f"{len(files)} file(s), {total / 1e9:.2f} GB", file=sys.stderr)
207
+ if dry_run:
208
+ return files
209
+ out = Path(out) if out else _config.root() / "raw"
210
+ probe = out
211
+ while not probe.exists():
212
+ probe = probe.parent
213
+ free = shutil.disk_usage(probe).free
214
+ if total > free:
215
+ raise OSError(f"Need {total / 1e9:.1f} GB but only {free / 1e9:.1f} GB free at {out}")
216
+ return [share.download_file(f, out / f.path) for f in files]
217
+
218
+
219
+ def _as_list(x):
220
+ if x is None:
221
+ return []
222
+ return [x] if isinstance(x, str) else list(x)
envodat/hub.py ADDED
@@ -0,0 +1,213 @@
1
+ """Annotated, training-ready scenes on the Hugging Face Hub."""
2
+
3
+ import sys
4
+
5
+ import yaml
6
+
7
+ from . import _config
8
+ from .catalog import SCENES, match_scene
9
+
10
+ SPLIT_DIRS = {"train": "train", "validation": "valid", "test": "test"}
11
+ COMPLETE_MARKER = ".envodat-complete" # written only after a scene has been fully unpacked
12
+
13
+
14
+ def _hub():
15
+ try:
16
+ import huggingface_hub
17
+ except ImportError as exc:
18
+ raise ImportError("Install the Hub client: pip install huggingface_hub") from exc
19
+ return huggingface_hub
20
+
21
+
22
+ def _as_list(scene):
23
+ if scene is None:
24
+ return []
25
+ return [scene] if isinstance(scene, str) else list(scene)
26
+
27
+
28
+ def _normalise(scenes):
29
+ out = []
30
+ for s in scenes:
31
+ sid = s if s == "all" else (match_scene(s) or s.lower())
32
+ out.append(sid)
33
+ return out
34
+
35
+
36
+ def _not_found():
37
+ """Exception types for 'file not in repo', across huggingface_hub versions."""
38
+ from huggingface_hub import errors
39
+ return tuple(getattr(errors, n) for n in ("EntryNotFoundError", "RemoteEntryNotFoundError")
40
+ if hasattr(errors, n))
41
+
42
+
43
+ def list_scenes(format="yolo", revision=None, repo_id=None):
44
+ """List the scenes published on the Hugging Face Hub.
45
+
46
+ Args:
47
+ format: Annotation format folder on the Hub (default ``"yolo"``).
48
+ revision: Branch, tag or commit to query.
49
+ repo_id: Override the dataset repo (default ``Linpen/EnvoDat``).
50
+
51
+ Returns:
52
+ Sorted list of scene ids, e.g. ``["leo-for", "mu-hall", ...]``.
53
+ """
54
+ files = _hub().list_repo_files(repo_id or _config.HF_REPO_ID, repo_type="dataset",
55
+ revision=revision)
56
+ prefix = format.rstrip("/") + "/"
57
+ return sorted(f[len(prefix):-4] for f in files
58
+ if f.startswith(prefix) and f.endswith(".zip") and f.count("/") == 1)
59
+
60
+
61
+ def scene_dir(scene, format="yolo"):
62
+ """Local folder of a downloaded scene (it may not exist yet)."""
63
+ return _config.root() / format / _normalise([scene])[0]
64
+
65
+
66
+ def data_yaml(scene):
67
+ """Path to the ready-to-use Ultralytics ``data.yaml`` of a downloaded scene.
68
+
69
+ Raises:
70
+ FileNotFoundError: if the scene has not been downloaded with :func:`download`.
71
+ """
72
+ path = scene_dir(scene) / "data.yaml"
73
+ if not path.exists():
74
+ raise FileNotFoundError(f"{path} not found. Run envodat.download('{scene}') first.")
75
+ return path
76
+
77
+
78
+ def _localise_yaml(sdir):
79
+ """Give the scene's data.yaml an absolute ``path`` so it works from any directory."""
80
+ src = sdir / "data.yaml"
81
+ if not src.exists():
82
+ return None
83
+ cfg = yaml.safe_load(src.read_text()) or {}
84
+ cfg.pop("path", None)
85
+ cfg = {"path": str(sdir.resolve()), **cfg}
86
+ for split in ("train", "val", "test"):
87
+ if split in cfg and not (sdir / cfg[split]).is_dir():
88
+ cfg.pop(split)
89
+ src.write_text(yaml.safe_dump(cfg, sort_keys=False))
90
+ return src
91
+
92
+
93
+ def _load_config(config):
94
+ with open(config) as f:
95
+ cfg = yaml.safe_load(f) or {}
96
+ if "root" in cfg:
97
+ _config.init(cfg.pop("root"))
98
+ if "scenes" in cfg:
99
+ cfg["scene"] = cfg.pop("scenes")
100
+ return cfg
101
+
102
+
103
+ def download(scene=None, format="yolo", revision=None, config=None, repo_id=None, force=False):
104
+ """Download annotated scenes from the Hugging Face Hub into the data root.
105
+
106
+ Each scene is one zip on the Hub (``yolo/<scene>.zip``), so a download is a single
107
+ request. It is cached and unpacked into ``<root>/yolo/<scene>/``, and its YOLO
108
+ ``data.yaml`` is rewritten with an absolute path so it can be passed straight to
109
+ Ultralytics. Scenes that are already completely unpacked are skipped unless ``force``;
110
+ a folder left by an interrupted download is replaced.
111
+
112
+ Args:
113
+ scene: A scene id (``"mu-hall"``), a list of ids, or ``"all"``. Names such as
114
+ ``"MU-Hall"`` are accepted too.
115
+ format: Annotation format folder on the Hub (default ``"yolo"``).
116
+ revision: Branch, tag or commit to pin (recommended for papers).
117
+ config: Path to a YAML file with any of the keys ``root``, ``scenes``,
118
+ ``format`` and ``revision``. Keyword arguments are ignored when given.
119
+ repo_id: Override the dataset repo (default ``Linpen/EnvoDat``).
120
+ force: Unpack again even if the scene folder already exists.
121
+
122
+ Returns:
123
+ Dict mapping each downloaded scene id to its local folder.
124
+ """
125
+ if config is not None:
126
+ return download(**_load_config(config), repo_id=repo_id, force=force)
127
+ scenes = _normalise(_as_list(scene))
128
+ if not scenes:
129
+ raise ValueError("Pass scene='mu-hall', a list of scenes, or scene='all'.")
130
+ repo_id = repo_id or _config.HF_REPO_ID
131
+ if scenes == ["all"]:
132
+ scenes = list_scenes(format, revision, repo_id)
133
+ root = _config.root()
134
+ root.mkdir(parents=True, exist_ok=True)
135
+ print(f"Downloading {', '.join(scenes)} ({format}) from huggingface.co/datasets/{repo_id} "
136
+ f"to {root}", file=sys.stderr)
137
+ import shutil
138
+ import zipfile
139
+ hub = _hub()
140
+ result = {}
141
+ for s in scenes:
142
+ sdir = root / format / s
143
+ if (sdir / COMPLETE_MARKER).exists() and not force:
144
+ result[s] = sdir
145
+ continue
146
+ try:
147
+ zpath = hub.hf_hub_download(repo_id, f"{format}/{s}.zip", repo_type="dataset",
148
+ revision=revision)
149
+ except _not_found():
150
+ print(f"WARNING: scene '{s}' is not on the Hub in format '{format}'. "
151
+ f"See envodat.list_scenes().", file=sys.stderr)
152
+ continue
153
+ if sdir.exists():
154
+ shutil.rmtree(sdir)
155
+ tmp = sdir.with_name(sdir.name + ".part")
156
+ shutil.rmtree(tmp, ignore_errors=True)
157
+ with zipfile.ZipFile(zpath) as z:
158
+ z.extractall(tmp)
159
+ tmp.rename(sdir)
160
+ if format == "yolo":
161
+ _localise_yaml(sdir)
162
+ (sdir / COMPLETE_MARKER).write_text(f"{repo_id} {format}/{s}.zip {revision or 'main'}\n")
163
+ result[s] = sdir
164
+ return result
165
+
166
+
167
+ def load(scene, split=None, repo_id=None, revision=None, **kwargs):
168
+ """Load a scene as a πŸ€— ``datasets`` object.
169
+
170
+ Uses the local copy when the scene has been downloaded, and otherwise streams
171
+ it from the Hub. Each example has ``image``, ``width``, ``height`` and
172
+ ``objects`` with COCO-style pixel boxes ``[x_min, y_min, w, h]``, class ids
173
+ (``category``) and class names (``category_name``).
174
+
175
+ Args:
176
+ scene: Scene id, e.g. ``"mu-hall"``.
177
+ split: ``"train"``, ``"validation"`` or ``"test"``; ``None`` returns all splits.
178
+ **kwargs: Passed to :func:`datasets.load_dataset`.
179
+
180
+ Returns:
181
+ A ``DatasetDict``, or a ``Dataset`` when ``split`` is given.
182
+ """
183
+ try:
184
+ from datasets import load_dataset
185
+ except ImportError as exc:
186
+ raise ImportError("Install πŸ€— datasets: pip install 'envodat[hf]'") from exc
187
+ sid = _normalise([scene])[0]
188
+ sdir = scene_dir(sid)
189
+ if sdir.is_dir():
190
+ files = {name: str(sdir / d / "images" / "*") for name, d in SPLIT_DIRS.items()
191
+ if (sdir / d / "images").is_dir()}
192
+ return load_dataset("imagefolder", data_files=files, split=split, **kwargs)
193
+ return load_dataset(repo_id or _config.HF_REPO_ID, sid, split=split, revision=revision,
194
+ **kwargs)
195
+
196
+
197
+ def class_names(scene):
198
+ """Class names of a downloaded scene, in label-id order."""
199
+ names = yaml.safe_load(data_yaml(scene).read_text())["names"]
200
+ return [names[k] for k in sorted(names)] if isinstance(names, dict) else list(names)
201
+
202
+
203
+ def info(scene):
204
+ """Catalog entry of a scene (name, environment, sequences, description)."""
205
+ sid = _normalise([scene])[0]
206
+ if sid not in SCENES:
207
+ raise KeyError(f"Unknown scene '{scene}'. Known: {', '.join(SCENES)}")
208
+ entry = dict(SCENES[sid], id=sid)
209
+ entry["downloaded"] = scene_dir(sid).is_dir()
210
+ return entry
211
+
212
+
213
+ __all__ = ["list_scenes", "download", "load", "data_yaml", "scene_dir", "class_names", "info"]
envodat/slam.py ADDED
@@ -0,0 +1,97 @@
1
+ """Trajectory loading and SLAM evaluation (ATE, RPE, scale drift; EnvoDat Eqs. 1-3)."""
2
+
3
+ import copy
4
+ from pathlib import Path
5
+
6
+
7
+ def _np():
8
+ import numpy as np
9
+ return np
10
+
11
+
12
+ def get_traj_np(path):
13
+ """Load a trajectory as an ``[N, 8]`` array ``t, x, y, z, qx, qy, qz, qw``.
14
+
15
+ Accepts the EnvoDat ground-truth CSV (``gt-poses-*.csv``, comma separated, optional
16
+ header) and TUM files (space separated).
17
+ """
18
+ np = _np()
19
+ rows = []
20
+ for line in Path(path).read_text().splitlines():
21
+ v = line.replace(",", " ").split()
22
+ if len(v) < 8 or line.lstrip().startswith("#"):
23
+ continue
24
+ try:
25
+ rows.append([float(x) for x in v[:8]])
26
+ except ValueError:
27
+ continue # header line
28
+ return np.asarray(rows, dtype=float)
29
+
30
+
31
+ def to_tum(path, out=None):
32
+ """Convert an EnvoDat ground-truth CSV to a TUM trajectory file and return its path."""
33
+ traj = get_traj_np(path)
34
+ out = Path(out) if out else Path(path).with_suffix(".tum")
35
+ _np().savetxt(out, traj, fmt="%.9f")
36
+ return out
37
+
38
+
39
+ def _evo():
40
+ try:
41
+ from evo.core import metrics, sync
42
+ from evo.core.trajectory import PoseTrajectory3D
43
+ except ImportError as exc:
44
+ raise ImportError("Install evo: pip install 'envodat[slam]'") from exc
45
+ return metrics, sync, PoseTrajectory3D
46
+
47
+
48
+ def _as_evo(traj):
49
+ _, _, PoseTrajectory3D = _evo()
50
+ np = _np()
51
+ a = get_traj_np(traj) if isinstance(traj, (str, Path)) else np.asarray(traj, dtype=float)
52
+ # EnvoDat/TUM quaternions are x, y, z, w; evo expects w, x, y, z.
53
+ return PoseTrajectory3D(positions_xyz=a[:, 1:4], orientations_quat_wxyz=a[:, [7, 4, 5, 6]],
54
+ timestamps=a[:, 0])
55
+
56
+
57
+ def _stat(metric, data):
58
+ metrics = _evo()[0]
59
+ metric.process_data(data)
60
+ return (round(metric.get_statistic(metrics.StatisticsType.mean), 2),
61
+ round(metric.get_statistic(metrics.StatisticsType.std), 2))
62
+
63
+
64
+ def evaluate_traj(est_traj, gt_traj, align="se3", delta=1, max_diff=0.02, sd_form="ratio"):
65
+ """Evaluate an estimated trajectory against ground truth, as in the EnvoDat benchmark.
66
+
67
+ Args:
68
+ est_traj: Estimated trajectory: path (TUM or EnvoDat CSV) or ``[N, 8]`` array.
69
+ gt_traj: Ground truth: path to ``gt-poses-*.csv`` / TUM file, or ``[N, 8]`` array.
70
+ align: ``"none"``, ``"se3"`` or ``"sim3"`` alignment for ATE/RPE.
71
+ delta: Frame offset for RPE and scale drift.
72
+ max_diff: Maximum timestamp difference for association [s].
73
+ sd_form: Scale drift as ``"ratio"`` (optimum 1) or ``"abs"`` (optimum 0).
74
+
75
+ Returns:
76
+ Dict with ``ate``, ``rpe`` and ``sd``, each a ``(mean, std)`` tuple.
77
+ """
78
+ np = _np()
79
+ metrics, sync, _ = _evo()
80
+ gt, est = sync.associate_trajectories(_as_evo(gt_traj), _as_evo(est_traj), max_diff=max_diff)
81
+ est_a = copy.deepcopy(est)
82
+ if align in ("se3", "sim3"):
83
+ est_a.align(gt, correct_scale=(align == "sim3"))
84
+ ate = _stat(metrics.APE(metrics.PoseRelation.translation_part), (gt, est_a))
85
+ rpe = _stat(metrics.RPE(metrics.PoseRelation.translation_part, delta=delta,
86
+ delta_unit=metrics.Unit.frames, all_pairs=False), (gt, est_a))
87
+ e, g = est.positions_xyz, gt.positions_xyz
88
+ n = min(len(e), len(g))
89
+ est_seg = np.linalg.norm(e[delta:n] - e[:n - delta], axis=1)
90
+ gt_seg = np.linalg.norm(g[delta:n] - g[:n - delta], axis=1)
91
+ valid = gt_seg > 1e-6
92
+ sd = None
93
+ if np.any(valid):
94
+ r = est_seg[valid] / gt_seg[valid]
95
+ r = r if sd_form == "ratio" else np.abs(r - 1.0)
96
+ sd = (round(float(np.mean(r)), 2), round(float(np.std(r)), 2))
97
+ return {"ate": ate, "rpe": rpe, "sd": sd}
envodat/torch_data.py ADDED
@@ -0,0 +1,120 @@
1
+ """PyTorch access to downloaded scenes (YOLO layout), without extra dependencies."""
2
+
3
+
4
+ from .hub import SPLIT_DIRS, class_names, scene_dir
5
+
6
+ IMG_EXT = {".jpg", ".jpeg", ".png", ".bmp", ".webp"}
7
+
8
+
9
+ def _torch():
10
+ try:
11
+ import torch
12
+ except ImportError as exc:
13
+ raise ImportError("Install PyTorch: pip install 'envodat[torch]'") from exc
14
+ return torch
15
+
16
+
17
+ class EnvoDatDetection:
18
+ """Map-style detection dataset over one split of a downloaded scene.
19
+
20
+ Each item is ``(image, target)``: ``image`` is a float tensor ``[3, H, W]`` in
21
+ ``[0, 1]`` (resized to ``image_size`` if given), and ``target`` is a dict with
22
+ ``boxes`` (``[N, 4]``, normalised ``cx, cy, w, h``), ``labels`` (``[N]``),
23
+ ``image_id`` and ``path``. Polygon labels are converted to their bounding boxes.
24
+
25
+ Args:
26
+ scene: Scene id, e.g. ``"mu-hall"``.
27
+ split: ``"train"``, ``"validation"`` (or ``"val"``) or ``"test"``.
28
+ image_size: Int (square) or ``(h, w)`` to resize to; ``None`` keeps the original.
29
+ transform: Optional callable ``(image, target) -> (image, target)``.
30
+ """
31
+
32
+ def __init__(self, scene, split="train", image_size=640, transform=None):
33
+ split = {"val": "validation", "valid": "validation"}.get(split, split)
34
+ self.dir = scene_dir(scene) / SPLIT_DIRS[split]
35
+ if not (self.dir / "images").is_dir():
36
+ raise FileNotFoundError(f"{self.dir}/images not found. "
37
+ f"Run envodat.download('{scene}') first.")
38
+ self.images = sorted(p for p in (self.dir / "images").iterdir()
39
+ if p.suffix.lower() in IMG_EXT)
40
+ self.classes = class_names(scene)
41
+ self.image_size = (image_size, image_size) if isinstance(image_size, int) else image_size
42
+ self.transform = transform
43
+
44
+ def __len__(self):
45
+ return len(self.images)
46
+
47
+ def _labels(self, img_path):
48
+ lbl = self.dir / "labels" / (img_path.stem + ".txt")
49
+ boxes, labels = [], []
50
+ if lbl.exists():
51
+ for line in lbl.read_text().splitlines():
52
+ v = line.split()
53
+ if len(v) < 5:
54
+ continue
55
+ c, xy = int(float(v[0])), [float(x) for x in v[1:]]
56
+ if len(xy) == 4:
57
+ boxes.append(xy)
58
+ else:
59
+ xs, ys = xy[0::2], xy[1::2]
60
+ boxes.append([(min(xs) + max(xs)) / 2, (min(ys) + max(ys)) / 2,
61
+ max(xs) - min(xs), max(ys) - min(ys)])
62
+ labels.append(c)
63
+ return boxes, labels
64
+
65
+ def __getitem__(self, i):
66
+ torch = _torch()
67
+ from PIL import Image
68
+ path = self.images[i]
69
+ img = Image.open(path).convert("RGB")
70
+ if self.image_size:
71
+ img = img.resize((self.image_size[1], self.image_size[0]))
72
+ w, h = img.size
73
+ x = torch.frombuffer(bytearray(img.tobytes()), dtype=torch.uint8)
74
+ x = x.view(h, w, 3).permute(2, 0, 1).float().div(255)
75
+ boxes, labels = self._labels(path)
76
+ target = {"boxes": torch.tensor(boxes, dtype=torch.float32).reshape(-1, 4),
77
+ "labels": torch.tensor(labels, dtype=torch.int64),
78
+ "image_id": i, "path": str(path)}
79
+ if self.transform:
80
+ x, target = self.transform(x, target)
81
+ return x, target
82
+
83
+
84
+ def collate(batch):
85
+ """Stack images (same size) and keep targets as a list."""
86
+ torch = _torch()
87
+ images, targets = zip(*batch)
88
+ try:
89
+ images = torch.stack(images)
90
+ except RuntimeError:
91
+ images = list(images) # variable sizes (image_size=None)
92
+ return images, list(targets)
93
+
94
+
95
+ def dataloader(scene, split="train", batch_size=8, image_size=640, shuffle=None,
96
+ num_workers=0, transform=None, **kwargs):
97
+ """Return a ``torch.utils.data.DataLoader`` over a downloaded scene.
98
+
99
+ Args:
100
+ scene: Scene id, e.g. ``"mu-hall"``.
101
+ split: ``"train"``, ``"validation"`` or ``"test"``.
102
+ batch_size: Images per batch.
103
+ image_size: Resize target (int or ``(h, w)``); ``None`` keeps originals.
104
+ shuffle: Defaults to ``True`` for the train split, else ``False``.
105
+ num_workers: Worker processes for loading.
106
+ transform: Optional ``(image, target) -> (image, target)`` callable.
107
+ **kwargs: Passed to ``DataLoader``.
108
+
109
+ Yields:
110
+ ``(images, targets)`` where ``images`` is ``[B, 3, H, W]`` and ``targets`` a list of
111
+ dicts as described in :class:`EnvoDatDetection`.
112
+ """
113
+ torch = _torch()
114
+ ds = EnvoDatDetection(scene, split, image_size, transform)
115
+ return torch.utils.data.DataLoader(
116
+ ds, batch_size=batch_size, shuffle=(split == "train") if shuffle is None else shuffle,
117
+ num_workers=num_workers, collate_fn=collate, **kwargs)
118
+
119
+
120
+ __all__ = ["EnvoDatDetection", "dataloader", "collate"]
envodat/train.py ADDED
@@ -0,0 +1,35 @@
1
+ """Training helpers."""
2
+
3
+ from .hub import data_yaml, download, scene_dir
4
+
5
+
6
+ def train_yolo(scene, model="yolo11n.pt", epochs=100, imgsz=640, batch=16, download_missing=True,
7
+ evaluate_test=True, **kwargs):
8
+ """Train an Ultralytics YOLO detector (YOLOv8-YOLO11) on a scene.
9
+
10
+ The scene is downloaded first if it is not present locally.
11
+
12
+ Args:
13
+ scene: Scene id, e.g. ``"mu-hall"``.
14
+ model: Pretrained weights or model config, e.g. ``"yolo11n.pt"``, ``"yolov8s.pt"``.
15
+ epochs, imgsz, batch: Main training settings.
16
+ download_missing: Fetch the scene from the Hub when it is not downloaded yet.
17
+ evaluate_test: Also validate on the test split after training.
18
+ **kwargs: Any other Ultralytics train argument (``lr0``, ``device``, ``patience``, ...).
19
+
20
+ Returns:
21
+ Dict with the trained ``model`` and the ``val`` (and ``test``) metrics objects.
22
+ """
23
+ try:
24
+ from ultralytics import YOLO
25
+ except ImportError as exc:
26
+ raise ImportError("Install Ultralytics: pip install 'envodat[train]'") from exc
27
+ if download_missing and not (scene_dir(scene) / "data.yaml").exists():
28
+ download(scene)
29
+ cfg = str(data_yaml(scene))
30
+ yolo = YOLO(model)
31
+ yolo.train(data=cfg, epochs=epochs, imgsz=imgsz, batch=batch, **kwargs)
32
+ out = {"model": yolo, "val": yolo.val(data=cfg, split="val")}
33
+ if evaluate_test:
34
+ out["test"] = yolo.val(data=cfg, split="test")
35
+ return out
@@ -0,0 +1,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: envodat
3
+ Version: 0.1.0
4
+ Summary: Toolkit for EnvoDat: download, load, train on and evaluate a multisensory robotics dataset
5
+ Author: Linus Nwankwo
6
+ License: MIT
7
+ Project-URL: Homepage, https://linusnep.github.io/EnvoDat/
8
+ Project-URL: Documentation, https://linusnep.github.io/EnvoDat/
9
+ Project-URL: Repository, https://github.com/LinusNEP/EnvoDat
10
+ Project-URL: Dataset, https://huggingface.co/datasets/Linpen/EnvoDat
11
+ Project-URL: Paper, https://ieeexplore.ieee.org/document/11127594
12
+ Keywords: robotics,dataset,slam,object-detection,lidar,hugging-face
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE-CODE
19
+ Requires-Dist: huggingface_hub>=0.25
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: pillow>=9.0
22
+ Requires-Dist: numpy>=1.21
23
+ Provides-Extra: hf
24
+ Requires-Dist: datasets>=2.14; extra == "hf"
25
+ Provides-Extra: torch
26
+ Requires-Dist: torch>=2.0; extra == "torch"
27
+ Provides-Extra: train
28
+ Requires-Dist: ultralytics>=8.1.0; extra == "train"
29
+ Provides-Extra: slam
30
+ Requires-Dist: evo>=1.25; extra == "slam"
31
+ Provides-Extra: all
32
+ Requires-Dist: datasets>=2.14; extra == "all"
33
+ Requires-Dist: torch>=2.0; extra == "all"
34
+ Requires-Dist: ultralytics>=8.1.0; extra == "all"
35
+ Requires-Dist: evo>=1.25; extra == "all"
36
+ Provides-Extra: docs
37
+ Requires-Dist: sphinx>=7; extra == "docs"
38
+ Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
39
+ Requires-Dist: myst-parser>=2; extra == "docs"
40
+ Requires-Dist: sphinx-copybutton; extra == "docs"
41
+ Dynamic: license-file
42
+
43
+ <div align="center">
44
+
45
+ # EnvoDat
46
+
47
+ **A Large-Scale Multisensory Dataset for Robotic Spatial Awareness and Semantic Reasoning in Heterogeneous Environments**
48
+
49
+ [![Documentation](https://img.shields.io/badge/Docs-linusnep.github.io%2FEnvoDat-1f72b8.svg)](https://linusnep.github.io/EnvoDat/)
50
+ [![PyPI](https://img.shields.io/pypi/v/envodat.svg)](https://pypi.org/project/envodat/)
51
+ [![Paper (ICRA 2025)](https://img.shields.io/badge/Paper-ICRA%202025-b31b1b.svg)](https://ieeexplore.ieee.org/document/11127594)
52
+ [![arXiv](https://img.shields.io/badge/arXiv-2410.22200-b31b1b.svg)](https://arxiv.org/abs/2410.22200)
53
+ [![Hugging Face Dataset](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Dataset-ffcc4d.svg)](https://huggingface.co/datasets/Linpen/EnvoDat)
54
+ [![License: CC BY 4.0](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)
55
+
56
+ πŸ“– [Documentation](https://linusnep.github.io/EnvoDat/) | 🌐 [Project Website](https://sites.google.com/view/envodat/overview) | βš™οΈ [Install](docs/installation.md) | πŸ§ͺ [Examples](docs/examples.md) | πŸ† [Leaderboard](docs/benchmark.md) | πŸ€— [Hugging Face](https://huggingface.co/datasets/Linpen/EnvoDat) | πŸ“₯ [Download](https://sites.google.com/view/envodat/download) | βš–οΈ [License](https://creativecommons.org/licenses/by/4.0/)
57
+
58
+ <img src="docs/scene_characteristics.gif" alt="Scene characteristics">
59
+
60
+ ---
61
+
62
+ </div>
63
+
64
+ ## Overview
65
+
66
+ EnvoDat is a large-scale, multisensory robotics dataset captured across **heterogeneous indoor, outdoor, and subterranean environments**, with annotations and ground truth designed for tasks such as:
67
+
68
+ 1. **Spatial awareness:** SLAM and odometry benchmarking under dynamic entities, varying illumination, opaque surfaces, low/zero-visibility, and feature-sparse conditions.
69
+ 2. **Semantic reasoning:** Object detection and semantic perception on non-standard objects, terrain, and lighting that differ from common household/urban datasets.
70
+
71
+ Here, we provide the **`envodat` toolkit** (`pip install envodat`) and the **development and benchmarking kit** to download and load the data, reproduce the perception experiments, evaluate SLAM trajectories, and submit results to the public leaderboard. The annotated scenes can be pulled straight from the Hugging Face Hub for training, while the raw sensor data is hosted on our server (see [Download](#download)).
72
+
73
+ ## Summary Video
74
+
75
+ <p align="center">
76
+ <a href="https://youtu.be/5OcByVmTUPQ">
77
+ <img src="docs/sumVideo.png" alt="Summary video" width="500">
78
+ </a>
79
+ </p>
80
+
81
+ ## Download
82
+
83
+ EnvoDat is available from two places, depending on what you need:
84
+
85
+ | Source | Contents | Best for |
86
+ |--------|----------|----------|
87
+ | πŸ€— [Hugging Face Hub](https://huggingface.co/datasets/Linpen/EnvoDat) | Annotated scenes, training-ready (YOLO layout + πŸ€— `datasets` configs) | Training and evaluating ML models |
88
+ | πŸ“₯ [EnvoDat Download](https://sites.google.com/view/envodat/download) | Full release: raw ROS bags (RGB, LiDAR, depth, IMU), ground-truth poses, and all annotation formats (YOLO, COCO, OpenAI-CLIP, VOC, …) | SLAM/odometry, multisensor research, other formats |
89
+
90
+ To fetch scenes from the Hub, either use the helper script or load them directly with πŸ€— `datasets`:
91
+
92
+ ```bash
93
+ pip install envodat
94
+ envodat list # available scenes
95
+ envodat download mu-hall # one scene, YOLO-ready
96
+ ```
97
+
98
+ ```python
99
+ from datasets import load_dataset
100
+ ds = load_dataset("Linpen/EnvoDat", "mu-hall") # train / validation / test splits
101
+ ```
102
+
103
+ See [`docs/huggingface.md`](docs/huggingface.md) for the Hub layout and version pinning, and [`docs/examples.md`](docs/examples.md#download-raw-data) for downloading raw data from the CPS server.
104
+
105
+ ## Quickstart
106
+
107
+ ```bash
108
+ pip install "envodat[all]"
109
+ ```
110
+
111
+ ```python
112
+ import envodat as ed
113
+
114
+ ed.init("./envodat_data") # where the data is stored
115
+ ed.download("mu-hall") # training-ready scene from Hugging Face
116
+ ds = ed.load("mu-hall") # πŸ€— datasets: train / validation / test
117
+ loader = ed.dataloader("mu-hall", split="train", batch_size=8) # PyTorch
118
+ ed.train_yolo("mu-hall", model="yolo11n.pt", epochs=100) # Ultralytics YOLO
119
+ ed.evaluate_traj("my_slam.tum", "gt-poses-mu-hall.csv") # ATE / RPE / scale drift
120
+ ```
121
+
122
+ The same is available from the command line (`envodat download mu-hall`, `envodat train mu-hall`, `envodat eval ...`). The [documentation](https://linusnep.github.io/EnvoDat/) covers [installation](docs/installation.md), [examples](docs/examples.md) including training with πŸ€— Transformers, the [API](docs/api.md), the [modalities](docs/modalities.md) and [environments](docs/environments.md), and a full [YOLO walkthrough](docs/get_started.md).
123
+
124
+ ## Benchmark & Leaderboard
125
+
126
+ The public leaderboard can be found in [`docs/benchmark.md`](docs/benchmark.md) and covers two tracks:
127
+
128
+ - **SLAM track** β€” RTAB-Map, ORB-SLAM3, HDL-SLAM, FAST-LIO2, DLIO across five representative scenes, scored by ATE, RPE, and scale drift.
129
+ - **Detection track** β€” object detectors evaluated with mAP on EnvoDat scenes.
130
+
131
+ To reproduce or contribute results, see [How to submit](docs/benchmark.md#how-to-submit) and [`CONTRIBUTING.md`](CONTRIBUTING.md).
132
+
133
+ ## Paper Citation
134
+
135
+ If you use this work in your research, please cite our [paper](https://ieeexplore.ieee.org/abstract/document/11127594) and [dataset](https://linusnep.github.io/EnvoDat/) using the following BibTeX entry:
136
+
137
+ ```bibtex
138
+ @INPROCEEDINGS{11127594,
139
+ author={Nwankwo, Linus and Ellensohn, BjΓΆrn and Dave, Vedant and Hofer, Peter and Forstner, Jan and Villneuve, Marlene and Galler, Robert and Rueckert, Elmar},
140
+ booktitle={2025 IEEE International Conference on Robotics and Automation (ICRA)},
141
+ title={EnvoDat: A Large-Scale Multisensory Dataset for Robotic Spatial Awareness and Semantic Reasoning in Heterogeneous Environments},
142
+ year={2025},
143
+ volume={},
144
+ number={},
145
+ pages={153-160},
146
+ keywords={Simultaneous localization and mapping;Annotations;Heuristic algorithms;Supervised learning;Semantics;Benchmark testing;Cognition;Spatial databases;Robustness;Sensors},
147
+ doi={10.1109/ICRA55743.2025.11127594}}
148
+ ```
149
+ ## Dataset
150
+
151
+ ```bibtex
152
+ @software{envodat,
153
+ author = {Linus Nwankwo and Bjoern Ellensohn and Vedant Dave and Peter Hofer and Jan Forstner and Marlene Villneuve and Robert Galler and Elmar Rueckert},
154
+ title = {EnvoDat: A Large-Scale Multisensory Dataset for Robotic Spatial Awareness and Semantic Reasoning in Heterogeneous Environments},
155
+ note = {Project Website: \url{https://linusnep.github.io/EnvoDat/}},
156
+ eprint={2410.22200},
157
+ archivePrefix={arXiv},
158
+ url={https://linusnep.github.io/EnvoDat/}
159
+ }
160
+ ```
161
+
162
+ ## License
163
+
164
+ The dataset and documentation are licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
165
+ The code/scripts in this repository are released under the [MIT License](LICENSE-CODE). (Creative Commons recommends against using CC licenses for software, hence the separate code license.)
166
+
167
+ ## Acknowledgement
168
+
169
+ This project has received funding from the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation), No. #430054590 (TRAIN).
@@ -0,0 +1,15 @@
1
+ envodat/__init__.py,sha256=RoWY09j-Jg-Hdq4611ha5hM5Fggl8TZ5n7NI0kHKLdA,1222
2
+ envodat/_config.py,sha256=IAH7dlHkaz-m5W0yLNLHgxpxyZKSflCb3fpUvEOxaHY,885
3
+ envodat/catalog.py,sha256=OmpU3Rj3owy_9XHvfxSg92Yh9fB4xBx_K9JVyKKYc1s,4566
4
+ envodat/cli.py,sha256=T2PycKekEqPHdWIsm5uo9hLuWJF8dEct2vHqxeFT2WU,4372
5
+ envodat/cps.py,sha256=0w23VvIe9lNW7-QtQ6Py1fpHa41_aNDMHAZ9MaUsy94,9528
6
+ envodat/hub.py,sha256=ZN7chAf4habFZD4xpt0z1j3v29uNJ_xaxPxghvaFbqA,8029
7
+ envodat/slam.py,sha256=56-yjVgG1a0eVz2xz_yC7OCjY9H_HpOMpiIREtYlG1I,3695
8
+ envodat/torch_data.py,sha256=Bt8L4veUuMZdySTI5t4ooqnP3GxBl85Bt54OiCtu_Xk,4893
9
+ envodat/train.py,sha256=hKBtHZQKZ3zVpr9B9OwZQVbMq-kDZ_JkJfG4uT4Itrw,1474
10
+ envodat-0.1.0.dist-info/licenses/LICENSE-CODE,sha256=9ULDxbV16cL5ZbRYvMlIBMtcNahKq1IPF6-ZbEji91Q,1364
11
+ envodat-0.1.0.dist-info/METADATA,sha256=zZujlEvGzo0ifffgYBexKEQnUS1exSCZlKgntS78Itg,8883
12
+ envodat-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
13
+ envodat-0.1.0.dist-info/entry_points.txt,sha256=ZaA_8zKbGxTV5K_yXlu8NWPXj3t63C0X68BRN93WNwI,45
14
+ envodat-0.1.0.dist-info/top_level.txt,sha256=rAmixTBHuhzJ342NhwfJSw3QfGx1iOD0xyT3u1pW3I8,8
15
+ envodat-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ envodat = envodat.cli:main
@@ -0,0 +1,27 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 Linus Nwankwo and the EnvoDat authors
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
+
23
+ ---
24
+ Note: This MIT license only applies to the CODE in this repository (scripts, tooling).
25
+ The EnvoDat DATASET and DOCUMENTATION are licensed separately under
26
+ Creative Commons Attribution 4.0 International (CC BY 4.0):
27
+ https://creativecommons.org/licenses/by/4.0/
@@ -0,0 +1 @@
1
+ envodat