Safer driving with AI – algorithm classifies road conditions in real time
Predicting conditions is the key for safer driving. So what if you could check the road conditions in real time before hopping into your car? Digia's experts built a machine learning algorithm to classify road conditions using open data from road weather cameras. Learn more about the experiment!
Every year around 4200 road traffic accidents causing personal injuries happen in Finland. Many of these traffic accidents occur during the winter months when the road conditions are bad. For example, in 2017 a total of 870 accidents involving human injuries took place when the road surface was icy, snowy, slushy, or wet.
What if drivers could see the road conditions in real time? Or they can get a warning of slippery roads ahead on their navigators so that they will slow down? Or an app would find safer routes to drive during bad weather conditions? Or better yet, could alerts of bad road conditions be sent automatically to the traffic management so that the ice or snow is cleaned in time?
Using open data from road weather cameras, we built a machine learning algorithm to classify road conditions from images. The algorithm successfully identifies bad road weather conditions in nine out of ten pictures, achieving approximately 90% accuracy.
Open data from road weather cameras
There are more than 1700 road weather cameras installed in Finland. These cameras automatically take pictures around every 15 minutes and send them to a database. Thanks to EU’s effort in increasing the role of open data, the road images are now accessible to everyone from internet. These updated pictures give accurate and timely snapshot of the road conditions.
However, it is costly and time-consuming for human labor to screen through 1700 pictures every hour to determine which roads are slippery. This is a perfect challenge to utilize machine learning algorithms. A trained algorithm goes automatically through the images, classifies the road conditions, and then sends the result back to users.
Identifying road conditions using machine learning
In this experiment, we used 346 road images to train models, and 87 images to test and to evaluate how the models performs. The training images are classified into four labels: icy, slushy, wet, and dry, which represent the road conditions. From training images, machine algorithms recognize the features associated with each road conditions and retain this information to process other images in the future. The result of training process is a model which can be used to classify road conditions in an image.
To evaluate the performance of the machine algorithms, the test images are used. The test images are labeled by the model with one of the four road condition classifications mentioned above. The predicted labels are then compared with the true labels to determine how accurate the trained algorithm is. It is quite impressive that the trained model accurately classifies about 90% of test images. It means that road conditions are correctly identified in 9 out of 10 images. Note that there is still room to improve the accuracy by increasing the size of the training data set.
In addition to the classification result, the model gives the confidence of its prediction. For example, the model classifies the road condition in the below image as ‘Slushy’ with a certainty of 99.9%.
"We have used an open source data to create a completely new tool for the road safety and maintenance. The results of this experiment are highly encouraging. With more resources on defining the exact use case and modelling the data, this could potentially become a really useful tool for situations where analyzing of weather conditions needs automation,” says Joachim Wahlström, Data Scientist at Digia.
After the model is trained, it can be deployed and consumed through API call. This allows classifying road conditions of any pictures in real time through calling the model as part of daily automated operations for road safety. One set up could be when a new road image is taken and updated in the database, a function will trigger the model to run and classify the road condition in the image and then return the result back to the database.
It has never been easier to analyze massive unstructured data such as images and videos. New technology providers such as AWS and Azure offer great tools to analyze images in large volume with ease. From our experiments with AWS Rekognition and Azure Computer Vision we conclude that both tools perform comparably well, achieving over 90% precision, and are user-friendly. The table below compares the two platforms.
|Azure Computer Vision
|API and possibility to export the whole model
The findings of the experiment can also be easily visualized in Power BI. By adding information provided by the API:s from the cameras we can also enrich the data from the machine learning algorithm to produce a handy tool to observe the current road conditions in Finland.
All the individual road cameras are presented on a map with colours representing the current conditions. We have also summarised the data to represent the driving conditions per area, road number and road type. The report is based on data from 22.11.2020 but could easily be reworked to present live conditions.
Other applications of road image analytics
Winter road maintenance
Machine learning can identify roads which need to be cleared of snow or ice during wintertime. This will notify traffic management office to send maintenance resource in time and therefore keep the traffic flow and increase road safety.
Detecting malfunctioned cameras
Another application of road image analytics is to determine whether road cameras function properly and if any timely maintenance is needed such as changing battery or recharging. When cameras malfunction, they stop taking photos or may produce blurry, unclear pictures. Machine learning can identify or even predict these cases and notify the situations to the traffic management office beforehand.
Tilaa blogikirjoitukset sähköpostiisi