datapartnership / integrated-framework-for-road-safety

Provides a road safety scan using machine learning to derive characteristics from street view images and predict road risk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How it works

Integrated Framework for Road Safety

The user specifies a region of interest (ROI) using a bounding box. The code will automatically retrieve this ROI's road network from OpenStreetMap. For each road segment, the code will download a street view image by calling the Mapillary API. The code will then call the image segmentation model, Road Information Collector (RIC), for inferring road characteristics. The output will be fed into the Road Risk Evaluator (RRE), a neural network, which will predict the risk level for each road segment for the ROI.

Installation

Python > 3.6 is required

Download mmdetection into the current folder

git clone https://github.com/open-mmlab/mmdetection.git

Download the trained model from here and put it in the model folder like this

model/sv1/sv1.pth

Install mmdetection following the instructions here

Install other requirements

pip install -r requirements.txt

Infer road characteristics for a selected region

python inferX.py \
-t '{mapillary_client_token}' \
-p '{place_mame}' \
-b '{north west south east}' \
-c 'configs/sv1.py' -ckp 'model/sv1/sv1.pth' \
-f yes
  • mapillary_client_token: Get your Mapillary Client Token from here
  • place_mame: give a name for the region you are interested in
  • {north west south east}: defining a bounding box of interest, in longitude and latitude

Predict risk level

Download the trained RRE model from here and save it in the model folder

model/RRE.sav

Run RRE model to predict road risk

python predict.py -p {place_mame} -b '{north west south east}' -m 'model/RRE.sav'

You can change the -p and -b values for different regions. Road risk prediction will be saved at

data/{place_mame}/Predictions_final.geojson

About

Provides a road safety scan using machine learning to derive characteristics from street view images and predict road risk


Languages

Language:Python 100.0%