Commit 2ca86cb9 authored by Duncan Deveaux's avatar Duncan Deveaux
Browse files

Updated readme

parent 738d6fa3
# rounD_risk
Estimation of the relationship between the variation of TTC in an area and the amount of associated risk.
\ No newline at end of file
Estimation of the relationship between the variation of TTC in an area and the amount of associated risk.
# How to use
* To use the provided code, ROUND_PATH = "path/to/round/data/" should be replaced with the path to your local copy of the rounD dataset in the [] file.
The provided TTC analysis code is a tool to assess the variation of TTC in roundabouts of the rounD dataset, as well as risk, and investigate on correlation between these two units.
The provided files should be run in the following order:
* []: Provide tools to visualize the tracks of all vehicles from a given tracks file. As well as a tool to replay the tracks frame by frame.
* []: Parses the provided tracks files (all from a single Location ID) to augment the tracks with TTC data.
* []: Uses the TTC-augmented tracks generated by the [] file to study correlation between TTC variation and risk.
# How to add locations
For the moment, support for the location of ID 0 is provided.
In order to add new locations to the study, the following process should be followed:
1. A Topology description has to be generated for the wanted location ID. The Topology description is a simple class instance which indicates the center point of the roundabout. It also provides a list of circular lanes that the roundabout contains.
1. In order to define the Topology object, please refer to the comments and tools in the [] file.
* Replace the input_file, input_meta_file and input_recordingMeta_file with a tracks file of the wanted location ID.
* A plot of all tracks of the file will appear. Use it to choose the center point of the roundabout and the distance of lanes to the center of the roundabouts.
* Each lane should be 2.25meters long, see [] for a simple example of a topology for Location 0.
* Play with the topology object in line 85 of [] until the generated blue lanes accurately wrap the tracks.
2. Use the file to generate TTC-augmented data for the wanted location.
1. Replace the input_ids variable with a list of all tracks id of the wanted location.
2. **Do replace the transition object on line 73 with the new topology you generated in the first step.**
3. Upon running the updated script, TTC-augmented data will be generated in a newly created ttc_parse/ directory.
3. Use the file to generate the scatter plots and correlation analysis between the variation of TTC values and the amount of risk.
1. Replace the input_ids variable with the list of all tracks id of the wanted location.
2. Run the script to see the plotted results!
......@@ -99,7 +99,7 @@ for args in input_args:
risk_modes = [1,2,3,4,5,6]
timeline = TTCTimeline(risk_modes)
timeline = TTCTimeline(risk_modes, recordings_meta[rd.FRAME_RATE])
for frameId in range(len(frames)):
print("frame {}/{}".format(frameId, last_frame), end='\r')
......@@ -66,7 +66,7 @@ def get_object_back(obj):
# Lane: represents a circular lane, centered around a roundabout.
class Lane:
def __init__(self, center, radius_begin, radius_end, nb_slices):
def __init__(self, center, radius_begin, radius_end, nb_slices=30): = center
self.radius_begin = radius_begin
self.radius_end = radius_end
......@@ -144,10 +144,10 @@ class Topology:
#Lanes in circular_lanes must be sorted from the closest
#to the further from the roundabout center.
circular_lanes = [Lane(roundabout_center, 15, 17.25, 30),
Lane(roundabout_center, 17.25, 19.5, 30),
Lane(roundabout_center, 19.5, 21.75, 30),
Lane(roundabout_center, 21.75, 24, 30)]
circular_lanes = [Lane(roundabout_center, radius_begin=15, radius_end=17.25),
Lane(roundabout_center, radius_begin=17.25, radius_end=19.5),
Lane(roundabout_center, radius_begin=19.5, radius_end=21.75),
Lane(roundabout_center, radius_begin=21.75, radius_end=24)]
return Topology(roundabout_center, circular_lanes)
......@@ -56,7 +56,6 @@ def read_trajectory(tracks, trackId):
return (np.array(x), np.array(y))
class_color = {'car': 'grey', 'van': 'black', 'truck': 'orange', 'trailer':'red', 'bus':'darkred', 'motorcycle':'green', 'pedestrian':'purple', 'bicycle':'yellow'}
def get_class(tracks_meta, trackId):
return tracks_meta[trackId][rd.CLASS]
......@@ -64,17 +63,17 @@ def get_frames(tracks_meta, trackId):
return (tracks_meta[trackId][rd.INITIAL_FRAME], tracks_meta[trackId][rd.FINAL_FRAME])
def plot_tracks(tracks_range, draw_lanes, topology):
for trackId in tracks_range:
trackClass = get_class(tracks_meta, trackId)
if trackClass == 'pedestrian': #Ignore pedestrian tracks
(x,y) = read_trajectory(tracks, trackId)
plt.title("Tracks for vehicles {}".format(tracks_range))
if draw_lanes:
plt.title("Tracks for vehicles {}".format(tracks_range))
# .................................................................. #
......@@ -132,8 +131,8 @@ fig, ax = plt.subplots()
# NOTE: background image of the roundabout.
# Needs extra work as it must be manually positioned to match the tracks
# of each vehicles
# Disabled, the provided example shows the background of location ID=0
#im ='loc0_background.png')
# The provided example shows the background of location ID=0
im ='loc0_background.png')
for frameId in range(0, len(frames), 10):
......@@ -142,7 +141,7 @@ for frameId in range(0, len(frames), 10):
# NOTE: manual positioning of the background image
#ax.imshow(im, extent=[1,169,-94,-1])
ax.imshow(im, extent=[1,169,-94,-1])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment