Code Monkey home page Code Monkey logo

conflict_resolution_dataset's Introduction

A Comparative Conflict Resolution Dataset Derived from Argoverse-2: Scenarios with vs. without Autonomous Vehicles

Authors: Guopeng Li, Yiru Jiao, Simeon C. Calvert, and Hans van Lint

Conflict Regimes

Quick to start

Reading and visualizing the dataset requires the following packages"

python >=3.8
numpy
scipy>=0.17.0
zarr
h5py
matplotlib
tqdm (optional)
  • Put the visual_utils.py in the root dir.
  • Unzip the downloaded data.zip file to the root dir.
  • The dataset is stored in a compact zarr form so even a 'potato' computer can handle this.

Read and visualize data

  • Import the necessary packages:
import zarr
import os
from visual_utils import *

folder = 'av' # or 'hv'

root ='./data_3m/'+folder+'/'

log_ids = [name for name in os.listdir(root) if os.path.isdir(os.path.join(root, name))]
print('Number of scenarios: ', len(log_ids))
  • Read the data
'''
slices: len = nb_objects + 1, slices[n] and slices[n+1] gives the start/end indices of the n-th object
maps: lanes as NumPy array
type: len = nb_objects, contains 7 numbers with the following meanings:
        -1: Static background
        0: human-driven vehicles
        1: pedestrians
        2: motorcyclists
        3: cyclists
        4: buses
        10: autonomous vehicles
timestep: timestamps in second, timestep[slices[n]: slices[n+1]] give the timestamps for the n-th object
motion: motion state, with 7 dimensions
    motion[slices[n]: slices[n+1]] gives the motion of the n-th object, the 7 features are the following variables in order:
        [x, y, vx, vy, ax, ay, yaw]
        yaw is to the x-axis, between [-pi, pi]
'''
slices, timestep, motion, type, maps = read_scenario(log_ids[2441], root)
  • Visualize the data
# Visualize the 2441-st scenario
# the parameter other_road_users = True/False controls whether to plot the surrounding agents (True by default)
# The parameter direction = True/False controls whether to plot the start and end directions of the vehicles involved in the conflict (True by default)
fig, ax = visualize(log_ids[2441], root, other_road_users=True, direction=True)

About metadata file

The metadata files is a table, shown as the example below, for AV-involved scenarios (metafile_av.csv) and AV-free scenarios (metafile_hv.csv), respectively.

log_id xi_start yi_start xj_start yj_start typei xi_end yi_end xj_end yj_end typej direction PET ifirst angle_start angle_end start end
2441 -0.028310 0.999599 -0.278388 -0.960469 AV -0.001506 0.999999 0.998085 0.061850 HV R-L 3.7 False 162.213724 86.540315 opposite cross
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

These tables provide the following information about each scenario:

column dtype information
log_id str index of the scenario
[xi_start, yi_start] float direction vector of the first* agent recorded in the scenario at the start** time
[xj_start, yj_start] float direction vector of the second agent recorded in the scenario at the start time
typei str agent type of the first agent recorded in the scenario, being one of {'AV','HV','Pedestrian','Motorcyclist','Cyclist','Bus'}
[xi_end, yi_end] float direction vector of the first* agent recorded in the scenario at the end*** time
[xj_end, yj_end] float direction vector of the second agent recorded in the scenario at the end time
typej str agent type of the second agent recorded in the scenario, being one of {'AV','HV','Pedestrian','Motorcyclist','Cyclist','Bus'}
direction str whether the second-passing vehicle moved from the left ('L-R') or the right ('R-L') of the first-passing agent
PET float post-encroachment-time
ifirst bool whether the first-passing agent is the first agent recorded in the scenario
angle_start float angle between the direction vectors of the two agents at the start time
angle_end float angle between the direction vectors of the two agents at the end time
start str whether the two agents ran parallel (P), crossed (C), or ran opposite (O) to each other before reaching the conflict point
end str whether the two agents ran parallel (P), crossed (C), or ran opposite (O) to each other after reaching the conflict point
Notes * Note that the first agent does not necessarily pass the conflict point first.
** We consider the start time as 5 seconds before the first-passing agent passed the conflict point, or the start of the record if the time before passing the conflict point is less than 5 seconds.
*** Similarly, the end time is 5 seconds after the second-passing vehicle passed the conflict point, or the end of the record if the time after passing the conflict point is less than 5 seconds.

One can use the following code to select data in different conditions:

# AV passing the conflict point first
case_av_first = metafile_av[(metafile_av['ifirst'])] # In cases involving AV, the AV is the first recorded agent

# Pedestrian passing the conflict point second
case_ped_first_av_free = metafile_hv[(~metafile_hv['ifirst'])&(metafile_hv['typej']=='Pedestrian')]

conflict_resolution_dataset's People

Contributors

romainlitud avatar yiru-jiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.