v1.0.1: Automatum house format (Sample_Data, doc, example_scripts, zip, overview) + Parquet
b35f113 verified Download example_scripts/03_high_acceleration.py from AutomatumData/automatum-data-highway-area-pools: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/datasets/AutomatumData/automatum-data-highway-area-pools/resolve/main/example_scripts/03_high_acceleration.py
- Command line
-
hf download hf://datasets/AutomatumData/automatum-data-highway-area-pools/example_scripts/03_high_acceleration.py
-
curl -L -o 03_high_acceleration.py https://huggingface.co/datasets/AutomatumData/automatum-data-highway-area-pools/resolve/main/example_scripts/03_high_acceleration.py
2.14 kB
| """ | |
| High Acceleration Detection — Automatum Data Highway Area Pools (Multi-Drone) | |
| Detects vehicles exceeding a given acceleration threshold. | |
| Usage: | |
| python 03_high_acceleration.py <path_to_recording_folder> [threshold_m_s2] | |
| Example: | |
| python 03_high_acceleration.py ../Sample_Data/Pool-Highway-A9-OffenbauRastanlage_c025-c02598c7-fa60-4302-8cee-12a05f4e0db6 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 <path_to_recording_folder> [threshold]") | |
| else: | |
| threshold = float(sys.argv[2]) if len(sys.argv) >= 3 else 3.0 | |
| detect_high_accelerations(sys.argv[1], threshold) | |