A method, device, storage medium and terminal for predicting traffic flow based on Fourier functions
By predicting traffic flow using Fourier functions and combining specific weekday and weather-related parameters, the problem of low accuracy in traffic flow prediction in existing technologies has been solved, achieving more accurate short-term traffic flow prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-15
- Publication Date
- 2026-03-24
AI Technical Summary
Existing traffic flow prediction methods cannot accurately predict the development patterns of traffic flow within the network under complex and ever-changing urban road traffic conditions, resulting in low accuracy in traffic flow prediction.
The method of predicting traffic flow using Fourier functions involves obtaining traffic flow prediction requests and preset control parameters, combining structured historical data to calculate parameters related to specific workdays and weather conditions, generating target periodic items and random items, and finally generating the traffic flow corresponding to the target time parameters.
It improves the accuracy of short-term traffic flow forecasts by taking into account the impact of random factors such as weather and holidays, thus enhancing the accuracy of forecast results.
Smart Images

Figure CN113688350B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a method and device for predicting traffic flow based on Fourier function, a storage medium and a terminal. BACKGROUND
[0002] With the increase of the per capita ownership of urban cars, urban traffic congestion has become a common and serious traffic problem, especially for some big cities, the congestion of expressways and main roads will undoubtedly cause huge losses in time and economy. More and more researchers hope to solve this problem by analyzing the traffic flow state, and early prediction to avoid traffic congestion has become an important research direction.
[0003] In the existing traffic state analysis, the historical traffic data is analyzed to obtain the long-term trend component and the random component to predict the network traffic. Due to the complex and changeable urban road traffic, the long-term trend component analysis cannot accurately predict the development law of the network service traffic, thereby reducing the accuracy of traffic flow prediction. SUMMARY
[0004] The present application provides a method and device for predicting traffic flow based on Fourier function, a storage medium and a terminal. In order to have a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not a general review, nor does it determine the key / important elements or delineate the protection scope of these embodiments. Its only purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0005] In a first aspect, the present application provides a method for predicting traffic flow based on Fourier function, the method comprising:
[0006] obtaining a traffic flow prediction request, the traffic flow prediction request comprising a to-be-predicted road section parameter and a target time parameter to be predicted;
[0007] receiving a preset control parameter corresponding to an expansion series of a pre-constructed Fourier prediction function;
[0008] inputting the target time parameter and the preset control parameter into the pre-constructed Fourier prediction function to generate a target periodic term;
[0009] calculating a specific workday influence parameter and a weather influence parameter through structured historical data, and determining the sum of the specific workday influence parameter and the weather influence parameter as a target random term;
[0010] summing the target periodic term, the target random term and a preset residual term to generate a traffic flow corresponding to the target time parameter.
[0011] Optionally, the pre-constructed Fourier prediction function is generated according to the following steps, comprising:
[0012] S201 obtains first traffic flow data of a plurality of historical working days in a preset period for a to-be-predicted road section from the structured historical data, wherein the first traffic flow data of each working day comprises a plurality of second traffic flow data divided according to a preset time period, and each second traffic flow data corresponds to a preset time period;
[0013] S203 determines a number of traffic periodic terms in each preset time period according to the plurality of second traffic flow data;
[0014] S205 performs periodic fitting on the number of traffic periodic terms in each preset time period by using a Fourier function to obtain first and second characteristic values of the Fourier function of each preset time period;
[0015] S207 constructs a Fourier prediction model based on the first and second characteristic values of the Fourier function of each preset time period;
[0016] S209 determines the constructed Fourier prediction model as a pre-constructed periodic term prediction model.
[0017] Optionally, before determining the target parameter to be predicted, the method further comprises:
[0018] generating raw data by collecting traffic data of vehicles passing through the detector in each preset period in real time through the detector;
[0019] loading a data processing rule table;
[0020] structuring the raw data according to the data processing rule table to generate structured historical data.
[0021] Optionally, after obtaining the first traffic flow data of a plurality of historical working days in a preset period for a to-be-predicted road section from the structured historical data, the method further comprises:
[0022] dividing the plurality of first traffic flow data into a training set and a test set;
[0023] performing steps S203-S209 on the first traffic flow data in the training set to obtain a pre-constructed periodic term prediction model corresponding to the to-be-predicted time parameter;
[0024] verifying the pre-constructed periodic term prediction model by using the first traffic flow data in the test set, and taking a Fourier expansion series with the optimal fitting effect as the preset control parameter.
[0025] Optionally, the traffic flow data of the plurality of historical working days used in constructing the Fourier prediction function is traffic flow data of n historical working days adjacent to the to-be-predicted time period, where n≥20.
[0026] Optionally, the calculating the specific working day influence parameter from the structured historical data comprises:
[0027] obtaining traffic flow of the specific working day and traffic flow of all working days in a preset period from the structured historical data;
[0028] calculating an average value of the traffic flow of the specific working day to obtain a first average value;
[0029] calculating an average value of the traffic flow of all working days to obtain a second average value;
[0030] determining a first average value difference by subtracting the first average value from the second average value;
[0031] determining the first average value difference as the specific working day influence degree.
[0032] Optionally, the calculating the weather influence parameter from the structured historical data comprises:
[0033] obtaining traffic flow of the specific working day on all non-rainy days and traffic flow of the specific working day on all rainy days from the structured historical data;
[0034] calculating an average value of the traffic flow of the specific working day on the non-rainy days to obtain a third average value;
[0035] calculating an average value of the traffic flow of the specific working day on the rainy days to obtain a fourth average value;
[0036] determining a second average value difference by subtracting the fourth average value from the third average value;
[0037] determining the second average value difference as the weather influence degree.
[0038] In a second aspect, an apparatus for predicting traffic flow based on a Fourier function is provided, and the apparatus comprises:
[0039] a parameter determination module configured to obtain a traffic flow prediction request, the traffic flow prediction request comprising a to-be-predicted road section parameter and a target time parameter to be predicted;
[0040] a control parameter receiving module configured to receive a preset control parameter corresponding to an expansion series of a pre-constructed Fourier prediction function;
[0041] a feature value output module configured to
[0042] a target periodic term generation module configured to input the target time parameter and the preset control parameter into a pre-constructed Fourier prediction function to generate a target periodic term;
[0043] a target random term generation module configured to calculate a specific workday influence parameter and a weather influence parameter through structured historical data, and determine a sum of the specific workday influence parameter and the weather influence parameter as a target random term;
[0044] a traffic flow generation module configured to sum the target periodic term, the target random term, and a preset residual term to generate a traffic flow corresponding to the target time parameter.
[0045] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions. The instructions are suitable for being loaded by a processor and performing the method steps described above.
[0046] In a fourth aspect, an embodiment of the present application provides a terminal, which can include a processor and a memory. The memory stores a computer program, which is suitable for being loaded by the processor and performing the method steps described above.
[0047] The technical scheme provided by the embodiments of the present application can have the following beneficial effects:
[0048] In the embodiments of the present application, the device for predicting traffic flow based on a Fourier function first acquires a traffic flow prediction request, the traffic flow prediction request including a to-be-predicted road section parameter and a target time parameter to be predicted, then receives a preset control parameter corresponding to an expansion series of a pre-constructed Fourier prediction function, and inputs the target time parameter and the preset control parameter into the pre-constructed Fourier prediction function to generate a target periodic term. Then, the device calculates a specific workday influence parameter and a weather influence parameter through structured historical data, and determines a sum of the specific workday influence parameter and the weather influence parameter as a target random term. Finally, the device sums the target periodic term, the target random term, and a preset residual term to generate a traffic flow corresponding to the target time parameter. Since the device fits a characteristic value corresponding to the target time parameter to be predicted through a pre-constructed characteristic value prediction model, and further calculates a required periodic term using the characteristic value, and then corrects the result by considering the influence of random terms such as weather holidays and workdays, the accuracy of short-term prediction of traffic flow is improved.
[0049] It should be understood that the general description above and the detailed description below are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0050] The accompanying drawings, which are incorporated herein and constitute part of this specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application.
[0051] Figure 1 is a flow diagram of a method for predicting traffic flow based on Fourier functions according to an embodiment of the present application;
[0052] Figure 2 is a flow diagram of a structured raw data according to an embodiment of the present application;
[0053] Figure 3 is a flow diagram of a predicted traffic flow for future time periods according to an embodiment of the present application;
[0054] Figure 4 is a flow diagram of a feature value prediction model generation according to an embodiment of the present application;
[0055] Figure 5 is a structural diagram of a device for predicting traffic flow based on Fourier functions according to an embodiment of the present application;
[0056] Figure 6 is a structural diagram of a terminal according to an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following description and drawings are illustrative of the application and are not to be construed as limiting the application. Numerous specific implementation of the present application are described herein.
[0058] It should be noted that the described embodiments are merely a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0059] The following description refers to the accompanying drawings, which are incorporated in and constitute a part of this specification. Unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements. The implementations described in the following example embodiments are not meant to represent all implementations consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0060] In the description of the present application, it should be understood that the terms "first", "second" and the like are used only for descriptive purposes, and cannot be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. In addition, in the description of the present application, "a plurality of" means two or more, unless otherwise specified. The association relationship of the associated objects is described, which means that there can be three kinds of relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after it.
[0061] The present application provides a method, device, storage medium and terminal for predicting traffic flow based on Fourier function, to solve the problems in the above related technical problems. In the technical scheme provided by the present application, the characteristic value corresponding to the target time parameter to be predicted is fitted by the pre-constructed characteristic value prediction model, and the required periodic term is calculated using the characteristic value, and the result is modified by considering the influence of random items such as weather, holiday and working day difference, thereby improving the accuracy of short-term traffic flow prediction. The following will be described in detail by exemplary embodiments.
[0062] The following will be described in detail by exemplary embodiments. Figure 1 -Appendix Figure 4 The method for predicting traffic flow based on Fourier function provided by the embodiments of the present application is described in detail. The method can be realized by relying on a computer program and can run on a Fourier function-based traffic flow prediction device based on the von Neumann system. The computer program can be integrated in an application or run as an independent tool application. Among them, the Fourier function-based traffic flow prediction device in the embodiments of the present application can be a user terminal, including but not limited to: personal computer, tablet computer, handheld device, vehicle-mounted device, wearable device, computing device or other processing device connected to wireless modem, etc. In different networks, the user terminal can be called different names, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), terminal device in 5G network or future evolution network, etc.
[0063] Please refer to Figure 1 A flowchart of a method for predicting traffic flow based on Fourier function is provided for the embodiments of the present application. As Figure 1 shown, the method of the embodiments of the present application can include the following steps:
[0064] S101, Obtain a traffic flow prediction request, the traffic flow prediction request including the road segment parameters to be predicted and the target time parameters to be predicted;
[0065] The target time parameter to be predicted is the time data of traffic flow in a future time period that needs to be predicted.
[0066] Typically, when the target time parameter is determined, it can be determined based on the time period setting command input by the user, or it can be determined by automatically dividing future working days according to a pre-set time period.
[0067] In one possible implementation, when it is necessary to predict traffic flow, the user first determines the time period to be predicted, and then sets the time period by inputting a command. After the setting is completed, the user terminal determines the target time parameter to be predicted according to the user's settings.
[0068] In another possible implementation, when it is necessary to predict traffic flow, the user terminal parses a pre-set time period, divides each workday in the future prediction period according to the time period, obtains multiple prediction time periods for each workday, and determines the multiple prediction time periods for each workday as the target time parameter to be predicted.
[0069] S102, receive preset control parameters corresponding to the expansion series of the pre-constructed Fourier prediction function;
[0070] In one possible implementation, after the target time parameter to be predicted is determined, the user needs to set the control parameter corresponding to the expansion series of the Fourier function. When the user inputs the control parameter, the user terminal receives the control parameter.
[0071] S103, input the target time parameter and the preset control parameter into the pre-constructed Fourier prediction function to generate the target periodic term;
[0072] Among them, the pre-constructed eigenvalue prediction model is a mathematical model for predicting eigenvalues, which is fitted based on structured historical data. The eigenvalue prediction model is essentially a Fourier function.
[0073] Specifically, when generating the pre-constructed Fourier prediction function, firstly, the first traffic flow data of the road segment to be predicted for multiple historical workdays within a preset period is obtained from the structured historical data. The first traffic flow data of each workday includes multiple second traffic flow data divided according to preset time periods, and each second traffic flow data corresponds to a preset time period. Then, the traffic flow periodicity value within each preset time period is determined based on the multiple second traffic flow data. Next, the Fourier function is used to periodically fit the traffic flow periodicity value in each preset time period to obtain the first and second eigenvalues of the Fourier function for each preset time period. Then, a Fourier prediction model is constructed based on the first and second eigenvalues of the Fourier function for each preset time period. Finally, the constructed Fourier prediction model is determined as the pre-constructed periodicity prediction model.
[0074] Furthermore, after obtaining the first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, it is necessary to divide the multiple first traffic flow data into a training set and a test set, and then execute the first traffic flow data in the training set. Figure 4 In the process steps S203-S209, a pre-constructed periodic term prediction model corresponding to the time parameter to be predicted is obtained. Then, the pre-constructed periodic term prediction model is verified using the first traffic flow data in the test set. Finally, the Fourier expansion series corresponding to the best fitting effect is used as the preset control parameter.
[0075] Furthermore, when generating structured historical data, the system first collects traffic data of vehicles passing through the detectors in real time during preset time periods to generate raw data, then loads the data processing rule table, and finally structures the raw data according to the data processing rule table to generate structured historical data.
[0076] For example, the raw traffic data initially only records the vehicles detected by the detectors. Therefore, it's necessary to statistically analyze this raw data, categorizing it by time periods. For instance, by analyzing data in 30-minute intervals, we can obtain the traffic data for each checkpoint within each time period. Figure 2 As shown.
[0077] Furthermore, the traffic flow data of multiple historical working days used in constructing the Fourier prediction function are the traffic flow data of the past n historical working days adjacent to the time period to be predicted, where n≥20.
[0078] In one possible implementation, after determining the target time parameter and control parameter, a pre-built feature value prediction model is loaded, and then the target time parameter and control parameter are input into the pre-built feature value prediction model. After model processing, the first feature value and the second feature value are output.
[0079] S104, calculate the impact parameters and weather impact parameters for a specific workday using structured historical data, and determine the sum of the impact parameters for the specific workday and the weather impact parameters as the target random item;
[0080] Among them, the impact parameter for a specific working day is a parameter that characterizes the degree of impact on a specific working day, and the weather impact parameter is similar.
[0081] In this embodiment, the traffic flow of a specific workday and the traffic flow of all workdays within a preset period are first obtained from structured historical data. Then, the impact of the specific workday is calculated based on the traffic flow of the specific workday and the traffic flow of all workdays. Next, the traffic flow of all non-rainy specific workdays and the traffic flow of all rainy specific workdays are obtained from structured historical data. Finally, the impact of the weather is calculated based on the traffic flow of all non-rainy specific workdays and the traffic flow of all rainy specific workdays.
[0082] Furthermore, when calculating the impact of a specific workday based on the traffic flow of a specific workday and the traffic flow of all workdays, the average traffic flow of the specific workday is first calculated to obtain the first average. Then, the average traffic flow of all workdays is calculated to obtain the second average. The difference between the first average and the second average is then calculated to generate the first average difference. Finally, the first average difference is determined as the impact of the specific workday.
[0083] Furthermore, when calculating the degree of weather impact based on the traffic flow of all non-rainy days and all rainy days on a specific workday, the average traffic flow of non-rainy days on a specific workday is first calculated to obtain the third mean. Then, the average traffic flow of rainy days on a specific workday is calculated to obtain the fourth mean. The difference between the fourth mean and the third mean is then calculated to generate the second mean difference. Finally, the second mean difference is determined as the weather impact parameter characterizing the degree of weather impact.
[0084] Specifically, in addition to periodic characteristics, flow rate data also contains random factors that influence flow rate, such as differences between weekdays, rainy days, and holidays. Considering these factors when predicting flow rate can improve the accuracy of the final prediction. By querying historical weather and holiday records in the existing flow rate and speed data, corresponding variable parameters (weather: 0 sunny, 1 rainy; holidays: 1 major holiday, 0 no) are added to the flow rate and speed table.
[0085] The difference obtained by subtracting the periodic term from the original data contains the value of this random term. It is clear that the remaining data is not a completely chaotic dataset, but rather contains certain patterns. Therefore, extracting the random term may improve the accuracy of the prediction results.
[0086] The first step is to extract the impact of the random term "workday variation." To ensure that the extracted random term is not influenced by other factors, data from rainy days, holidays, etc., needs to be excluded from the training set. This ensures that the extracted variation values do not include the influence of these factors. Next, the average traffic flow on a specific workday (Friday) and the average traffic flow across all workdays are calculated. Subtracting the average traffic flow across all workdays from the average traffic flow on the specific workday yields the degree of influence on that specific workday, as shown in the following formula:
[0087]
[0088] In the formula R 工作日 It refers to the degree of impact on a specific workday, Q. 特定工作日 This refers to traffic on a specific weekday (traffic on Fridays), Q 所有工作日 This is the traffic for all weekdays.
[0089] For the random factor of weather, keeping the weekday constant (e.g., Friday), calculate the average traffic flow on non-rainy Fridays and the average traffic flow on rainy Fridays across all data. The impact of weather is equal to the average traffic flow on rainy Fridays (including weather) minus the average traffic flow on non-rainy Fridays (excluding weather), as shown in the formula below:
[0090]
[0091] In the formula R 天气 Q is about the degree of weather impact. 特定天气 It refers to the flow rate under specific weather conditions (flow rate on a rainy Friday), Q 非特定天气 This refers to non-weather-specific traffic flow (traffic flow on Fridays that are not rainy).
[0092] After obtaining R 工作日 With R 天气 Then, it can be substituted into the expression for the random term: Obtain the target random item.
[0093] S105, sum the target periodic term, the target random term, and the preset residual term to generate the traffic flow corresponding to the target time parameter.
[0094] In one possible implementation, after obtaining the target periodic term and the target random term, a preset residual term can be obtained from the cache. Finally, the target periodic term, the target random term, and the preset residual term are substituted into the formula: The traffic flow is obtained by summing the values in the middle to obtain the final target time parameter.
[0095] in, It is a periodic term. For random items, This is the preset residual term.
[0096] After predicting multiple future time periods according to steps S101-S106, the resulting traffic forecast curves for each time period are as follows: Figure 3 As shown.
[0097] In this embodiment, the device for predicting traffic flow based on Fourier functions first obtains a traffic flow prediction request, which includes parameters of the road segment to be predicted and a target time parameter to be predicted. It then receives preset control parameters corresponding to the expansion series of a pre-constructed Fourier prediction function. The target time parameter and the preset control parameters are then input into the pre-constructed Fourier prediction function to generate a target periodic term. Next, a specific workday impact parameter and a weather impact parameter are calculated using structured historical data, and the sum of these two parameters is determined as a target random term. Finally, the target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter. Because this application uses a pre-constructed eigenvalue prediction model to fit the eigenvalue corresponding to the target time parameter to be predicted, and uses this eigenvalue to further calculate the required periodic term, and then considers the influence of random terms such as weather, holidays, and workday differences to correct the results, the accuracy of short-term traffic flow prediction is improved.
[0098] Please see Figure 4 This document provides a flowchart illustrating the process of generating a pre-built Fourier prediction function, as described in an embodiment of this application. Figure 4 As shown, the method in this application embodiment may include the following steps:
[0099] S201, Obtain first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, wherein the first traffic flow data of each working day includes multiple second traffic flow data divided according to a preset time period, and each second traffic flow data corresponds to a preset time period;
[0100] S202, determine the value of the flow cycle item in each preset time period based on multiple second traffic flow data;
[0101] In one possible implementation, traffic flow data for the same road segment over n working days is selected, and the average value of the n working days within each time period is the specific value of the periodic item for that road segment within that time period.
[0102] The formula is expressed as: In the formula Let t be the flow rate of the road segment during time period t. This formula can be used to obtain the periodic value of the flow rate.
[0103] S203, Fourier function is used to periodically fit the value of the flow periodic item in each preset time period to obtain the first feature value and the second feature value of the Fourier function for each preset time period.
[0104] Typically, the Fourier function can effectively fit functions with a certain period, and can be used to predict the periodic portion to obtain the corresponding eigenvalues, i.e., a. n b n .
[0105] Simultaneously, the eigenvalue a n b n It can also be used as a feature of this road segment for subsequent traffic flow prediction. The specific function is shown in the following formula:
[0106]
[0107] In the formula a n b n These are the eigenvalues of the cosine and sine functions as the Fourier series expands; Let x be the first term of the function, x be the time interval, and l be the period of the function. Integrating the above equation over the region [-π, π] yields:
[0108]
[0109] The expression for a0 is obtained as follows:
[0110]
[0111] For the eigenvalues a of the function n b n The corresponding expression can be obtained by integrating over the interval and combining it with the parity of trigonometric functions. The specific formula is shown below:
[0112]
[0113]
[0114] By combining the specific formula of the Fourier function with the value of the flow period term for each preset time period, we can obtain the fitting formula for the function of a given period term:
[0115]
[0116] The third eigenvalue 'a' for each time period can be obtained using the fitting formula for the periodic term function. n With the fourth eigenvalue b n .
[0117] S204, Construct a Fourier prediction model based on the first and second eigenvalues of the Fourier function for each preset time period;
[0118] In one possible implementation, the third feature value 'a' for each time period is combined. n With the fourth eigenvalue b n Construct an eigenvalue prediction model.
[0119] S205, the constructed Fourier prediction model is determined as a pre-constructed periodic term prediction model.
[0120] In this embodiment, the device for predicting traffic flow based on Fourier functions first obtains a traffic flow prediction request, which includes parameters of the road segment to be predicted and a target time parameter to be predicted. It then receives preset control parameters corresponding to the expansion series of a pre-constructed Fourier prediction function. The target time parameter and the preset control parameters are then input into the pre-constructed Fourier prediction function to generate a target periodic term. Next, a specific workday impact parameter and a weather impact parameter are calculated using structured historical data, and the sum of these two parameters is determined as a target random term. Finally, the target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter. Because this application uses a pre-constructed eigenvalue prediction model to fit the eigenvalue corresponding to the target time parameter to be predicted, and uses this eigenvalue to further calculate the required periodic term, and then considers the influence of random terms such as weather, holidays, and workday differences to correct the results, the accuracy of short-term traffic flow prediction is improved.
[0121] The following are embodiments of the apparatus of the present invention, which can be used to execute embodiments of the method of the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, please refer to the embodiments of the method of the present invention.
[0122] Please see Figure 5 This diagram illustrates a schematic representation of an apparatus for predicting traffic flow based on a Fourier function, provided by an exemplary embodiment of the present invention. This apparatus for predicting traffic flow based on a Fourier function can be implemented as all or part of a terminal through software, hardware, or a combination of both. The apparatus 1 includes a parameter determination module 10, a control parameter receiving module 20, a feature value output module 30, a target periodic term generation module 40, a target random term generation module 50, and a traffic flow generation module 60.
[0123] The parameter determination module 10 is used to obtain a traffic flow prediction request, which includes parameters of the road segment to be predicted and parameters of the target time to be predicted.
[0124] The control parameter receiving module 20 is used to receive preset control parameters corresponding to the expansion series of the pre-constructed Fourier prediction function;
[0125] Feature value output module 30, used for
[0126] The target periodic term generation module 40 is used to input the target time parameter and the preset control parameter into a pre-constructed Fourier prediction function to generate the target periodic term;
[0127] The target random item generation module 50 is used to calculate the impact parameters of a specific workday and the weather impact parameters through structured historical data, and to determine the sum of the impact parameters of the specific workday and the weather impact parameters as the target random item;
[0128] The traffic flow generation module 60 is used to sum the target periodic term, the target random term, and the preset residual term to generate the traffic flow corresponding to the target time parameter.
[0129] It should be noted that the above embodiments of the device for predicting traffic flow based on Fourier functions are only illustrated by the division of the functional modules described above when executing the method for predicting traffic flow based on Fourier functions. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device for predicting traffic flow based on Fourier functions and the method embodiments for predicting traffic flow based on Fourier functions provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0130] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0131] In this embodiment, the device for predicting traffic flow based on Fourier functions first obtains a traffic flow prediction request, which includes parameters of the road segment to be predicted and a target time parameter to be predicted. It then receives preset control parameters corresponding to the expansion series of a pre-constructed Fourier prediction function. The target time parameter and the preset control parameters are then input into the pre-constructed Fourier prediction function to generate a target periodic term. Next, a specific workday impact parameter and a weather impact parameter are calculated using structured historical data, and the sum of these two parameters is determined as a target random term. Finally, the target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter. Because this application uses a pre-constructed eigenvalue prediction model to fit the eigenvalue corresponding to the target time parameter to be predicted, and uses this eigenvalue to further calculate the required periodic term, and then considers the influence of random terms such as weather, holidays, and workday differences to correct the results, the accuracy of short-term traffic flow prediction is improved.
[0132] The present invention also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement the method for predicting traffic flow based on Fourier functions provided in the above-described method embodiments.
[0133] The present invention also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the methods for predicting traffic flow based on Fourier functions in the various method embodiments described above.
[0134] Please see Figure 6 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. Figure 6 As shown, terminal 1000 may include: at least one processor 1001, at least one network interface 1004, user interface 1003, memory 1005, and at least one communication bus 1002.
[0135] The communication bus 1002 is used to realize the connection and communication between these components.
[0136] The user interface 1003 may include a display screen and a camera. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.
[0137] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0138] The processor 1001 may include one or more processing cores. The processor 1001 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. Optionally, the processor 1001 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 1001 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 1001.
[0139] The memory 1005 may include random access memory (RAM) or read-only memory. Optionally, the memory 1005 may include a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 6 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for predicting traffic flow based on Fourier functions.
[0140] exist Figure 6In the terminal 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 1001 can be used to call the application program stored in the memory 1005 that predicts traffic flow based on the Fourier function, and specifically perform the following operations:
[0141] Obtain a traffic flow prediction request, the traffic flow prediction request including parameters of the road segment to be predicted and parameters of the target time to be predicted;
[0142] Receive preset control parameters corresponding to the expansion series of the pre-constructed Fourier prediction function;
[0143] The target time parameter and the preset control parameter are input into a pre-constructed Fourier prediction function to generate a target periodic term;
[0144] The impact parameters and weather impact parameters for a specific workday are calculated using structured historical data, and the sum of the impact parameters for the specific workday and the weather impact parameters is determined as the target random item.
[0145] The target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter.
[0146] In one embodiment, the processor 1001 generates a pre-built Fourier prediction function by performing the following steps:
[0147] The first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period is obtained from the structured historical data. The first traffic flow data of each working day includes multiple second traffic flow data divided according to a preset time period, and each second traffic flow data corresponds to a preset time period.
[0148] The value of the traffic cycle item within each preset time period is determined based on multiple second traffic flow data;
[0149] The Fourier function is used to periodically fit the value of the flow periodic term in each preset time period to obtain the first feature value and the second feature value of the Fourier function for each preset time period.
[0150] A Fourier prediction model is constructed based on the first and second eigenvalues of the Fourier function for each preset time period;
[0151] The constructed Fourier prediction model is determined to be a pre-constructed periodic term prediction model.
[0152] In one embodiment, when the processor 1001 determines the value of the traffic flow cycle item within each preset time period based on multiple second traffic flow data, it specifically performs the following operations:
[0153] S201 obtains the first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, wherein the first traffic flow data of each working day includes multiple second traffic flow data divided according to a preset time period, and each second traffic flow data corresponds to a preset time period.
[0154] S202 determines the value of the flow cycle item in each preset time period based on multiple second traffic flow data;
[0155] S203 uses a Fourier function to periodically fit the value of the flow periodic term in each preset time period to obtain the first characteristic value and the second characteristic value of the Fourier function for each preset time period.
[0156] S204 constructs a Fourier prediction model based on the first and second eigenvalues of the Fourier function for each preset time period;
[0157] S205 determines the constructed Fourier prediction model as a pre-constructed periodic term prediction model.
[0158] In one embodiment, before determining the target parameters to be predicted, the processor 1001 performs the following specific operations:
[0159] The system collects traffic flow data of vehicles passing through the detectors in real time during preset time periods, and generates raw data.
[0160] Load the data processing rule table;
[0161] The raw data is structured according to the data processing rule table to generate structured historical data.
[0162] In one embodiment, after the processor 1001 obtains the first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, it specifically performs the following operations:
[0163] The multiple first traffic flow data are divided into a training set and a test set;
[0164] Steps S202-S205 are performed on the first traffic flow data in the training set to obtain a pre-constructed periodic prediction model corresponding to the time parameter to be predicted.
[0165] The pre-constructed periodic prediction model is validated using the first traffic flow data in the test set, and the Fourier expansion series corresponding to the best fitting effect is used as the preset control parameter.
[0166] In one embodiment, when the processor 1001 calculates the impact parameters of a specific workday using structured historical data, it specifically performs the following operations:
[0167] Calculate the average traffic flow for a specific workday to obtain the first mean;
[0168] Calculate the average traffic flow for all workdays to obtain the second mean;
[0169] The difference between the first mean and the second mean is used to generate the first mean difference;
[0170] The first mean difference is determined as the degree of impact on a specific workday.
[0171] In one embodiment, when the processor 1001 calculates weather impact parameters using structured historical data, it specifically performs the following operations:
[0172] Calculate the average traffic flow on a specific weekday (non-rainy) to obtain the third mean;
[0173] The average traffic flow on a specific workday with rain was calculated to obtain the fourth mean.
[0174] The difference between the fourth mean and the third mean is used to generate the second mean difference;
[0175] The second mean difference is determined as the degree of weather impact.
[0176] In this embodiment, the device for predicting traffic flow based on Fourier functions first obtains a traffic flow prediction request, which includes parameters of the road segment to be predicted and a target time parameter to be predicted. It then receives preset control parameters corresponding to the expansion series of a pre-constructed Fourier prediction function. The target time parameter and the preset control parameters are then input into the pre-constructed Fourier prediction function to generate a target periodic term. Next, a specific workday impact parameter and a weather impact parameter are calculated using structured historical data, and the sum of these two parameters is determined as a target random term. Finally, the target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter. Because this application uses a pre-constructed eigenvalue prediction model to fit the eigenvalue corresponding to the target time parameter to be predicted, and uses this eigenvalue to further calculate the required periodic term, and then considers the influence of random terms such as weather, holidays, and workday differences to correct the results, the accuracy of short-term traffic flow prediction is improved.
[0177] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0178] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A method for predicting traffic flow based on Fourier functions, characterized in that, The method includes: Obtain a traffic flow prediction request, which includes parameters of the road segment to be predicted and a target time parameter to be predicted; the target time parameter to be predicted is the time data of the traffic flow in a future time period that needs to be predicted. Receive preset control parameters corresponding to the expansion series of the pre-constructed Fourier prediction function; The target time parameter and the preset control parameter are input into a pre-constructed Fourier prediction function to generate a target period term; the pre-constructed Fourier prediction function is fitted based on structured historical data, which includes the first traffic flow data of the road segment to be predicted for multiple historical working days within the preset period; The impact parameters and weather impact parameters for a specific workday are calculated using structured historical data, and the sum of the impact parameters for the specific workday and the weather impact parameters is determined as the target random item. The target periodic term, the target random term, and the preset residual term are summed to generate the traffic flow corresponding to the target time parameter; a pre-constructed Fourier prediction function is generated according to the following steps: S201 Obtain first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, wherein the first traffic flow data of each working day includes multiple second traffic flow data divided according to a preset time period, and each second traffic flow data corresponds to a preset time period; S202 determines the value of the flow cycle item within each preset time period based on multiple second traffic flow data; S203 The Fourier function is used to periodically fit the value of the flow periodic item in each preset time period to obtain the first feature value and the second feature value of the Fourier function for each preset time period. S204 Construct a Fourier prediction model based on the first and second eigenvalues of the Fourier function for each preset time period; S205 The constructed Fourier prediction model is determined as a pre-constructed Fourier prediction function.
2. The method according to claim 1, characterized in that, Before determining the target parameters to be predicted, the following steps are also included: The system collects vehicle traffic data in real time at preset time periods using detectors, generating raw data. Load the data processing rule table; The raw data is structured according to the data processing rule table to generate structured historical data.
3. The method according to claim 1, characterized in that, After obtaining the first traffic flow data of the road segment to be predicted for multiple historical working days within a preset period from the structured historical data, the method further includes: The multiple first traffic flow data are divided into a training set and a test set; Steps S202-S205 are performed on the first traffic flow data in the training set to obtain a pre-constructed Fourier prediction function corresponding to the time parameter to be predicted; The pre-constructed Fourier prediction function is validated using the first traffic flow data in the test set, and the Fourier expansion series corresponding to the best fitting effect is used as the preset control parameter.
4. The method according to claim 1, characterized in that, The traffic flow data used in constructing the Fourier prediction function are the traffic flow data of the past n historical working days adjacent to the time period to be predicted, where n≥20.
5. The method according to claim 1, characterized in that, The calculation of impact parameters for specific workdays using structured historical data includes: Obtain traffic flow data for a specific workday within a preset period and traffic flow data for all workdays from structured historical data; Calculate the average traffic flow for the specific workday to obtain a first average; Calculate the average traffic flow for all workdays to obtain the second average. The difference between the first mean and the second mean is used to generate the first mean difference; The first mean difference is determined as the degree of impact on a specific workday.
6. The method according to claim 1, characterized in that, The calculation of weather impact parameters using structured historical data includes: Obtain traffic flow data for all non-rainy weekdays and all rainy weekdays from structured historical data; The average traffic flow on a specific workday without rain is calculated to obtain the third mean. Calculate the average traffic flow on a specific workday during the rainy period to obtain the fourth average. The difference between the fourth mean and the third mean is used to generate the second mean difference; The second mean difference is determined as the degree of weather impact.
7. An apparatus for predicting traffic flow based on a Fourier function, implemented using the method described in any one of claims 1-6, characterized in that, The device includes: The traffic flow prediction request acquisition module is used to acquire traffic flow requests, which include target time parameters; The control parameter receiving module is used to receive preset control parameters corresponding to the expansion series of the pre-built Fourier prediction function; The target periodic term generation module is used to input the target time parameter and the control parameter into a pre-constructed Fourier prediction function to generate the target periodic term; The target random item generation module is used to calculate the impact parameters of a specific workday and the weather impact parameters through structured historical data, and to determine the sum of the impact parameters of the specific workday and the weather impact parameters as the target random item; The traffic flow generation module is used to sum the target periodic term, the target random term, and the preset residual term to generate traffic flow with target time parameters.
8. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the method as described in any one of claims 1-7.
9. A terminal, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-7.
Citation Information
Patent Citations
Road traffic state prediction method and device, storage medium and electronic equipment
CN112906984A