Traffic flow monitoring method, system and device based on visualization and storage medium

By constructing a dynamic adjacency matrix and using a multi-branch network architecture to combine meteorological and flow characteristics for prediction, the problem of inability to effectively consider the impact of weather factors on traffic conditions in the prior art is solved, and more accurate traffic flow prediction and more effective traffic management decisions are achieved.

CN120071629APending Publication Date: 2025-05-30浪潮智慧科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510540438.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The visual large-screen display function of the existing traffic management center cannot effectively consider the impact of weather factors on traffic conditions, making it difficult for traffic managers to understand the changes in traffic situations in advance, and thus fail to formulate effective traffic guidance strategies in a timely manner.

Method used

By monitoring the traffic data of each monitoring point in real time and obtaining the meteorological data of each monitoring point area, a dynamic adjacency matrix is ​​built, and a multi-branch network architecture combines meteorological and traffic characteristics for prediction is generated to generate a display interface to display geospatial, traffic flow and meteorological information.

Benefits of technology

The accuracy of traffic flow prediction is improved, allowing traffic managers to understand the future traffic flow trends of each intersection under different weather conditions in advance, and thus formulate traffic diversion strategies more effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120071629A_ABST
    Figure CN120071629A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and particularly provides a visualization-based traffic flow monitoring method, system and device and a storage medium, and the method comprises the steps: monitoring the flow data of each monitoring point in real time, and obtaining a flow time sequence; acquiring meteorological data of an area where each monitoring point is located; constructing a dynamic adjacency matrix according to the traffic time sequence by taking a monitoring point as a node; predicting the flow value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data; and generating a display interface by taking the geographic spatial data as a basic layer and taking the predicted flow value and the corresponding meteorological data as additional coatings. According to the method, the flow difference caused by weather change can be more accurately captured, and the accuracy of flow prediction is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, and particularly relates to a traffic flow monitoring method, system, device and storage medium based on visualization. Background Art

[0002] Most of the visualization display functions of the current traffic management center are limited to presenting the real-time traffic flow data at each intersection. This traditional traffic supervision mode has obvious limitations. On the one hand, it completely ignores the significant impact of weather factors on traffic conditions, and meteorological conditions often play a key role in road traffic capacity, driving behavior, etc.; on the other hand, relying solely on real-time traffic flow to observe the traffic state is essentially a kind of after-the-fact reflection, and only relatively lagged traffic information can be obtained, which makes it difficult for traffic managers to anticipate the changing trend of traffic conditions in advance, and thus unable to formulate effective traffic diversion strategies in a timely manner to cope with possible congestion and other problems. Summary of the Invention

[0003] In view of the above deficiencies of the prior art, the present invention provides a traffic flow monitoring method, system, device and storage medium based on visualization to solve the above technical problems.

[0004] In a first aspect, the present invention provides a traffic flow monitoring method based on visualization, including: Real-time monitoring of the traffic flow data at each monitoring point to obtain a traffic flow time series; Obtaining the meteorological data of the area where each monitoring point is located; Taking the monitoring points as nodes, and constructing a dynamic adjacency matrix according to the traffic flow time series; Predicting the traffic flow value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data; Taking the geospatial data as the base layer and the predicted traffic flow value and the corresponding meteorological data as additional coatings to generate a display interface.

[0005] In an optional embodiment, real-time monitoring of the traffic flow data at each monitoring point to obtain a traffic flow time series includes: Receiving the traffic flow data collected by the sensor through a message queue, and arranging the traffic flow data in the order of collection time as a traffic flow time series.

[0006] In an optional embodiment, obtaining the meteorological data of the area where each monitoring point is located includes: Pre-establishing the correspondence between the monitoring points and the areas; Obtaining the meteorological data of each area from a meteorological prediction platform; Determining the meteorological data of each monitoring point according to the correspondence and the meteorological data of each area.

[0007] In an alternative embodiment, taking the monitoring points as nodes, a dynamic adjacency matrix is constructed based on the traffic time series, including: Filling in the missing values and normalizing the traffic time series of each monitoring point to obtain a sample series; Calculating the dynamic Pearson correlation coefficient, dynamic time warping distance, and transfer entropy between the monitoring points according to the sample series of each monitoring point; Generating the edge weights between the corresponding nodes according to the dynamic Pearson correlation coefficient, dynamic time warping distance, and transfer entropy between the monitoring points; Constructing a dynamic adjacency matrix according to the edge weights between the nodes.

[0008] In an alternative embodiment, predicting the traffic value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data, including: Using a multi-branch network architecture to process the meteorological data and the dynamic adjacency matrix in parallel, the multi-branch network architecture including a meteorological branch and a traffic branch; The meteorological branch is used to extract meteorological features from the meteorological data, including a 3D convolutional layer and spatio-temporal attention; the traffic branch is used to extract traffic features from the dynamic adjacency matrix, including a graph convolutional layer and a temporal convolutional layer; Using the bilinear interpolation method to improve the coordinate mapping accuracy of the meteorological features and the traffic features; Using the cross-attention mechanism to fuse the meteorological features and the traffic features; Using an LSTM network to predict the traffic value of each monitoring point based on the fused meteorological features and traffic features.

[0009] In an alternative embodiment, using the cross-attention mechanism to fuse the meteorological features and the traffic features, including: Inputting the traffic feature H flow and the meteorological feature H weather ; Generating queries (Q), keys (K), and values (V): , ,

[0010] wherein, , , is a learning parameter matrix, and ; is the core representation dimension of the model, determining the capacity of the model, is the dimension of the key and query in the attention mechanism, affecting the computational efficiency and stability, is the set of real numbers; Calculating the attention:

[0011] Introduce extreme weather prior into the attention weights:

[0012] where is the level of extreme weather at time t, is the weight factor, is the initial attention weight value from node i to node j; Calculate the fused feature:

[0013] where represents the number of monitoring points; Add the fusion result to the original traffic feature to retain the original information: H fused =H flow +Dropout(FusedFeature) H fused contains traffic features and dynamically selected meteorological information.

[0014] In an optional embodiment, a display interface is generated with geospatial data as the base layer and predicted traffic values and corresponding meteorological data as additional layers, including: Encode the geospatial data into a vertex buffer object (VBO) and generate a multi-level vector tile index through a compute shader; Parse the received traffic data and meteorological data through WebSocket and update the GPU structured buffer based on the parsed traffic data and meteorological data through the WebGL API; Convert the meteorological data into a 3D voxel texture and calculate the cloud shadow corresponding to the 3D voxel texture through ray marching; Render the traffic value of ground traffic and the meteorological voxel respectively, and mix the colors in the color buffer according to the depth test result; Perform color grading and bloom processing on the mixed color buffer; In the fragment shader, generate screen pixels by combining the data of the vector tile texture and the GPU structured buffer.

[0015] In a second aspect, the present invention provides a traffic flow monitoring system based on visualization, including: A first acquisition module for real-time monitoring of traffic data at each monitoring point to obtain a traffic time series; A second acquisition module for obtaining meteorological data in the area where each monitoring point is located; A first processing module for constructing a dynamic adjacency matrix with the monitoring points as nodes according to the traffic time series; A second processing module, configured to predict the traffic volume value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data; A visualization module, configured to generate a display interface with geospatial data as the base layer and the predicted traffic volume value and the corresponding meteorological data as additional layers.

[0016] In a third aspect, there is provided a device, including: A memory, configured to store a visualization-based traffic flow monitoring program; A processor, configured to implement the steps of the visualization-based traffic flow monitoring method provided in the first aspect when executing the visualization-based traffic flow monitoring program.

[0017] In a fourth aspect, there is provided a computer-readable storage medium, on which a visualization-based traffic flow monitoring program is stored. When the visualization-based traffic flow monitoring program is executed by a processor, the steps of the visualization-based traffic flow monitoring method provided in the first aspect are implemented.

[0018] The beneficial effects of the present invention are as follows. The visualization-based traffic flow monitoring method, system, device, and storage medium provided by the present invention can more accurately capture the traffic volume differences caused by weather changes by combining meteorological data and traffic volume time series to construct a dynamic adjacency matrix for prediction, greatly improving the accuracy of traffic volume prediction; by capturing this dynamic association through the dynamic adjacency matrix, the traffic volume prediction can take into account the integrity and dynamics of the traffic network, further improving the prediction accuracy; by predicting the traffic volume value of each monitoring point, traffic managers can understand in advance the future traffic flow trends of each intersection under different weather conditions; with geospatial data as the base layer and the predicted traffic volume value and the corresponding meteorological data as additional layers to generate a display interface, geographical spatial information, traffic flow information, and meteorological information can be displayed simultaneously on one interface. Traffic managers can intuitively understand the geographical locations, traffic flow conditions, and weather conditions of each intersection through this interface, without having to switch between multiple systems or interfaces, improving the efficiency of information acquisition.

[0019] In addition, the design principle of the present invention is reliable, the structure is simple, and it has a very broad application prospect. Description of the Drawings

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0021] Figure 1It is a schematic flowchart of the method according to an embodiment of the present invention.

[0022] Figure 2 It is a schematic block diagram of the system according to an embodiment of the present invention.

[0023] Figure 3 It is a schematic structural diagram of a device provided by an embodiment of the present invention. Detailed implementation manners

[0024] In order to enable those skilled in the art of the present technology to better understand the technical solutions in the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments, and are not intended to limit the present invention.

[0026] The visualization-based traffic flow monitoring method provided by the embodiments of the present invention is executed by a computer device. Correspondingly, the visualization-based traffic flow monitoring system runs in the computer device.

[0027] Figure 1 It is a schematic flowchart of the method according to an embodiment of the present invention. Among them, Figure 1 The execution subject can be a visualization-based traffic flow monitoring system. According to different requirements, the order of the steps in this flowchart can be changed, and some can be omitted.

[0028] As Figure 1 shown, the method includes: S1. Real-time monitor the traffic flow data of each monitoring point to obtain a traffic flow time series; S2. Obtain the meteorological data of the area where each monitoring point is located; S3. Taking the monitoring points as nodes, construct a dynamic adjacency matrix according to the traffic flow time series; S4. Predict the traffic flow value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data; S5. Using the geospatial data as the base layer and the predicted traffic flow value and the corresponding meteorological data as additional layers, generate a display interface.

[0029] In an embodiment of the present invention, based on step S1, a possible embodiment will be given below to non - restrictively elaborate on its specific implementation scheme.

[0030] First, select a suitable message queue middleware in the system architecture, such as RabbitMQ, Kafka, etc. Taking Kafka as an example, build and configure a Kafka cluster on the server side, and set appropriate partition numbers and replica numbers to ensure the high availability of the message queue and the reliability of data.

[0031] On the sensor device side, encapsulate the collected traffic data, and add necessary metadata information to each piece of traffic data, such as device identification, collection timestamp, etc. Send the encapsulated traffic data to the specified topic (Topic) according to the protocol format required by the message queue (such as the format required by Kafka's Producer API).

[0032] On the data receiving side, establish a connection with the message queue by writing corresponding code. For example, use Kafka's Consumer API to create a consumer instance, specify the topic to be consumed, and set parameters such as the consumer group. When the consumer pulls the traffic data message sent by the sensor from the message queue, parse the message to extract the traffic data content and the collection timestamp information.

[0033] In order to arrange the traffic data in chronological order of collection into a traffic time series, create a data structure in memory, such as an ordered list (such as collections.deque in Python or PriorityQueue in Java). For each piece of received and parsed traffic data, insert it into the appropriate position according to its collection timestamp. Taking Python as an example, when using collections.deque, when new data arrives, by comparing the timestamps, the data can be added to the appropriate position in the queue to ensure that the data in the queue is always arranged in chronological order of collection.

[0034] In the case of a large amount of data, in order to improve processing efficiency and avoid memory overflow, a paging or batch - processing method can be adopted. That is, pull a certain number of messages from the message queue for processing and arrangement each time. After processing a batch of data, pull the next batch of data until all data is processed and arranged into a complete traffic time series.

[0035] In an embodiment of the present invention, based on step S2, a possible embodiment will be given below to non - restrictively elaborate on its specific implementation scheme.

[0036] S201. Establish the corresponding relationship between the monitoring points and the regions in advance.

[0037] At the database level, a relational database (such as MySQL, PostgreSQL) or a non-relational database (such as MongoDB) is selected to build a data storage system. An associated table containing monitoring point information and area information is created. The monitoring point table needs to record information such as the unique identifier (such as monitor_id), longitude and latitude coordinates, and device model; the area table records information such as the area number (such as area_id), area name, and geographical boundary (represented by a set of polygon vertex coordinates). When establishing the corresponding relationship, the spatial analysis function of the spatial database can be used. Taking PostGIS (a spatial extension plugin for PostgreSQL) as an example, the ST_Contains function is used to determine whether the monitoring point coordinates are within the area polygon, so as to determine its affiliated area, and a foreign key association relationship is established between the monitoring point ID and the area ID. It is also possible to write an algorithm at the application layer. By traversing the polygon vertices of the area and using the ray method or the turning angle method to determine whether the monitoring point is within the area, the corresponding relationship is stored in the database in JSON format for subsequent querying.

[0038] At the same time, to ensure data accuracy and integrity, a data verification mechanism is established to perform format verification, duplicate item checking on the newly entered or modified monitoring point and area data, and regular data consistency verification.

[0039] S202. Obtain the meteorological data of each area from the meteorological prediction platform.

[0040] First, clarify the data interfaces provided by the meteorological prediction platform. Common ones include RESTful API, SOAP API, etc. Before interacting with the platform, identity authentication needs to be completed to obtain an access token or API key to ensure the security of data access. When requesting data, according to the area division, construct a request URL containing parameters such as area number and time range.

[0041] Since meteorological data may include various types (such as temperature, humidity, wind speed, precipitation, etc.) and the data volume is large, the method of paging acquisition can be adopted, and at the same time, the acquired data is cached (such as using Redis caching technology) to avoid frequent requests for the same data and improve the data acquisition efficiency.

[0042] S203. Determine the meteorological data of each monitoring point according to the corresponding relationship and the meteorological data of each area.

[0043] Read the corresponding relationship table of monitoring points and areas from the database, and combine the acquired meteorological data of each area to write data processing logic at the application layer. The monitoring point list can be traversed through a loop, and according to the area ID corresponding to each monitoring point, the corresponding data is filtered out from the area meteorological data. If the meteorological data is gridded data (such as there are multiple meteorological grid point data in each area), spatial interpolation algorithms (such as inverse distance weighting interpolation method, Kriging interpolation method) can be used to calculate the meteorological data of the monitoring point according to the position of the monitoring point coordinates in the area. Taking the inverse distance weighting interpolation method as an example, by calculating the distance between the monitoring point and each grid point in the area and weighted averaging according to the reciprocal of the distance, the meteorological data of the monitoring point is obtained. After the processing is completed, the determined meteorological data of each monitoring point is stored back in the database, and the meteorological data field in the monitoring point table is updated. At the same time, visual charts (such as using ECharts, Matplotlib) can be generated to intuitively display the change trend of the meteorological data of each monitoring point, which is convenient for subsequent analysis and decision-making.

[0044] In an embodiment of the present invention, based on step S3, a possible embodiment will be given below to non-restrictively elaborate on its specific implementation scheme.

[0045] S301. Fill in the missing values and perform standardization processing on the traffic time series of each monitoring point to obtain a sample sequence.

[0046] Unify the sampling frequency of the traffic time series of each monitoring point (such as 5-minute granularity), and fill in the missing values by linear interpolation. Perform Z-score standardization on the time series of each node.

[0047] S302. Calculate the dynamic Pearson correlation coefficient, dynamic time warping distance, and transfer entropy between the monitoring points according to the sample sequences of each monitoring point.

[0048] Define the window length W (such as 6 hours = 72 5-minute points) and the step size S (such as 1 hour = 12 steps).

[0049] Calculate the correlation coefficient for nodes i and j within the window w:

[0050] Among them, is the traffic of node i at time t, is the traffic of node j at time t, is the average traffic of node i, is the average traffic of node j, w is the unit time window, and W is the total length of the time window.

[0051] Retain the significance test result (p-value < 0.05).

[0052] For non-aligned sequences, calculate the dynamic time warping distance within the window:

[0053] Among them, π is the warping path.

[0054] Improved Granger causality test. For two sequences {x i},{x j} within window w, construct a VAR model:

[0055] where k represents the lag order, a k represents the autoregressive coefficient, and b k represents the Granger causality coefficient. If ∑∣b k ∣ is significantly non - zero, then x i Granger causes x j .

[0056] Calculate transfer entropy:

[0057] S303. Generate edge weights between corresponding nodes according to the dynamic Pearson correlation coefficient, dynamic time warping distance, and transfer entropy between monitoring points.

[0058] The edge weight between nodes i and j in window w:

[0059] where α + β+δ = 1 are weight coefficients.

[0060] Retain the edges with the top k% of the weights (e.g., Top 20%).

[0061] S304. Construct a dynamic adjacency matrix according to the edge weights between nodes.

[0062] Define the build_dynamic_adjacency_matrix function to construct the dynamic adjacency matrix. This function takes the number of nodes num_nodes, the list of indices top_k_indices of the top k% of the retained edges, and the list of edge weights weights as inputs. First, create a zero - matrix adj_matrix of size num_nodes times num_nodes as the initial value of the adjacency matrix. Then, by looping through the top_k_indices list, find the corresponding node pairs according to each index (here, the actual node index mapping relationship needs to be used for conversion, which is implemented by index_to_node_pair(index) in the function), and assign the corresponding edge weight weights[index] to the corresponding position in the adjacency matrix adj_matrix, and finally return the constructed dynamic adjacency matrix.

[0063] In an embodiment of the present invention, based on step S4, a possible embodiment will be given below to non - restrictively elaborate on its specific implementation scheme.

[0064] S401. Use a multi - branch network architecture to process meteorological data and a dynamic adjacency matrix in parallel. The multi - branch network architecture includes a meteorological branch and a traffic branch; The meteorological branch is used to extract meteorological features from the meteorological data, including a 3D convolutional layer and spatio - temporal attention; the traffic branch is used to extract traffic features from the dynamic adjacency matrix, including a graph convolutional layer and a temporal convolutional layer.

[0065] Specifically, the traffic branch includes: Graph convolutional layer: Capture the spatial dependence of monitoring points (the adjacency matrix is constructed based on road topology or dynamic correlation). Select a graph convolutional network (GCN) or a graph attention network (GAT) to construct the graph convolutional layer. In practical applications, according to the scale of monitoring points and computing resources, set the number of input channels to the node feature dimension, and the number of output channels to 64 - 256. When constructing the adjacency matrix based on road topology, if there is a road connection between nodes, the corresponding element is set to 1, otherwise 0; when constructing based on dynamic correlation, quantify the correlation strength according to indicators such as the Pearson correlation coefficient calculated in S302.

[0066] Temporal convolutional layer: Adopt causal dilated convolution, and its convolutional kernel samples at intervals of 2 (Dilation = 2) in the time dimension to ensure that the output at the current moment only depends on the information of past moments and avoid leakage of future information. Set the convolutional kernel size to 3 - 5, the number of input channels is the same as the output of the graph convolutional layer, and the number of output channels is adjusted according to the model complexity. During the training process, update the convolutional kernel parameters through backpropagation to learn the temporal dependence pattern of traffic data.

[0067] The meteorological branch includes: Spatial encoding: Flatten the grid meteorological data into a sequence and model the spatial correlation through multi - head self - attention. Specifically, convert the three - dimensional grid meteorological data into a two - dimensional sequence through a flatten operation, with the dimension [time step, number of grid nodes × number of meteorological indicators]. Use the multi - head self - attention mechanism (Multi - Head Attention) to model the spatial correlation. Each head calculates the attention independently and then splices the results. During the calculation of multi - head self - attention, map the input sequence to the query (Q), key (K), and value (V) spaces respectively, and calculate the attention output. The multi - head self - attention mechanism can capture spatial features from different angles and enhance the model's expressive ability.

[0068] Temporal Convolution: Capturing the temporal variations in meteorological data. The formula is the same as that of the flow branch. The structure is the same as the temporal convolution layer of the flow branch, and causal dilated convolution (Dilation = 2) is also used. By stacking multiple convolutional layers, the temporal variations in meteorological data at different time scales are captured. After each layer of convolution, a batch normalization layer and an activation function (such as ReLU) are added to accelerate the model convergence speed and alleviate the vanishing gradient problem.

[0069] S402. Use the bilinear interpolation method to improve the coordinate mapping accuracy between meteorological features and flow features.

[0070] Before performing bilinear interpolation, the time dimensions of meteorological features and flow features need to be unified. Assume that the dimension of meteorological features is [T1, N1, C1], and the dimension of flow features is [T2, N2, C2]. If T1 = T2, linear interpolation or nearest neighbor interpolation is used to adjust them to the same time step T.

[0071] Bilinear interpolation is performed in a two-dimensional space (such as the correspondence between spatial grids and monitoring point positions). For each grid point in meteorological features, find its four nearest neighbor points in the flow feature space, and calculate the interpolation result according to the distance weights. Taking the PyTorch library in Python as an example, use the torch.nn.functional.interpolate function, set the parameters mode='bilinear' and align_corners=True to achieve the scaling of meteorological features in the spatial dimension to match the spatial coordinates of flow features, thereby improving the mapping accuracy.

[0072] S403. Use the cross-attention mechanism to fuse meteorological features and flow features: Input flow features H flow and meteorological features H weather ; Generate query (Q), key (K), and value (V): , ,

[0073] where, , , are learnable parameter matrices, and ; is the core representation dimension of the model, which determines the capacity of the model, is the dimension of keys and queries in the attention mechanism, which affects the computational efficiency and stability, is the set of real numbers; Calculate the attention:

[0074] Introduce extreme weather prior into the attention weights:

[0075] where, is the level of extreme weather at time t, is the weight factor, is the initial attention weight value from node i to node j; Calculate the fused feature:

[0076] where, represents the number of monitoring points; Add the fused result to the original flow feature to retain the original information: H fused =H flow +Dropout(FusedFeature) H fused contains the flow feature and the dynamically selected meteorological information.

[0077] S404. Use the LSTM network to predict the flow value of each monitoring point based on the fused meteorological feature and flow feature.

[0078] Adjust the fused feature H fused to the input format suitable for the LSTM network, that is [batch_size, time_steps, feature_dim]. The LSTM network contains multiple hidden layers, and the number of hidden units is set to 64 - 256, and the number of layers is generally 2 - 3 layers. During the training process, use the mean squared error (MSE) or mean absolute error (MAE) as the loss function, select Adam or RMSProp as the optimizer, initialize the learning rate to 0.001 - 0.01, and adopt a learning rate decay strategy (such as decaying by 0.9 every 10 epochs). Update the parameters of the LSTM network through the backpropagation algorithm, including the weights and biases of the forget gate, input gate, output gate, and the update parameters of the cell state. After training, input the fused feature of the future period into the LSTM network to output the flow prediction value of each monitoring point.

[0079] In an embodiment of the present invention, based on step S5, a possible embodiment will be given below to non - restrictively elaborate on its specific implementation scheme.

[0080] S501. Encode the geospatial data into a vertex buffer object (VBO) and generate a multi - level vector tile index through a compute shader.

[0081] Geospatial data preprocessing: First, obtain the original geospatial data, such as Shapefile, GeoJSON and other format files. Use a geospatial information processing library, such as GDAL (Geospatial Data Abstraction Library), to parse and transform the data, and extract the geometric shapes (points, lines, surfaces) and attribute information therein. Convert the geospatial coordinates (such as longitude and latitude) into a planar coordinate system suitable for rendering, such as the Web Mercator projection, to ensure that the data is correctly displayed on the screen. Encoding into vertex buffer object (VBO): In the WebGL environment, create a vertex buffer object. Store the geometric vertex information (coordinates, normal vectors, texture coordinates, etc.) in the geospatial data into the VBO in a specific format. Each vertex usually consists of multiple components, such as three-dimensional coordinates (x, y, z), and if there is texture mapping, it also includes two-dimensional texture coordinates (s, t). Use the gl.bufferData() method to upload the data to the GPU video memory to improve the data access efficiency. Compute shader to generate multi-level vector tile indexes: Write a compute shader program to process data in parallel on the GPU. According to the range and precision requirements of the geospatial data, divide the data into different levels of vector tiles. The compute shader traverses the vertex data and assigns the tile level and index number to which each vertex belongs according to the tile division rules. For example, use a quadtree structure to layer the data, and the number of tiles in each layer increases by a factor of 4. Generate multi-level vector tile indexes in this way to facilitate subsequent rapid query and rendering of geospatial data in a specific area.

[0082] S502. Parse the received traffic data and meteorological data through WebSocket, and update the GPU structured buffer based on the parsed traffic data and meteorological data through the WebGL API.

[0083] WebSocket data reception and parsing: Establish a WebSocket connection to listen for traffic data and meteorological data sent by the server. The data is usually transmitted in JSON or binary format. When the data is received, parse it according to the data format. If it is in JSON format, use the JSON.parse() method in JavaScript to convert the string into a JavaScript object; if it is in binary format, it is necessary to parse the data according to the predefined data protocol in the byte order and extract the key information, such as traffic values, meteorological indicators (temperature, humidity, wind speed, etc.), timestamps, etc. Updating the GPU Structured Buffer: Create a structured buffer object in WebGL to store the parsed traffic data and meteorological data. The structured buffer can be regarded as an array on the GPU, and each element can contain multiple fields. For example, a traffic data element may contain fields such as monitoring point ID, traffic value, timestamp, etc. Use the gl.bufferSubData() method to update the parsed data to the corresponding position in the structured buffer. In this way, the GPU can directly access and process this data, avoiding frequent CPU-GPU data transfers and improving rendering performance. S503. Convert the meteorological data into a 3D voxel texture and calculate the cloud shadow corresponding to the 3D voxel texture through ray marching.

[0084] Converting Meteorological Data into a 3D Voxel Texture: Organize the meteorological data (such as temperature, humidity, air pressure, etc.) into a three-dimensional array according to spatial position and time dimension. Each array element corresponds to a voxel, and the voxel value is the meteorological index value at the corresponding position and time. Use the texture object in WebGL to convert the three-dimensional array into a 3D voxel texture. Set texture parameters such as texture filtering mode (gl.NEAREST or gl.LINEAR), texture wrapping mode (gl.CLAMP_TO_EDGE), etc. to ensure that the texture is correctly displayed during rendering. Calculating Cloud Shadows through Ray Marching: Implement the ray marching algorithm in the fragment shader. Emit rays from the observation point into the scene, and the rays march in the 3D voxel texture. At each marching position, obtain the meteorological data of the corresponding voxel, and judge whether it is a cloud area according to predefined rules (such as humidity and temperature thresholds). Determine the intensity of the cloud shadow by calculating the attenuation degree of the ray in the cloud. For example, the larger the voxel value encountered by the ray in the cloud (indicating a thicker cloud), the more obvious the ray attenuation, thus producing a shadow effect. Through multiple marchings and calculations, finally obtain the cloud shadow value corresponding to each pixel. S504. Render the traffic values of ground traffic and meteorological voxels respectively, and mix the colors in the color buffer according to the depth test results. Rendering the Traffic Values of Ground Traffic: Use the WebGL rendering pipeline to map the traffic data stored in the GPU structured buffer to the monitoring point positions in the geospatial. Set different colors and sizes for each monitoring point to intuitively represent the magnitude of the traffic value. For example, the larger the traffic value, the brighter the color (such as red), and the larger the icon size of the monitoring point. Through the cooperation of the vertex shader and the fragment shader, convert the position coordinates of the monitoring point into screen coordinates, and calculate the color value according to the traffic value, and finally render the visualization effect of ground traffic flow on the screen. Rendering meteorological voxels: For meteorological data represented by 3D voxel textures, volume rendering technology is used for rendering. During the rendering process, each voxel in the voxel texture is traversed through ray casting or ray marching algorithms. According to the voxel value and a predefined color mapping table, the color value corresponding to each voxel is calculated. These color values are blended to obtain the final rendering effect of the meteorological voxels, showing the distribution of meteorological data in space. Color blending: In the color buffer, the depth test function (gl.enable(gl.DEPTH_TEST)) is enabled. When rendering the ground traffic flow value and meteorological voxels, comparison is made according to the depth value of each pixel (indicating the distance of the object from the observation point). Pixels with smaller depth values (i.e., objects closer to the observation point) will cover pixels with larger depth values, achieving the correct occlusion relationship. At the same time, according to a predefined blending function (such as gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA)), the colors of the ground traffic flow value and meteorological voxels are blended, so that the two visualization effects are integrated together, presenting richer information. S505. Perform color grading and bloom processing on the blended color buffer. Color grading: Color grading remaps the colors in the color buffer through a lookup table (LUT, LookupTable) to adjust the color style and contrast of the image. Create a color grading lookup table that contains the output color values corresponding to different input color values. In the fragment shader, the output color is obtained by indexing the lookup table according to the color value in the color buffer, achieving the color grading effect. For example, a vintage-style lookup table can be created to make the image present the color effect of an old photo. Bloom processing: Bloom processing is used to simulate the scattering effect of light in bright areas of the scene, enhancing the visual impact of the image. First, during the rendering process, the image in the color buffer is downsampled to obtain a low-resolution version. Then, the low-resolution image is blurred, and common blurring algorithms include Gaussian blur. Through multiple iterative blurring operations, the colors in the bright areas spread outwards. Finally, the blurred image is blended with the image in the original color buffer, and the blending weight is adjusted to obtain an image with a bloom effect. S506. In the fragment shader, screen pixels are generated by combining the data of vector tile textures and GPU structured buffers. In the fragment shader, obtain the texture coordinates and screen coordinates corresponding to the current pixel. According to the texture coordinates, sample the texture information of the geospatial data from the vector slice texture, such as the lines and symbols on the map. At the same time, according to the screen coordinates and predefined rules, obtain the corresponding traffic data and meteorological data from the GPU structured buffer. Integrate and process these data, and calculate the final color value of the current pixel according to the data value and the predefined color mapping rules. For example, set different color mappings according to different combinations of traffic values and meteorological data, so that the screen pixels can accurately reflect the geospatial, traffic flow, and meteorological information, and finally generate a complete visualization image. In some embodiments, the visualization-based traffic flow monitoring system may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the visualization-based traffic flow monitoring system can be stored in the memory of the computer device and executed by at least one processor to execute (see details in Figure 1 the description) the functions of visualization-based traffic flow monitoring.

[0085] In this embodiment, the visualization-based traffic flow monitoring system can be divided into multiple functional modules according to the functions it performs, as Figure 2 shown. The module referred to in the present invention means a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0086] The first acquisition module is used to monitor the traffic data of each monitoring point in real time to obtain the traffic time series; The second acquisition module is used to obtain the meteorological data of the area where each monitoring point is located; The first processing module is used to construct a dynamic adjacency matrix with the monitoring points as nodes according to the traffic time series; The second processing module is used to predict the traffic value of each monitoring point according to the dynamic adjacency matrix and the corresponding meteorological data; The visualization module is used to generate a display interface with the geospatial data as the base layer and the predicted traffic value and the corresponding meteorological data as additional coatings.

[0087] Figure 3The traffic flow monitoring method based on visualization provided by the embodiments of this application can be applied to devices. Those skilled in the art can understand that the device structure involved in the embodiments of the present invention does not constitute a limitation on the device. The device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the device includes, but is not limited to, laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of this application described herein and / or required.

[0088] Among them, the device 300 may include: a processor 310, a memory 320, and a communication unit 330. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the present invention. It can be a bus structure, a star structure, or may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0089] Among them, the memory 320 can be used to store the execution instructions of the processor 310. The memory 320 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the device 300 can execute some or all of the steps in the above method embodiments.

[0090] The processor 310 is the control center of the storage device, connecting various parts of the entire electronic device through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 320, and by invoking the data stored in the memory, it performs various functions of the electronic device and / or processes data. The processor may be composed of an integrated circuit (IC), for example, it may be composed of a single packaged IC, or it may be composed of multiple packaged ICs with the same or different functions connected together. For example, the processor 310 may include only a central processing unit (CPU). In the embodiments of the present invention, the CPU may be a single arithmetic core or may include multiple arithmetic cores.

[0091] The communication unit 330 is used to establish a communication channel so that the storage device can communicate with other devices. It receives user data sent by other devices or sends user data to other devices.

[0092] The present invention also provides a computer storage medium. Among them, the computer storage medium can store a program, and when the program is executed, it may include some or all of the steps in the various embodiments provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.

[0093] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solutions in the embodiments of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium 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, etc., which can store program codes, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a second device, a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0094] For the same or similar parts among the various embodiments in this specification, reference can be made to each other. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the description in the method embodiments.

[0095] In several embodiments provided by the present invention, 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 modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling, direct coupling, or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the system or module can be in electrical, mechanical, or other forms.

[0096] The modules described as separate components may or may not be physically separated. The components displayed as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0097] In addition, in each embodiment of the present invention, the functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module.

[0098] Although the present invention has been described in detail by referring to the drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, those of ordinary skill in the art can make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions should be within the scope of the present invention. / Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should be covered within the protection scope of the present invention.

Claims

1. A traffic flow monitoring method based on visualization, characterized in that: include: Monitor the flow data of each monitoring point in real time to obtain the flow time series; Obtain meteorological data for the area where each monitoring point is located; Taking the monitoring points as nodes, a dynamic adjacency matrix is ​​constructed according to the traffic time series; Predicting the flow value of each monitoring point according to the dynamic adjacency matrix and corresponding meteorological data; The display interface is generated with geospatial data as the base layer and predicted flow values ​​and corresponding meteorological data as additional coatings.

2. The method according to claim 1, characterized in that Monitor the traffic data of each monitoring point in real time to obtain the traffic time series, including: The traffic data collected by the sensor is received through the message queue, and the traffic data is arranged into a traffic time series according to the collection time.

3. The method according to claim 1, characterized in that Obtain meteorological data for the area where each monitoring point is located, including: Establish the correspondence between monitoring points and areas in advance; Obtain meteorological data for each region from the meteorological forecast platform; The meteorological data of each monitoring point is determined according to the corresponding relationship and the meteorological data of each area.

4. The method according to claim 1, characterized in that Taking the monitoring points as nodes, a dynamic adjacency matrix is ​​constructed according to the traffic time series, including: The flow time series of each monitoring point is filled with missing values ​​and standardized to obtain a sample sequence; According to the sample sequence of each monitoring point, the dynamic Pearson correlation coefficient, dynamic time warping distance and transfer entropy between the monitoring points are calculated; Generate edge weights between corresponding nodes based on the dynamic Pearson correlation coefficient, dynamic time warping distance and transfer entropy between monitoring points; Construct a dynamic adjacency matrix based on the edge weights between nodes.

5. The method according to claim 1, characterized in that Predicting the flow value of each monitoring point according to the dynamic adjacency matrix and corresponding meteorological data includes: Processing meteorological data and a dynamic adjacency matrix in parallel using a multi-branch network architecture, wherein the multi-branch network architecture includes a meteorological branch and a traffic branch; The meteorological branch is used to extract meteorological features from the meteorological data, including a 3D convolution layer and spatiotemporal attention; the traffic branch is used to extract traffic features from the dynamic adjacency matrix, including a graph convolution layer and a temporal convolution layer; The bilinear difference method is used to improve the coordinate mapping accuracy of meteorological characteristics and flow characteristics; Using the cross-attention mechanism to fuse meteorological features and traffic features; The LSTM network is used to predict the flow value of each monitoring point based on the fused meteorological characteristics and flow characteristics.

6. The method according to claim 5, characterized in that The cross-attention mechanism is used to fuse meteorological features and traffic features, including: Input flow characteristic H flow and meteorological characteristics weather ; Generate query (Q), key (K), value (V): , , in, , , is the learning parameter matrix, and ; It is the core representation dimension of the model and determines the capacity of the model. is the dimension of key and query in the attention mechanism, which affects the computational efficiency and stability. is the set of real numbers; Calculating attention: Introducing extreme weather priors in attention weights: in, is the level of extreme weather at time t, is the weight factor, is the initial attention weight value from node i to node j; Calculate fusion features: in, Indicates the number of monitoring points; The fusion result is added to the original traffic features, retaining the original information: H fused =H flow +Dropout(FusedFeature) H fused Contains traffic characteristics and dynamically selected meteorological information.

7. The method according to claim 1, characterized in that With geospatial data as the base layer, predicted flow values ​​and corresponding meteorological data as additional layers, a display interface is generated, including: Encode geospatial data into vertex buffers (VBOs) and generate multi-level vector tile indices through compute shaders; Parse the received traffic data and meteorological data through WebSocket, and update the GPU structured buffer based on the parsed traffic data and meteorological data through WebGL API; Converting meteorological data into 3D voxel textures, and calculating cloud shadows corresponding to the 3D voxel textures by ray marching; Render the flow values ​​of ground traffic and weather voxels separately, and mix the colors in the color buffer according to the depth test results; Perform color grading and flood processing on the blended color buffer; In the fragment shader, data from the vector tile texture and the GPU structured buffer are combined to generate screen pixels.

8. A visualization-based traffic flow monitoring system, characterized in that: include: The first acquisition module is used to monitor the flow data of each monitoring point in real time to obtain the flow time series; The second acquisition module is used to obtain the meteorological data of the area where each monitoring point is located; A first processing module is used to construct a dynamic adjacency matrix according to the traffic time series by taking the monitoring points as nodes; A second processing module is used to predict the flow value of each monitoring point according to the dynamic adjacency matrix and corresponding meteorological data; The visualization module is used to generate a display interface with geospatial data as the base layer and predicted flow values ​​and corresponding meteorological data as an additional coating.

9. A device, characterized in that: include: A memory for storing a visualization-based traffic flow monitoring program; A processor is used to implement the steps of the visualization-based traffic flow monitoring method as described in any one of claims 1-7 when executing the visualization-based traffic flow monitoring program.

10. A computer-readable storage medium storing a computer program, characterized in that: The readable storage medium stores a visualization-based traffic flow monitoring program, and when the visualization-based traffic flow monitoring program is executed by a processor, the steps of the visualization-based traffic flow monitoring method as described in any one of claims 1 to 7 are implemented.