COMPARISON OF LSTM AND GRU IN TRAFFIC DENSITY PREDICTION USING HISTORICAL VISUAL DATA AND YOLOV5 DETECTION

Supplementary Files

PDF

Keywords

YOLOv5
LSTM
GRU
Traffic density prediction
Historical visual image

How to Cite

Angellia, F. ., Merlina, N. ., Subekti, A., & Handayanto, R. (2026). COMPARISON OF LSTM AND GRU IN TRAFFIC DENSITY PREDICTION USING HISTORICAL VISUAL DATA AND YOLOV5 DETECTION. Journal of Engineering & Technological Advances , 11(1), 44-67. https://doi.org/10.35934/segi.v11i1.163

Abstract

The problem of traffic congestion in urban areas requires adaptive and data-based predictive solutions. This study aims to develop vehicle density detection and prediction patterns based on historical visual data by integrating YOLOv5 object detection algorithms and sequential neural network models, namely Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU). The study also compared the effectiveness of LSTM and GRU in capturing vehicle movement patterns over time. LSTM can be implemented on long-term prediction accuracy by preserving more complex historical contexts, while GRU can be implemented for better training efficiency and processing time due to its simpler architecture. The dataset consists of 254 videos and 13,435 frames with an average VPS of 10.0. The GRU model obtained an MSE value of 5.81, lower than LSTM 6.05, indicating that the mean squared difference between the prediction and the actual value was smaller in the GRU. The RMSE value in the GRU is 2.41, also lower than the LSTM 2.46. The difference of about 0.05 points, although it seems small, still shows consistency that the GRU prediction error is lower. In MAE, the GRU has a value of 1.84, lower than the LSTM 1.89, which means that the mean absolute difference between the prediction and the actual value is smaller in the GRU. This research not only contributes to intelligent transportation systems but also opens up opportunities to develop traffic monitoring systems that are responsive to vehicle dimensions and traffic environment dynamics in real-time.

https://doi.org/10.35934/segi.v11i1.163

References

Abdullah, S. M., Periyasamy, M., Kamaludeen, N. A., Towfek, S. K., Marappan, R., Kidambi Raju, S., Alharbi, A. H., & Khafaga, D. S. (2023). Optimizing Traffic Flow in Smart Cities: Soft GRU-Based Recurrent Neural Networks for Enhanced Congestion Prediction Using Deep Learning. Sustainability. 15(7). 5949. https://doi.org/10.3390/SU15075949

Abdushkour, M., Khadidos, H.A., Alshareef, A.O., Alyoubi, A.M., Khadidos, K.H., Mustafa, A., Rienow, A., Ragab, M., Abdushkour, H. A., Khadidos, A. O., Alshareef, A. M., Alyoubi, K. H., & Khadidos, A. O. (2023). Improved Deep Learning-Based Vehicle Detection for Urban Applications Using Remote Sensing Imagery. Remote Sensing. 15(19). 4747. https://doi.org/10.3390/RS15194747

Akhmedov, F., Khujamatov, H., Abdullaev, M., & Jeon, H.S. (2025). Joint Driver State Classification Approach: Face Classification Model Development and Facial Feature Analysis Improvement. Sensors. 25(5). 1472. https://doi.org/10.3390/S25051472

Alahi, M.E.E., Sukkuea, A., Tina, F.W., Nag, A., Kurdthongmee, W., Suwannarat, K., & Mukhopadhyay, S.C. (2023). Integration of IoT-Enabled Technologies and Artificial Intelligence (AI) for Smart City Scenario: Recent Advancements and Future Trends. Sensors. 23(11). 5206. https://doi.org/10.3390/S23115206

Alsaade, F.W., & Hmoud Al-Adhaileh, M. (2021). Cellular Traffic Prediction Based on an Intelligent Model. Mobile Information Systems. 1, 6050627. https://doi.org/10.1155/2021/6050627

Arora, S., Mittal, R., Arora, D., & Shrivastava, A.K. (2024). A Robust Approach for Licence Plate Detection Using Deep Learning. Inteligencia Artificial: Revista Iberoamericana de Inteligencia Artificial. 27(73). 129. https://doi.org/10.4114/INTARTIF.VOL27ISS73PP129-141

Ballesteros, J. R., Sanchez-Torres, G., & Branch-Bedoya, J. W. (2022). HAGDAVS: Height-Augmented Geo-Located Dataset for Detection and Semantic Segmentation of Vehicles in Drone Aerial Orthomosaics. Data. 7(4). 50. https://doi.org/10.3390/DATA7040050

Beltran, J., Madridano, Á., De Miguel, M.Á., Ervin, L., Eastepp, M., Mcvicker, M., & Ricks, K. (2025). Evaluation of Semantic Segmentation Performance for a Multimodal Roadside Vehicle Detection System on the Edge. Sensors. 25(2), 370. https://doi.org/10.3390/S25020370

Bi, J., Zhang, X., Yuan, H., Zhang, J., & Zhou, M. C. (2022). A hybrid prediction method for realistic network traffic with temporal convolutional network and LSTM. IEEE Transactions on Automation Science and Engineering. 19(3). 1869–1879. https://doi.org/10.1109/TASE.2021.3077537

Bittencourt, J.C.N., Costa, D.G., Portugal, P., & Vasques, F. (2024). A Survey on Adaptive Smart Urban Systems. IEEE Access, 12, 102826–102850. https://doi.org/10.1109/ACCESS.2024.3433381

Butploy, N., Kanarkard, W., Intapan, P.M., & Sanpool, O. (2023). An Approach for Egg Parasite Classification Based on Ensemble Deep Learning. Journal of Advanced Computational Intelligence and Intelligent Informatics. 27(6). 1113–1121. https://doi.org/10.20965/JACIII.2023.P1113

Choe, D.E., Kim, H.C., & Kim, M.H. (2021). Sequence-based modeling of deep learning with LSTM and GRU networks for structural damage detection of floating offshore wind turbine blades. Renewable Energy. 174, 218–235. https://doi.org/10.1016/J.RENENE.2021.04.025

Dong, X., Yan, S., & Duan, C. (2022). A lightweight vehicles detection network model based on YOLOv5. Engineering Applications of Artificial Intelligence. 113, 104914. https://doi.org/10.1016/J.ENGAPPAI.2022.104914

Esmaeil Abbasi, A., Mangini, A. M., & Fanti, M. P. (2024). Object and Pedestrian Detection on Road in Foggy Weather Conditions by Hyperparameterized YOLOv8 Model. Electronics. 13(18), 3661. https://doi.org/10.3390/ELECTRONICS13183661

Fatima, Z., Hassan Tanveer, M., Mariam, H., Voicu, R.C., Rehman, T., & Riaz, R. (2024). Performance comparison of object detection models for road sign detection under different conditions. International Journal of Advanced Computer Science & Applications. 15(12), 996. https://doi.org/10.14569/IJACSA.2024.0151299

Izzulhaq, M.A., Tjatur Widodo, R., & Oktavianto, H. (2024). A comparative study of GRU and LSTM time-series forecasting for precise river dam hydrodynamic prediction. International Electronics Symposium: Shaping the Future: Society 5.0 and Beyond, IES 2024 - Proceeding, 473–478. https://doi.org/10.1109/IES63037.2024.10665796

Jiang, S., Feng, Y., Zhang, W., Liao, X., Dai, X., Onasanya, B.O.A., Jiang, S., Feng, Y., Zhang, W., Liao, X., Dai, X., & Onasanya, B.O. (2024). A New Multi-Branch Convolutional Neural Network and Feature Map Extraction Method for Traffic Congestion Detection. Sensors. (13). 4272. https://doi.org/10.3390/S24134272

Li, Y., Yu, X., & Koudas, N. (2021). Data Acquisition for improving machine learning models. Proceedings of the VLDB Endowment. 14(10). 1832–1844. https://doi.org/10.14778/3467861.3467872

Liu, B., Ma, Y., Zhang, J., Kuang, Y., Bian, J., & Jiang, X. (2024). Unveiling urban traffic accessibility patterns and phase diagrams of traffic direction through real-time navigation data in Beijing. Information Processing & Management. 61(3). 103660. https://doi.org/10.1016/J.IPM.2024.103660

LiYifan, YuXiaohui, & KoudasNick. (2024). Data Acquisition for Improving Model Confidence. Proceedings of the ACM on Management of Data. 2(3). 1–25. https://doi.org/10.1145/3654934

Lu, E.H., Gozdzikiewicz, C?;, Chang, M.?;, Ciou, K.H.?;, Lu, E.H.C., Gozdzikiewicz, M., Chang, K.H., & Ciou, J.M. (2022). A Hierarchical Approach for Traffic Sign Recognition Based on Shape Detection and Image Classification. Sensors. 22(13), 4768. https://doi.org/10.3390/S22134768

Lv, C., Mittal, U., Madaan, V., & Agrawal, P. (2024). Vehicle detection and classification using an ensemble of EfficientDet and YOLOv8. PeerJ Computer Science. 10, e2233. https://doi.org/10.7717/PEERJ-CS.2233

Nasr Azadani, M., & Boukerche, A. (2022). A novel multimodal vehicle path prediction method based on temporal convolutional networks. IEEE Transactions on Intelligent Transportation Systems. 23(12). 25384–25395. https://doi.org/10.1109/TITS.2022.3151263

Nespoli, P., Chung, K.L., Samo, M., Mosima Mafeni Mase, J., & Figueredo, G. (2023). Deep learning with attention mechanisms for road weather detection. Sensors. 23(2). 798. https://doi.org/10.3390/S23020798

Nishat, A. (2022). The role of IoT in building smarter cities and sustainable infrastructure. International Journal of Digital Innovation. 3(1). https://researchworkx.com/index.php/ijdi/article/view/56

Peng, B., Zhang, H., Yang, N., & Xie, J. (2022). Vehicle recognition from unmanned aerial vehicle videos based on fusion of target pre-detection and deep learning. Sustainability. 14(13), 7912. https://doi.org/10.3390/SU14137912

Shi, H., & Zhao, D. (2023). License plate recognition system based on improved YOLOv5 and GRU. IEEE Access. 11, 10429–10439. https://doi.org/10.1109/ACCESS.2023.3240439

Shiri, F. M., Perumal, T., Mustapha, N., & Mohamed, R. (2025). A Comprehensive overview and comparative analysis on deep learning models: CNN, RNN, LSTM, GRU. Journal on Artificial Intelligence. 6(1). 301–360. https://doi.org/10.32604/jai.2024.054314

Tahir, H., Jung, E.S., Tahir, H., & Jung, E.S. (2023). Comparative study on distributed lightweight deep learning models for road pothole detection. Sensors. 23(9). 4347. https://doi.org/10.3390/S23094347

Tsalikidis, N., Mystakidis, A., Koukaras, P., Ivaškevi?ius, M., Mork?nait?, L., Ioannidis, D., Fokaides, P.A., Tjortjis, C., & Tzovaras, D. (2024). Urban traffic congestion prediction: a multi-step approach utilizing sensor data and weather information. Smart Cities. 7(1). 233–253. https://doi.org/10.3390/SMARTCITIES7010010

Vignesh, U., & Moolchandani, T. (2024). Revolutionizing autonomous parking: GNN-powered slot detection for enhanced efficiency. Interdisciplinary Journal of Information, Knowledge, and Management. 19. https://doi.org/10.28945/5334

Yang, P., Yu, D., & Yang, G. (2023). Object detection in aerial remote sensing images using bidirectional enhancement FPN and attention module with data augmentation. Multimedia Tools and Applications. 83(13). 38635–38656. https://doi.org/10.1007/S11042-023-16973-8

Yang, Z., Zhao, C., Maeda, H., & Sekimoto, Y. (2022). Development of a large-scale roadside facility detection model based on the mapillary dataset. Sensors.22(24). 9992. https://doi.org/10.3390/S22249992

Zafar, N., Haq, I. U., Chughtai, J. U. R., & Shafiq, O. (2022). Applying hybrid LSTM-GRU model based on heterogeneous data sources for traffic speed prediction in urban areas. Sensors. 22(9). 3348. https://doi.org/10.3390/S22093348

Zarzycki, K., ?awry´nczuk, M., ?awry´nczuk, ?., & Lenci, S. (2021). LSTM and GRU neural networks as models of dynamical processes used in predictive control: a comparison of models developed for two chemical reactors. Sensors. 21(16). 5625. https://doi.org/10.3390/S21165625

Zhang, Y., Guo, Z., Wu, J., Tian, Y., Tang, H., & Guo, X. (2022). Real-time vehicle detection based on improved YOLO V5. Sustainability. 14(19). 12274. https://doi.org/10.3390/SU141912274

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Copyright (c) 2026 Array