Home / Case Studies / Traffic Prediction

  • NAI Solution

AI Traffic Density Prediction

The solution based on Machine Learning (ML) and Artificial Neural Networks (NN) is able to predict the number of cars and their average harmonic speed for the segments where road equipment is installed.

car traffic density  forecast ai

Aim of the Project

● Build a prediction AI model using Graph Neural Network
● Develop a web service & API for the ML model integration and usage


Results Achieved

● Forecast timeline: up to 2 hours
● Data pre- & post-processing with interpolation and extrapolation
● Auto re-training of the model


Main Technologies

● AI/ML: Python, Keras, TensorFLow, Spectral, Pandas, NumPy, XGBoost, OSMnx, time-series, Graph Neural Networks, Recurrent and Convolutional Neural Networks
● API & web-services: Python, Flask, MongoDB, Docker


AI System Features

The forecast model was developed from scratch using historical data from a large set of special sensors and road cameras that are used to detect cars and measure their current speed. The influence of such features as weather conditions and road events was considered.

The impact of the features is shown in the following table:


Group of Features

Impact on Metric


Road accidents and events features


Positive impact

Weather (synoptic) features


Positive impact

The inputs of the model:

● historical data of cars amount and speed
● current cars amount and speed
● weather conditions
● road events/accidents


The outputs of the model are presented with predictions:

● of speed and count
● for every segment of the network
● for 2 classes of vehicles: heavyweight and light vehicles
● for 4 different futures:
○ T+15 minutes
○ T+30 minutes
○ T+60 minutes
○ T+120 minutes
● all these predictions need to be refreshed every 15 minutes.

The output is generated in a MongoDB format.


Main Sources of Benefits

● The solution provides an ability to view current and forecasted car density on the roads in a large country region.
● The system can be used to build optimal travelling routes for citizens and entities.
● It can also help municipal organisations in planning roadworks.
● The AI processing time is quite fast (~3 sec). The forecast update period is 15 minutes. It means the solution can fastly react to the input conditions changes and provide actual data.
● The developed web-service API can be used for 3rd-parties integration.