Traffic Flow Prediction Using Deep Learning Techniques in Urban Road Networks
Publicado en línea: 17 mar 2025
Recibido: 15 oct 2024
Aceptado: 12 feb 2025
DOI: https://doi.org/10.2478/amns-2025-0832
Palabras clave
© 2025 Yilin Han, published by Sciendo
This work is licensed under the Creative Commons Attribution 4.0 International License.
Accurate traffic flow prediction is a crucial component of intelligent transportation systems (ITS), playing a key role in managing urban road networks, reducing congestion, and improving mobility. Lv et al. [1] showcased the potential of deep learning in traffic flow prediction by employing a stacked autoencoder, achieving performance that surpassed traditional approaches. Polson and Sokolov [2] built on this foundation, applying deep learning methods for short-term traffic forecasting and emphasizing their adaptability in dynamic urban settings. Further advancements by Pamuła and Żochowska [3] explored deep learning models for origin-destination (OD) matrix estimation, showcasing their ability to handle uncongested urban road networks.
Recent innovations in graph-based models have also emerged as a promising direction. Yang and Lv [4] proposed a graph deep learning approach that captures spatial dependencies in urban traffic flow, achieving improved prediction accuracy. Medina-Salgado et al. [5] provided a comprehensive review of urban traffic flow prediction techniques, emphasizing the importance of integrating spatial-temporal patterns into predictive models. Razali et al. [6] highlighted current gaps and evaluation metrics in traffic flow prediction with machine learning and deep learning, offering guidance for future studies.
Deep learning techniques using convolutional methods have been employed for short-term traffic forecasting. Bilotta et al. [7] utilized convolutional neural networks (CNNs) to predict urban traffic flow, effectively extracting spatial patterns from traffic data. Liu et al. [8] developed deep learning models based on mobility data, showcasing the capability of neural networks to handle large-scale urban traffic datasets. Chen et al. [9] advanced this further by integrating deep learning into Internet of Vehicles (IoV) traffic prediction, proposing innovative methods for incorporating real-time vehicle data.
To address data quality challenges, Pamuła [10] examined how data loss impacts traffic flow predictions in neural networks, emphasizing the importance of robust preprocessing methods. Essien et al. [11] explored incorporating external factors, such as traffic incidents derived from social media, into deep learning models, offering a new method to enhance prediction accuracy. Wang et al. [12] introduced a route-oriented deep learning model capable of accurately capturing path-specific traffic dynamics in urban transportation networks.
Federated learning has recently gained attention as a potential solution for traffic flow prediction in heterogeneous scenarios. Pei et al. [13] reviewed federated learning methods for handling diverse data environments, while Xia et al. [14] proposed novel approaches for memory evaluation and federated unlearning in distributed traffic management networks. These advancements pave the way for privacy-preserving and scalable traffic prediction systems.
Spatiotemporal modeling continues to be a key area of research. Xie et al. [15] examined machine learning techniques for urban flow prediction, emphasizing the integration of spatial and temporal features. Han and Huang [16] introduced a deep learning approach for short-term traffic flow forecasting, demonstrating its suitability for real-time use cases. Abdullah et al. [17] improved traffic flow forecasting with soft GRU-based recurrent neural networks, enabling better congestion management in smart cities.
Hybrid deep learning approaches have demonstrated significant potential in traffic forecasting. Wu et al. [18] integrated multiple deep learning frameworks to create a hybrid model for traffic flow prediction, achieving enhanced performance in diverse scenarios. Fouladgar et al. [19] proposed scalable neural networks to predict urban traffic congestion, effectively tackling computational challenges in large-scale applications. Miglani and Kumar [20] conducted an extensive review of deep learning methods for traffic prediction in autonomous vehicles, highlighting solutions and challenges in incorporating predictive models into advanced transportation systems.
While deep learning methods have greatly improved traffic flow prediction, challenges remain. Many existing models face difficulties in effectively managing the complexity of spatial-temporal dependencies in urban traffic data, particularly in dynamic and unpredictable scenarios. Additionally, many approaches face limitations in scalability and computational efficiency, particularly when deployed in real-world, large-scale transportation networks. To tackle these challenges, This paper presents a new deep learning-based algorithm for traffic flow prediction, integrating advanced spatiotemporal feature extraction with adaptive optimization techniques. The proposed method leverages a hybrid architecture combining convolutional and recurrent neural networks to capture fine-grained spatial relationships and long-term temporal trends, ensuring robust and accurate predictions. Furthermore, a multi-task learning framework is employed to enhance computational efficiency and support the simultaneous prediction of multiple traffic metrics, such as flow, speed, and congestion levels. The contributions of this work are threefold: (1) introducing an innovative hybrid deep learning framework tailored for urban traffic flow prediction, (2) addressing scalability challenges through adaptive optimization techniques, and (3) demonstrating the model’s efficacy in real-world scenarios through extensive experimental validation on multiple benchmark datasets. This research provides a comprehensive solution to the pressing challenges in traffic flow prediction, paving the way for smarter and more efficient urban traffic management.
This section presents a deep learning framework tailored for traffic flow prediction in urban road networks. The design focuses on tackling challenges such as capturing intricate spatial-temporal dependencies, managing large-scale data, and maintaining computational efficiency. The approach incorporates advanced methods, utilizing convolutional neural networks (CNNs) to extract spatial features and recurrent neural networks (RNNs) to capture temporal dynamics, all incorporated into a multi-task learning framework.
The proposed framework consists of three primary modules: data preprocessing, feature extraction, and prediction modeling. Figure 1 illustrates the architecture.
1)
2)
3)

Framework for Traffic Flow Prediction Using Deep Learning Techniques.
Accurate traffic flow prediction depends on reliable and high-quality data. In this study, raw traffic datasets, including historical traffic volumes, vehicle speeds, and congestion levels, were obtained from sensors deployed across urban road networks. However, such data frequently contains noise, missing entries, and outliers that can negatively impact prediction accuracy. To mitigate these issues, a detailed data preprocessing pipeline was implemented, comprising the following steps:
1) 2) 1) where 3) 4) 5)
By applying this preprocessing pipeline, the resulting dataset was standardized, noise-free, and representative of the underlying traffic dynamics, providing a robust foundation for deep learning-based traffic flow prediction.
Accurately predicting traffic flow requires an effective representation of both spatial and temporal dependencies. Traffic data inherently exhibits strong correlations across spatially connected road segments and temporally evolving patterns. To address these complexities, a hybrid feature extraction framework combining graph-based spatial modeling and temporal sequence analysis was employed.
1)
2)
3)
By combining the strengths of GCNs and LSTMs, the proposed framework provides a robust mechanism for extracting meaningful spatial-temporal features, which are critical for understanding and predicting traffic dynamics in urban road networks.
Accurate prediction of traffic flow requires a sophisticated model that effectively integrates the extracted spatial-temporal features into a predictive framework. This section outlines the prediction model design, utilizing the combined outputs of the previously discussed Graph Convolutional Network (GCN) and Long Short-Term Memory (LSTM) network. This framework efficiently captures spatial relationships among road segments and temporal patterns over time, enabling precise traffic flow predictions.
1)
The model comprises the following essential components: - Input Layer: Accepts the spatial-temporal feature matrix
2)
3) Regularization: To reduce overfitting and improve the model's generalization, L2 regularization is applied to the trainable parameters:
4)
5)
This approach enables the model to predict traffic flows for extended horizons, supporting proactive traffic management and decision-making.
By integrating spatial-temporal feature extraction and a robust prediction modeling framework, the proposed method achieves high accuracy in traffic flow forecasting while maintaining scalability and adaptability for urban road networks.
To ensure the effectiveness and efficiency of the proposed traffic flow prediction model, an optimization-driven training framework is employed. This section details the optimization strategies, training procedures, and techniques used to enhance the model’s performance and generalization capabilities.
1)
2)
3)
This strategy ensures steady convergence while avoiding premature stagnation.
4)
5) Early Stopping: Early stopping is employed to prevent overfitting by monitoring performance on a validation set. Training is halted if the validation loss does not improve after a set number of epochs.
6) Multi-Step Prediction Training: For multi-step traffic flow forecasting, the model is trained iteratively to predict sequential future time steps. The predicted output
7)
8)
Initialize model parameters
(1) Shuffle the training dataset and divide it into mini-batches.
For each mini-batch, perform forward propagation to compute predictions
Compute the loss
(2) Update parameters using the Adam optimizer.
(3) Monitor validation loss and adjust the learning rate if necessary.
(4) Apply early stopping if validation performance stagnates.
This optimization and training framework ensures that the model achieves high accuracy and generalization performance while maintaining computational efficiency.
The proposed traffic flow prediction model was evaluated through extensive experiments on benchmark datasets, such as METR-LA and PEMS-BAY. These experiments aimed to examine the model's scalability, resilience to missing data, computational efficiency, and accuracy in long-term predictions. Comparisons were made against baseline models, including LSTM, GCN, ST-GCN, and T-GCN, to validate the superiority of the proposed method.
The experiments were conducted in a high-performance computing environment with NVIDIA Tesla GPUs, using Python and the PyTorch framework for implementation. To improve computational efficiency, training was parallelized across multiple GPUs. The evaluation utilized two well-known urban traffic datasets: METR-LA and PEMS-BAY. METR-LA includes data from 207 loop detectors on Los Angeles highways, measured every 5 minutes over 4 months, capturing speed, volume, and occupancy rates. PEMS-BAY comprises data from 325 sensors in the Bay Area, recorded at 5-minute intervals over several months, providing detailed metrics such as speed and flow rates. These datasets offer extensive spatial-temporal information, enabling a robust evaluation of the model’s performance across various urban traffic conditions. Missing data were imputed, and traffic flows were normalized to enhance model convergence during training.
To demonstrate the strengths of the proposed model, its performance was evaluated against several state-of-the-art models: LSTM, a recurrent neural network designed to capture temporal dependencies in sequential data; GCN, a graph convolutional network that extracts spatial features from graph-structured traffic data; ST-GCN, a spatial-temporal graph convolutional network combining GCNs and RNNs for joint spatial-temporal learning; and T-GCN, a time-aware GCN model that directly integrates temporal information into the graph convolution process. For fair comparisons, all baseline models were fine-tuned, with hyperparameters such as learning rate, batch size, and hidden layer dimensions optimized using grid search and cross-validation.
Scalability is a crucial aspect of traffic flow prediction models, especially when applied to large urban networks with extensive sensor deployments. To assess the scalability of the proposed model, subsets of the METR-LA dataset containing 50, 100, and 200 sensors were analyzed. As summarized in Table 1, the proposed model consistently outperformed baseline models such as LSTM, GCN, and ST-GCN, achieving lower Mean Absolute Error (MAE) and Root Mean Square Error (RMSE) values across all sensor subsets. Notably, the MAE increased by only 8.6% when the number of sensors increased fourfold (from 50 to 200), indicating the model's ability to scale effectively without significant performance loss. This scalability is attributed to its efficient spatial-temporal feature extraction, which mitigates the challenges posed by higher data dimensions.
Scalability Analysis Results on METR-LA Dataset
| Number of Sensors | 50 | 100 | 200 |
|---|---|---|---|
| MAE (Proposed, mph) | 2.31 | 2.43 | 2.51 |
| RMSE (Proposed, mph) | 4.52 | 4.67 | 4.80 |
| MAE (ST-GCN, mph) | 2.45 | 2.60 | 2.78 |
| RMSE (ST-GCN, mph) | 4.76 | 4.98 | 5.24 |
| MAE (LSTM, mph) | 2.68 | 2.83 | 3.01 |
| RMSE (LSTM, mph) | 5.05 | 5.32 | 5.60 |
Robustness was evaluated by introducing missing data into the METR-LA dataset at rates of 10%, 20%, and 30%. As depicted in Table 2, the proposed model demonstrated remarkable resilience, with MAE increasing by only 15.9% under 30% data loss. In comparison, baseline models such as T-GCN and LSTM showed steeper degradation in accuracy. This robustness stems from the model's attention mechanism, which adaptively assigns weights to input features, effectively reducing the influence of missing data.
Robustness to Missing Data
| Missing Data Rate | 10% | 20% | 30% |
|---|---|---|---|
| MAE (Proposed, mph) | 2.45 | 2.62 | 2.84 |
| RMSE (Proposed, mph) | 4.69 | 4.92 | 5.18 |
| MAE (T-GCN, mph) | 2.61 | 2.82 | 3.12 |
| RMSE (T-GCN, mph) | 4.88 | 5.16 | 5.54 |
| MAE (LSTM, mph) | 2.85 | 3.12 | 3.45 |
| RMSE (LSTM, mph) | 5.15 | 5.46 | 5.84 |
The results highlight the proposed model’s advantages in both scalability and robustness. The minimal increase in error with larger network sizes and higher data loss underscores the model’s adaptability to real-world scenarios. These improvements are attributed to its hybrid spatial-temporal feature extraction and dynamic attention mechanisms, which effectively manage increased data complexity and incomplete input data.
The computational efficiency of the proposed model was assessed by measuring training time, inference time, and GPU memory usage during training and prediction. These metrics were compared against state-of-the-art models, such as LSTM, T-GCN, and ST-GCN, utilizing the METR-LA dataset.
Computational Efficiency Analysis
| Model | Training Time (s/epoch) | Inference Time (ms/batch) | GPU Memory (GB) |
|---|---|---|---|
| Proposed Model | 1.8 | 42 | 6.2 |
| ST-GCN | 2.6 | 53 | 6.8 |
| T-GCN | 2.9 | 56 | 7.1 |
| LSTM | 3.1 | 59 | 7.2 |

Long-Term Prediction Accuracy for Different Models Across Prediction Horizons

Error Trend Analysis for Long-Term Prediction
The experimental results clearly demonstrate the superiority of the proposed model in predicting traffic flow across varying time horizons, as evidenced by its consistently lower MAE compared to benchmark models such as ST-GCN, T-GCN, and LSTM. The scalability and robustness evaluation highlighted the model’s ability to adapt to datasets of different sizes and complexities, maintaining high prediction accuracy even under scenarios of increased data volume and dynamic variations in traffic patterns. This advantage can be attributed to the effective integration of spatial-temporal feature extraction with deep neural architectures, which allows the model to capture both local and global traffic dynamics. Furthermore, the computational efficiency and long-term prediction experiments revealed that the proposed model not only reduces training time but also achieves reliable predictions over extended periods. This is primarily due to the optimization techniques employed during training, including gradient-based tuning and loss function customization, which ensure convergence to optimal solutions without overfitting. By leveraging its ability to learn spatial dependencies through graph convolution and temporal patterns through sequence modeling, the model inherently overcomes the limitations of traditional approaches that often treat spatial and temporal features independently. The model's robustness to noise and its ability to generalize across various urban networks emphasize its practical applicability in real-world settings. These results highlight the potential of the proposed approach to tackle key challenges in traffic flow prediction, providing a reliable, scalable, and computationally efficient solution for complex urban road systems.
This study presented a deep learning model for predicting traffic flow in urban road networks,addressing key challenges such as scalability, robustness, and computational efficiency. By integrating spatial-temporal feature extraction with graph-based convolution and sequence modeling, the model effectively captures complex traffic dependencies. Extensive experiments demonstrated its advantages over state-of-the-art methods, delivering higher prediction accuracy, improved computational efficiency, and better scalability across diverse datasets. Additionally, the model's resilience to noise and ability to generalize across varying traffic conditions highlight its practical relevance for real-world urban applications. This work provides a scalable and adaptive solution to meet the growing demands of intelligent transportation systems, supporting optimized urban traffic management. Future efforts will focus on enhancing the model with multi-modal data sources and exploring its use in multi-objective optimization for smarter urban mobility.
