Datasets:

Modalities:
Image
Libraries:
Datasets
License:
File size: 3,652 Bytes
3a25bde
 
 
 
4c949b2
3a25bde
 
 
 
 
 
 
 
0174235
3a25bde
 
 
 
 
aeb406f
3a25bde
 
 
f39f726
3a25bde
aeb406f
89fff23
aeb406f
3a25bde
aeb406f
3a25bde
 
 
 
 
 
 
f39f726
3a25bde
aeb406f
 
 
3a25bde
 
 
 
 
 
 
 
 
 
 
 
 
 
aeb406f
3a25bde
 
 
 
 
 
 
 
 
aeb406f
3a25bde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aeb406f
3a25bde
aeb406f
 
 
 
 
 
 
 
3a25bde
aeb406f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
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

<video title="source" controls>
  <source src="https://cdn-uploads.huggingface.co/production/uploads/608c79739c5a8f8ddd85c409/SVwh26SkRYi5QsH6A76xj.mp4" type="video/mp4">
</video>

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)

<img src="https://cdn-uploads.huggingface.co/production/uploads/608c79739c5a8f8ddd85c409/F3dVqtMBR0zIicx1RD4Ek.png" alt="hw_types" width="500"/>

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/
└── <segment_id>/
    ├── 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()
```

![tmpwp75ks43](https://cdn-uploads.huggingface.co/production/uploads/608c79739c5a8f8ddd85c409/c6DkyVrD6644hwFgt1Aow.png)

```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()
```
<img src="https://cdn-uploads.huggingface.co/production/uploads/608c79739c5a8f8ddd85c409/MR00BzcF_gCATP4nombod.png" alt="map" width="800"/>

```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
```