The escalating number of vehicles on the roads has exacerbated trafficcongestion, presenting a significant and inevitable challenge for roadusers.Trafficcongestionnotonlyincreasesthetraveltimeofroadusers;it also causes air pollution since more vehicles are stuck on theroad. To address this issue, deep learning algorithms, including YOLOv5and DeepSORT, have been leveraged to enable vehicle detection and estimate the number of vehicles through image processing. This study focuses on training a custom YOLOv5 dataset of vehicles and compares its performance with a pretrained YOLOv5 dataset in terms of feasibility for detecting and estimating the number of vehicles. In the proposed approach, YOLOv5 is employed to detect vehicles in video streams, DeepSORT is used for vehicle tracking and counting as they pass through the detection zone, and the number of vehicles in each lane is estimated with the aid of Supervision. The custom dataset's validation demonstrates promising results, with the precision curve indicating convergence for all classes at 97.4% precision and an 87% accuracy in predicting vehicle classes. Additionally, the precision-recall curve assesses the ability to detect individual vehicle categories, such as bus, car, motorcycle, and truck, with accuracies of 68.2%, 95.2%, 79.9%, and 70.1%, respectively. Furthermore, the overall accuracy for detecting all vehicle classes combined is 78.3%. The F1 curve indicates that the system achieves a confidence level of 30.9% F1 score, ensuring 78% confidence in accurately predicting all classes. Both the pretrained and custom datasets exhibit similar accuracy in counting the total number of vehicles passing through the detection zone as well as estimating the number of vehicles in each lane. However, it is evident that the custom dataset's performance can be further improved by incorporating more extensive and diverse datasets during the training process to enhance the accuracy of vehicle detection and estimation. In conclusion, the integration of deep learning algorithms, specificallyYOLOv5 and DeepSORT, offers a promising solution for addressing traffic congestion byefficiently detecting and estimating vehicle numbers, which allow traffic systems to identify which lane is congested and prioritise ensuring the congested lane has a smooth traffic flow. Continued research with larger datasets can lead to further advancements and refined results in the field of traffic management and optimization.