Scene2Wave / metadata /raw_dataset_schema.md
mfzheng's picture
Upload Scene2Wave release metadata
30d138d verified
|
Raw
History Blame Contribute Delete
8.19 kB

Scene2Wave dataset schema v1

Scene2Wave 1.0.1 contains 100 one-second multimodal CARLA/Sionna samples. The machine-readable JSON Schema is metadata/json_schema.json; this document defines file roles, units, synchronization rules, and minimal reading examples.

Sample layout

data/main_training/<Town>/<state>/<profile>/<scenario>/
├── sample_metadata.json
├── carla/
│   ├── alignment_index.json
│   ├── cav_1/
│   ├── rsu_1/
│   ├── birdview/
│   └── scenes/
└── sionna/

Generator cache keys, internal asset manifests, visualizations, and derived videos are not release data and are deliberately excluded.

JSON and JSONL documents

dataset_info.json

Release-level identity, provenance, distribution counts, byte/file counts, and the explicit inclusion/exclusion policy. Validate it with JSON Schema definition datasetInfo.

metadata/samples.jsonl

The authoritative sample index. Each non-empty line is one independent JSON object matching sampleIndexRecord.

Field Type Unit / meaning
sample_id string Unique sample identifier.
relative_path string Dataset-root-relative sample directory.
town string CARLA map.
state string static, 10kmh, 20kmh, 40kmh, or 60kmh.
profile string Dataset/channel profile bucket.
scenario string Generator scenario name.
valid_cir boolean Whether the formal CIR sample passed validity checks.
contains_empty_cir boolean Whether any selected CIR frame is empty.
carrier_frequency_hz number RF carrier frequency in Hz.
bandwidth_hz number Occupied bandwidth in Hz.
subcarrier_spacing_hz number OFDM subcarrier spacing in Hz.
num_subcarriers integer Number of CSI subcarriers.
csi_sampling_rate_hz number CIR/CSI temporal sampling rate in Hz.

sample_metadata.json

A compact user-facing record matching sampleMetadata. It intentionally keeps only stable fields needed for filtering, interpretation, reproduction, and the browser demo.

  • dataset: subset/profile/role/split/Town/state labels.
  • radio: carrier, bandwidth, subcarrier spacing/count, and temporal rate.
  • channel: validity, outage, LOS/NLOS, path-count, delay-spread, and material profile summaries.
  • geometry: RSU/CAV positions and mean link distance in CARLA world metres.
  • ray_tracing: the public Sionna RT computation summary.
  • sensor_context: birdview calibration and route centre needed to place overlays. It is not a generator cache.
  • provenance: stable hashes only; no workstation path.
  • paths: sample-relative locations of CARLA, Sionna, and alignment data.

Coordinates under geometry use the CARLA world frame and metres. The file does not replace the per-frame YAML pose records under carla/cav_1/ and carla/rsu_1/.

carla/alignment_index.json

The authoritative mapping between the 2 kHz geometry/CIR/CSI clock and lower rate sensors. Validate it with alignmentIndex.

  • geometry.frames[] maps geometry_index to CARLA frame_id and time_s.
  • streams[] identifies every sensor stream and its actual observed frames.
  • observed_frames[].nearest_geometry_frame_id is the geometry frame associated with the sensor callback.
  • planned_samples[] records the requested schedule and is retained for acquisition QA; consumers normally use observed_frames[].
  • An empty relative_path means construct the path as carla/<relative_dir>/<frame_id:06d><filename_suffix>.
  • For LiDAR, _lidar.pcd maps to the actual suffix .pcd; for Radar, _radar.json maps to .json.

Do not synchronize modalities by taking equal list indices or by comparing sorted filenames. Select on the geometry clock and use the nearest observed frame from the relevant stream.

carla/rsu_1/<frame_id>.json

One raw RSU Radar frame matching radarFrame. It is an array of detections:

Field Unit Meaning
depth m Range from the Radar sensor.
azimuth rad Horizontal detection angle in the sensor frame.
altitude rad Vertical detection angle in the sensor frame.
velocity m/s Relative radial velocity along the detection ray.

Sensor-frame Cartesian coordinates are:

x = depth * cos(altitude) * cos(azimuth)
y = depth * cos(altitude) * sin(azimuth)
z = depth * sin(altitude)

Use the matching per-frame RSU pose YAML when transforming these points into the CARLA world frame.

Read the release index and compact metadata

import json
from pathlib import Path

root = Path("scene2wave_dataset")
records = [
    json.loads(line)
    for line in (root / "metadata/samples.jsonl").read_text().splitlines()
    if line.strip()
]

record = records[0]
sample = root / record["relative_path"]
metadata = json.loads((sample / "sample_metadata.json").read_text())

print(record["sample_id"])
print(metadata["radio"]["carrier_frequency_hz"])
print(metadata["channel"]["dominant_link_state"])

Resolve the nearest aligned sensor frame

import json
from pathlib import Path


def actual_suffix(stream):
    suffix = stream["filename_suffix"]
    if stream["modality"] == "lidar" and suffix == "_lidar.pcd":
        return ".pcd"
    if stream["modality"] == "radar" and suffix == "_radar.json":
        return ".json"
    return suffix


def nearest_stream_file(sample, alignment, stream_id, geometry_frame_id):
    stream = next(item for item in alignment["streams"] if item["stream_id"] == stream_id)
    observed = min(
        stream["observed_frames"],
        key=lambda row: abs(row["nearest_geometry_frame_id"] - geometry_frame_id),
    )
    if observed["relative_path"]:
        return sample / "carla" / observed["relative_path"]
    return (
        sample / "carla" / stream["relative_dir"]
        / f"{observed['frame_id']:06d}{actual_suffix(stream)}"
    )


alignment = json.loads((sample / "carla/alignment_index.json").read_text())
geometry_frame_id = alignment["geometry"]["frames"][1000]["frame_id"]
radar_path = nearest_stream_file(
    sample, alignment, "rsu_1.radar", geometry_frame_id
)
print(radar_path)

The exact Radar stream ID can also be discovered instead of assumed:

radar_streams = [
    stream["stream_id"]
    for stream in alignment["streams"]
    if stream["modality"] == "radar"
]

Read Radar and convert to XYZ

import json
import numpy as np

detections = json.loads(radar_path.read_text())
depth = np.asarray([row["depth"] for row in detections], dtype=np.float32)
azimuth = np.asarray([row["azimuth"] for row in detections], dtype=np.float32)
altitude = np.asarray([row["altitude"] for row in detections], dtype=np.float32)
velocity = np.asarray([row["velocity"] for row in detections], dtype=np.float32)

xyz = np.column_stack(
    (
        depth * np.cos(altitude) * np.cos(azimuth),
        depth * np.cos(altitude) * np.sin(azimuth),
        depth * np.sin(altitude),
    )
)

Inspect Sionna CIR/CSI NPZ

Sionna products remain in their native NPZ form. Discover keys before assuming tensor names or dimensions:

import numpy as np

npz_path = next((sample / "sionna").rglob("*_paths.npz"))
with np.load(npz_path, allow_pickle=False) as payload:
    print(npz_path.name, payload.files)
    for key in payload.files:
        print(key, payload[key].shape, payload[key].dtype)

Pair an NPZ frame to sensor data through the NPZ filename's frame ID and alignment_index.json, not through array ordinal alone.

Validate JSON documents

Install jsonschema, then select the definition appropriate to the file:

import json
from jsonschema import Draft202012Validator

schema = json.loads((root / "metadata/json_schema.json").read_text())
validator = Draft202012Validator({
    "$schema": schema["$schema"],
    "$ref": "#/$defs/sampleMetadata",
    "$defs": schema["$defs"],
})
validator.validate(metadata)

Use datasetInfo, sampleIndexRecord, sampleMetadata, alignmentIndex, or radarFrame as the $ref target. For JSONL, validate each line separately.