ATLAS-nuScenes / README.md
ps3020's picture
Add files using upload-large-folder tool
d6c6a09 verified
|
Raw
History Blame Contribute Delete
11.6 kB
---
license: cc-by-nc-sa-4.0
task_categories:
- object-detection
tags:
- atlas
- lidar
- 3d-object-detection
- adversarial-robustness
- point-cloud
- nuscenes
size_categories:
- 10K<n<100K
configs:
- config_name: inject_global_easy
data_files:
- split: train
path: data/inject_global_easy/train-*
- config_name: inject_global_medium
data_files:
- split: train
path: data/inject_global_medium/train-*
- config_name: inject_global_hard
data_files:
- split: train
path: data/inject_global_hard/train-*
- config_name: inject_relative_easy
data_files:
- split: train
path: data/inject_relative_easy/train-*
- config_name: inject_relative_medium
data_files:
- split: train
path: data/inject_relative_medium/train-*
- config_name: inject_relative_hard
data_files:
- split: train
path: data/inject_relative_hard/train-*
- config_name: removal_az10
data_files:
- split: train
path: data/removal_az10/train-*
- config_name: removal_az20
data_files:
- split: train
path: data/removal_az20/train-*
- config_name: removal_az30
data_files:
- split: train
path: data/removal_az30/train-*
- config_name: removal_az40
data_files:
- split: train
path: data/removal_az40/train-*
- config_name: removal_az50
data_files:
- split: train
path: data/removal_az50/train-*
- config_name: removal_az60
data_files:
- split: train
path: data/removal_az60/train-*
---
# ATLAS-nuScenes
Adversarial LiDAR point clouds derived from the nuScenes trainval **validation**
split (150 scenes, 6019 keyframes).
Anonymous release supporting a submission under review; author and affiliation
details are withheld for the review period.
Part of **ATLAS**: `ps3020/atlas-kitti` · `ps3020/atlas-nuscenes`
## Configs
Injection — a phantom vehicle that does not exist is added:
`inject_global_easy`, `inject_global_medium`, `inject_global_hard`,
`inject_relative_easy`, `inject_relative_medium`, `inject_relative_hard`
`global` fixes the phantom in world coordinates, `relative` fixes it relative to
the ego vehicle. `easy`/`medium`/`hard` are decreasing phantom point densities.
Removal — points in an azimuth wedge are deleted to hide a real vehicle:
`removal_az10`, `removal_az20`, `removal_az30`, `removal_az40`, `removal_az50`,
`removal_az60` (suffix = wedge width in degrees)
Every row is an attacked frame; there are no clean frames.
## Setup
**1. Install**
```bash
pip install datasets numpy
pip install nuscenes-devkit # only for sequence reconstruction (optional)
```
**2. Load a config**
```python
from datasets import load_dataset
ds = load_dataset("ps3020/atlas-nuscenes", "removal_az20", split="train")
```
Add `streaming=True` to avoid downloading a whole config (each is 2.5–3.7 GB).
**That is all that is required to evaluate attacks.** Each row carries the
complete attacked point cloud and the attacked object's box, so attack success
rate needs nothing else.
**3. nuScenes source data — only for sequence reconstruction**
Needed *only* if you want the clean frames this dataset does not ship (see
*Attacked frames only* below). Download from
<https://www.nuscenes.org/nuscenes> (free account): `v1.0-trainval_meta.tgz`
plus the ten `v1.0-trainval{01..10}_blobs_lidar.tgz` (~126 GB). Extract to:
```
<NUSCENES_ROOT>/
samples/LIDAR_TOP/ 34149 keyframe clouds
sweeps/LIDAR_TOP/ 297737 intermediate clouds
v1.0-trainval/ *.json metadata tables
```
> Some nuScenes archives carry trailing bytes that make `tar xzf` abort **silently
> part-way**, leaving `sweeps/` incomplete. If you hit missing-file errors, use
> `gzip -dc FILE.tgz | tar -x --ignore-zeros -C <NUSCENES_ROOT>` and confirm
> `ls sweeps/LIDAR_TOP | wc -l` reports 297737.
### Quick check
```python
from datasets import load_dataset
import numpy as np
ds = load_dataset("ps3020/atlas-nuscenes", "removal_az20",
split="train", streaming=True)
ex = next(iter(ds))
pts = np.asarray(ex["points"], np.float32).reshape(ex["num_points"], ex["point_dim"])
print(ex["segment"], ex["frame_index"], pts.shape)
# scene-0003 32 (259188, 6)
```
## Usage
```python
from datasets import load_dataset
import numpy as np
ds = load_dataset("ps3020/atlas-nuscenes", "removal_az20", split="train")
ex = ds[0]
# points are stored FLAT -- reshape to recover the cloud
pts = np.asarray(ex["points"], np.float32).reshape(ex["num_points"], ex["point_dim"])
# (N, 6) = x, y, z, intensity, time, lag (10-sweep accumulated, N ~ 265k)
spoof_gt = np.asarray(ex["spoof_gt"], np.float32) # (7,) injection | (10,) removal
gt_boxes = np.asarray(ex["gt_boxes"], np.float32).reshape(ex["num_gt"], ex["gt_box_dim"])
pose = np.asarray(ex["pose"], np.float64).reshape(4, 4) # ref(lidar) -> global
```
Or use the bundled helper:
```python
from load_atlas_nuscenes import load_atlas, points_of, attacked_index
ds = load_atlas("removal_az20")
pts = points_of(ds[0])
idx = attacked_index(ds) # {segment: {frame_index: row}}
```
## Attack success rate
`spoof_gt` is the attacked object. Score each frame by whether a prediction
overlaps it at IoU >= 0.3:
- **injection** — success = a detection *appears* (false positive created)
- **removal** — success = the detection *is missing* (true positive destroyed)
```python
n_success = 0
for ex in ds:
pts = np.asarray(ex["points"], np.float32).reshape(ex["num_points"], ex["point_dim"])
pred = my_detector(pts)
hit = overlaps(pred, ex["spoof_gt"], iou_thresh=0.3)
n_success += hit if "inject" in config else (not hit)
asr = n_success / len(ds)
```
**Use `len(ds)`, not 6019.** Only attacked frames are shipped and only they are
scored. Counts differ per family because removal additionally requires a trackable
vehicle:
| family | configs | attacked frames each |
|---|---|---|
| injection | 6 | 1219 |
| removal | 6 | 869 |
## Attacked frames only
A nuScenes scene is ~40 keyframes and the attack covers the last 8, so ~80% of
each split would be a **bit-identical copy of source nuScenes**. Those frames are
not shipped, for three reasons: they are nuScenes' data rather than ours and
redistributing them would bypass nuScenes' own registration and license terms;
they are identical across all 12 configs, so shipping them means 12 duplicate
copies; and they are never scored, since ASR is defined only on attacked frames.
Nothing is lost. The omitted frames are unmodified, so a full sequence is
recovered by substitution. Every row carries four keys back to the source:
| key | meaning |
|---|---|
| `segment` | scene name, e.g. `"scene-0003"` |
| `frame_index` | position within the scene (0-based) |
| `sample_token` | **nuScenes sample token — the canonical global key** |
| `frame_id` | source `LIDAR_TOP` filename |
Prefer `sample_token`: it is nuScenes' own primary key and does not depend on
reproducing our scene ordering.
### Reconstructing a full sequence
This dataset is standalone — it is not a patch layer over nuScenes, and nothing
substitutes frames automatically. If you want full sequences, mix the two sources
in your own loader. This example is complete and runnable:
```python
import os
import numpy as np
from nuscenes.nuscenes import NuScenes
from datasets import load_dataset
NUSCENES_ROOT = "/path/to/nuscenes"
nusc = NuScenes(version="v1.0-trainval", dataroot=NUSCENES_ROOT, verbose=False)
ds = load_dataset("ps3020/atlas-nuscenes", "removal_az20", split="train")
attacked = {} # {segment: {frame_index: row}}
for r in ds:
attacked.setdefault(r["segment"], {})[r["frame_index"]] = r
def clean_cloud(sample_token):
"""One clean nuScenes keyframe as (N, 5) = x, y, z, intensity, ring."""
sd = nusc.get("sample_data", nusc.get("sample", sample_token)["data"]["LIDAR_TOP"])
return np.fromfile(os.path.join(NUSCENES_ROOT, sd["filename"]),
dtype=np.float32).reshape(-1, 5)
scene_name = "scene-0003"
scene = next(s for s in nusc.scene if s["name"] == scene_name)
sequence, tok = [], scene["first_sample_token"]
for i in range(scene["nbr_samples"]):
if i in attacked[scene_name]:
row = attacked[scene_name][i]
pts = np.asarray(row["points"], np.float32).reshape(
row["num_points"], row["point_dim"]) # (N, 6), ATTACKED
sequence.append((pts, True))
else:
sequence.append((clean_cloud(tok), False)) # clean, from your copy
tok = nusc.get("sample", tok)["next"]
print(f"{scene_name}: {len(sequence)} frames, "
f"{sum(a for _, a in sequence)} attacked")
# scene-0003: 40 frames, 7 attacked
```
For an existing pipeline, one dict lookup is usually enough:
```python
attacked_by_token = {r["sample_token"]: r for r in ds}
def get_points(sample_token):
r = attacked_by_token.get(sample_token)
if r is not None:
return np.asarray(r["points"], np.float32).reshape(r["num_points"], r["point_dim"])
return my_existing_loader(sample_token)
```
Three things to know when doing this:
- **Clean and attacked clouds are not the same width.** Ours are `(N, 6)` at ~265k
points because they are 10-sweep accumulated. A single raw `.pcd.bin` is `(N, 5)`
at ~35k points with `ring` as the 5th column. If your loader accumulates sweeps
itself, do **not** re-accumulate ours — they are already assembled.
- **Reproducing our clean frames exactly needs the detector pipeline, not just
sweep accumulation.** `load_atlas_nuscenes.clean_cloud()` accumulates 10 sweeps
and is fine for inspection, but it omits the point-cloud range filter and returns
~1.3× too many points (~347k vs ~265k). For a numerically matched clean baseline,
load through the same config used for evaluation (e.g. OpenPCDet
`NuScenesDataset` with the standard 10-sweep nuScenes config).
- **`frame_id` is the `.pcd` stem** while nuScenes stores `<stem>.pcd.bin`, so a
filename equality check fails. Use `sample_token`.
For **attack evaluation none of this applies**: ASR uses only the shipped frames.
## Fields
| field | description |
|---|---|
| `segment`, `frame_index`, `num_frames_in_segment` | position within the scene |
| `sample_token`, `frame_id` | nuScenes identity |
| `points`, `num_points`, `point_dim` | attacked cloud, flattened; reshape to `(N, 6)` |
| `spoof_gt`, `spoof_gt_dim` | attacked object — `(7,)` injection, `(10,)` removal |
| `gt_boxes`, `num_gt`, `gt_box_dim` | clean nuScenes GT `(M, 10)`, last column = 1-indexed class (car = 1) |
| `pose` | 4×4 ref(lidar) → global, flattened |
| `atk_*` | attack parameters — 7 fields for injection, 21 for removal |
For removal, the realised removal rate is
`atk_n_points_removed / atk_n_points_in_sector`.
## Notes
- Point clouds are **10-sweep accumulated** (~265k points/frame), the standard
nuScenes detection setting. Feature 4 is a timestamp, not elongation.
- `spoof_gt` has 10 columns for removal (a real GT box: geometry + velocity +
class) but 7 for injection (a phantom: geometry only).
- Attacks target the **car** class.
- Removal follows the A-HFR model, with per-width removal probabilities calibrated
against physical measurements from Cao et al., USENIX Security 2023. Its
range-dependent firing gate means not every scheduled frame fires.
- Phantom intensity is sampled from the diffuse range-conditioned distribution
rather than saturated; see the paper for the ablation.
## License
`cc-by-nc-sa-4.0`, inherited from nuScenes. These are derived point clouds, so the
non-commercial and share-alike terms of the original apply. Please cite nuScenes
alongside this dataset.