---
license: other
license_link: LICENSE.md
license_name: comma-av-dataset
short_description: A large self-driving dataset containing one-minute driving segments with road-camera video, and full localization data.
configs:
- config_name: thumbnails
default: true
data_files:
- split: test
path: "data/*/thumbnail.jpg"
drop_labels: true
---
# comma 5k
A 5k preview of comma.ai's self-driving dataset containing one-minute driving segments with road-camera video, logs, and full localization data.
## Dataset collection
Segments were recorded by comma devices installed in real user vehicles. The collection spans several hardware generations (comma three, comma 3X, and comma four)
Each segment includes a narrow FOV camera, wide FOV camera, preview thumbnail, log file with various measurements (GNSS, IMU, etc.), frame timing data, and offline localization data.
The offline `localizer.safetensors` is the result of an a fusion of raw GNSS measurements, accelerometer and gyroscope data, vehicle motion constraints, and visual feature tracks from the road cameras providing an accurate localization estimate.
## Structure
```text
data/
└── /
├── fcamera.hevc
├── ecamera.hevc
├── thumbnail.jpg
├── localizer.safetensors
├── frame_info.safetensors
└── rlog.zst
```
## Example usage
```python
import numpy as np
import plotly.graph_objects as go
from huggingface_hub import hf_hub_download
from safetensors.numpy import load_file
from pymap3d import ecef2geodetic
from PIL import Image
segment_id = "001774ef60cf6c43657cd317035fae58"
thumbnail_path = hf_hub_download(
repo_id="commaai/comma5k", repo_type="dataset",
filename=f"data/{segment_id}/thumbnail.jpg",
)
Image.open(thumbnail_path).show()
```

```python
localizer_path = hf_hub_download(
repo_id="commaai/comma5k", repo_type="dataset",
filename=f"data/{segment_id}/localizer.safetensors",
)
states = load_file(localizer_path)["states"]
latitude, longitude, _ = ecef2geodetic(*states[:, :3].T)
speed = np.linalg.norm(states[:, 7:10], axis=1)
fig = go.Figure()
fig.add_trace(go.Scattermap(lat=latitude[::10], lon=longitude[::10],
mode="lines+markers", line={"color": "#ff4d4d", "width": 3},
marker={"size": 6,"color": speed[::10],"colorscale": "Turbo","colorbar": {"title": "speed (m/s)"}}))
# span and zoom for map
span = max(float(np.ptp(latitude)), float(np.ptp(longitude)), 1e-6)
zoom = float(np.clip(np.log2(360.0 / span) - 1., 1, 18))
fig.update_layout(map={"style": "open-street-map","center": {"lat": float(np.mean(latitude)), "lon": float(np.mean(longitude))},"zoom": zoom},
legend={"orientation": "h", "x": 0.01, "y": 0.01},
)
fig.show()
```
```python
from openpilot.tools.lib.logreader import LogReader
rlog_path = hf_hub_download(
repo_id="commaai/comma5k",
repo_type="dataset",
filename=f"data/{segment_id}/rlog.zst",
)
lr = LogReader(rlog_path)
speeds = [state.vEgo for state in lr.filter("carState")]
print(f"max speed: {max(speeds):.2f} m/s")
# max speed: 16.76 m/s
```