Skip to main content

Densely-Populated Traffic Detection Using YOLOv5 and Non-maximum Suppression Ensembling

Part of the Lecture Notes on Data Engineering and Communications Technologies book series (LNDECT,volume 95)


Vehicular object detection is the heart of any intelligent traffic system. It is essential for urban traffic management. Recent state-of-the-art methods apply R-CNN, Fast R-CNN, Faster R-CNN, and YOLO for this task. However, region-based CNN methods have the problem of higher inference time which makes them unrealistic to use the model in real-time. YOLO on the other hand struggles to detect small objects that appear in groups. In this paper, we propose a method that can locate and classify vehicular objects from a given densely crowded image using YOLOv5. We apply non-maximum suppression ensembling of 4 different models of YOLOv5 trained on different setups. The performance of our proposed model was measured on the Dhaka AI dataset which contains densely crowded vehicular images taken from both top view and side view of the street in both day and night settings. Our experiments show that our model achieved mAP@0.5 of 0.458 with an inference time of 0.75s outperforming other state-of-the-art models on performance. Hence, the model can be implemented in the street for real-world traffic detection which can be used for traffic control and data collection.


  • Real-time object detection
  • Ensemble learning
  • YOLOv5
  • Non-maximum suppression

This is a preview of subscription content, access via your institution.

Buying options

USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-981-16-6636-0_43
  • Chapter length: 12 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
USD   229.00
Price excludes VAT (USA)
  • ISBN: 978-981-16-6636-0
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   299.99
Price excludes VAT (USA)
Hardcover Book
USD   299.99
Price excludes VAT (USA)
Fig. 1
Fig. 2
Fig. 3
Fig. 4


  1. 1.

    Available at:

  2. 2.

    Available at


  1. Girshick R, Donahue J, Darrell T, Malik J (2014) Rich feature hierarchies for accurate object detection and semantic segmentation. In: 2014 IEEE conference on computer vision and pattern recognition, pp 580–587.

  2. Girshick R (2015) Fast r-cnn. In: 2015 IEEE international conference on computer vision (ICCV), pp 1440–1448.

  3. Ren S, He K, Girshick R, Sun J (2017) Faster r-cnn: towards real-time object detection with region proposal networks. IEEE Trans Pattern Anal Mach Intell 39(6):1137–1149.

  4. Redmon J, Divvala S, Girshick R, Farhadi A (2016) You only look once: Unified, real-time object detection. In: 2016 IEEE conference on computer vision and pattern recognition (CVPR), pp 779–788.

  5. Jocher G, Stoken A, Borovec J, NanoCode012, Chaurasia A, TaoXie, Changyu L, V, A., Laughing, tkianai, yxNONG, Hogan A, lorenzomammana, AlexWang1900, Hajek J, Diaconu L, Marc, Kwon Y, oleg, wanghaoyang0106, Defretin Y, Lohia A, ml5ah, Milanko B, Fineran B, Khromov D, Yiwei D, Doug, Durgesh, Ingham F (2021) ultralytics/yolov5: v5.0 - YOLOv5-P6 1280 models, AWS, and YouTube integrations (Apr 2021).

  6. Laopracha N, Sunat K (2018) Comparative study of computational time that hog-based features used for vehicle detection. In: Meesad P, Sodsee S, Unger H (eds) Recent advances in information and communication technology 2017. Springer, Cham, pp 275–284

    CrossRef  Google Scholar 

  7. Cao X, Wu C, Yan P, Li X (2011) Linear svm classification using boosting hog features for vehicle detection in low-altitude airborne videos. In: 2011 18th IEEE international conference on image processing. IEEE, pp 2421–2424.

  8. Pan C, Sun M, Yan Z (2018) The study on vehicle detection based on dpm in traffic scenes. In: Yen NY, Hung JC (eds) Frontier computing. Springer Singapore, Singapore, pp 19–27.

  9. Tang Y, Zhang C, Gu R, Li P, Yang B (2017) Vehicle detection and recognition for intelligent traffic surveillance system. Multimedia Tools Appl 76(4):5817–5832.

  10. Gao Y, Guo S, Huang K, Chen J, Gong Q, Zou Y, Bai T, Overett G (2017) Scale optimization for full-image-cnn vehicle detection. In: 2017 IEEE intelligent vehicles symposium (IV). IEEE, pp 785–791.

  11. Huttunen H, Yancheshmeh FS, Chen K (2016) Car type recognition with deep neural networks. In: 2016 IEEE intelligent vehicles symposium (IV). IEEE, pp 1115–1120.

  12. Uijlings JR, Van De Sande KE, Gevers T, Smeulders AW (2013) Selective search for object recognition. Int J Comput Vis 104(2):154–171.

  13. Kasper-Eulaers M, Hahn N, Berger S, Sebulonsen T, Myrland Ø, Kummervold PE (2021) Short communication: detecting heavy goods vehicles in rest areas in winter conditions using yolov5. Algorithms 14(4).

  14. Sang J, Wu Z, Guo P, Hu H, Xiang H, Zhang Q, Cai B (2018) An improved yolov2 for vehicle detection. Sensors 18(12).

  15. Asha C, Narasimhadhan A (2018) Vehicle counting for traffic management system using yolo and correlation filter. In: 2018 IEEE international conference on electronics, computing and communication technologies (CONECCT). IEEE, pp 1–6.

  16. Neubeck A, Van Gool L (2006) Efficient non-maximum suppression. In: 18th international conference on pattern recognition (ICPR’06). vol 3, pp 850–855.

  17. Shihavuddin A, Rashid MRA (2020) DhakaAI.

  18. Tzutalin: Labelimg. Git Code (Dec 2018).

  19. Buslaev A, Iglovikov VI, Khvedchenya E, Parinov A, Druzhinin M, Kalinin AA (2020) Albumentations: fast and flexible image augmentations. Information 11(2).

  20. Bochkovskiy A, Wang C, Liao HM (2020) Yolov4: optimal speed and accuracy of object detection. Comput Res Repos (CoRR) abs/2004.10934.

  21. Liu Y, Lu B, Peng J, Zhang Z (2020) Research on the use of yolov5 object detection algorithm in mask wearing recognition. World Sci Res J 276–284

    Google Scholar 

  22. He K, Zhang X, Ren S, Sun J (2015) Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans Pattern Anal Mach Intell 37(9):1904–1916.

  23. Yan B, Fan P, Lei X, Liu Z, Yang F (2021) A real-time apple targets detection method for picking robot based on improved yolov5. Remote Sens 13(9).

  24. Lin TY, Maire M, Belongie, S, Hays J, Perona P, Ramanan D, Dollár P, Zitnick CL (2014) Microsoft coco: common objects in context. In: Fleet D, Pajdla T, Schiele B, Tuytelaars T (eds) Computer vision—ECCV 2014. Springer International Publishing, Cham (2014), pp 740–755.

  25. Bisong E (2019) Google Colaboratory. Apress, Berkeley, CA, pp 59–64.

Download references


We would like to extend our gratitude to Mr. Redwan Karim Sony, Department of Computer Science and Engineering, Islamic University of Technology, and Mr. Mohammad Sabik Irbaz, Pioneer Alpha Limited for their continuous support and suggestions throughout the work. We would also like to thank the organizing committee of Dhaka AI 2020 for organizing the competition.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Raian Rahman .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Rahman, R., Bin Azad, Z., Bakhtiar Hasan, M. (2022). Densely-Populated Traffic Detection Using YOLOv5 and Non-maximum Suppression Ensembling. In: Arefin, M.S., Kaiser, M.S., Bandyopadhyay, A., Ahad, M.A.R., Ray, K. (eds) Proceedings of the International Conference on Big Data, IoT, and Machine Learning. Lecture Notes on Data Engineering and Communications Technologies, vol 95. Springer, Singapore.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-16-6635-3

  • Online ISBN: 978-981-16-6636-0

  • eBook Packages: EngineeringEngineering (R0)