diff --git a/.gitattributes b/.gitattributes index 8ff50265dc845cd47120fca1fe2d5d3a3b4542aa..6bbe4c35f823f600a5c9cfa7f90144f056450f01 100644 --- a/.gitattributes +++ b/.gitattributes @@ -60,3 +60,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.webm filter=lfs diff=lfs merge=lfs -text T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/dynamicWorld.json filter=lfs diff=lfs merge=lfs -text T-Crossing-St2214-DuenzlauUmgehung_1b9b-1b9bf4b8-9fa6-4d23-abd2-2b715d087e8f/dynamicWorld.json filter=lfs diff=lfs merge=lfs -text +Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/dynamicWorld.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0fa16ad883ff7d9fcca1eba6001b161960e91a6e --- /dev/null +++ b/README.md @@ -0,0 +1,275 @@ +--- +language: +- en +- de +license: cc-by-nd-4.0 +tags: +- autonomous-driving +- traffic-analysis +- trajectory-prediction +- drone-data +- automatum +- open-drive +- json +- t-crossing +- intersection +- openscenario +pretty_name: "Automatum Data: T-Crossing Drone Dataset" +task_categories: +- time-series-forecasting +- object-detection +size_categories: +- 1K **Quick Preview:** Browse `Sample_Data/` to explore the data structure before downloading the full archive. The sample recording can be loaded directly with the `openautomatumdronedata` Python library. + +## Recording Overview + +### 1. T-Crossing Gaimersheim Stadtweg + +| | | +|---|---| +| ![Map](doc/map_gaimersheim.jpg) | ![Trajectories](doc/trajectories_gaimersheim.jpg) | + +| KPI | Value | +|-----|-------| +| Trajectories | 299 | +| Duration | 650.7 s (~10.8 min) | +| Traffic Flow | 1,654.3 veh/h | +| Traffic Density | 40.2 veh/km | +| Avg. Speed | 41.2 km/h | +| Max. Speed | 109.4 km/h | +| Max. Acceleration | 4.7 m/s² | +| Location | 48.7882°N, 11.3855°E | + +### 2. T-Crossing St2214 Dünzlau Umgehung + +| | | +|---|---| +| ![Map](doc/map_duenzlau.jpg) | ![Trajectories](doc/trajectories_duenzlau.jpg) | + +| KPI | Value | +|-----|-------| +| Trajectories | 384 | +| Duration | 1,125.6 s (~18.8 min) | +| Traffic Flow | 1,228.1 veh/h | +| Traffic Density | 22.1 veh/km | +| Avg. Speed | 55.6 km/h | +| Max. Speed | 110.4 km/h | +| Max. Acceleration | 5.8 m/s² | +| Location | 48.7762°N, 11.3196°E | + +## Data Structure + +Each recording folder contains: + +``` +recording_folder/ +├── dynamicWorld.json # Trajectories, velocities, accelerations, bounding boxes +├── staticWorld.xodr # Road geometry in OpenDRIVE format +├── recording_name.html # Interactive metadata overview (Bokeh) +└── img/ + ├── kpis.json # Key performance indicators + ├── *_map.jpg # Aerial map view + ├── *_trajectories.jpg # Trajectory visualization + └── *_centerImg_thumb.jpg # Center frame thumbnail +``` + +### dynamicWorld.json + +The core data file contains for each tracked vehicle: + +- **Position vectors**: `x_vec`, `y_vec` — UTM coordinates over time +- **Velocity vectors**: `vx_vec`, `vy_vec` — in m/s +- **Acceleration vectors**: `ax_vec`, `ay_vec` — in m/s² +- **Jerk vectors**: `jerk_x_vec`, `jerk_y_vec` +- **Heading**: `psi_vec` — orientation angle +- **Lane assignment**: `lane_id_vec`, `road_id_vec` — linked to XODR +- **Object dimensions**: `length`, `width` +- **Object relationships**: `object_relation_dict_list` — front/behind/left/right neighbors +- **Safety metrics**: `ttc_dict_vec` (Time-to-Collision), `tth_dict_vec` (Time-to-Headway) +- **Lane distances**: `distance_left_lane_marking`, `distance_right_lane_marking` + +![Vehicle Dynamics](doc/VehicleDynamics.png) + +### staticWorld.xodr + +OpenDRIVE 1.6 format file defining: + +- Road network topology and geometry +- Lane definitions with widths and types +- Junction configurations +- Speed limits and road markings + +![Static World](doc/static_world_fig_02.png) + +### Key Metrics Explained + +![Time-to-Collision](doc/ttc.png) +![Lane Distance](doc/lane_distance.png) +![Point-to-Lane Assignment](doc/point_to_lane_assignement_Sans.png) + +## Quick Start + +### Installation + +```bash +pip install openautomatumdronedata +``` + +### Load and Explore + +```python +from openautomatumdronedata.dataset import droneDataset +import os + +# Point to one recording folder +path = os.path.abspath("T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2") +dataset = droneDataset(path) + +# Access dynamic world +dynWorld = dataset.dynWorld + +print(f"UUID: {dynWorld.UUID}") +print(f"Duration: {dynWorld.maxTime:.1f} seconds") +print(f"Frames: {dynWorld.frame_count}") +print(f"Vehicles: {len(dynWorld)}") + +# Get all vehicles visible at t=1.0s +objects = dynWorld.get_list_of_dynamic_objects_for_specific_time(1.0) +for obj in objects[:5]: + print(f" {obj.UUID} ({obj.type}) — x={obj.x_vec[0]:.1f}, y={obj.y_vec[0]:.1f}") +``` + +### Using with Hugging Face + +```python +from huggingface_hub import snapshot_download, hf_hub_download +import zipfile, os + +# Option 1: Download only the sample for a quick look +local_path = snapshot_download( + repo_id="AutomatumData/automatum-data-crossing", + repo_type="dataset", + allow_patterns=["Sample_Data/**"] +) + +# Option 2: Download the full archive +archive = hf_hub_download( + repo_id="AutomatumData/automatum-data-crossing", + filename="automatum_data_crossing.zip", + repo_type="dataset" +) +# Extract +with zipfile.ZipFile(archive, 'r') as z: + z.extractall("automatum_data_crossing") + +# Load with openautomatumdronedata +from openautomatumdronedata.dataset import droneDataset +dataset = droneDataset("automatum_data_crossing/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2") +print(f"Vehicles: {len(dataset.dynWorld)}") +``` + +## Example Scripts + +See the `example_scripts/` folder for ready-to-use analysis scripts: + +- **`01_lane_changes.py`** — Analyze lane change behavior across all vehicles +- **`02_heatmap_density.py`** — Generate traffic density heatmaps +- **`03_high_acceleration.py`** — Detect high-acceleration events +- **`04_export_objects.py`** — Export per-vehicle JSON files with surrounding object data + +## Comparison with Established Datasets + +| Feature | Automatum Data | highD | NGSIM | +|---------|---------------|-------|-------| +| **Data Format** | JSON + OpenDRIVE XODR | CSV + XML | CSV | +| **Road Geometry** | OpenDRIVE 1.6 standard | Simple annotations | Basic annotations | +| **Coordinate System** | UTM world coordinates | Local coordinates | Local coordinates | +| **Object Relationships** | Built-in (TTC, TTH, distances) | Must compute | Must compute | +| **Velocity Error** | < 0.2% (validated) | < 10 cm positional | Known issues | +| **Python Library** | `openautomatumdronedata` | Custom scripts | Custom scripts | +| **OpenSCENARIO** | Available on request | No | No | + +## Research Use & Extended Data Pool + +**These publicly available datasets are intended exclusively for research purposes.** + +This dataset is a small excerpt from the comprehensive **Automatum Data Pool** containing over **1,000 hours of processed drone video**. For commercial use or access to further datasets, including OpenSCENARIO exports, please contact us via our website: + +**[automatum-data.com](https://automatum-data.com)** + +## Citation + +If you use this dataset in your research, please cite: + +```bibtex +@inproceedings{spannaus2021automatum, + title={AUTOMATUM DATA: Drone-based highway dataset for development and validation of automated driving software}, + author={Spannaus, Paul and Zechel, Peter and Lenz, Kilian}, + booktitle={IEEE Intelligent Vehicles Symposium (IV)}, + year={2021} +} +``` + +## License + +This dataset is licensed under [Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)](https://creativecommons.org/licenses/by-nd/4.0/). + +## Contact + +- **Website**: [automatum-data.com](https://automatum-data.com) +- **Email**: info@automatum-data.com +- **HuggingFace**: [AutomatumData](https://huggingface.co/AutomatumData) +- **Documentation**: [openautomatumdronedata.readthedocs.io](https://openautomatumdronedata.readthedocs.io) diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2.html b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2.html new file mode 100644 index 0000000000000000000000000000000000000000..25c1b5a5918f6e85709991cd219d9308e8171a38 --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2.html @@ -0,0 +1,53 @@ + + + + + Bokeh Plot + + + + + +
+ + + + + \ No newline at end of file diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/dynamicWorld.json b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/dynamicWorld.json new file mode 100644 index 0000000000000000000000000000000000000000..b7071def88d285c33736f9de38ad075a0be5ee66 --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/dynamicWorld.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:899037a7be1f61dd75915fbdeab32e8e2c01c8d2b4be4e814775216896f2cd19 +size 51283310 diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_centerImg_thumb.jpg b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_centerImg_thumb.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4e7eec90bb3c1e88e3d9411571b2031a555dff2f --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_centerImg_thumb.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6572d29dfea3d53e25a4b52d36a249a6d6384c913d0893a579fb78fc24a69ba +size 14777 diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_map.jpg b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_map.jpg new file mode 100644 index 0000000000000000000000000000000000000000..28e346734c7fbf31b52a2acff87f310372358a27 --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_map.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ca1f2dd2426858509d5030e5fc57a261309a5deaa78a925f3927b401be309a4 +size 83178 diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_trajectories.jpg b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_trajectories.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ff210330adb8387ff51bd094339eaf4448201a34 --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2_trajectories.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf45d21d2bfc5daadc1da307b3db858ed97221fb3124e97bde0af3f96f2ea429 +size 101742 diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/kpis.json b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/kpis.json new file mode 100644 index 0000000000000000000000000000000000000000..3e40e7bf49b61e314ee3bd0d928a30dead87dfce --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/img/kpis.json @@ -0,0 +1,10 @@ +{ + "Anzahl Trajektorien": 299, + "Aufzeichnungsdauer (s)": 650.7, + "Verkehrsfluss (veh/h)": 1654.3, + "Verkehrsdichte (veh/km)": 40.2, + "Ø Trajektorienlänge (m)": 160.3, + "Ø Geschwindigkeit (km/h)": 41.2, + "Maximale Geschwindigkeit (km/h)": 109.4, + "Maximale Beschleunigung (m/s²)": 4.7 +} \ No newline at end of file diff --git a/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/staticWorld.xodr b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/staticWorld.xodr new file mode 100644 index 0000000000000000000000000000000000000000..d56a7bce880866e0f11b5d54d8814db0aaf8a506 --- /dev/null +++ b/Sample_Data/T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2/staticWorld.xodr @@ -0,0 +1,301 @@ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
diff --git a/automatum.dataset.html b/automatum.dataset.html new file mode 100644 index 0000000000000000000000000000000000000000..82242bd275100eee76f62b0e6122f71d2409835d --- /dev/null +++ b/automatum.dataset.html @@ -0,0 +1,140 @@ + + + + + Bokeh Plot + + + + + + + +
+ + +
+ Automatum Data +
+

Automatum Data: T-Crossing Drone Dataset

+

+ License: CC BY-ND 4.0  |  Format: JSON + OpenDRIVE XODR +

+
+
+ + +
+ + +
+ Dataset Icon +
+ + +
+

+ High-precision vehicle trajectory data from drone recordings at T-crossing intersections in Bavaria, Germany. Contains 2 recordings with 683 vehicles. +

+ +
+ + 🌐 Website + + + 📖 Documentation + + + 📦 PyPI Package + + + 🤗 HuggingFace + +
+
+
+ + +
+

Quick Start

+
+
+

1. Install the Python library

+ + pip install openautomatumdronedata + +
+
+

2. Load a recording

+ from openautomatumdronedata.dataset import droneDataset +dataset = droneDataset("path/to/recording") +dynWorld = dataset.dynWorld +
+
+

+ See example_scripts/ for lane change analysis, density heatmaps, and acceleration detection. +

+
+ + +
+
+ + +
+ + + + + \ No newline at end of file diff --git a/automatum_data_crossing.zip b/automatum_data_crossing.zip new file mode 100644 index 0000000000000000000000000000000000000000..5824578ee17c2ae9733c9ccac2a8add1de1df6bb --- /dev/null +++ b/automatum_data_crossing.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea2c528fafdb306ea20686065b15c39ae2332342594a0f8031477bdd8f91f19f +size 33479907 diff --git a/doc/VehicleDynamics.png b/doc/VehicleDynamics.png new file mode 100644 index 0000000000000000000000000000000000000000..7a72e02713e018df8a4c48cab9a97c3db95be2be --- /dev/null +++ b/doc/VehicleDynamics.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:320a6da6e7a29d3d4c8d6b20a4117805d1aaf0e38d1699fa884f92503d31d2c2 +size 16864 diff --git a/doc/automatum_logo.png b/doc/automatum_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1610c293a8144d88884a8125f47199c78f0e8466 --- /dev/null +++ b/doc/automatum_logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eded7ce43163ecb898166a7bc587235f59b15bd17856235867d404760ca54c3e +size 42970 diff --git a/doc/icon_crossing.jpg b/doc/icon_crossing.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df289fa01a7d887a5f3f3bc8a2216c8c0b0cf2db --- /dev/null +++ b/doc/icon_crossing.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a969dfd2a5f7d1dca585c5f7f388fc7809191b5d97f99dd642756c5fb3159f9 +size 2953515 diff --git a/doc/illustration.jpg b/doc/illustration.jpg new file mode 100644 index 0000000000000000000000000000000000000000..746a1c8878e3c37b49cdde2fcc555ce1c0bde3cf --- /dev/null +++ b/doc/illustration.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b9287acfe10df4dfaa33c3a1fc579acacca950477da2b18e397ad7363f91bf4 +size 2760658 diff --git a/doc/lane_distance.png b/doc/lane_distance.png new file mode 100644 index 0000000000000000000000000000000000000000..b42fb0022f2df45cd388459648bdd4d2b6cc86c2 --- /dev/null +++ b/doc/lane_distance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb10140e7a9a8a563c97f45aca806c49a8789e38558d834f178946166ec3abfe +size 15099 diff --git a/doc/map_duenzlau.jpg b/doc/map_duenzlau.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7c3a15f4778843413c9e61eb31d8d7540232de05 --- /dev/null +++ b/doc/map_duenzlau.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9eb8fb6a882258d989dffbccfd381943c7089bdfb8beacbec2d4c53d1a23f44c +size 56736 diff --git a/doc/map_gaimersheim.jpg b/doc/map_gaimersheim.jpg new file mode 100644 index 0000000000000000000000000000000000000000..28e346734c7fbf31b52a2acff87f310372358a27 --- /dev/null +++ b/doc/map_gaimersheim.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ca1f2dd2426858509d5030e5fc57a261309a5deaa78a925f3927b401be309a4 +size 83178 diff --git a/doc/point_to_lane_assignement_Sans.png b/doc/point_to_lane_assignement_Sans.png new file mode 100644 index 0000000000000000000000000000000000000000..aff5bcf2414e7f3f2f0f40a2ac98136eb500c382 --- /dev/null +++ b/doc/point_to_lane_assignement_Sans.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b863d5b518eae3d2326cf1594c8d26f3159fe60d534c30f3b9d50ca759f3f330 +size 21578 diff --git a/doc/static_world_fig_02.png b/doc/static_world_fig_02.png new file mode 100644 index 0000000000000000000000000000000000000000..5822f90d00faf4b658fe3adc3a4f122dc1ec6a7b --- /dev/null +++ b/doc/static_world_fig_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c046e208a04c088bd863f0a9f4d2cbf7ad7c84c0284530655d031f5a8541854 +size 166095 diff --git a/doc/trajectories_duenzlau.jpg b/doc/trajectories_duenzlau.jpg new file mode 100644 index 0000000000000000000000000000000000000000..beed25af5f59a3b2057cdf4cdefcdcbcfaba5d61 --- /dev/null +++ b/doc/trajectories_duenzlau.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bd0a77ec64926991a9a614a488b1f3c7db6048c0bc73af3798cbfce77268e75 +size 70396 diff --git a/doc/trajectories_gaimersheim.jpg b/doc/trajectories_gaimersheim.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ff210330adb8387ff51bd094339eaf4448201a34 --- /dev/null +++ b/doc/trajectories_gaimersheim.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf45d21d2bfc5daadc1da307b3db858ed97221fb3124e97bde0af3f96f2ea429 +size 101742 diff --git a/doc/ttc.png b/doc/ttc.png new file mode 100644 index 0000000000000000000000000000000000000000..ced21ef5272542e1f4e35b8865c92f4a9f9e8265 --- /dev/null +++ b/doc/ttc.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c443a4927e4282e4afd9b8bf00061174175b0ad0d7fcdc662c23a58eb1a5f5d7 +size 15518 diff --git a/example_scripts/.DS_Store b/example_scripts/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e9096960ab0062d99d64d83fb4699fbe6d39c422 Binary files /dev/null and b/example_scripts/.DS_Store differ diff --git a/example_scripts/01_lane_changes.py b/example_scripts/01_lane_changes.py new file mode 100644 index 0000000000000000000000000000000000000000..f80e641ca5161531564af55d21d97507b98932ad --- /dev/null +++ b/example_scripts/01_lane_changes.py @@ -0,0 +1,54 @@ +""" +Lane Change Analysis — Automatum Data T-Crossing Dataset +Analyzes lane change behavior across all vehicles in a recording. + +Usage: + python 01_lane_changes.py + +Example: + python 01_lane_changes.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 +""" +import sys +import os +from openautomatumdronedata.dataset import droneDataset + + +def analyze_lane_changes(dataset_path): + print(f"Loading dataset from: {dataset_path}") + dataset = droneDataset(dataset_path) + dynWorld = dataset.dynWorld + + print(f"Vehicles found: {len(dynWorld)}") + + lane_change_counts = [] + + for dynObj in dynWorld.dynamicObjects.values(): + lane_ids = dynObj.lane_id_vec + if len(lane_ids) == 0: + continue + + changes = 0 + current_lane = lane_ids[0] + for lane in lane_ids[1:]: + if lane != current_lane: + changes += 1 + current_lane = lane + + lane_change_counts.append({ + "uuid": dynObj.UUID, + "type": dynObj.type, + "changes": changes, + }) + + sorted_by_changes = sorted(lane_change_counts, key=lambda x: x["changes"], reverse=True) + + print("\n--- Top 10 vehicles with most lane changes ---") + for idx, item in enumerate(sorted_by_changes[:10]): + print(f"{idx+1}. Vehicle {item['uuid']} ({item['type']}): {item['changes']} lane changes") + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: python 01_lane_changes.py ") + else: + analyze_lane_changes(sys.argv[1]) diff --git a/example_scripts/02_heatmap_density.py b/example_scripts/02_heatmap_density.py new file mode 100644 index 0000000000000000000000000000000000000000..f3080655179572d5e78a0a1afaa6e0faa0a44243 --- /dev/null +++ b/example_scripts/02_heatmap_density.py @@ -0,0 +1,58 @@ +""" +Traffic Density Heatmap — Automatum Data T-Crossing Dataset +Generates a 2D heatmap of all vehicle positions over time. + +Usage: + python 02_heatmap_density.py + +Example: + python 02_heatmap_density.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 + +Output: + traffic_heatmap.png in the current directory +""" +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +from openautomatumdronedata.dataset import droneDataset + + +def generate_density_heatmap(dataset_path, output_filename="traffic_heatmap.png"): + print(f"Loading dataset from: {dataset_path}") + dataset = droneDataset(dataset_path) + dynWorld = dataset.dynWorld + + print("Extracting position data...") + all_x, all_y = [], [] + + for dynObj in dynWorld.dynamicObjects.values(): + x_valid = [x for x in dynObj.x_vec if not np.isnan(x)] + y_valid = [y for y in dynObj.y_vec if not np.isnan(y)] + all_x.extend(x_valid) + all_y.extend(y_valid) + + if not all_x: + print("No position data found!") + return + + print(f"Extracted {len(all_x)} data points. Creating heatmap...") + + plt.figure(figsize=(12, 8)) + plt.style.use("dark_background") + plt.hist2d(all_x, all_y, bins=(200, 200), cmap="inferno", cmin=1) + plt.colorbar(label="Traffic density (data points)") + plt.title("Traffic Density Heatmap (Top-View)") + plt.xlabel("X-Position [m]") + plt.ylabel("Y-Position [m]") + plt.gca().set_aspect("equal", adjustable="box") + plt.tight_layout() + plt.savefig(output_filename, dpi=300) + print(f"Heatmap saved: {os.path.abspath(output_filename)}") + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: python 02_heatmap_density.py ") + else: + generate_density_heatmap(sys.argv[1]) diff --git a/example_scripts/03_high_acceleration.py b/example_scripts/03_high_acceleration.py new file mode 100644 index 0000000000000000000000000000000000000000..d41c3c8923eb1126e00c4bc7ca9738ad317f4aa7 --- /dev/null +++ b/example_scripts/03_high_acceleration.py @@ -0,0 +1,61 @@ +""" +High Acceleration Detection — Automatum Data T-Crossing Dataset +Detects vehicles exceeding a given acceleration threshold. + +Usage: + python 03_high_acceleration.py [threshold_m_s2] + +Example: + python 03_high_acceleration.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 3.0 +""" +import sys +import os +import numpy as np +from openautomatumdronedata.dataset import droneDataset + + +def detect_high_accelerations(dataset_path, acc_threshold=3.0): + print(f"Loading dataset from: {dataset_path}") + dataset = droneDataset(dataset_path) + dynWorld = dataset.dynWorld + + print(f"Searching for accelerations > {acc_threshold} m/s^2...") + + high_accel_vehicles = [] + + for dynObj in dynWorld.dynamicObjects.values(): + length = min(len(dynObj.ax_vec), len(dynObj.ay_vec)) + if length == 0: + continue + + ax = np.array(dynObj.ax_vec[:length]) + ay = np.array(dynObj.ay_vec[:length]) + total_accel = np.sqrt(ax**2 + ay**2) + valid_accel = total_accel[~np.isnan(total_accel)] + + if len(valid_accel) > 0: + max_accel = np.max(valid_accel) + if max_accel > acc_threshold: + high_accel_vehicles.append({ + "uuid": dynObj.UUID, + "type": dynObj.type, + "max_accel": max_accel, + }) + + if not high_accel_vehicles: + print(f"No vehicles with acceleration > {acc_threshold} m/s^2 found.") + return + + sorted_vehicles = sorted(high_accel_vehicles, key=lambda x: x["max_accel"], reverse=True) + + print(f"\n--- {len(sorted_vehicles)} vehicles with notable acceleration ---") + for item in sorted_vehicles: + print(f"Vehicle {item['uuid']} ({item['type']}): max {item['max_accel']:.2f} m/s^2") + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: python 03_high_acceleration.py [threshold]") + else: + threshold = float(sys.argv[2]) if len(sys.argv) >= 3 else 3.0 + detect_high_accelerations(sys.argv[1], threshold) diff --git a/example_scripts/README.md b/example_scripts/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9694593d5a875e5ad4c447af8ed8c5748d8daa4d --- /dev/null +++ b/example_scripts/README.md @@ -0,0 +1,33 @@ +# Example Scripts — Automatum Data T-Crossing Dataset + +These scripts demonstrate how to work with the Automatum drone traffic data using the `openautomatumdronedata` Python library. + +## Prerequisites + +```bash +pip install openautomatumdronedata numpy matplotlib +``` + +## Scripts + +| Script | Description | +|--------|-------------| +| `01_lane_changes.py` | Analyzes lane change frequency per vehicle and shows the top 10 | +| `02_heatmap_density.py` | Creates a traffic density heatmap from all position data | +| `03_high_acceleration.py` | Detects vehicles exceeding an acceleration threshold | +| `example_export_objects.py` | Exports per-vehicle JSON files with surrounding object data | + +## Usage + +All scripts take the path to a recording folder as their first argument: + +```bash +python 01_lane_changes.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 +python 02_heatmap_density.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 +python 03_high_acceleration.py ../T-Crossing--GaimersheimStadtweg_e2e6-e2e6f4bb-4668-4654-ac7e-bcd90c9df4c2 3.0 +``` + +## Learn More + +- [Full Documentation](https://openautomatumdronedata.readthedocs.io) +- [Automatum Data Website](https://automatum-data.com) diff --git a/example_scripts/example_export_objects.py b/example_scripts/example_export_objects.py new file mode 100644 index 0000000000000000000000000000000000000000..8b5950f621770b64602ffab258ec67a3577cef05 --- /dev/null +++ b/example_scripts/example_export_objects.py @@ -0,0 +1,164 @@ +""" + This is a demo script that was used to take the default dynamicWorld.json and extract every vehicle with its related objects and sorts them + to a new json file for each ego vehicle. + This allows an analysis of each maneuver without accessing other vehicles in the dynamicWorld. + Please note that this will generate a lot of redundant information. + +""" +from openautomatumdronedata.dataset import droneDataset +import json +import os +import shutil +import sys + +# Get all present recording folders in the current dataset +dataset_folders = list() +current_path = os.path.abspath(os.path.join(__file__ ,"../..")) +for item in os.listdir(current_path): + if os.path.isdir(os.path.join(current_path, item)) and item != "img": + dataset_folders.append(item) + + + +for recording_folder in dataset_folders: + path = os.path.join(current_path, recording_folder) + + # Create an output folder + export_path = os.path.join(current_path, recording_folder, "export_single_objects") + if not os.path.exists(export_path): + os.mkdir(export_path) + + # Now we open each dataset and create a droneDataset object for it + dataset = droneDataset(path) + + # Here we access the dynamic world, the global JSON file containing all recording infromation + dynWorld = dataset.dynWorld + + # Here we open the plain JSON file without the automatum pip utility in parallel + f = open(os.path.join(path, "dynamicWorld.json")) + json_dict = json.load(f) + + # Create a new dict to store all agregated values in + relation_dict = dict() + + # Lets take every object (car, truck, etc.) from the plain JSON file and crate a new JSON containing only this object with all its surrounding objects + for object in json_dict["objects"]: + """ + Now we access the object_relation_dict_list, ttc_dict and tth_dict of the object to see which objects are the surrounding ones: + "object_relation_dict_list": [ + { + "front_ego": null, + "behind_ego": "32499e60-30e9-4f41-8dc4-8699364db5dc", + "front_left": null, + "behind_left": null, + "front_right": "3e67c856-116a-4af5-96cc-39f5002f71a0", + "behind_right": "3002eaf3-a545-4e56-aa31-557f25e79643" + }, + ... + + "ttc_dict_vec": [ + { + "front_ego": -1, + "behind_ego": null, + "front_left": null, + "behind_left": null, + "front_right": 477.62466112341815, + "behind_right": null + }, + ... + + "tth_dict_vec": [ + { + "front_ego": null, + "behind_ego": 0.380621726114513, + "front_left": null, + "behind_left": null, + "front_right": -1, + "behind_right": 3.687973804225473 + }, + ... + """ + for i, (object_relation_dict, ttc_dict, tth_dict, lat_dict, long_dict) in enumerate(zip(object["object_relation_dict_list"], object["ttc_dict_vec"], object["tth_dict_vec"], object["lat_dist_dict_vec"], object["long_dist_dict_vec"])): + time_stamp = object["time"][i] + for key in object_relation_dict.keys(): # key = "front_ego", relation = "UUID of the object in this position" for example + relation = object_relation_dict[key] + if relation is not None: # Check if there is an object at this position at all + relation_object = dynWorld.get_dynObj_by_UUID(relation) # Access the object with the automatum utility by its UUID + time_idx = relation_object.next_index_of_specific_time(time_stamp) # Get the time index of the object for the time stamp of our current ego vehicle we generate the new JSON for + + + # Copy all values from this object at the specific time + relation_dict["UUID"] = relation_object.UUID + relation_dict["length"] = relation_object.length + relation_dict["width"] = relation_object.width + relation_dict["x"] = relation_object.x_vec[time_idx] + relation_dict["y"] = relation_object.y_vec[time_idx] + relation_dict["vx"] = relation_object.vx_vec[time_idx] + relation_dict["vy"] = relation_object.vy_vec[time_idx] + relation_dict["ax"] = relation_object.ax_vec[time_idx] + relation_dict["ay"] = relation_object.ay_vec[time_idx] + relation_dict["jerk_x"] = relation_object.vx_vec[time_idx] + relation_dict["jerk_y"] = relation_object.vx_vec[time_idx] + relation_dict["curvature"] = relation_object.vx_vec[time_idx] + relation_dict["psi"] = relation_object.psi_vec[time_idx] + relation_dict["lane_id"] = relation_object.lane_id_vec[time_idx] + relation_dict["road_id"] = relation_object.road_id_vec[time_idx] + relation_dict["road_type"] = relation_object.vx_vec[time_idx] + relation_dict["distance_left_lane_marking"] = relation_object.distance_left_lane_marking[time_idx] + relation_dict["distance_right_lane_marking"] = relation_object.distance_right_lane_marking[time_idx] + relation_dict["ttc"] = ttc_dict[key] + relation_dict["tth"] = tth_dict[key] + relation_dict["lat_dist"] = lat_dict[key] + relation_dict["long_dist"] = long_dict[key] + + else: + relation_dict = None + + + """ + Now we replace the initial single UUID of the object with all information we accumulated about the object behind the UUID + + "object_relation_dict_list": [ + { + "front_left": 0decabdc-fa4f-4f25-93ed-88eed734bba0, + ... + + "object_relation_dict_list": [ + { + "front_left": { + "UUID": "0decabdc-fa4f-4f25-93ed-88eed734bba0", + "length": 4.172288426073395, + "width": 1.8141249203213998, + "vx": 46.54388406290268, + "vy": 0.005328263922638854, + "ax": 0.5608367460027531, + "ay": -0.5516711364613421, + "psi": -0.5643746012832805, + "x": 47.834595023288536, + "y": -32.82371510377445, + "lane_id": 3, + "road_id": 0, + "distance_left_lane_marking": 2.3102357971463827, + "distance_right_lane_marking": 1.6230526113559351 + }, + --- + + """ + object["object_relation_dict_list"][i][key] = relation_dict + + relation_dict = dict() # Delete the dict for the next object + + + # Delete redundant information + del object["ttc_dict_vec"] + del object["tth_dict_vec"] + del object["lat_dist_dict_vec"] + del object["long_dist_dict_vec"] + + # Finally we save each object as its own JSON + with open(os.path.join(export_path, object["UUID"] + ".json"), "w") as outfile: + json.dump(object, outfile) + print("Successfully exported object %s" % object["UUID"]) + + +