Note
Using the DLRUTDataset#
This example shall give an overview of the methods and attributes that are available in the DLRUTDataset class.
Load trajectory data#
At first, we need to load the trajectory data of the dataset.
[1]:
from tasi.dlr.dataset import DLRUTDatasetManager, DLRUTVersion
from tasi.dlr import DLRTrajectoryDataset
dataset = DLRUTDatasetManager(DLRUTVersion.latest)
dataset.load()
ds = DLRTrajectoryDataset.from_csv(dataset.trajectory()[50])
[2025-04-25 12:46:34 | dataset.py:load:112] > INFO: Checking if dataset already downloaded /tmp/DLR-Urban-Traffic-dataset_v1-2-0
[2025-04-25 12:46:34 | dataset.py:load:138] > INFO: Dataset already available at /tmp/DLR-Urban-Traffic-dataset_v1-2-0
Attributes of the dataset#
There are several attributes available to get information about a dataset. For instance, we can get the interval of a dataset via the property
[2]:
ds.interval
[2]:
Interval(2023-09-24 12:30:00.016482+00:00, 2023-09-24 12:44:59.966482+00:00, closed='right')
or all unique timestamps of it via
[3]:
ds.timestamps
[3]:
DatetimeIndex(['2023-09-24 12:30:00.016482+00:00',
'2023-09-24 12:30:00.066482+00:00',
'2023-09-24 12:30:00.116482+00:00',
'2023-09-24 12:30:00.166482+00:00',
'2023-09-24 12:30:00.216482+00:00',
'2023-09-24 12:30:00.266482+00:00',
'2023-09-24 12:30:00.316482+00:00',
'2023-09-24 12:30:00.366482+00:00',
'2023-09-24 12:30:00.416482+00:00',
'2023-09-24 12:30:00.466482+00:00',
...
'2023-09-24 12:44:59.516482+00:00',
'2023-09-24 12:44:59.566482+00:00',
'2023-09-24 12:44:59.616482+00:00',
'2023-09-24 12:44:59.666482+00:00',
'2023-09-24 12:44:59.716482+00:00',
'2023-09-24 12:44:59.766482+00:00',
'2023-09-24 12:44:59.816482+00:00',
'2023-09-24 12:44:59.866482+00:00',
'2023-09-24 12:44:59.916482+00:00',
'2023-09-24 12:44:59.966482+00:00'],
dtype='datetime64[ns, UTC]', name='timestamp', length=18000, freq=None)
or the ids of all traffic participants in the dataset.
[4]:
ds.ids
[4]:
Index([1695558514712340, 1695558558975558, 1695558561769745, 1695558563216597,
1695558565170472, 1695558571572035, 1695558572272810, 1695558573520980,
1695558576618026, 1695558579216721,
...
1695559487523035, 1695559488624461, 1695559490123751, 1695559490123748,
1695559491223905, 1695559492674737, 1695559496120575, 1695559498274800,
1695559499574101, 1695559499171792],
dtype='int64', name='id', length=750)
Filtering#
If you want to look into a short sequence of the overall dataset, you can select specific rows of the overall dataset. The DLRTrajectoryDataset provides various ways for this purpose.
Time and object#
There are two variants to filter a dataset based on the information on the dataset’s index. For instance, if you want to filterthe dataset by an interval, you can utilize the during method
[5]:
ds.during(ds.timestamps[0], ds.timestamps[10])
[5]:
| center | velocity | acceleration | yaw | dimension | classifications | interpolated | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | northing | easting | northing | magnitude | easting | northing | magnitude | length | width | height | pedestrian | bicycle | motorbike | car | van | truck | ||||
| timestamp | id | |||||||||||||||||||
| 2023-09-24 12:30:00.016482+00:00 | 1695558514712340 | 604774.496 | 5792796.320 | 7.140 | -3.970 | 8.169 | 1.068 | 1.320 | 1.698 | -29.398 | 2.536 | 1.177 | 1.445 | 0.000 | 0.008 | 0.388 | 0.598 | 0.0 | 0.006 | False |
| 1695558558975558 | 604740.884 | 5792779.240 | 0.021 | 0.000 | 0.021 | 0.014 | -0.008 | 0.016 | 7.852 | 2.669 | 1.259 | 1.261 | 0.000 | 0.000 | 0.163 | 0.838 | 0.0 | 0.000 | False | |
| 1695558561769745 | 604787.539 | 5792764.373 | -0.008 | 0.041 | 0.042 | 0.008 | -0.035 | 0.036 | 107.830 | 3.445 | 1.409 | 1.311 | 0.011 | 0.000 | 0.037 | 0.952 | 0.0 | 0.000 | False | |
| 1695558563216597 | 604741.853 | 5792776.267 | -0.030 | 0.032 | 0.044 | -0.041 | -0.014 | 0.044 | 9.183 | 3.323 | 1.293 | 1.468 | 0.000 | 0.000 | 0.026 | 0.954 | 0.0 | 0.000 | False | |
| 1695558565170472 | 604791.430 | 5792770.438 | -0.000 | 0.013 | 0.013 | -0.002 | -0.004 | 0.004 | 116.146 | 3.407 | 1.775 | 1.556 | 0.000 | 0.000 | 0.000 | 1.000 | 0.0 | 0.000 | False | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 12:30:00.466482+00:00 | 1695558592618702 | 604725.976 | 5792780.341 | 3.969 | 0.516 | 4.002 | -1.060 | -0.095 | 1.065 | 7.403 | 3.387 | 1.496 | 1.496 | 0.000 | 0.000 | 0.095 | 0.904 | 0.0 | 0.001 | False |
| 1695558596566965 | 604744.173 | 5792789.955 | 0.441 | -1.464 | 1.529 | 0.117 | -0.155 | 0.194 | -73.101 | 1.323 | 0.787 | 1.624 | 0.837 | 0.163 | 0.000 | 0.000 | 0.0 | 0.000 | False | |
| 1695558596716951 | 604742.064 | 5792846.878 | 0.674 | -2.246 | 2.345 | 0.054 | -0.237 | 0.243 | -73.240 | 2.848 | 1.394 | 1.368 | 0.000 | 0.000 | 0.062 | 0.933 | 0.0 | 0.000 | False | |
| 1695558598618723 | 604745.924 | 5792793.615 | 1.345 | -2.617 | 2.942 | -0.116 | 0.072 | 0.137 | -62.834 | 0.939 | 1.029 | 1.445 | 0.000 | 1.000 | 0.000 | 0.000 | 0.0 | 0.000 | False | |
| 1695558598820336 | 604747.604 | 5792840.329 | 3.606 | -10.172 | 10.793 | 0.091 | -0.122 | 0.152 | -70.505 | 2.950 | 1.698 | 1.640 | 0.000 | 0.000 | 0.068 | 0.922 | 0.0 | 0.010 | False | |
172 rows × 19 columns
that returns the rows within the given interval.
Another variant to select specific rows of the datasets is by the id of a traffic participant. This might be useful if you want to take a closer look into the behavior of specific traffic participants. For instance, to filter by the second traffic participant in the dataset, we can combine the ids attribute with the trajectory method.
[6]:
ds.trajectory(ds.ids[1])
[6]:
| center | velocity | acceleration | yaw | dimension | classifications | interpolated | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | northing | easting | northing | magnitude | easting | northing | magnitude | length | width | height | pedestrian | bicycle | motorbike | car | van | truck | ||||
| timestamp | id | |||||||||||||||||||
| 2023-09-24 12:30:00.016482+00:00 | 1695558558975558 | 604740.884 | 5792779.240 | 0.021 | 0.000 | 0.021 | 0.014 | -0.008 | 0.016 | 7.852 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:00.066482+00:00 | 1695558558975558 | 604740.884 | 5792779.240 | 0.023 | -0.001 | 0.023 | 0.013 | -0.008 | 0.015 | 7.852 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:00.116482+00:00 | 1695558558975558 | 604740.884 | 5792779.240 | 0.025 | -0.001 | 0.025 | 0.012 | -0.008 | 0.014 | 7.852 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:00.166482+00:00 | 1695558558975558 | 604740.884 | 5792779.240 | 0.028 | -0.002 | 0.028 | 0.011 | -0.007 | 0.014 | 7.852 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:00.216482+00:00 | 1695558558975558 | 604740.885 | 5792779.240 | 0.030 | -0.002 | 0.030 | 0.010 | -0.007 | 0.013 | 7.852 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 12:30:34.216482+00:00 | 1695558558975558 | 604783.725 | 5792742.854 | 3.161 | -9.792 | 10.290 | -0.242 | -0.183 | 0.304 | -72.008 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:34.266482+00:00 | 1695558558975558 | 604783.882 | 5792742.364 | 3.153 | -9.798 | 10.293 | -0.242 | -0.183 | 0.304 | -72.049 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:34.316482+00:00 | 1695558558975558 | 604784.038 | 5792741.873 | 3.146 | -9.803 | 10.296 | -0.242 | -0.183 | 0.304 | -72.084 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:34.366482+00:00 | 1695558558975558 | 604784.194 | 5792741.382 | 3.140 | -9.808 | 10.298 | -0.242 | -0.183 | 0.304 | -72.114 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
| 2023-09-24 12:30:34.416482+00:00 | 1695558558975558 | 604784.349 | 5792740.890 | 3.134 | -9.812 | 10.301 | -0.242 | -0.183 | 0.304 | -72.141 | 2.669 | 1.259 | 1.261 | 0.0 | 0.0 | 0.163 | 0.838 | 0.0 | 0.0 | False |
689 rows × 19 columns
Traffic participant properties#
There are also methods available that might help to find the relevant information in the dataset. The most straight forward option is to use pandas’ capability to access specific attributesof the datasets. The available attributes on the dataset, are available via theattribute` property.
[7]:
ds.attributes
[7]:
Index(['center', 'velocity', 'acceleration', 'yaw', 'dimension',
'classifications', 'interpolated'],
dtype='object')
We can, for instance, access the traffic participants center position.
[8]:
ds.center
[8]:
| easting | northing | ||
|---|---|---|---|
| timestamp | id | ||
| 2023-09-24 12:30:00.016482+00:00 | 1695558514712340 | 604774.496 | 5792796.320 |
| 1695558558975558 | 604740.884 | 5792779.240 | |
| 1695558561769745 | 604787.539 | 5792764.373 | |
| 1695558563216597 | 604741.853 | 5792776.267 | |
| 1695558565170472 | 604791.430 | 5792770.438 | |
| ... | ... | ... | ... |
| 2023-09-24 12:44:59.966482+00:00 | 1695559492674737 | 604789.200 | 5792769.423 |
| 1695559496120575 | 604702.210 | 5792771.596 | |
| 1695559498274800 | 604855.834 | 5792822.882 | |
| 1695559499171792 | 604740.345 | 5792785.036 | |
| 1695559499574101 | 604871.056 | 5792836.959 |
388075 rows × 2 columns
or the classification propabilities.
[9]:
ds.classifications
[9]:
| pedestrian | bicycle | motorbike | car | van | truck | ||
|---|---|---|---|---|---|---|---|
| timestamp | id | ||||||
| 2023-09-24 12:30:00.016482+00:00 | 1695558514712340 | 0.000 | 0.008 | 0.388 | 0.598 | 0.0 | 0.006 |
| 1695558558975558 | 0.000 | 0.000 | 0.163 | 0.838 | 0.0 | 0.000 | |
| 1695558561769745 | 0.011 | 0.000 | 0.037 | 0.952 | 0.0 | 0.000 | |
| 1695558563216597 | 0.000 | 0.000 | 0.026 | 0.954 | 0.0 | 0.000 | |
| 1695558565170472 | 0.000 | 0.000 | 0.000 | 1.000 | 0.0 | 0.000 | |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 12:44:59.966482+00:00 | 1695559492674737 | 0.000 | 0.000 | 0.021 | 0.979 | 0.0 | 0.000 |
| 1695559496120575 | 0.001 | 0.014 | 0.414 | 0.572 | 0.0 | 0.000 | |
| 1695559498274800 | 0.000 | 0.000 | 0.079 | 0.921 | 0.0 | 0.000 | |
| 1695559499171792 | 0.000 | 0.000 | 0.340 | 0.660 | 0.0 | 0.000 | |
| 1695559499574101 | 0.000 | 0.022 | 0.089 | 0.890 | 0.0 | 0.000 |
388075 rows × 6 columns
We extended these basic capabilities with additional methods, that, for instance, allow to get the most likely class by each traffic participant’s pose
[10]:
ds.most_likely_class(by='pose')
[10]:
timestamp id
2023-09-24 12:30:00.016482+00:00 1695558514712340 car
1695558558975558 car
1695558561769745 car
1695558563216597 car
1695558565170472 car
...
2023-09-24 12:44:59.966482+00:00 1695559492674737 car
1695559496120575 car
1695559498274800 car
1695559499171792 car
1695559499574101 car
Length: 388075, dtype: object
or by the overall trajectory (the default), i.e. all poses of a traffic participants.
[11]:
ds.most_likely_class(by='trajectory')
[11]:
id
1695558514712340 car
1695558558975558 car
1695558561769745 car
1695558563216597 car
1695558565170472 car
...
1695559492674737 car
1695559496120575 car
1695559498274800 car
1695559499171792 car
1695559499574101 car
Length: 750, dtype: object
This might help to filter the dataset to select only traffic participants that are classified as a car. To archieve this, we first get the most likely class per trajectory, select the rows having the value ‘car’ and pass their index (the traffic particpant’s id) into the trajectory method of the Dataset.
[12]:
classification = ds.most_likely_class(by='trajectory')
ds.trajectory(classification[classification == 'car'].index)
[12]:
| center | velocity | acceleration | yaw | dimension | classifications | interpolated | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| easting | northing | easting | northing | magnitude | easting | northing | magnitude | length | width | height | pedestrian | bicycle | motorbike | car | van | truck | ||||
| timestamp | id | |||||||||||||||||||
| 2023-09-24 12:30:00.016482+00:00 | 1695558514712340 | 604774.496 | 5792796.320 | 7.140 | -3.970 | 8.169 | 1.068 | 1.320 | 1.698 | -29.398 | 2.536 | 1.177 | 1.445 | 0.000 | 0.008 | 0.388 | 0.598 | 0.0 | 0.006 | False |
| 1695558558975558 | 604740.884 | 5792779.240 | 0.021 | 0.000 | 0.021 | 0.014 | -0.008 | 0.016 | 7.852 | 2.669 | 1.259 | 1.261 | 0.000 | 0.000 | 0.163 | 0.838 | 0.0 | 0.000 | False | |
| 1695558561769745 | 604787.539 | 5792764.373 | -0.008 | 0.041 | 0.042 | 0.008 | -0.035 | 0.036 | 107.830 | 3.445 | 1.409 | 1.311 | 0.011 | 0.000 | 0.037 | 0.952 | 0.0 | 0.000 | False | |
| 1695558563216597 | 604741.853 | 5792776.267 | -0.030 | 0.032 | 0.044 | -0.041 | -0.014 | 0.044 | 9.183 | 3.323 | 1.293 | 1.468 | 0.000 | 0.000 | 0.026 | 0.954 | 0.0 | 0.000 | False | |
| 1695558565170472 | 604791.430 | 5792770.438 | -0.000 | 0.013 | 0.013 | -0.002 | -0.004 | 0.004 | 116.146 | 3.407 | 1.775 | 1.556 | 0.000 | 0.000 | 0.000 | 1.000 | 0.0 | 0.000 | False | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2023-09-24 12:44:59.966482+00:00 | 1695559492674737 | 604789.200 | 5792769.423 | -0.813 | 2.471 | 2.602 | 0.612 | -2.115 | 2.202 | 108.191 | 3.642 | 1.634 | 1.318 | 0.000 | 0.000 | 0.021 | 0.979 | 0.0 | 0.000 | False |
| 1695559496120575 | 604702.210 | 5792771.596 | 8.734 | 0.456 | 8.745 | -0.850 | 0.111 | 0.857 | 2.955 | 2.280 | 0.931 | 1.304 | 0.001 | 0.014 | 0.414 | 0.572 | 0.0 | 0.000 | False | |
| 1695559498274800 | 604855.834 | 5792822.882 | -13.271 | -5.832 | 14.496 | -0.009 | 0.252 | 0.253 | -156.208 | 3.026 | 1.385 | 1.385 | 0.000 | 0.000 | 0.079 | 0.921 | 0.0 | 0.000 | False | |
| 1695559499171792 | 604740.345 | 5792785.036 | 5.195 | 0.908 | 5.274 | 1.309 | 0.118 | 1.314 | 9.847 | 2.907 | 1.451 | 1.269 | 0.000 | 0.000 | 0.340 | 0.660 | 0.0 | 0.000 | False | |
| 1695559499574101 | 604871.056 | 5792836.959 | -15.391 | -5.728 | 16.423 | -0.422 | -0.030 | 0.423 | -159.568 | 3.028 | 1.593 | 1.389 | 0.000 | 0.022 | 0.089 | 0.890 | 0.0 | 0.000 | False | |
344669 rows × 19 columns