AI for Good: Preventing Road Crashes and Saving Lives

Leveraging AI solutions to help assess road crash risk at scale

Giulio
Omdena
9 min readJul 10, 2021

--

This article was written by Giulio Giaconi and Dave Bunten.

Object detection applied to a still image from this video. Source: Omdena.

This article was originally published on Omdena’s blog.

To read more articles on Computer Vision applications and How-to’s, check here.

A Global Tragedy

More than 100,000 people are injured in road crashes every day, resulting in costs of over $6 billion every single day. Currently, road accidents represent the eighth leading cause of death globally and the leading cause of death for children and young adults aged 5–29 years. Moreover, it is estimated that 500 million people will suffer life-changing injuries or be killed in road crashes between now and 2030, with the economic cost being more than the US $25 trillion.

Because of the unbearable cost of human lives and the huge impact on the global economy, the UN General Assembly drafted the Improving Global Road Safety Resolution in August 2020. Within the Resolution, it proclaimed the period 2021–2030 as the Second Decade of Action for Road Safety, setting the goal of halving road traffic deaths and injuries by 2030 and including targets on ensuring better overall road safety in the world.

Various organizations and charities help the UN achieve road safety goals, reducing the devastating social and economic cost of road crashes. Among those is the International Road Assessment Programme (iRAP), which helps reduce road crashes globally through research and coding of road attributes, a 5-star road rating system built on those attributes, investment plans for road improvement guidance, and worldwide partnerships. You can find more information on iRAP’s road ratings and how those align with the UN target of halving road deaths and injuries by 2030 here.

The Omdena + iRAP Collaboration

At the end of 2020, iRAP teamed up with the Omdena collaborative platform for an 8-week AI challenge to help reduce the consequences of dangerous roads around the world. Omdena is a platform and leading social enterprise where a global community of changemakers builds innovative and ethical AI solutions to tackle real-world problems.

The Omdena and iRAP volunteer-led challenge involved 31 collaborators, 35% of whom were women, from 17 different countries. Machine learning practitioners used their expertise on the project to address the serious impacts of road crashes and develop innovative solutions to address them.

Project Challenges

During the project, volunteers worked on a few challenges including the following:

  • Identifying the most suitable existing crash data that could be used to train all the machine learning models developed by the team;
  • Detecting relevant road features from image and video data, possibly matching iRAP’s features;
  • Creating models to assess and predict road safety;
  • Assessing the importance of road features in predicting each type of star rating;
  • Producing a dashboard to help predict the 5-star rating using all the models developed during the project.

Real-world data science strategies and procedures were used throughout the project. Volunteers first had to make their way through initial data exploration activities to gain knowledge of the available data. Then, they started decomposing the overall problem into several smaller tasks and went on developing appropriate solutions to address each of them. At the same time, the data “plumbing” aspect was also considered, and a pipeline was set in place to link the various activities. Finally, all the different workstreams have been summarised into a user-friendly dashboard to show the most relevant aspects and outputs of the work.

Saving Lives with AI

iRAP currently assesses road risk based on the value of more than 60 attributes that are coded for every 100-meter section of each road in the world. Features include traffic flow for cars, motorcycles, bicycles, pedestrians, and others; structural properties of the road, e.g., the number of carriageways and lanes, the types of intersections present, and the curvature of the road; the presence (or absence) of security features, e.g., shoulders and fencing; other road features, e.g., speed limits, lighting conditions, and many others.

Because attribute collection and coding are performed mainly manually, this process is a truly colossal effort given the large number of roads and attributes involved. For this reason, the main aim of the project was to make the whole process of feature extraction and road risk assessment faster and more efficient mainly through automation.

More specifically, we identified the following techniques that could help improve the current process:

  • Automatic road attribute extraction through computer vision techniques;
  • Road risk prediction based on historical vehicle accident data using regression and classification techniques;
  • Assess which specific road attributes are of the highest importance in evaluating the iRAP score;
  • Leveraging existing API’s with geospatial libraries to extract road attributes at scale.

The following image depicts the overall project workflow.

Overall project workflow. Source: Omdena.

Computer Vision Applications

Computer vision is the branch of machine learning that encompasses algorithms that allow automatic detection and recognition of features in images and videos. Computer vision techniques were used in this project to detect relevant road features from images at scale. Feature extraction from various sources was a crucial task for the project because the extracted features would provide the necessary training data for the machine learning models.

More specifically, volunteers worked on techniques to automatically extract road features from both ground-level imagery (e.g., Google street view) as well as from aerial level imagery (e.g., satellite photos). While ground-level imagery allows getting insights on numerous road features, aerial images allow to also recognize larger-scale features, e.g., road curvature and road intersection type, which would be difficult to estimate on the basis of ground-level images alone.

Labeling Panoramic Images

Feature detection in panoramic images proved to be particularly challenging due to the lack of numerous pre-trained models capable of detecting objects in panoramic images. Volunteers tackled this issue thanks to a sprint labeling exercise using a dataset provided by TomTom, and using the python labellmg package.

Using labelImg in annotating an image from the TomTom dataset. Source: TomTom and Omdena.

Object Detection on Road Images

The most modern computer vision techniques have been implemented on various datasets, and their accuracy has been evaluated to determine the best-performing model. Machine learning models that have been investigated for ground-level imagery include the You Look Only Once v3 (YOLOv3), the Histogram of Gradients (HOG), the MobileNet Single Shot Detector (SSD), and the RetinaNet. The YOLOv3 model was chosen in the end because it provided more flexibility for our requirements as well as a good enough performance.

Objects detected by means of a RetinaNet-based detector on an image from the KITTI dataset¹. Source: Omdena.

Feature Detection from Aerial Imagery

Concerning aerial level imagery, volunteers investigated various convolutional neural networks, including the VGG16, ResNet50, and Inceptionv3 models, to obtain traffic flow estimates. These models were trained on various datasets including the DOTA-v1.5 dataset. Road features were also obtained from OpenStreetMap data by means of the osmnx python package, and a model to detect the types of the intersection was developed using an autoencoder trained on Google Maps satellite images.

Maximum speed near Wembley Stadium, London, UK. Speed limit information retrieved from OpenStreetMap. Source: Omdena.

Work has also been done on detecting school road warning signs on roads by means of a ResNet50 model, and on detecting road curvature.

Road curvature estimation. Above is a map showing the original road and below is the estimation of its curvature for each 100m section. Source: Omdena.

Regression Techniques

Regression techniques allow models to understand the relationship between one or multiple independent variables and a dependent variable. Regression techniques enable us to understand the strength of the relationship between the dependent variable and each independent variable, allowing as well to estimate what function best approximates such relationship.

Road Feature Importance for iRAP Score

Regression models were considered in different workstreams in this project. First, regression models were used to assess what road features were of the highest importance in evaluating the iRAP score. In other words, the question that was being addressed was: what features, out of the 60+ available, can be used to approximate well enough the iRAP score of a road? To answer this question, volunteers worked on various types of regressors including random forest regressor, extreme gradient boosted (Xgboost) regressor, and categorical boost (catboost) regressor.

Road Risk Score Estimation

Regression techniques have also been used to compute the risk score automatically on the basis of historical road incident data. To this end, the comprehensive road safety dataset and the road traffic dataset, both published by the UK Department for Transport, were used as training datasets. The former dataset provides plenty of information on car accidents and road features, whereas the latter provides traffic information for various roads.

Additionally, OpenStreetMap’s data accessed through the Overpass API was used to calculate the distance between accidents and various landmarks, including schools, colleges, universities, hospitals, bars, pubs, and restaurants, which was one of the additional features that were used in our model. We trained both a random forest regressor and a gradient boosting regressor, using the level of accident severity as the target variable.

Importance of various road features, as estimated by a random forest regressor. Source: Omdena.

Pipeline

One of iRAP’s priorities for this project involved scaling their data-driven operations with automation. Road attributes change over time and this, in turn, can change the rating a road receives. A pipeline using some of the above methods was developed to help create workflows that scale on a continuous basis. This pipeline demonstrated the capability to gather data, transform that data, train models, and predict iRAP road attribute scores.

Workflows were built using a python library called Prefect. Perfect allows the creation of directed acyclic graphs (DAG’s) which are labeled as “flows”. Flows are composed of “tasks” and logic around those tasks to help sequence them together towards a specific goal. A Perfect task can be created by decorating any python function or by leveraging an existing library of tasks built by others.

Example workflow depicting notebook-based “tasks” which gather road data, segment those roads, then determine the curvature rating of the segments. Source: Omdena.

Flows created for this project involved tasks that ran Jupyter notebooks automatically with a library called Papermill. Papermill allows for automated and parameterized execution of notebooks. Using notebooks in this way allowed for straightforward transitions from analysis and experimentation to production-ready workflows. It also enables the flexibility for data scientists or engineers to expand or troubleshoot code in the future.

Reflections on the Project

A lot of data and great fun experimenting with machine learning

One of the most salient aspects of this project was the possibility for volunteers to experiment with real-world data, using both high-quality open source data as well as datasets belonging to iRAP partner companies, to which volunteers were given access. In fact, the amount of data we could use was overwhelming, and, hence, rather difficult to process, e.g., be it because of the large number of pictures available to train our YOLOv3 model or because of the millions of records in the UK car accident datasets. Moreover, self-organizing workstreams focused on a large variety of machine learning techniques, allowing volunteers to experiment with many problems and types of approaches.

The Power of Volunteers!

After iRAP and Omdena provided the introduction to the problem at the beginning of the project, the collaborators quickly started to suggest the potential main development ideas, around which others started to gather. Discussions started to take place on our main collaboration channel (Slack) on whether to abandon or pursue some of them and later some tasks were chosen by the collaborators based on interest and on the relevance with the problem at hand.

It was delightful to see that during the project everyone could work on anything they wanted providing it was relevant. Volunteers could choose their task of interest, switch between tasks or work on multiple tasks at once.

Some collaborators opted to lead the various tasks and helped manage the workload among the collaborators and the different tasks. Regular weekly calls helped ensure the progress was on track and everyone was on the same page. Members from iRAP also helped guide the teams through iterative feedback and by answering questions.

A Great Journey for A Great Cause

We hope the worldwide collaboration and implementation of AI technologies on this project will help scale iRAP’s goals. The unique combination of Omdena’s model, global volunteer expertise, and iRAP’s data-driven approach created outcomes that may create safer roads for everyone. We had huge fun experimenting with so much data and so many different techniques, but, most importantly, we feel very proud to have had the opportunity to contribute to such an important cause.

All the volunteers who contributed to the project. Source: Omdena.

References

  1. Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun, Vision meets Robotics: The KITTI Dataset, International Journal of Robotics Research (IJRR), 2013

--

--

Giulio
Omdena
Writer for

Senior Data Scientist at Ofcom — Exploring AI for good