Urban traffic flow monitoring and predicting system based on deep learning

By combining the deep learning models of YOLOv5, DeepSORT and LSTM, the problem of insufficient computing resource consumption and real-time performance of the intelligent traffic management system in a high-density environment is solved, and high-precision and efficient traffic flow monitoring and prediction are achieved, improving the practicality and safety of the traffic management system.

CN120260279APending Publication Date: 2025-07-04JINLING INST OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510424232.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing intelligent traffic management system faces the problems of high computing resource consumption, insufficient real-time performance and low prediction accuracy in high-density and complex traffic environments, and it is difficult to meet the needs of efficient and stable traffic flow monitoring and prediction.

Method used

The YOLOv5 object detection algorithm is used to identify and track human-vehicle targets and track LSTM network for traffic prediction. By introducing CBAM module in YOLOv5 and replacing ResNet in DeepSORT, feature extraction and tracking accuracy is optimized.

Benefits of technology

It realizes high-precision and high-real-time traffic monitoring and prediction in complex traffic environments, improves the efficiency and safety of the traffic management system, optimizes the consumption of computing resources, and meets the real-time response capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120260279A_ABST
    Figure CN120260279A_ABST
Patent Text Reader

Abstract

The invention relates to the field of intelligent traffic, in particular to an urban traffic flow monitoring and predicting system based on deep learning, and the system comprises a data acquisition module which is used for reading the data of each frame in a traffic camera through a pre-trained target detection algorithm, and carrying out the recognition of human and vehicle targets; performing target tracking on an identification result obtained by the target detection algorithm by using a tracking algorithm so as to obtain a time sequence of the pedestrian flow; and the traffic flow prediction module is used for predicting the pedestrian and traffic flow according to a pre-trained prediction model, and the pre-trained prediction model is obtained by training the time sequence of the pedestrian and traffic flow obtained by the data acquisition module. According to the intelligent traffic monitoring and prediction system based on deep learning, the limitation of a traditional traffic management mode is broken through, and the intelligent level of traffic flow monitoring and prediction is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent transportation, and particularly to an urban traffic flow monitoring and prediction system based on deep learning. Background Art

[0002] In the intelligent transportation management system, traffic flow identification and prediction technology is a key means to improve traffic mobility and optimize road traffic efficiency. With the accelerating urbanization process, the complexity and variability of traffic flow are increasing day by day. When facing these challenges, the existing traffic flow identification and prediction methods still have certain limitations. Although domestic and foreign scholars have made positive progress in this field in recent years and proposed various technical solutions, when dealing with high-density and variable traffic scenarios, the existing methods generally face problems such as low accuracy, insufficient real-time performance, and excessive consumption of computing resources.

[0003] In China, Wang Wei et al. proposed a traffic flow monitoring method based on deep convolutional neural network (DCNN). This method effectively identifies and tracks pedestrians and vehicles by real-time analyzing traffic video streams, and extracts spatio-temporal features in traffic scenarios by combining convolutional neural network, so as to achieve traffic flow prediction. However, although this method can improve the accuracy of traffic flow monitoring to a certain extent, when dealing with large-scale data, it still faces high computing resource consumption and low real-time performance. Especially in high-density urban traffic environments, the bottlenecks of system processing speed and performance are more obvious.

[0004] Li Pengfei et al. proposed a traffic flow prediction method based on recurrent neural network (RNN). This method mainly uses RNN to process time series data of traffic flow and predicts future traffic flow by learning the changing trend of historical traffic flow. This model can effectively capture the time-dependent relationship of traffic flow and is particularly suitable for processing traffic flow data with seasonal or periodic fluctuations. However, the RNN model has the problem of gradient disappearance in long-term sequence learning, and its prediction accuracy and stability are affected to a certain extent when dealing with emergencies or sharp fluctuations in traffic flow. In addition, the RNN has high requirements for computing resources, and real-time performance is still a major challenge for this method, especially when dealing with large-scale traffic data.

[0005] Abroad, Zhang et al. proposed a traffic flow prediction model based on the combination of convolutional neural network (CNN) and LSTM. This method extracts spatial features in traffic flow data by CNN and models time series data by combining LSTM, thus improving the prediction accuracy. This method can effectively handle complex traffic flow changes, but due to the need to process and extract features from a large amount of historical data, its computational overhead is large. Especially in the analysis of large-scale urban traffic data, it faces significant computational bottlenecks and real-time limitations.

[0006] Ge et al. proposed a traffic flow prediction method based on the Graph Convolutional Network (GCN). By considering the topological structure information of the traffic network and combining the spatial relationships of traffic flows, this method can more accurately predict the traffic flow changes on multiple traffic sections. This model effectively solves the problem that traditional methods ignore spatial relationships and is particularly suitable for complex urban traffic networks. However, this method also has a relatively high computational complexity, requires powerful computing resources, and in practical applications, its response speed to traffic flow changes still needs to be further optimized to meet real-time requirements.

[0007] In summary, although the current traffic flow recognition and prediction technologies have made certain progress in terms of accuracy and real-time performance, they still face challenges such as high computational resource consumption, insufficient real-time performance, and poor adaptability to complex traffic scenarios. Therefore, this patent application proposes an intelligent traffic flow monitoring and prediction system based on deep learning, aiming to solve the problems of high computational resource consumption, poor real-time performance, and insufficient adaptability in complex scenarios in the existing technologies by optimizing the algorithm architecture, reducing the computational complexity, and enhancing the real-time response ability. By combining efficient object detection and tracking technologies and advanced traffic flow prediction algorithms, this system can achieve high-precision and high-real-time traffic flow monitoring and prediction in complex traffic environments, providing more accurate and reliable data support for intelligent traffic management. Summary of the Invention

[0008] The objective of the present invention is to propose an innovative solution to the technical bottlenecks in traffic flow recognition and prediction in existing intelligent traffic management systems. In the existing technologies, under high-density, low-speed, or stagnant traffic flows, the accuracy of traffic flow recognition models is often limited, directly affecting the accuracy of traffic flow prediction and further affecting the effectiveness of traffic management decisions. In addition, the computational complexity of existing deep learning models in traffic flow prediction is relatively high, especially when dealing with large-scale real-time traffic data, the demand for computing resources is too large, resulting in the system's difficulty in meeting real-time response requirements. In complex dynamic traffic environments, existing traffic flow prediction systems often struggle to maintain high-efficiency and stable prediction accuracy, limiting their performance in practical applications.

[0009] To overcome these challenges, the present invention proposes a deep learning-based urban traffic flow prediction system, including:

[0010] A data acquisition module: used to read the data of each frame in a traffic camera using a pre-trained object detection algorithm and identify vehicle and pedestrian targets; use a tracking algorithm to perform target tracking on the recognition results obtained by the object detection algorithm, and then obtain the time series of vehicle and pedestrian traffic flows.

[0011] Traffic flow prediction module: used to predict the traffic flow of people and vehicles according to a pre-trained prediction model, and the pre-trained prediction model is trained by the time series of the traffic flow of people and vehicles obtained by the data acquisition module.

[0012] Furthermore, the object detection algorithm is YOLOv5.

[0013] Furthermore, the tracking algorithm is DeepSORT.

[0014] Furthermore, the prediction model is an LSTM network.

[0015] Furthermore, a CBAM module is provided before the SPPF module of YOLOv5.

[0016] Furthermore, in DeepSORT, DenseNet is used as the feature extractor for extracting appearance features.

[0017] The present invention also provides an urban traffic flow monitoring system based on deep learning, including:

[0018] Data acquisition module: used to read the data of each frame in the traffic camera using a pre-trained YOLOv5 object detection algorithm, and identify the objects of people and vehicles; use the DeepSORT tracking algorithm to perform object tracking on the recognition results obtained by the YOLOv5 object detection algorithm, and then obtain the time series of the traffic flow of people and vehicles, so as to realize the monitoring of the urban traffic flow.

[0019] Furthermore, a CBAM module is provided before the SPPF module of YOLOv5; in DeepSORT, DenseNet is used as the feature extractor for extracting appearance features.

[0020] Beneficial effects:

[0021] The core innovation of the present invention lies in the efficient application of deep learning technology, especially the breakthrough progress in traffic monitoring and flow analysis. The system collects real-time video stream data at traffic intersections, uses deep learning models to intelligently analyze the data, extracts potential traffic patterns and trends from it, and performs accurate traffic flow prediction. Through real-time traffic flow analysis, the system can provide timely and accurate traffic condition assessments for traffic managers, improving the efficiency and safety of the traffic system.

[0022] Furthermore, the present invention solves the technical problems in high-dimensional data processing and multi-modal data fusion of traditional traffic management systems. To improve the accuracy of object detection, the present invention introduces a channel attention mechanism (CBAM) into the YOLOv5 model, enabling the system to focus more on key areas, thereby effectively improving the detection accuracy; in the DeepSORT object tracking algorithm, the DenseNet network is used to replace the traditional ResNet network, further improving the diversity and efficiency of feature extraction. This technical improvement significantly enhances the robustness of the system in complex dynamic traffic environments, enabling it to accurately and real-time detect and track pedestrians and vehicles in congested, busy, and high-speed moving traffic scenarios, and providing reliable traffic flow analysis data.

[0023] In summary, the intelligent traffic monitoring and prediction system based on deep learning proposed by the present invention breaks through the limitations of traditional traffic management methods and significantly improves the intelligent level of traffic flow monitoring and prediction. Through accurate real-time data collection and flow prediction, the system can optimize traffic management, improve road traffic efficiency, reduce accident risks, and enhance the safety and sustainability of urban traffic systems. This technical solution has broad application prospects in large-scale urban traffic management, intelligent transportation systems (ITS), traffic flow analysis and prediction, road safety monitoring, etc., and has important technical value and social significance, which can effectively improve urban traffic conditions, enhance the travel experience, and promote the construction of smart cities. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a general technical solution diagram of the invention system;

[0025] Figure 2 It is a flow chart for identifying the flow of people and vehicles;

[0026] Figure 3 It is a tracking flow chart of YOLOv5 and DeepSORT;

[0027] Figure 4 It is a structural diagram of the improved YOLOv5 network;

[0028] Figure 5 It is a structural diagram of the CBAM module;

[0029] Figure 6 It is a schematic diagram of the channel attention module;

[0030] Figure 7 It is a schematic diagram of the spatial attention module;

[0031] Figure 8 It is a schematic diagram of the ResNet short-circuit connection mechanism;

[0032] Figure 9Schematic diagram of the DenseNet dense connection mechanism;

[0033] Figure 10 It is the model training flow chart in the data acquisition module;

[0034] Figure 11 It is the model prediction index graph;

[0035] Figure 12 It is the recognition result before the improvement of the data acquisition module;

[0036] Figure 13 It is the recognition result after the improvement of the data acquisition module;

[0037] Figure 14 It is the LSTM model training loss rate index graph;

[0038] Figure 15 It is the GRU model training loss rate index graph;

[0039] Figure 16 It is the SAEs model training loss rate index graph; Specific implementation manner

[0040] To make the objectives, features, and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0041] As Figure 1 shown, a city traffic flow prediction system based on deep learning includes

[0042] Data acquisition module: used to read the data of each frame in the traffic camera using the pre-trained YOLOv5 object detection algorithm and identify the vehicle and pedestrian targets; use the DeepSORT tracking algorithm to perform target tracking on the recognition results obtained by the YOLOv5 object detection algorithm, and then obtain the time series of vehicle and pedestrian traffic;

[0043] As Figure 4 shown, as a preferred implementation manner, a CBAM module is added before the SPPF module of the YOLOv5 object detection algorithm; in the DeepSORT tracking algorithm, DenseNet is used as the feature extractor for extracting appearance features;

[0044] Traffic flow prediction module: used to predict the traffic flow of people and vehicles according to a pre-trained LSTM network, and the pre-trained LSTM network is trained by the time series of the traffic flow of people and vehicles obtained by the data acquisition module.

[0045] In terms of object recognition and tracking, the model selection directly affects the real-time performance, accuracy and resource efficiency of the system. Therefore, the present invention deeply compares the mainstream object detection and tracking models, including object detection models such as Faster R-CNN, SSD, YOLOv5, and tracking algorithms such as Kalman Filter, SORT and DeepSORT. As a classic two-stage object detection framework, Faster R-CNN performs well in dealing with complex scenes and small object detection. However, due to its slow detection speed, it is difficult to meet the real-time requirements. As a single-stage detection model, SSD takes into account both speed and accuracy, especially performing excellently in detecting larger objects, but its accuracy decreases in the case of dealing with small objects or occlusions. With its lightweight design and high detection speed, YOLOv5 has become the mainstream method in modern object detection and is particularly suitable for traffic monitoring applications that require high frame rate and low latency.

[0046] In terms of object tracking, although the classic Kalman Filter is widely used in target trajectory prediction, its ability to model the appearance features of targets is limited. Especially in complex traffic scenarios, when encountering target occlusion or crossing, its tracking accuracy is poor. As a lightweight tracking algorithm based on the Kalman filter, SORT can provide good real-time performance, but its performance is still limited in the case of multi-object interaction or occlusion. In contrast, DeepSORT significantly improves the multi-object tracking accuracy by introducing deep learning technology and combining the appearance features and motion information of targets. Experimental results show that DeepSORT improves by 16.4% and 13.2% respectively compared with Kalman Filter and SORT in terms of tracking accuracy and multi-object tracking accuracy (MOTA).

[0047] Combining the advantages and disadvantages of object detection and tracking models, the combination scheme of YOLOv5 and DeepSORT has high real-time performance while ensuring high accuracy, and can effectively meet the traffic flow monitoring requirements of high frame rate, low latency and high accuracy. This scheme not only improves the adaptability of the system in complex traffic environments, but also optimizes the consumption of computing resources, meeting the dual requirements of real-time performance and accuracy of intelligent transportation systems.

[0048] Such as Figures 2 to 3As shown in the figure, the process of implementing object tracking using the combination of YOLOv5 and DeepSORT is as follows: The YOLOv5 model is used for efficient object detection, and the DeepSORT algorithm is combined to achieve precise object tracking. The system captures the traffic video stream in real time through the camera, uses YOLOv5 to detect pedestrians and vehicles in each frame of the image, generates the corresponding bounding boxes and class labels, thus effectively coping with complex multi-object detection tasks. To further improve the detection performance, a Convolutional Block Attention Module (CBAM) is introduced in YOLOv5. The CBAM module effectively enhances the detection ability of small and occluded objects in complex scenarios by significantly enhancing the model's attention to key regions, thereby optimizing the detection accuracy, especially in crowded or dynamic traffic environments.

[0049] After the detection results are passed to DeepSORT, the algorithm predicts the motion state of the object through the Kalman filter and uses the Hungarian algorithm for matching to associate the detection results with the predicted trajectories. To enhance the tracking accuracy, DeepSORT introduces the Re-Identification (ReID) technology. By assigning a unique identifier to each object, it ensures high-precision tracking even when the object is occluded or there are multiple similar objects. In addition, to further improve the feature extraction ability of DeepSORT, the system uses DenseNet to replace the traditional ResNet architecture. DenseNet reduces information loss while improving the diversity and efficiency of feature representation by introducing the Dense Connections strategy, enhancing the robustness in complex traffic scenarios.

[0050] In the case of successful matching, the system updates the Kalman filter state in real time and continues to track; if the matching fails, the lost processing logic is enabled to re-identify the object in subsequent frames. Through this systematic detection and tracking mechanism, the system can accurately count the traffic flow data of people and vehicles, providing important decision-making support for traffic management and data analysis, and significantly improving the real-time performance and accuracy of the intelligent transportation system in complex environments.

[0051] The process of implementing object tracking using the combination of YOLOv5 and DeepSORT belongs to the prior art, so the detailed process will not be elaborated here.

[0052] The following is a more detailed description of the design of the technical solution:

[0053] (1) Optimized design of introducing the CBAM module in YOLOv5

[0054] As an efficient object detection model, YOLOv5 performs excellently in terms of real-time performance and detection accuracy. However, in complex environments such as illumination changes and object occlusion, its feature extraction ability is still insufficient. Therefore, in this invention, a CBAM module that combines channel and spatial attention mechanisms is introduced into the backbone network of YOLOv5 and integrated before the SPPF (Spatial Pyramid Pooling Fast) module. This module enhances the model's attention to important information by weighting feature channels and spatial regions, thereby improving its adaptability and detection accuracy in diverse scenarios. The structural diagram of the improved YOLOv5 network is as shown in Figure 4 shown.

[0055] The CBAM module aims to effectively improve the feature extraction ability by combining channel and spatial attention mechanisms. It dynamically adjusts the importance of features, guiding the model to focus on key features and important regions, thereby enhancing the object detection performance of YOLOv5 in complex environments. This improvement provides the model with stronger robustness under changing conditions. The structural diagram of the CBAM module is as shown in Figure 5 shown.

[0056] a. As shown in Figure 6 shown, the channel attention mechanism weights different channels in the feature map to highlight important channel information related to object recognition. Its mathematical expression is:

[0057]

[0058] where, represents the input feature map, is the channel attention map, is the sigmoid activation function, represents the multi-layer perceptron, is the average pooling and max pooling results of the input feature map.

[0059] b. As shown in Figure 7 shown, the spatial attention mechanism weights the spatial dimension of the feature map to focus on key regions in the image. Its mathematical expression is:

[0060]

[0061] where, represents the input feature map, is the spatial attention map, is the sigmoid activation function, is a 7×7 convolutional kernel, is the concatenated average pooling and max pooling results.

[0062] Through the above mechanism, CBAM can effectively enhance the target focusing ability of YOLOv5 in complex backgrounds. Especially in scenarios such as multi-target overlap and low illuminance, the detection accuracy is significantly improved.

[0063] (2)Using DenseNet to optimize appearance feature extraction in DeepSORT

[0064] As Figures 8 to 9 shown, DeepSORT successfully achieves efficient multi-target tracking by transforming the detection results into a tracking problem. In the original system, ResNet is used as a feature extractor to extract the appearance features of targets. However, ResNet is prone to losing information when passing features layer by layer, resulting in poor diversity and reuse ability of features, thus affecting the tracking performance. To improve the richness of feature expression and tracking accuracy, the present invention replaces ResNet with DenseNet, aiming to make full use of the feature reuse mechanism and improve the extraction effect of appearance features.

[0065] ① Through the dense connection mechanism, DenseNet directly connects the output of each layer to all subsequent layers, ensuring that the features of the first few layers can be fully used by the subsequent layers. Compared with the skip connection design of ResNet, the dense connection method of DenseNet can better retain the fine-grained features at different levels, thereby improving the ability to capture appearance information. Its connection method is:

[0066]

[0067] ② By sharing the features of the previous layers, DenseNet reduces redundant calculations. Compared with ResNet of the same depth, DenseNet improves the efficiency of feature extraction while reducing the number of parameters.

[0068] ③ The dense connection structure of DenseNet helps the gradient flow in the network, alleviates the problem of gradient disappearance, and enhances the trainability and convergence speed of deep networks.

[0069] In practical applications, after replacing ResNet with DenseNet, the tracking performance of DeepSORT in complex traffic scenarios is significantly improved. Especially in the case of partial occlusion of targets or complex backgrounds, the richer feature expression ability provided by DenseNet significantly improves the accuracy of tracking.

[0070] (3)Selection of prediction models in the traffic flow prediction module

[0071] During the testing process, the prediction models in the traffic flow prediction module selected three models, namely LSTM, GRU, and SAEs, for implementation. The data processing stage involved the systematic collection and preprocessing of historical traffic flow data, including data cleaning, normalization, and feature engineering, to ensure the quality and usability of the input data. During the model construction process, LSTM, GRU, and SAEs were designed respectively to capture the dynamic characteristics of traffic flow. LSTM effectively captures the long-term dependencies of time series through its complex gating mechanism. GRU simplifies the network structure while retaining similar characteristics, improving computational efficiency. SAEs extracts the latent patterns of high-dimensional data through deep feature learning. During prediction, the preprocessed data is input into the three models for parallel inference, and then the model outputs are evaluated, and performance indicators such as mean squared error and mean absolute error are used for comparison. Finally, the optimal model is selected based on the evaluation results to output the traffic flow prediction value. This method effectively improves the accuracy of vehicle and pedestrian flow prediction and provides important decision-making support for the intelligent transportation management system. According to the experiment, LSTM was finally selected as the prediction model.

[0072] The following describes the detailed testing process:

[0073] (1) The model training and testing process in the data acquisition module

[0074] As Figure 10 shown, using the preprocessed dataset, the model structure is initialized and the model is trained. A total of 200 epochs are designed for training, with 16 images in each batch. The trained model is evaluated using the validation set, and indicators such as the loss function, accuracy, and recall rate of the model on the validation set are calculated. Finally, the trained model weight file is formed.

[0075] Table 1 Training environment configuration table

[0076] The total time taken for the training process of this model is 2 hours, 38 minutes, and 6 seconds. After each epoch ends, the system will record and evaluate the performance of the model on the validation set, including calculating indicators such as the loss value and accuracy, and monitor and adjust the training effect in real time. The final generated change curve graph is as Figure 11 shown.

[0077] The model prediction metric graph shows the changing trends of various performance metrics of the traffic flow recognition model during training, reflecting the performance of this model under different training iterations and the process of the gradual reduction of the loss function. The main loss functions include box_loss, obj_loss, and cls_loss, and these values continuously decrease as the training progresses, indicating that the recognition ability of this model gradually increases. At the same time, the precision (metrics / precision) of the model measures the proportion of true positive samples among the instances predicted as positive samples; while the recall (metrics / recall) represents the proportion of all actual positive samples that are successfully recognized as positive samples. The changes in these two metrics provide profound insights into the "precision" and "recall" capabilities of this model in traffic flow monitoring.

[0078] In addition, the mAP (mean Average Precision) metric comprehensively evaluates the performance of the model in multi-class tasks. The mAP values given in the graph are calculated under two different IoU (Intersection over Union) thresholds, namely mAP_0.5 and mAP_0.5:0.95, reflecting the performance of the model under different strictness requirements. The higher the IoU threshold, the stricter the requirements for the prediction accuracy of the model.

[0079] To evaluate the effectiveness of the improvement strategy of this system, ablation experiments were carried out based on YOLOv5, mainly comparing the models with and without CBAM. The experiments used Precision, Recall, mAP@0.5, mAP@0.5:0.95, and F1-score as model evaluation metrics to systematically reveal the impact of each improvement measure on the model performance. The calculation formulas of the model evaluation metrics are shown in Table 2, and the ablation experiment results of YOLOv5 are shown in Table 3.

[0080] Table 2 Calculation Formulas of Model Evaluation Metrics

[0081]

[0082] Table 3 Ablation Experiment Results of YOLOv5

[0083]

[0084] As can be seen from Table 3, after introducing the CBAM mechanism, the Precision and Recall increased by 0.017 and 0.014 respectively, indicating that the model's ability to identify and capture positive samples has been significantly enhanced. In addition, mAP50 increased by 0.004, showing stable performance under high IoU thresholds, while mAP50-95 increased by 0.027, indicating that the model's overall detection ability under multiple IoU criteria has been improved. The F1-score increased by 0.015, further emphasizing the optimized balance between precision and recall of the model.

[0085] Table 4 lists the mAP@0.5 performance metrics of the model before and after improvement for each category.

[0086] Table 4 Performance Metrics for Each Category

[0087]

[0088] The mAP@0.5 results for each category show that after introducing the CBAM mechanism, the performance of the "Car" category increased by 0.002, the "Bus" category also increased by 0.002, while the "Truck" category decreased slightly by 0.001, reflecting its stability based on high precision. It is worth noting that the "Others" category increased significantly by 0.015, reflecting the enhanced ability of CBAM in dealing with diverse and complex targets. Overall, the CBAM mechanism shows potential for improvement in each category, especially when dealing with scarce and complex scenarios, further emphasizing the importance of model optimization.

[0089] By introducing the CBAM module into YOLOv5 and using DenseNet to replace ResNet in DeepSORT, the optimized system shows significant improvement in complex scenarios of vehicle and pedestrian flow recognition. The CBAM module enhances the feature extraction and target area focusing ability of YOLOv5, making it more stable in complex environments such as multi-target density and poor lighting; while the introduction of DenseNet improves the appearance feature extraction ability of DeepSORT, significantly enhancing the accuracy and robustness of multi-target tracking. The recognition results before and after improvement are as Figure 12 and Figure 13 shown. By comparing the above two pictures, it can be seen that the confidence of the improved model in target recognition has been improved. Especially in the vehicle-dense area, a truck target was successfully detected after introducing CBAM. This indicates that the improved system has stronger adaptability and detection ability in complex actual traffic monitoring scenarios.

[0090] This system realizes the accurate identification of vehicles through YOLOv5, and assigns a unique ID (such as carID-39) to each detected target to ensure the unique identification of each target during the DeepSORT tracking process. At the same time, the center point of the vehicle is used to calculate the trajectory for further target tracking and crossing line detection.

[0091] In terms of crossing line detection, the system sets up detection lines in specific areas and judges whether the vehicle crosses the detection line by monitoring the trajectory movement of the vehicle's center point in real time. When the vehicle crosses the line, the system can automatically identify the vehicle category (such as "car") and display the detection information in the upper left corner of the image. At the same time, the identified vehicle information is immediately written into the database, and the system continuously updates the total traffic volume and the number of vehicles in the waiting area.

[0092] In addition, the system has the function of vehicle speed monitoring. By calculating the displacement of the vehicle in the image and the time interval, the driving speed of the vehicle is obtained in real time and displayed above the detection frame (such as "12.0 km / h"). If the system detects that the vehicle is speeding, it will automatically trigger an alarm signal to remind the passing pedestrians to pay attention to safety. By combining the object detection ability of YOLOv5 with the tracking technology of DeepSORT, the system can realize functions such as accurate object detection, traffic volume statistics, speed monitoring and speeding alarm in complex traffic scenarios, significantly improving the intelligence and practicality of the traffic monitoring system.

[0093] (2) The model training and testing process in the traffic flow prediction module

[0094] To ensure the accuracy and generalization ability of the traffic flow prediction model, this system adopts rigorous design and optimization strategies during the training process. The training batch size is set to 256, the number of training epochs is 600, the optimizer RMSprop is selected to accelerate convergence, and the validation set ratio is 5% to evaluate the model's generalization ability. Based on the sliding window mechanism, time series data can be effectively processed, enabling the model to capture both short-term fluctuations and long-term dependency relationships. The model training adopts a phased framework. In the initial stage, the LSTM, GRU, and SAEs models are trained independently to fully exploit the specific advantages of each model.

[0095] In terms of the choice of loss function, the network uses a 20% Dropout rate to prevent overfitting, and the mean square error (MSE) is used as the main optimization target, supplemented by indicators such as the mean absolute percentage error (MAPE) to comprehensively evaluate the relative error performance of the model under different traffic flow levels. In order to mitigate the overfitting phenomenon, L2 regularization and Dropout mechanisms are used, and an early stopping strategy is introduced to ensure the robustness of model training. In view of the complexity of the parameter space of deep neural networks, the Adam adaptive optimization algorithm is selected, combined with a mechanism for dynamically adjusting the learning rate to ensure the efficiency and stability of the training process.

[0096] The model's hyperparameter settings are optimized through grid search-based cross-validation in order to achieve balanced performance improvements on different data subsets. In addition, a multi-dimensional performance evaluation system is used, including indicators such as mean square error (MSE), mean absolute percentage error (MAPE), and explained variance score, to verify the model's prediction accuracy and generalization ability from multiple perspectives.

[0097] For the model training system, the performance of the model on the validation set will be recorded and evaluated, and the loss rate change curves of the three models will be generated as follows: Figure 14 , Figure 15 and Figure 16 shown.

[0098] In the loss rate change curves of the three models, we can observe the performance differences among LSTM, GRU, and SAES during the training process.

[0099] The initial loss rate of the LSTM model is about 0.025. Although the starting point is slightly higher, the loss rate drops rapidly within the first 50 rounds and stabilizes after 100 rounds. The gap between the training loss and the validation loss is small, indicating that the LSTM model successfully avoids overfitting during training and exhibits good convergence and stability. This trend reflects that LSTM has good generalization ability when processing time series tasks, and the stability of the validation loss further proves its robustness when facing new data.

[0100] The performance of the GRU model is similar to that of the LSTM model, with an initial loss rate of about 0.02. It also experienced a rapid decline in the first 50 rounds and gradually stabilized after 100 rounds. The training loss is close to the validation loss, and the validation loss curve tends to be smooth, reflecting that the model has good convergence characteristics and robustness.

[0101] The initial loss rate of the SAES model is relatively high, about 0.05, and in the initial stage of training, the validation loss shows large fluctuations. This volatility may indicate the insufficient stability of SAES in dealing with complex data. Although the model gradually converges after the first 100 rounds, there is still an obvious gap between the validation loss and the training loss. This phenomenon indicates that the SAES model may have an overfitting problem, and its generalization ability is inferior to that of GRU and LSTM models.

[0102] Generally speaking, the LSTM model shows the best performance in this task. Its validation loss curve is the smoothest, and its generalization ability and convergence speed are better than those of GRU and SAES. The performance of GRU is also relatively stable, but it is slightly inferior to LSTM in terms of generalization ability. In contrast, the validation loss of the SAES model fluctuates greatly, indicating its weak robustness in dealing with new data. Therefore, in the time series prediction task, the LSTM model obviously has more advantages.

[0103] To further evaluate the prediction effects of different models, the training results adopt four indicators, namely Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and Coefficient of Determination (R²), as the model evaluation indicators to systematically reveal the differences in the prediction performance of different models. The evaluation of the prediction results of each model is shown in Table 5.

[0104] Table 5 Evaluation Table of Model Prediction Results

[0105]

[0106] When comparing the performances of the three prediction models of LSTM, GRU, and SAES according to Table 5, LSTM demonstrates relatively superior prediction performance, especially in terms of error control and model fitting. Specifically, the Mean Square Error (MSE) of LSTM is 44.69, slightly higher than 43.41 of GRU and 39.66 of SAES, but its high fitting degree is still better than that of GRU. Despite the differences in MSE among the three, LSTM still has an advantage in error magnification control with its lower RMSE (6.68) compared to 6.58 of GRU and 6.29 of SAES, indicating that its prediction errors are relatively stable and have higher accuracy.

[0107] In terms of MAPE, the value of LSTM is 16.23%, lower than 18.42% of GRU and 19.48% of SAES, indicating that LSTM can maintain a relatively low relative error in practical applications, which helps to improve the reliability and effectiveness of the model. Although the MAPE of LSTM is higher than that of some other models, considering its performance in terms of RMSE and MSE, LSTM still demonstrates strong overall prediction ability.

[0108] From the perspective of the coefficient of determination (R²), the R² of LSTM is 0.95, the same as that of SAES, both showing a high model fitting degree. This indicates that LSTM can effectively capture the changing trends in the data and make accurate predictions. Although the R² of GRU is 0.94, slightly inferior, the increase in its error level and the lower fitting degree result in its overall performance being inferior to that of LSTM.

[0109] Taking these performance indicators into comprehensive consideration, LSTM shows strong advantages in error control, prediction accuracy, and model stability. Therefore, LSTM remains the optimal choice for dealing with complex time series prediction tasks.

[0110] The above description is only the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art of this technology, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.

Claims

1. An urban traffic flow prediction system based on deep learning, characterized in that, It includes: Data acquisition module: It is used to read the data of each frame in the traffic camera using a pre-trained object detection algorithm and identify the vehicle and pedestrian targets. Use a tracking algorithm to perform object tracking on the recognition results obtained by the object detection algorithm, and then obtain the time series of vehicle and pedestrian flow. Traffic flow prediction module: It is used to predict the vehicle and pedestrian flow according to a pre-trained prediction model, and the pre-trained prediction model is trained through the time series of vehicle and pedestrian flow obtained by the data acquisition module.

2. The urban traffic flow prediction system based on deep learning according to claim 1, characterized in that, The object detection algorithm is YOLOv5.

3. A city traffic flow prediction system based on deep learning according to claim 1, characterized in that, The tracking algorithm is DeepSORT.

4. A city traffic flow prediction system based on deep learning according to claim 1, characterized in that, The prediction model is an LSTM network.

5. The urban traffic flow prediction system based on deep learning according to claim 2, wherein Before the SPPF module of the YOLOv5, there is a CBAM module.

6. The urban traffic flow prediction system based on deep learning according to claim 3, wherein In the DeepSORT, DenseNet is used as the feature extractor for extracting appearance features.

7. An urban traffic flow monitoring system based on deep learning, characterized in that, It includes: Data acquisition module: It is used to read the data of each frame in the traffic camera using the pre-trained YOLOv5 object detection algorithm and identify the vehicle and pedestrian targets. Use the DeepSORT tracking algorithm to perform object tracking on the recognition results obtained by the YOLOv5 object detection algorithm, and then obtain the time series of vehicle and pedestrian flow to realize the monitoring of urban traffic flow.

8. The urban traffic flow monitoring system based on deep learning according to claim 7, characterized in that, Before the SPPF module of the YOLOv5, there is a CBAM module; in the DeepSORT, DenseNet is used as the feature extractor for extracting appearance features.