A traffic flow prediction method, system, device and medium based on spatio-temporal data
By constructing the graph structure data of the expressway and using the graph convolution algorithm for feature aggregation, the problem of low computational efficiency of existing vehicle flow prediction methods is solved, and more efficient vehicle flow prediction is achieved.
Patent Information
- Application Number
- CN202410643616.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2044-05-23
AI Technical Summary
The existing vehicle flow prediction method based on graph neural network is difficult to meet real-time requirements in terms of computing efficiency, and ignores time overhead, resulting in low vehicle flow prediction efficiency.
By obtaining the spatiotemporal data of the highway network, constructing graph structure data, and using graph convolution algorithm to perform feature aggregation processing on the adjacency matrix and feature matrix, outputting the traffic prediction results.
It improves the accuracy and real-time performance of traffic forecasts, reduces the computing power requirements of models or algorithms, and improves data processing efficiency.
Smart Images

Figure CN118571008B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent transportation technology, and in particular to a method, system, device and medium for predicting traffic flow based on spatiotemporal data. Background Art
[0002] As road networks become increasingly complex, the probability of highway congestion increases. Predicting traffic flow in advance has become an effective way to address this congestion problem. Current traffic flow prediction methods based on graph neural networks often focus solely on model accuracy, ignoring the computational overhead. This makes their computational efficiency insufficient to meet real-time requirements. In summary, the technical issues in this area need to be addressed. Summary of the Invention
[0003] The main purpose of the embodiments of the present application is to propose a traffic flow prediction method, system, device and medium based on spatiotemporal data, which can improve the efficiency of traffic flow prediction.
[0004] To achieve the above objectives, one aspect of an embodiment of the present application provides a method for predicting traffic flow based on spatiotemporal data, the method comprising:
[0005] Acquire the spatiotemporal data of the highway network, and construct graph structure data based on the spatiotemporal data of the highway network;
[0006] Performing data processing on the graph structure data to obtain an adjacency matrix and a feature matrix;
[0007] Performing feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result;
[0008] The aggregation result is subjected to prediction processing, and a traffic flow prediction result is outputted.
[0009] In some embodiments, processing the graph structure data to obtain an adjacency matrix and a feature matrix comprises the following steps:
[0010] Performing matrix construction and partitioning processing on the graph structure data according to the node connection relationship of the graph structure data to obtain an adjacency matrix;
[0011] The graph structure data is subjected to feature extraction processing, and the extracted feature vectors are divided to obtain a feature matrix.
[0012] In some embodiments, performing feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result includes the following steps:
[0013] Performing aggregation calculation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain a result matrix;
[0014] Performing a characteristic format transformation on the result matrix to obtain a triplet vector;
[0015] Perform feature update processing on the triplet vector to obtain an aggregation result.
[0016] In some embodiments, performing aggregation calculation processing on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain a result matrix includes the following steps:
[0017] Inputting the feature matrix into the convolutional layer of the graph convolutional network to obtain an output result;
[0018] Performing aggregation calculation processing on the adjacency matrix and the output result by using a graph convolution algorithm to obtain a result matrix and update it to an external memory;
[0019] The expression of the graph convolution algorithm is:
[0020]
[0021] Where, X l Represents the result matrix of the lth layer, ReLU represents the activation function, represents the adjacency matrix, X l-1 Represents the output result of the l-1 layer, W l represents the weight of the lth convolutional layer.
[0022] In some embodiments, performing a feature format transformation on the result matrix to obtain a triple vector comprises the following steps:
[0023] Using a triplet data structure to store the position and result of the result matrix to obtain a transformation vector;
[0024] The transformation vector is indexed according to a first-in-first-out algorithm to obtain a triplet vector.
[0025] In some embodiments, performing feature update processing on the triple vector to obtain an aggregated result includes the following steps:
[0026] Partitioning the triple vector according to the adjacency matrix to obtain first partition data and second partition data;
[0027] Linking the first partition data to a corresponding position of an empty matrix in a memory, and performing format conversion processing on the first partition data to obtain a first result;
[0028] Performing weighted aggregation calculation processing on the second partition data according to the systolic array to obtain a second result;
[0029] The first result and the second result are determined as an aggregated result.
[0030] In some embodiments, obtaining the spatiotemporal data of a highway network and constructing graph structure data based on the spatiotemporal data of the highway network includes the following steps:
[0031] Performing graph construction processing on the road network structure of the expressway to obtain an expressway graph structure;
[0032] Performing data sampling processing on each node in the highway graph structure using a time sliding window algorithm to obtain the spatiotemporal data of the highway network;
[0033] The highway graph structure is processed according to the road network spatiotemporal data to obtain graph structure data.
[0034] To achieve the above objectives, another aspect of the present application provides a traffic flow prediction system based on spatiotemporal data, the system comprising:
[0035] The first module is used to obtain the spatiotemporal data of the highway network and construct graph structure data based on the spatiotemporal data of the highway network;
[0036] The second module is used to process the graph structure data to obtain an adjacency matrix and a feature matrix;
[0037] The third module is used to perform feature aggregation processing on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain an aggregation result;
[0038] The fourth module is used to perform prediction processing on the aggregation results and output the traffic flow prediction results.
[0039] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method when executing the computer program.
[0040] To achieve the above objectives, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0041] The embodiments of the present application include at least the following beneficial effects: The present application provides a method, system, device, and medium for traffic flow prediction based on spatiotemporal data. This solution obtains spatiotemporal data of highway road networks and constructs graph structure data based on the spatiotemporal data; processes the graph structure data to obtain an adjacency matrix and a feature matrix; aggregates the adjacency matrix and feature matrix using a graph convolution algorithm to obtain an aggregated result; and performs predictive processing on the aggregated result to output a traffic flow prediction result. By aggregating spatiotemporal data, this solution can reduce the computing power required by traffic flow prediction models or algorithms, thereby improving the accuracy and real-time performance of traffic flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a flow chart of a method for predicting traffic flow based on spatiotemporal data provided by an embodiment of the present application;
[0043] Figure 2 This is a flow chart of data aggregation provided by an embodiment of the present application;
[0044] Figure 3 This is a schematic diagram of the structure of a traffic flow prediction system based on spatiotemporal data provided by an embodiment of the present application;
[0045] Figure 4 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are merely examples of systems and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.
[0047] It will be understood that the terms "first", "second", etc. used in this application may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0048] The terms "at least one", "plurality", "each", "any", etc. used in this application include "at least one", "two" or more, "plurality" or "each", "any" or "any one", "each" or "any one" as used herein.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0050] As road networks become increasingly complex, the probability of highway congestion increases. Therefore, predicting traffic flow in advance has become an effective approach to addressing congestion. In particular, using graph neural networks for traffic flow prediction has become a hot research topic in the industry. However, due to the high real-time nature of highways and the complexity of road networks, achieving real-time and accurate predictions on these networks faces numerous challenges. The key to achieving accurate highway traffic flow prediction lies in robust feature extraction from highway graph networks. Compared to traditional highway traffic flow models, graph neural networks can better represent the direct spatial and temporal correlations of the road network, resulting in superior prediction results.
[0051] Related technologies include graph neural networks (GNNs), which analyze and predict traffic flow data. However, in practice, these technologies often focus solely on the accuracy of neural network models, ignoring the time overhead associated with model calculations. This makes their computational efficiency insufficient to meet real-time requirements, hindering the effectiveness of traffic flow prediction.
[0052] In light of this, embodiments of the present application provide a method, system, device, and medium for predicting traffic flow based on spatiotemporal data. This solution obtains spatiotemporal data from highway road networks and constructs graph structure data based on this data. The graph structure data is then processed to obtain an adjacency matrix and a feature matrix. The adjacency matrix and feature matrix are then subjected to feature aggregation using a graph convolution algorithm to obtain an aggregated result. The aggregated result is then subjected to predictive processing to output a traffic flow prediction result. By aggregating spatiotemporal data, this solution can reduce the computing power required by traffic flow prediction models or algorithms, thereby improving the accuracy and real-time performance of traffic flow prediction.
[0053] The embodiment of the present application provides a method for predicting traffic flow based on spatiotemporal data, which relates to the field of smart transportation technology. The embodiment of the present application provides a method for predicting traffic flow based on spatiotemporal data that can be applied to a terminal, a server, or software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or as a server cluster or distributed system composed of multiple physical servers, or as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements a method for predicting traffic flow based on spatiotemporal data, etc., but is not limited to the above forms.
[0054] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0055] Figure 1 This is an optional flowchart of a method for predicting traffic flow based on spatiotemporal data provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S104.
[0056] Step S101, obtaining the spatiotemporal data of the highway network, and constructing graph structure data based on the spatiotemporal data of the highway network;
[0057] Step S102: Process the graph structure data to obtain an adjacency matrix and a feature matrix;
[0058] Step S103, performing feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result;
[0059] Step S104: performing prediction processing on the aggregation result and outputting a traffic flow prediction result.
[0060] In the embodiment of the present application, steps S101 to S104 are performed by obtaining the spatiotemporal data of the highway network, which includes the spatial structure of the highway network and the time data of each node in the network structure. The graph structure data is then processed, and the adjacency matrix and the feature matrix are obtained by analyzing the topological structure of the graph structure data and extracting the features of the data. The adjacency matrix is a sparse matrix and a constant matrix obtained from the network structure, which is stored in an external memory. The feature matrix is used as the input of the model, and the pre-trained model weights are used as constants and stored together in a field programmable gate array (FPGA). The adjacency matrix and the feature matrix are then subjected to feature aggregation processing according to the graph convolution algorithm to obtain an aggregation result. By aggregating the data, the data processing efficiency is improved, and the accuracy and reliability of the traffic flow prediction are improved. Finally, the updated aggregation result is used for traffic flow prediction, and the traffic flow prediction result is output through the convolution layer. The predicted result is further stored in the form of node features, and the traffic flow prediction output of each node is output sequentially.
[0061] In step S101 of some embodiments, obtaining the spatiotemporal data of the highway network and constructing graph structure data based on the spatiotemporal data of the highway network may include the following steps:
[0062] Performing graph construction processing on the road network structure of the expressway to obtain an expressway graph structure;
[0063] Performing data sampling processing on each node in the highway graph structure using a time sliding window algorithm to obtain the spatiotemporal data of the highway network;
[0064] The highway graph structure is processed according to the road network spatiotemporal data to obtain graph structure data.
[0065] In an embodiment of the present application, a graph is constructed based on the road network structure of the highway. Specifically, toll stations are used as nodes of the graph structure based on the road network structure, and the roads between toll stations are used as edges to construct the highway graph structure. Then, data sampling processing is performed on each node in the highway graph structure using a time sliding window algorithm. For example, if the number of toll stations that need to be predicted is N, then the number of nodes is N. The data that needs to be sampled is the traffic flow, weather, and temperature of the toll stations, totaling 3 data. The sampling is performed at a time interval of 3 hours, and the time sliding window is 36 hours. Therefore, the data sampled from each node is 3×36 data, and the graph structure data is an N×108-dimensional graph feature vector. The embodiment of the present application obtains graph structure data by constructing the spatiotemporal data of the highway road network, providing a data foundation for subsequent traffic flow prediction.
[0066] In some embodiments, processing the graph structure data to obtain an adjacency matrix and a feature matrix comprises the following steps:
[0067] Performing matrix construction and partitioning processing on the graph structure data according to the node connection relationship of the graph structure data to obtain an adjacency matrix;
[0068] The graph structure data is subjected to feature extraction processing, and the extracted feature vectors are divided to obtain a feature matrix.
[0069] In an embodiment of the present application, a matrix is constructed by the connection relationship of each node in the graph structure data to obtain an adjacency matrix. The adjacency matrix is a sparse matrix, a constant matrix obtained by the road network structure, and stored in an external memory. In order to improve the efficiency of subsequent feature aggregation, the adjacency matrix needs to be divided and processed. The specific method is to divide the matrix according to the nodes and edges of the graph structure, and divide the adjacency matrix into 4 sub-blocks. The feature matrix is obtained as input by extracting features from the graph structure data, and the pre-trained weights are used as constants and stored together in the FPGA. In order to adapt to the partitioning method of the adjacency matrix, the extracted eigenvectors are divided and processed, and the eigenvectors of each node are divided into two sub-blocks. The embodiment of the present application can improve the processing efficiency of aggregating data in the subsequent processing process by dividing the adjacency matrix and the feature matrix.
[0070] In some embodiments, performing feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result includes the following steps:
[0071] Performing aggregation calculation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain a result matrix;
[0072] Performing a characteristic format transformation on the result matrix to obtain a triplet vector;
[0073] Perform feature update processing on the triplet vector to obtain an aggregation result.
[0074] In an embodiment of the present application, a new matrix multiplication data flow is designed by dividing the adjacency matrix and the feature matrix sub-blocks, and a graph convolution algorithm is used to perform aggregation calculation processing on the adjacency matrix and the feature matrix to obtain a result matrix. The result matrix is then subjected to feature format conversion processing to obtain a triple vector, and the result matrix obtained by the aggregation calculation is stored using the triple structure. Finally, the result matrix is updated with features according to the adjacency matrix to obtain the final aggregation result. An output module is designed to perform traffic flow prediction on the updated aggregation result, and the predicted result is continued to be stored in the form of node features. The result of the last layer of graph convolution is predicted to obtain a traffic flow graph, and the traffic flow prediction result of each node is output sequentially. The embodiment of the present application improves the processing efficiency of the graph convolution calculation by performing aggregation calculation on the adjacency matrix and the feature matrix, thereby improving the efficiency of traffic flow detection.
[0075] In some embodiments, performing aggregation calculation processing on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain a result matrix includes the following steps:
[0076] Inputting the feature matrix into the convolutional layer of the graph convolutional network to obtain an output result;
[0077] Performing aggregation calculation processing on the adjacency matrix and the output result by using a graph convolution algorithm to obtain a result matrix and update it to an external memory;
[0078] The expression of the graph convolution algorithm is:
[0079]
[0080] Where, X l Represents the result matrix of the lth layer, ReLU represents the activation function, represents the adjacency matrix, X l-1 Represents the output result of the l-1 layer, W l represents the weight of the lth convolutional layer.
[0081] In the embodiment of the present application, feature aggregation is an iterative process, wherein the iterative process is for the iteration of the output results in the memory. First, the feature matrix is input into the convolution layer of the graph convolution network to obtain the output results of each layer. The adjacency matrix and the output results of the previous layer are aggregated and calculated by the graph convolution algorithm to obtain the result matrix, which is the output result of the current convolution layer. The expression of the graph convolution algorithm is:
[0082]
[0083] Where, X l Represents the result matrix of the lth layer, ReLU represents the activation function, represents the adjacency matrix, X l-1 Represents the output result of the l-1 layer, W l represents the weight of the lth convolutional layer.
[0084] In the embodiment of the present application, the feature matrix and adjacency matrix obtained by division can be input into the graph convolution network respectively, and the sub-blocks obtained by division can be processed separately. Then, the graph convolution algorithm is used to aggregate the divided adjacency matrix and the output result of the previous layer to obtain a result matrix, which is updated to the external memory. The embodiment of the present application uses the graph convolution algorithm to perform aggregation calculations and iteratively aggregate the data to improve the processing efficiency of the data. It can address the high computing power requirements and poor real-time performance of the prediction algorithm, thereby improving the efficiency of traffic flow prediction.
[0085] In some embodiments, performing a feature format transformation on the result matrix to obtain a triple vector comprises the following steps:
[0086] Using a triplet data structure to store the position and result of the result matrix to obtain a transformation vector;
[0087] The transformation vector is indexed according to a first-in-first-out algorithm to obtain a triplet vector.
[0088] In an embodiment of the present application, the result matrix obtained by aggregation of each layer is allocated to memory, and the output result of the previous layer is allocated in the target buffer and loaded into the cache area. The result matrix is transformed into a feature format, specifically using a triple for storage, with the first element being the row position, the second element being the column position, and the third element being the result. Each element contains 8 bytes, and each result requires 24 bytes to complete. The transformed result is transformed from the original matrix pattern into a triple vector. The transformed result is then indexed according to the first-in-first-out feature, and according to the row and column positions of the triple, the triple can be accessed so that the features within a three-dimensional partition can be confined to a small range of memory space, that is, in a small number of consecutive DRAM pages. Under such an arrangement, the feature matrix can potentially reduce DRAM row loss and row conflicts, thereby improving the data processing efficiency of traffic flow prediction.
[0089] In some embodiments, performing feature update processing on the triple vector to obtain an aggregated result includes the following steps:
[0090] Partitioning the triple vector according to the adjacency matrix to obtain first partition data and second partition data;
[0091] Linking the first partition data to a corresponding position of an empty matrix in a memory, and performing format conversion processing on the first partition data to obtain a first result;
[0092] Performing weighted aggregation calculation processing on the second partition data according to the systolic array to obtain a second result;
[0093] The first result and the second result are determined as an aggregated result.
[0094] In an embodiment of the present application, in the output triple vector according to the degree of the node in the adjacency matrix, the triple vector is sorted according to the vertex degree and then divided into two parts on average, wherein the first partition data is the part with the smaller vertex degree of the node, which is updated using a sparse feature update module, and the remaining part, i.e., the second partition data, is updated using a dense update module. Specifically, the step of updating the first partition data is that in each iteration of calculating the aggregation result, an empty matrix is first obtained in the memory, and the generated feature vector, i.e., the first partition data, is linked to the corresponding position in this empty matrix and converted into a COO format, and then the first result is obtained by adding the src index and the dst index to the non-zero elements, where src and dst represent the source operand and the destination operand, respectively. Among them, in the storage of sparse matrices, the COO format is a format for storage based on the coordinate information of the matrix elements. In this format, each non-zero element is represented by its row and column number, which are called the coordinates of the element. The advantage of the COO format is that the elements can be accessed directly without any conversion. The second partition data is aggregated using a systolic array. During the calculation, the horizontal input in the systolic array is the weight, and the vertical input is the output result of the previous layer, and the second result is directly updated. Finally, the first result and the second result are determined as the aggregated result, and the final prediction result is obtained by performing traffic flow prediction on the aggregated result, and the traffic flow prediction for each node is obtained. The embodiment of the present application provides a hardware-aware partition-centric feature aggregation solution, which reduces memory traffic and overall memory access latency by considering on-chip data reuse and the structural characteristics of external memory, thereby improving the processing efficiency of traffic flow prediction.
[0095] The following is a detailed description of the embodiments of the present application with reference to specific application examples:
[0096] The embodiment of the present application is applied to the highway scenario. In order to solve the problem of lack of spatiotemporal data aggregation in the current highway traffic flow prediction technology based on time series, the embodiment of the present application establishes a highway graph structure to perform global feature extraction and global prediction on the entire highway network. The entire graph is extracted based on the graph structure of the road network and information such as intersection history and weather. The adjacency matrix and feature matrix are aggregated based on the graph convolution algorithm. Figure 2 The adjacency matrix is divided by the graph convolution model, and the input feature matrix is divided by the road network graph. The corresponding divided data is obtained from the memory for aggregation processing, and updated and iterated through the off-chip memory to achieve data aggregation processing, thereby performing real-time traffic flow prediction, which can be applied to tiny, low-power small computing systems.
[0097] See also Figure 3 The embodiment of the present application further provides a traffic flow prediction system based on spatiotemporal data, which can implement the above-mentioned traffic flow prediction method based on spatiotemporal data. The system includes:
[0098] The first module 301 is used to obtain the spatiotemporal data of the highway network and construct graph structure data based on the spatiotemporal data of the highway network;
[0099] The second module 302 is used to process the graph structure data to obtain an adjacency matrix and a feature matrix;
[0100] The third module 303 is configured to perform feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result;
[0101] The fourth module 304 is used to perform prediction processing on the aggregation result and output a traffic flow prediction result.
[0102] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0103] The present application also provides an electronic device comprising a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned method for predicting traffic flow based on spatiotemporal data. The electronic device can be any intelligent terminal, such as a tablet computer or an in-vehicle computer.
[0104] It can be understood that the contents of the above method embodiments are applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0105] See also Figure 4 , Figure 4 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0106] The processor 401 may be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0107] The memory 402 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 402 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program codes are stored in the memory 402 and are called by the processor 401 to execute a method for predicting traffic flow based on spatiotemporal data according to an embodiment of the present application.
[0108] Input / output interface 403, used to implement information input and output;
[0109] Communication interface 404, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0110] Bus 405 , which transmits information between various components of the device (e.g., processor 401 , memory 402 , input / output interface 403 , and communication interface 404 );
[0111] The processor 401 , the memory 402 , the input / output interface 403 and the communication interface 404 are connected to each other in communication within the device via a bus 405 .
[0112] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned traffic flow prediction method based on spatiotemporal data.
[0113] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiment, the functions specifically implemented by the present storage medium embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0114] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0115] Embodiments of the present application provide a method, system, device, and medium for predicting traffic flow based on spatiotemporal data. This solution obtains spatiotemporal data from highway networks and constructs graph-structured data based on this data. The graph-structured data is then processed to obtain an adjacency matrix and a feature matrix. Feature aggregation is then performed on the adjacency matrix and feature matrix using a graph convolution algorithm to obtain an aggregated result. The aggregated result is then subjected to predictive processing to output a traffic flow prediction result. By aggregating spatiotemporal data, this solution can reduce the computing power required by traffic flow prediction models or algorithms, thereby improving the accuracy and real-time performance of traffic flow predictions.
[0116] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0117] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0118] The system embodiment described above is merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0119] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0120] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0121] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the above units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0123] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0124] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0126] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A traffic flow prediction method based on spatiotemporal data, characterized in that: The method comprises the following steps: Acquire the spatiotemporal data of the highway network, and construct graph structure data based on the spatiotemporal data of the highway network; Performing data processing on the graph structure data to obtain an adjacency matrix and a feature matrix; Performing feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result; Performing prediction processing on the aggregation results and outputting a traffic flow prediction result; The step of performing feature aggregation processing on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain an aggregation result includes the following steps: Performing aggregation calculation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain a result matrix; Performing a characteristic format transformation on the result matrix to obtain a triple vector; the first element of the triple variable is the row position of the result matrix, the second element is the column position of the result matrix, and the third element is the result of the result matrix; Performing feature update processing on the triplet vector to obtain an aggregation result; The step of performing feature update processing on the triple vector to obtain an aggregation result includes the following steps: Partitioning the triple vector according to the adjacency matrix to obtain first partition data and second partition data; Linking the first partition data to a corresponding position of an empty matrix in a memory, converting the first partition data into a COO format, adding a source operand index and a destination operand index to non-zero elements, and obtaining a first result; Performing weighted aggregation calculation processing on the second partition data according to the systolic array to obtain a second result; The first result and the second result are determined as an aggregated result.
2. The method according to claim 1, characterized in that The processing of the graph structure data to obtain an adjacency matrix and a feature matrix comprises the following steps: Performing matrix construction and partitioning processing on the graph structure data according to the node connection relationship of the graph structure data to obtain an adjacency matrix; The graph structure data is subjected to feature extraction processing, and the extracted feature vectors are divided to obtain a feature matrix.
3. The method according to claim 1, characterized in that The step of performing aggregation calculation on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain a result matrix includes the following steps: Inputting the feature matrix into the convolutional layer of the graph convolutional network to obtain an output result; Performing aggregation calculation processing on the adjacency matrix and the output result by using a graph convolution algorithm to obtain a result matrix and update it to an external memory; The expression of the graph convolution algorithm is: Where, X l Represents the result matrix of the lth layer, ReLU represents the activation function, represents the adjacency matrix, X l-1 Represents the output result of the l-1 layer, W l represents the weight of the lth convolutional layer.
4. The method according to claim 1, wherein The step of performing a feature format transformation on the result matrix to obtain a triple vector comprises the following steps: Using a triplet data structure to store the position and result of the result matrix to obtain a transformation vector; The transformation vector is indexed according to a first-in-first-out algorithm to obtain a triplet vector.
5. The method according to any one of claims 1 to 4, characterized in that The step of obtaining the spatiotemporal data of the highway network and constructing graph structure data based on the spatiotemporal data of the highway network includes the following steps: Performing graph construction processing on the road network structure of the expressway to obtain an expressway graph structure; Performing data sampling processing on each node in the highway graph structure using a time sliding window algorithm to obtain the spatiotemporal data of the highway network; The highway graph structure is processed according to the road network spatiotemporal data to obtain graph structure data.
6. A traffic flow prediction system based on spatiotemporal data, characterized in that: The system comprises: The first module is used to obtain the spatiotemporal data of the highway network and construct graph structure data based on the spatiotemporal data of the highway network; The second module is used to process the graph structure data to obtain an adjacency matrix and a feature matrix; The third module is used to perform feature aggregation processing on the adjacency matrix and the feature matrix according to the graph convolution algorithm to obtain an aggregation result; The fourth module is used to perform prediction processing on the aggregation results and output a traffic flow prediction result; The third module is configured to perform feature aggregation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain an aggregation result, including: Performing aggregation calculation processing on the adjacency matrix and the feature matrix according to a graph convolution algorithm to obtain a result matrix; Performing a characteristic format transformation on the result matrix to obtain a triple vector; the first element of the triple variable is the row position of the result matrix, the second element is the column position of the result matrix, and the third element is the result of the result matrix; Performing feature update processing on the triplet vector to obtain an aggregation result; The step of performing feature update processing on the triple vector to obtain an aggregation result includes the following steps: Partitioning the triple vector according to the adjacency matrix to obtain first partition data and second partition data; Linking the first partition data to a corresponding position of an empty matrix in a memory, converting the first partition data into a COO format, adding a source operand index and a destination operand index to non-zero elements, and obtaining a first result; Performing weighted aggregation calculation processing on the second partition data according to the systolic array to obtain a second result; The first result and the second result are determined as an aggregated result.
7. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Image processing acceleration method, image processing model storage method and corresponding devices
CN111831254A
Traffic prediction method based on multi-scale graph convolutional network model
CN113053115A
Graph convolutional neural network acceleration method and apparatus, and electronic device
CN116451755A