Vehicle flow prediction method, device, equipment and storage medium
By constructing a vehicle flow prediction model, real-time vehicle flow data are divided and processed, the problems of insufficient real-time vehicle flow prediction and insufficient data utilization in the existing technology are solved, and more efficient and accurate vehicle flow prediction is achieved, which supports prediction needs in different scenarios and improves the operating efficiency of the transportation system.
Patent Information
- Application Number
- CN202411026546.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2044-07-30
AI Technical Summary
The existing vehicle traffic prediction methods are insufficient in real-time and are difficult to process new inflow data in real time or near real-time, resulting in insufficient response to sudden traffic events, and insufficient data utilization, which makes it impossible to fully utilize the dynamic information and fine-grained characteristics in massive, high-dimensional real-time data, resulting in the fineness and accuracy of the prediction results being affected.
By constructing a vehicle flow prediction model, dividing the real-time vehicle flow data based on the preset time threshold and saving it to the database, determining the target model based on the type of vehicle flow prediction request, and determining whether the prediction date is a holiday date. If so, adding a holiday tag, and finally inputting the processed data to the target model for prediction.
It improves the real-time and accuracy of traffic forecasting, and can estimate future traffic flow more accurately, reduce forecast deviations, meet the traffic forecast needs in different scenarios, provide management departments with sufficient time to take countermeasures, effectively alleviate or avoid congestion, and improve the operating efficiency of the traffic system.
Smart Images

Figure CN118587891B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of road traffic technology, and in particular to a vehicle flow prediction method, device, equipment and storage medium. Background Art
[0002] The technology of traffic flow prediction relies on historical and real-time traffic information, focuses on analyzing the various characteristics of traffic flow, and estimates the trend of the number of vehicles on the road in a specified period of time in the future, aiming to provide solid theoretical support for traffic control, road maintenance and itinerary scheduling, alleviate congestion and improve resource scheduling efficiency. Traditional traffic flow prediction methods usually use time series analysis, linear regression models and other methods to predict traffic flow.
[0003] However, existing technologies lack real-time performance and often rely on historical data sets with fixed periods for analysis. They find it difficult to process newly incoming data in real time or near real time. As a result, they are not quick enough to respond to sudden traffic incidents or short-term changes in traffic patterns. In addition, existing technologies do not make full use of data and are inefficient when processing massive, high-dimensional real-time data. They are unable to fully utilize the dynamic information and fine-grained features in the data, which affects the sophistication and accuracy of the prediction results. Furthermore, it is difficult to accurately depict the complex and changeable nature of traffic behavior, resulting in limited prediction accuracy, static and slow response, and difficulty in adapting to the dynamic characteristics of traffic flow. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a vehicle flow prediction method, device, equipment and storage medium, which can meet the vehicle flow prediction in different scenarios through the constructed model and the collected real-time vehicle flow data. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a vehicle flow prediction method, which is applied to a vehicle flow prediction platform, comprising:
[0006] Dividing the collected real-time traffic flow data based on a preset time threshold, so as to save the obtained divided traffic flow data into a preset database;
[0007] Determining a target traffic flow prediction model based on the request type of the received traffic flow prediction request, determining prediction date data corresponding to the traffic flow prediction request, and judging whether the prediction date data corresponds to a holiday date;
[0008] If the predicted date data corresponds to a holiday date, a holiday label is added to the predicted date data to obtain processed predicted date data;
[0009] The processed predicted date data is input into the target vehicle flow prediction model so that the target vehicle flow prediction model performs vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data.
[0010] Optionally, dividing the collected real-time traffic flow data based on a preset time threshold to save the obtained divided traffic flow data to a preset database includes:
[0011] Collect real-time traffic flow and data through preset sensors, and transmit the real-time traffic flow data to a preset Kafka message queue;
[0012] Preprocessing the real-time traffic flow data in the preset Kafka message queue through a preset processing framework to obtain preprocessed traffic flow data, and persisting the preprocessed traffic flow data through a preset first database;
[0013] The pre-processed traffic flow data stored in the preset first database is divided based on a preset time threshold to obtain divided traffic flow data, and the divided traffic flow data is saved in a preset second database; the preset time threshold is a time threshold in hours.
[0014] Optionally, determining a target vehicle flow prediction model based on a request type of a received vehicle flow prediction request includes:
[0015] If a traffic flow prediction request is received, determining that the traffic flow prediction request is a real-time traffic flow prediction request or a long-term traffic flow prediction request; the long-term traffic flow prediction request is a request for traffic flow prediction in units of days;
[0016] If the traffic flow prediction request is a real-time traffic flow prediction request, a first traffic flow prediction model constructed based on a ridge regression algorithm is used as a target traffic flow prediction model;
[0017] If the traffic flow prediction request is a long-term traffic flow prediction request, the second traffic flow prediction model constructed based on the Bayesian Ridge Regression algorithm is used as the target traffic flow prediction model.
[0018] Optionally, determining the predicted date data corresponding to the traffic flow prediction request and judging whether the predicted date data corresponds to a holiday date includes:
[0019] If the traffic flow prediction request is the real-time traffic flow prediction request, determining a real-time prediction date corresponding to the real-time traffic flow prediction request, and determining whether the real-time prediction date is a holiday date;
[0020] If the traffic flow prediction request is the long-term traffic flow prediction request, a prediction period corresponding to the long-term traffic flow prediction request is determined, and it is determined whether the prediction period includes a holiday date.
[0021] Optionally, if the predicted date data corresponds to a holiday date, adding a holiday label to the predicted date data to obtain processed predicted date data includes:
[0022] If the real-time predicted date is a holiday date, determining a first holiday type corresponding to the holiday date, and adding a first holiday label corresponding to the first holiday type to the real-time predicted date to obtain first processed predicted date data;
[0023] If the prediction period includes a holiday date, a target date corresponding to the holiday date within the prediction period is determined, and a second holiday type corresponding to the holiday date is determined, and a second holiday label corresponding to the second holiday type is added to the target date to obtain second processed prediction date data.
[0024] Optionally, the inputting the processed predicted date data into the target vehicle flow prediction model so that the target vehicle flow prediction model performs vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data, comprises:
[0025] Inputting the first processed predicted date data into the first vehicle flow prediction model, so that the first vehicle flow prediction model performs vehicle flow prediction corresponding to the first processed predicted date data based on the currently collected target real-time vehicle flow data and the divided vehicle flow data, so as to obtain a first vehicle flow prediction result corresponding to the real-time vehicle flow prediction request;
[0026] Or, the second processed predicted date data is input into the second traffic flow prediction model, so that the second traffic flow prediction model performs traffic flow prediction corresponding to the second processed predicted date data based on the target real-time traffic flow data and the integrated traffic flow data, so as to obtain a second traffic flow prediction result corresponding to the long-term traffic flow prediction request; the integrated traffic flow data is data obtained by integrating the divided traffic flow data in units of days.
[0027] Optionally, the vehicle flow prediction method further includes:
[0028] If an advance prediction request is received, determining an advance prediction date corresponding to the advance prediction request, and judging whether the advance prediction date is a holiday date, and if it is a holiday date, determining a third holiday type corresponding to the holiday date;
[0029] Target traffic flow data corresponding to the third holiday type is extracted from the preset database, and the advance prediction date is input into the target traffic flow prediction model, so that the target traffic flow prediction model performs traffic flow prediction based on the target traffic flow data to obtain a third traffic flow prediction result corresponding to the advance prediction request.
[0030] In a second aspect, the present application discloses a vehicle flow prediction device, which is applied to a vehicle flow prediction platform, comprising:
[0031] A data partitioning module, used to partition the collected real-time traffic flow data based on a preset time threshold, so as to save the partitioned traffic flow data to a preset database;
[0032] A date determination module, used to determine a target traffic flow prediction model based on the request type of the received traffic flow prediction request, determine the prediction date data corresponding to the traffic flow prediction request, and determine whether the prediction date data corresponds to a holiday date;
[0033] A label adding module, used for adding a holiday label to the predicted date data if the predicted date data corresponds to a holiday date, so as to obtain processed predicted date data;
[0034] The vehicle flow prediction module is used to input the processed predicted date data into the target vehicle flow prediction model so that the target vehicle flow prediction model can perform vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data.
[0035] In a third aspect, the present application discloses an electronic device, comprising:
[0036] Memory, used to store computer programs;
[0037] A processor is used to execute the computer program to implement the vehicle flow prediction method as described above.
[0038] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned vehicle flow prediction method.
[0039] In the present application, the collected real-time traffic flow data is first divided based on a preset time threshold to save the divided traffic flow data to a preset database, and then the target traffic flow prediction model is determined based on the request type of the received traffic flow prediction request, and the prediction date data corresponding to the traffic flow prediction request is determined, and it is judged whether the prediction date data corresponds to a holiday date. If the prediction date data corresponds to a holiday date, a holiday label is added to the prediction date data to obtain processed prediction date data, and finally the processed prediction date data is input into the target traffic flow prediction model, so that the target traffic flow prediction model performs traffic flow prediction corresponding to the processed prediction date data based on the divided traffic flow data. It can be seen that the method of the present application can divide the collected real-time traffic flow data based on the preset time threshold, and save the obtained divided traffic flow data to the preset database, and then determine the corresponding target traffic flow prediction model according to the received traffic flow prediction request, and then determine whether the predicted date data corresponding to the traffic flow prediction request corresponds to the holiday date, and add a holiday label to the predicted date data in the case of a corresponding holiday date, to obtain the processed predicted date data, and then input the processed predicted date data into the target traffic flow prediction model, so that the target traffic flow prediction model can predict the traffic flow corresponding to the processed predicted date data based on the divided traffic flow data. In this way, the collected real-time vehicle flow data can be used to predict traffic flow, so as to more accurately estimate future traffic flow, reduce prediction deviation, improve the real-time and accuracy of the prediction, and the constructed model can meet the traffic flow prediction in different scenarios, provide the management department with sufficient time to take countermeasures, effectively alleviate or avoid congestion, and thus improve the operation efficiency of the traffic system. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0041] Figure 1 A flow chart of a vehicle flow prediction method disclosed in this application;
[0042] Figure 2 A time sequence diagram of a vehicle flow prediction method disclosed in this application;
[0043] Figure 3 A schematic diagram of a traffic flow prediction organizational structure disclosed in this application;
[0044] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In the existing technology, traffic flow analysis often relies on historical data sets with fixed periods, and it is difficult to process newly incoming data in real time or near real time. This may cause the problem of insufficient real-time performance of traffic flow prediction, which in turn leads to a slow response when dealing with sudden traffic incidents or short-term traffic pattern changes. In addition, the existing technology does not make full use of data and is inefficient in processing massive, high-dimensional real-time data. It cannot fully utilize the dynamic information and fine-grained features in the data, which affects the precision and accuracy of the prediction results. It is also difficult to accurately depict the complex and changeable nature of traffic behavior, resulting in limited prediction accuracy, static and slow response, and difficulty in adapting to the dynamic characteristics of traffic flow.
[0047] In order to overcome the above-mentioned technical problems, the present application discloses a vehicle flow prediction method, device, equipment and storage medium which can use the collected real-time vehicle flow data to predict vehicle flow, so as to more accurately estimate future vehicle flow, reduce prediction deviation, improve the real-time and accuracy of the prediction, and can meet the vehicle flow prediction in different scenarios through the constructed model, so as to provide the management department with sufficient time to take countermeasures, effectively alleviate or avoid congestion, and thus improve the operating efficiency of the transportation system.
[0048] See also Figure 1 As shown, an embodiment of the present invention discloses a vehicle flow prediction method, which is applied to a vehicle flow prediction platform, comprising:
[0049] Step S11: divide the collected real-time traffic flow data based on a preset time threshold, and save the divided traffic flow data into a preset database.
[0050] In this embodiment, it is necessary to collect real-time vehicle data and divide the collected real-time vehicle data. Specifically, Figure 2As shown, it is necessary to continuously collect real-time traffic flow data through sensors on various road sections, and transmit the collected real-time traffic flow data to a high-throughput preset Kafka message queue, that is, a preset Kafka message queue. Then, the preset processing framework, that is, Apache Flink, can be used to process the traffic flow data transmitted from Kafka in real time. It should be noted that Flink is a high-performance distributed stream processing framework. Processing traffic flow data through the Flink framework can ensure accurate processing of each traffic flow record, and even when the data arrives out of order, it can also be accurately analyzed and classified based on the actual occurrence time of the event.
[0051] Furthermore, by consuming the real-time data stream in Kafka, the Flink framework can process each traffic flow record in real time, including data cleaning, data conversion, and aggregation operations, thereby completing the preprocessing of the real-time traffic flow data to obtain the preprocessed traffic flow data. After the preprocessing is completed, the preprocessed traffic flow data can be persisted through the preset first database, and the preset first database is an Oracle database. In this way, by preserving the real-time traffic flow data, the timeliness of water treatment is ensured, and the efficiency of data output is ensured through the Flink framework, and the reliability of data processing is ensured by completing the persistent storage of the real-time traffic flow data through the Oracle database.
[0052] In a further step, the pre-processed traffic flow data stored in the preset first database can be divided by a preset time threshold to obtain divided traffic flow data. It should be noted that the preset time threshold is a time threshold in hours, so the collected real-time traffic flow data can be regularly summarized and stored in the preset second database at an hourly granularity. The preset second database is an Elasticsearch database. Storing the segmented data in the Elasticsearch database can not only quickly index massive data, but also support complex queries and aggregation operations. In this way, the real-time traffic flow data divided by hourly granularity is stored and stored in the Elasticsearch database, which is convenient for reviewing and analyzing the traffic conditions in a specific period of time, and provides convenience for data retrieval for predicting future traffic trends and formulating traffic plans.
[0053] Step S12: determining a target traffic flow prediction model based on the request type of the received traffic flow prediction request, determining the prediction date data corresponding to the traffic flow prediction request, and judging whether the prediction date data corresponds to a holiday date.
[0054] In this embodiment, if a traffic flow prediction request is received, the request type corresponding to the traffic flow prediction request can be determined, and then the corresponding traffic flow prediction model is selected as the target traffic flow prediction model for traffic flow prediction. Specifically, Figure 2 As shown, if a traffic flow prediction request is received, it is necessary to determine whether the traffic flow prediction request is a real-time traffic flow prediction request or a long-term traffic flow prediction request. If the traffic flow prediction request is a real-time traffic flow prediction request, the first traffic flow prediction model built based on the ridge regression algorithm is used as the target traffic flow prediction model. It should be further explained that the real-time traffic flow prediction request is a prediction request for traffic flow changes in the next few hours to a day. For the model of the real-time traffic flow prediction request, the first traffic flow prediction model utilizes the Flink real-time processing framework's efficient processing capabilities for high-speed flow data, combined with the hourly granularity traffic flow rules in historical data and the current traffic conditions reflected by real-time data, and uses the time series algorithm RidgeRegression (ridge regression algorithm) for model training and prediction. It can help highway management departments to adjust traffic strategies in real time, effectively deal with short-term traffic congestion, and improve road traffic efficiency. If the traffic flow prediction request is a long-term traffic flow prediction request, the second traffic flow prediction model built based on the Bayesian Ridge regression algorithm will be used as the target traffic flow prediction model. It should be noted that the long-term traffic flow prediction request is a request for traffic flow prediction in days, and the range covers the next few days to months. Furthermore, the second traffic flow prediction model uses the time series model Bayesian Ridge (Bayesian Ridge regression algorithm) to learn the periodicity and trend characteristics in historical data, so as to make a reasonable estimate of the traffic flow in the future for a long period of time. Medium- and long-term predictions are of great value to high-speed traffic planning, infrastructure construction, major event arrangements, etc., and help to make resource allocation and traffic diversion plans in advance, reducing possible traffic pressure in the future.
[0055] After determining the target traffic flow prediction model for traffic flow prediction, it is necessary to determine whether the prediction date data corresponding to the prediction request corresponds to a holiday date.
[0056] Step S13: If the predicted date data corresponds to a holiday date, a holiday label is added to the predicted date data to obtain processed predicted date data.
[0057] In this embodiment, after determining the target traffic flow prediction model for traffic flow prediction, it is necessary to determine whether the prediction date data corresponding to the prediction request corresponds to a holiday date. Specifically, if the traffic flow prediction request is a real-time traffic flow prediction request, it is necessary to determine the real-time prediction date corresponding to the real-time traffic flow prediction request. It should be noted that since the real-time traffic flow prediction request corresponds to the traffic flow prediction within the next few hours or the day after the request is initiated in this application, the real-time prediction date corresponding to the real-time traffic flow prediction request is the date of the day corresponding to the request initiation in this application. For example, the real-time traffic flow prediction request is initiated on the C day of the year A month B, and the real-time prediction date is the C day. Therefore, it is necessary to determine whether the C day is a holiday. If it is not a holiday, the traffic flow prediction corresponding to the real-time prediction date is directly performed based on the data in the Elasticsearch database. If it is a holiday, it is necessary to determine the holiday type corresponding to the real-time prediction date, such as weekends, Spring Festival, Mid-Autumn Festival, National Day and other holidays. Then, the corresponding holiday date is marked with a holiday label of the corresponding holiday type to obtain the first processed prediction date data.
[0058] On the other hand, if the traffic flow prediction request is a long-term traffic flow prediction request, it is necessary to determine the prediction period corresponding to the long-term traffic flow prediction request. It should be noted that since the long-term traffic flow prediction request is a request for traffic flow prediction in days, and the range covers the next few days to months, it is necessary to determine whether the prediction period corresponds to a holiday date. For example, if the prediction period is from A day of month A to B day of month B, it is necessary to determine whether there are holidays such as weekends, Spring Festival, Mid-Autumn Festival, National Day, etc. Then, the corresponding holiday date is marked with a holiday label of the corresponding holiday type to obtain the second processed predicted date data.
[0059] In this way, adding corresponding holiday labels to date data can improve the processing speed and accuracy of the model when making traffic flow predictions.
[0060] Step S14: input the processed predicted date data into the target vehicle flow prediction model, so that the target vehicle flow prediction model performs vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data.
[0061] In this embodiment, the labeled processed predicted date data needs to be input into the target traffic flow prediction model so that the target traffic flow prediction model can perform traffic flow prediction. Specifically, if the traffic flow prediction request is a real-time prediction request, the first processed predicted date data needs to be input into the first traffic flow prediction model. Then, the first traffic flow prediction model performs traffic flow prediction corresponding to the first processed predicted date data based on the currently collected target real-time traffic flow data and the divided traffic flow data corresponding to the holiday dates stored in the Elasticsearch database, so as to obtain the first traffic flow prediction result corresponding to the real-time traffic flow prediction request.
[0062] In another specific implementation scenario, if the traffic flow prediction request is a real-time prediction request, the second processed prediction date data needs to be input into the second traffic flow prediction model, and then the second traffic flow prediction model performs traffic flow prediction corresponding to the second processed prediction date data based on the divided traffic flow data corresponding to holiday dates and the corresponding non-holiday date data stored in the Elasticsearch database to obtain a second traffic flow prediction result corresponding to the real-time traffic flow prediction request.
[0063] It can be seen that the method of the present application can divide the collected real-time traffic flow data based on the preset time threshold, and save the obtained divided traffic flow data to the preset database, and then determine the corresponding target traffic flow prediction model according to the received traffic flow prediction request, and then determine whether the predicted date data corresponding to the traffic flow prediction request corresponds to the holiday date, and add a holiday label to the predicted date data in the case of a corresponding holiday date, to obtain the processed predicted date data, and then input the processed predicted date data into the target traffic flow prediction model, so that the target traffic flow prediction model can predict the traffic flow corresponding to the processed predicted date data based on the divided traffic flow data. In this way, the collected real-time vehicle flow data can be used to predict traffic flow, so as to more accurately estimate future traffic flow, reduce prediction deviation, improve the real-time and accuracy of the prediction, and the constructed model can meet the traffic flow prediction in different scenarios, provide the management department with sufficient time to take countermeasures, effectively alleviate or avoid congestion, and thus improve the operation efficiency of the traffic system.
[0064] See also Figure 3 As shown, an embodiment of the present invention discloses a vehicle flow prediction device, which is applied to a vehicle flow prediction platform, including:
[0065] The data partitioning module 11 is used to partition the collected real-time traffic flow data based on a preset time threshold, so as to save the partitioned traffic flow data to a preset database;
[0066] The date determination module 12 is used to determine the target traffic flow prediction model based on the request type of the received traffic flow prediction request, determine the prediction date data corresponding to the traffic flow prediction request, and determine whether the prediction date data corresponds to a holiday date;
[0067] A label adding module 13, for adding a holiday label to the predicted date data if the predicted date data corresponds to a holiday date, so as to obtain processed predicted date data;
[0068] The vehicle flow prediction module 14 is used to input the processed predicted date data into the target vehicle flow prediction model so that the target vehicle flow prediction model performs a vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data.
[0069] In the present application, the collected real-time traffic flow data is first divided based on a preset time threshold to save the divided traffic flow data to a preset database, and then the target traffic flow prediction model is determined based on the request type of the received traffic flow prediction request, and the prediction date data corresponding to the traffic flow prediction request is determined, and it is judged whether the prediction date data corresponds to a holiday date. If the prediction date data corresponds to a holiday date, a holiday label is added to the prediction date data to obtain processed prediction date data, and finally the processed prediction date data is input into the target traffic flow prediction model, so that the target traffic flow prediction model performs traffic flow prediction corresponding to the processed prediction date data based on the divided traffic flow data. It can be seen that the method of the present application can divide the collected real-time traffic flow data based on the preset time threshold, and save the obtained divided traffic flow data to the preset database, and then determine the corresponding target traffic flow prediction model according to the received traffic flow prediction request, and then determine whether the predicted date data corresponding to the traffic flow prediction request corresponds to the holiday date, and add a holiday label to the predicted date data in the case of a corresponding holiday date, to obtain the processed predicted date data, and then input the processed predicted date data into the target traffic flow prediction model, so that the target traffic flow prediction model can predict the traffic flow corresponding to the processed predicted date data based on the divided traffic flow data. In this way, the collected real-time vehicle flow data can be used to predict traffic flow, so as to more accurately estimate future traffic flow, reduce prediction deviation, improve the real-time and accuracy of the prediction, and the constructed model can meet the traffic flow prediction in different scenarios, provide the management department with sufficient time to take countermeasures, effectively alleviate or avoid congestion, and thus improve the operation efficiency of the traffic system.
[0070] In some embodiments, the data partitioning module 11 may specifically include:
[0071] A data transmission unit, used to collect real-time vehicle flow and data through a preset sensor, and transmit the real-time vehicle flow data to a preset Kafka message queue;
[0072] A data storage unit, configured to preprocess the real-time traffic flow data in the preset Kafka message queue through a preset processing framework to obtain preprocessed traffic flow data, and to persistently store the preprocessed traffic flow data through a preset first database;
[0073] A data partitioning unit is used to partition the pre-processed traffic flow data stored in the preset first database based on a preset time threshold to obtain partitioned traffic flow data, and save the partitioned traffic flow data to a preset second database; the preset time threshold is a time threshold in hours.
[0074] In some embodiments, the date determination module 12 may specifically include:
[0075] a request type determination unit, configured to, if a traffic flow prediction request is received, determine whether the traffic flow prediction request is a real-time traffic flow prediction request or a long-term traffic flow prediction request; the long-term traffic flow prediction request is a request for traffic flow prediction in units of days;
[0076] a first model determination unit, configured to use a first vehicle flow prediction model constructed based on a ridge regression algorithm as a target vehicle flow prediction model if the vehicle flow prediction request is a real-time vehicle flow prediction request;
[0077] The second model prediction unit is used to use the second vehicle flow prediction model constructed based on the Bayesian Ridge regression algorithm as the target vehicle flow prediction model if the vehicle flow prediction request is a long-term vehicle flow prediction request.
[0078] In some embodiments, the date determination module 12 may specifically include:
[0079] a first date determination unit, configured to determine, if the traffic flow prediction request is the real-time traffic flow prediction request, a real-time prediction date corresponding to the real-time traffic flow prediction request, and determine whether the real-time prediction date is a holiday date;
[0080] The second date judgment unit is used to determine the prediction period corresponding to the long-term traffic flow prediction request if the traffic flow prediction request is the long-term traffic flow prediction request, and determine whether the prediction period includes a holiday date.
[0081] In some embodiments, the tag adding module 13 may specifically include:
[0082] A first label adding unit is used to determine a first holiday type corresponding to the holiday date if the real-time predicted date is a holiday date, and add a first holiday label corresponding to the first holiday type to the real-time predicted date to obtain first processed predicted date data;
[0083] The second label adding unit is used to determine the target date corresponding to the holiday date within the prediction period if the prediction period includes a holiday date, determine the second holiday type corresponding to the holiday date, and add a second holiday label corresponding to the second holiday type to the target date to obtain the second processed prediction date data.
[0084] In some embodiments, the vehicle flow prediction module 14 may specifically include:
[0085] A first vehicle flow prediction unit, configured to input the first processed predicted date data into the first vehicle flow prediction model, so that the first vehicle flow prediction model performs a vehicle flow prediction corresponding to the first processed predicted date data based on the currently collected target real-time vehicle flow data and the divided vehicle flow data, so as to obtain a first vehicle flow prediction result corresponding to the real-time vehicle flow prediction request;
[0086] The second traffic flow prediction unit is used to input the second processed predicted date data into the second traffic flow prediction model, so that the second traffic flow prediction model performs a traffic flow prediction corresponding to the second processed predicted date data based on the target real-time traffic flow data and the integrated traffic flow data, so as to obtain a second traffic flow prediction result corresponding to the long-term traffic flow prediction request; the integrated traffic flow data is the data obtained by integrating the divided traffic flow data in units of days.
[0087] In some embodiments, the vehicle flow prediction device may further include:
[0088] a third date determination unit, configured to, if an advance prediction request is received, determine an advance prediction date corresponding to the advance prediction request, and determine whether the advance prediction date is a holiday date, and if it is a holiday date, determine a third holiday type corresponding to the holiday date;
[0089] The third traffic flow prediction unit is used to extract the target traffic flow data corresponding to the third holiday type from the preset database, and input the advance prediction date into the target traffic flow prediction model, so that the target traffic flow prediction model performs traffic flow prediction based on the target traffic flow data to obtain a third traffic flow prediction result corresponding to the advance prediction request.
[0090] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0091] Figure 4 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the vehicle flow prediction method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0092] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0093] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0094] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the vehicle flow prediction method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0095] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed vehicle flow prediction method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0096] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0097] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0098] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0099] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0100] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A vehicle flow prediction method, characterized in that: Applied to the traffic flow prediction platform, including: Dividing the collected real-time traffic flow data based on a preset time threshold, so as to save the obtained divided traffic flow data into a preset database; Determining a target traffic flow prediction model based on the request type of the received traffic flow prediction request, determining prediction date data corresponding to the traffic flow prediction request, and judging whether the prediction date data corresponds to a holiday date; If the predicted date data corresponds to a holiday date, a holiday label is added to the predicted date data to obtain processed predicted date data; Inputting the processed predicted date data into the target vehicle flow prediction model, so that the target vehicle flow prediction model performs vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data; Wherein, determining the target vehicle flow prediction model based on the request type of the received vehicle flow prediction request includes: If a traffic flow prediction request is received, determining that the traffic flow prediction request is a real-time traffic flow prediction request or a long-term traffic flow prediction request; the long-term traffic flow prediction request is a request for traffic flow prediction in units of days; If the traffic flow prediction request is a real-time traffic flow prediction request, a first traffic flow prediction model constructed based on a ridge regression algorithm is used as a target traffic flow prediction model; If the traffic flow prediction request is a long-term traffic flow prediction request, a second traffic flow prediction model constructed based on the Bayesian Ridge regression algorithm is used as a target traffic flow prediction model; The step of determining the predicted date data corresponding to the traffic flow prediction request and judging whether the predicted date data corresponds to a holiday date includes: If the traffic flow prediction request is the real-time traffic flow prediction request, determining a real-time prediction date corresponding to the real-time traffic flow prediction request, and determining whether the real-time prediction date is a holiday date; If the traffic flow prediction request is the long-term traffic flow prediction request, determining a prediction period corresponding to the long-term traffic flow prediction request, and determining whether the prediction period includes a holiday date; If the predicted date data corresponds to a holiday date, a holiday label is added to the predicted date data to obtain processed predicted date data, including: If the real-time predicted date is a holiday date, determining a first holiday type corresponding to the holiday date, and adding a first holiday label corresponding to the first holiday type to the real-time predicted date to obtain first processed predicted date data; If the prediction period includes a holiday date, a target date corresponding to the holiday date within the prediction period is determined, and a second holiday type corresponding to the holiday date is determined, and a second holiday label corresponding to the second holiday type is added to the target date to obtain second processed prediction date data.
2. The vehicle flow prediction method according to claim 1, characterized in that: The step of dividing the collected real-time traffic flow data based on a preset time threshold to save the divided traffic flow data to a preset database includes: Collect real-time traffic flow and data through preset sensors, and transmit the real-time traffic flow data to a preset Kafka message queue; Preprocessing the real-time traffic flow data in the preset Kafka message queue through a preset processing framework to obtain preprocessed traffic flow data, and persisting the preprocessed traffic flow data through a preset first database; The pre-processed traffic flow data stored in the preset first database is divided based on a preset time threshold to obtain divided traffic flow data, and the divided traffic flow data is saved in a preset second database; the preset time threshold is a time threshold in hours.
3. The vehicle flow prediction method according to claim 1, characterized in that: The step of inputting the processed predicted date data into the target vehicle flow prediction model so that the target vehicle flow prediction model performs vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data includes: Inputting the first processed predicted date data into the first vehicle flow prediction model, so that the first vehicle flow prediction model performs vehicle flow prediction corresponding to the first processed predicted date data based on the currently collected target real-time vehicle flow data and the divided vehicle flow data, so as to obtain a first vehicle flow prediction result corresponding to the real-time vehicle flow prediction request; Or, the second processed predicted date data is input into the second traffic flow prediction model, so that the second traffic flow prediction model performs traffic flow prediction corresponding to the second processed predicted date data based on the target real-time traffic flow data and the integrated traffic flow data, so as to obtain a second traffic flow prediction result corresponding to the long-term traffic flow prediction request; the integrated traffic flow data is data obtained by integrating the divided traffic flow data in units of days.
4. The vehicle flow prediction method according to any one of claims 1 to 3, characterized in that: Also includes: If an advance prediction request is received, determining an advance prediction date corresponding to the advance prediction request, and judging whether the advance prediction date is a holiday date, and if it is a holiday date, determining a third holiday type corresponding to the holiday date; Target traffic flow data corresponding to the third holiday type is extracted from the preset database, and the advance prediction date is input into the target traffic flow prediction model, so that the target traffic flow prediction model performs traffic flow prediction based on the target traffic flow data to obtain a third traffic flow prediction result corresponding to the advance prediction request.
5. A vehicle flow prediction device, characterized in that: Applied to the traffic flow prediction platform, including: A data partitioning module, used to partition the collected real-time traffic flow data based on a preset time threshold, so as to save the partitioned traffic flow data to a preset database; A date determination module, used to determine a target traffic flow prediction model based on the request type of the received traffic flow prediction request, determine the prediction date data corresponding to the traffic flow prediction request, and determine whether the prediction date data corresponds to a holiday date; A label adding module, used for adding a holiday label to the predicted date data if the predicted date data corresponds to a holiday date, so as to obtain processed predicted date data; A vehicle flow prediction module, used for inputting the processed predicted date data into the target vehicle flow prediction model, so that the target vehicle flow prediction model performs a vehicle flow prediction corresponding to the processed predicted date data based on the divided vehicle flow data; Wherein, the date determination module includes: a request type determination unit, configured to, if a traffic flow prediction request is received, determine whether the traffic flow prediction request is a real-time traffic flow prediction request or a long-term traffic flow prediction request; the long-term traffic flow prediction request is a request for traffic flow prediction in units of days; a first model determination unit, configured to use a first vehicle flow prediction model constructed based on a ridge regression algorithm as a target vehicle flow prediction model if the vehicle flow prediction request is a real-time vehicle flow prediction request; a second model prediction unit, configured to use a second vehicle flow prediction model constructed based on a Bayesian Ridge regression algorithm as a target vehicle flow prediction model if the vehicle flow prediction request is a long-term vehicle flow prediction request; Wherein, the date determination module includes: a first date determination unit, configured to determine, if the traffic flow prediction request is the real-time traffic flow prediction request, a real-time prediction date corresponding to the real-time traffic flow prediction request, and determine whether the real-time prediction date is a holiday date; a second date determination unit, configured to determine, if the traffic flow prediction request is the long-term traffic flow prediction request, a prediction period corresponding to the long-term traffic flow prediction request, and determine whether the prediction period includes a holiday date; Wherein, the label adding module includes: A first label adding unit is used to determine a first holiday type corresponding to the holiday date if the real-time predicted date is a holiday date, and add a first holiday label corresponding to the first holiday type to the real-time predicted date to obtain first processed predicted date data; The second label adding unit is used to determine the target date corresponding to the holiday date within the prediction period if the prediction period includes a holiday date, determine the second holiday type corresponding to the holiday date, and add a second holiday label corresponding to the second holiday type to the target date to obtain the second processed prediction date data.
6. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the vehicle flow prediction method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the vehicle flow prediction method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Long-term and short-term traffic flow prediction model and method
CN111524348A
Traffic flow prediction method, device and equipment and readable storage medium
CN113689694A
Width parallel traffic prediction method based on big data, medium and equipment
CN117894173A