A spatiotemporal prediction method for roadside parking space occupancy rate integrated with sparse self-attention
By constructing a temporal informer model with a weighted directed graph and sparse self-attention mechanism to capture dynamic spatiotemporal dependencies, the problem of insufficient accuracy in roadside parking occupancy prediction in existing technologies is solved, accurate parking occupancy prediction is achieved, and urban traffic management and user parking experience are improved.
Patent Information
- Application Number
- CN202510571777.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-04-30
AI Technical Summary
Existing roadside parking space occupancy prediction methods fail to fully consider the temporal and spatial correlation of parking demand, resulting in insufficient prediction accuracy, affecting urban traffic management and user parking experience.
A spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention is adopted. By constructing an adjacency matrix of a weighted directed graph and combining the Gaussian kernel function with the temporal Informer model of the sparse self-attention mechanism, dynamic spatiotemporal dependencies are captured to achieve accurate parking space occupancy rate prediction.
It has achieved accurate prediction of roadside parking space occupancy rates, improved the efficiency of urban traffic management and user parking experience, and increased parking space utilization efficiency.
Smart Images

Figure CN120199087B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic prediction, and in particular to a spatiotemporal prediction method for roadside berth occupancy rate integrating sparse self-attention. Background Art
[0002] With the continuous growth of urban populations and the increase in car ownership, parking management has become a common challenge in today's cities. Parking facilities, including off-street parking lots, parking garages, and curbside parking spaces, are all important components of the transportation infrastructure system. Curbside parking spaces are designated by public security traffic management departments for motor vehicles using available parking spaces on urban roads, including motor vehicle lanes, non-motor vehicle lanes, and sidewalks. Curbside parking spaces are typically equipped with sensors and cameras, allowing management backends to monitor occupancy in real time.
[0003] Predicting the occupancy rate of curbside parking spaces is crucial. On one hand, it provides users with parking information and guides them to available spaces, reducing search time and improving parking resource utilization. More importantly, understanding parking occupancy allows management to better manage traffic flow, optimize vehicle flow, reduce congestion, and improve overall traffic efficiency. Therefore, predicting curbside parking occupancy plays a crucial role in the efficient management of urban transportation, impacting not only the user's parking experience but also the operational efficiency of the entire urban transportation system. Summary of the Invention
[0004] The purpose of this invention is to provide a spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention, which fully considers the temporal and spatial correlation of parking demand and realizes accurate prediction of roadside parking space occupancy rate.
[0005] To achieve the above objectives, the present invention provides a spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention, comprising the following steps:
[0006] S1. Obtain historical parking data, pre-process the historical parking data, and count the number of parking spaces in different time periods based on the entry and exit times of individual vehicles in each roadside parking area. Calculate the parking occupancy rate for each parking area in different time periods based on the counted number of parking spaces and the total number of parking spaces in each parking area, thereby obtaining a parking occupancy rate dataset.
[0007] S2. Treat the urban berth area network as a weighted directed graph Construct the adjacency matrix of the graph;
[0008] S3. Construct a parking space occupancy rate prediction model, input the information obtained in step S1 and step S2, perform parking space occupancy rate prediction based on the parking space occupancy rate prediction model, and obtain a roadside parking space occupancy rate prediction result.
[0009] Preferably, in step S2, the weighted directed graph Where V is the set of vertices, E is the set of edges, and A is the adjacency matrix of the graph. The steps to construct the adjacency matrix of the graph include:
[0010] S21. Accessing a map API to obtain the longitude and latitude of the roadside parking area, calculating the driving distance between each roadside parking area based on the longitude and latitude of the roadside parking area, and generating a distance matrix;
[0011] S22. Based on the generated distance matrix, apply a Gaussian kernel function to each element of the distance matrix to convert the distance into similarity. The Gaussian kernel form is:
[0012]
[0013] Among them, dis(x i →y j ) represents the distance between two points in the distance matrix, σ represents the bandwidth parameter of the Gaussian kernel, which is determined by the global standard deviation. The Gaussian kernel gives higher weights to points that are closer.
[0014] Preferably, the parking space occupancy rate prediction model in step S3 includes:
[0015] Input layer: Use the convolution layer to aggregate the input data and expand the data channel dimension;
[0016] Spatiotemporal layer: This layer includes spatial transformers and temporal informers. It is constructed by stacking spatiotemporal transformer-informer modules to capture dynamic spatiotemporal dependencies.
[0017] Spatial Transformer: It uses a spatiotemporal position embedding layer, a fixed graph convolution layer, and a dynamic self-attention mechanism layer to extract spatial information, and uses a gating mechanism to fuse the spatial features obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer;
[0018] Time Informer: Extracts time information using the Time Informer model based on the sparse self-attention mechanism;
[0019] Prediction layer: Use two convolutional layers to make predictions based on the spatiotemporal features output by the last spatiotemporal module to obtain the roadside parking space occupancy prediction results.
[0020] Preferably, the convolutional layer input of the input layer is The dimensions are M, N, C, where M represents the height and N represents the width. Represents a set of real numbers, C represents the number of channels, and after the convolution operation, is mapped to Indicates the number of output channels.
[0021] Preferably, the extraction of spatial information by using a spatiotemporal position embedding layer, a fixed graph convolution layer, and a dynamic self-attention mechanism layer, and the fusing of spatial features obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer by using a gating mechanism specifically include:
[0022] After the input layer features are aggregated, the spatiotemporal position embedding layer is used to Perform spatiotemporal position embedding, where the spatial and temporal position embeddings are and Considering the connectivity and distance factors between nodes, the graph adjacency matrix is initialized Tiled along the spatial axis and time axis, we get and and with Connect and get the embedded features, expressed as F c represents the convolutional layer;
[0023] Use fixed graph convolutional layers to extract the adjacency matrix and Extract spatial features from the graph The diagonal elements of the degree matrix D are defined as D ii =∑ i A ij ,i=1,2,…,N, the symmetric normalized Laplace matrix L is defined as L=I n -D -1 / 2 AD -1 / 2 , scale the Laplace matrix, and the scaled Laplace matrix is where λ max represents the maximum eigenvalue of the Laplace matrix, I n Represents the unit matrix, for the embedded features Graph convolution using Chebyshev polynomial approximation to obtain node features The formula is:
[0024]
[0025] in, express The jth channel, θ ij,k represents the learned weight, T k is a Chebyshev polynomial of order k, where k represents the highest order of the Chebyshev polynomial, k = 1,…,K;
[0026] Use the dynamic self-attention mechanism layer to extract spatial information and embed the features of each time step Projection based on Train three subspaces for each node and The formula is:
[0027]
[0028] in, Represents Q S , K S , V S The weight matrix, through Q S With K S Dynamic spatial dependencies between nodes in the dot product calculation Use the Softmax function to normalize the spatial dependence. Control the range of the dot product and make the node features Through the attention weight matrix S S To update, the formula is:
[0029]
[0030] A shared three-layer feedforward neural network and activation function are used to For node feature M S To update, the formula is:
[0031]
[0032] in, Represents the residual connection, W0, W1, W2 represent the parameter matrix of the three layers, U S Represents the spatial features after three layers of neural network and activation function;
[0033] A gating mechanism is used to fuse the spatial information obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer. The formula is:
[0034]
[0035] in, f S and Represents linear projection, respectively and Convert to a one-dimensional vector, Represents the spatial features obtained by the fixed graph convolution layer;
[0036] Through Y' S and X S Weighted with g to get the output Y S , the formula is:
[0037]
[0038] Where, output As the input of the time Informer.
[0039] Preferably, extracting time information using a time informer model based on a sparse self-attention mechanism includes:
[0040] Input features and time embedding D T Splicing G t represents a 1×1 convolutional layer that produces a dimensional vector, X′ T Represents the feature representation after time embedding;
[0041] The probabilistic sparse self-attention mechanism is used to model the temporal dependency and construct three latent subspaces, namely and The formula is:
[0042]
[0043] in, represents the input sequence, represents the weight matrix;
[0044] The modeling formula of the self-attention mechanism is:
[0045]
[0046] Where, q i represents the i-th query vector, k j represents the j-th key vector, v j represents the j-th value vector, Indicates that given a query vector q i Under the condition of j The associated value vector v j Calculate;
[0047] The probability sparsity criterion measures p(k j |q i ) and uniform distribution Gap, where L k Indicates Q T The length of , the sparsity measurement formula is:
[0048]
[0049] Where K represents the bond matrix, represents the embedding dimension, is the dot product of the query vector and the key vector, which is used to measure the similarity between them;
[0050] The filtered sparse matrix is calculated according to the sparsity measurement formula According to the sparse matrix The temporal attention is calculated as follows:
[0051]
[0052] The distillation mechanism is introduced to give higher weights to the data features of important nodes of temporal attention. The formula is:
[0053] Y T =MaxPool(ELU(Conv(S T )));
[0054] In the formula, MaxPool represents the selection of the maximum value within a fixed receptive field and generates a new matrix with reduced dimension, ELU represents the activation function, and Y T Represents the output after the distillation mechanism.
[0055] Preferably, the method of forming a spatiotemporal layer by stacking spatiotemporal Transformer-Informer modules to capture dynamic spatiotemporal dependencies includes: integrating the spatial Transformer module and the temporal Informer module through residual connections to form a spatiotemporal module with spatiotemporal feature processing capabilities; then, increasing the depth of the neural network by stacking spatiotemporal Transformer-Informer modules to form a spatiotemporal layer that can efficiently capture spatiotemporal dependencies.
[0056] Preferably, the process of capturing the spatiotemporal dependency relationship of the spatiotemporal layer includes:
[0057] In the lth spatiotemporal module, the spatial Transformer module is and extract spatial features from the adjacency matrix Represents the output of the l-1th spatiotemporal module, where the temporal informer incorporates spatial features and input features The formula is:
[0058]
[0059] Where, Represents the output of the time Informer module;
[0060] The spatiotemporal layer includes multiple spatiotemporal modules. After processing by the spatiotemporal layer, the feature representation is
[0061] Preferably, the input of the last spatiotemporal module is the output of the N nodes at the last time step. ST dimensional space-time characteristics Through N nodes, multi-step prediction of the future T traffic conditions is performed to obtain the prediction results The formula is
[0062] Y=Conv(Conv(X ST )).
[0063] Therefore, the present invention adopts the above-mentioned spatiotemporal prediction method of roadside parking space occupancy rate integrating sparse self-attention, which fully considers the temporal and spatial correlation of parking demand, and realizes the accurate prediction of roadside parking space occupancy rate. By predicting the occupancy of parking spaces, urban traffic management departments can better carry out parking guidance and parking management, further improve the efficiency of parking space utilization, and provide citizens with a more convenient parking experience.
[0064] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 This is a method framework diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0067] Example
[0068] Reference Figure 1 The present invention provides a spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention, the steps comprising:
[0069] We obtained 70 roadside parking spaces in a certain city, with the collection time span from August 1, 2019 to August 6, 2019, totaling 51,585 parking data items.
[0070] S1. Obtain historical parking data for 70 roadside parking spaces in a city and preprocess the historical parking data, including extracting the entry and exit time of each vehicle and the parking space location information. Then, clean the data and remove abnormal data to form a data set including the time when the vehicle enters the parking space (IN_TIME), the time when the vehicle leaves the parking space (OUT_TIME), and the parking space location (POSITION_NAME). The data example is shown in Table 1.
[0071] Table 1. Example of parking data
[0072]
[0073]
[0074] Based on vehicle entry and exit times, the number of parking spaces in each roadside parking area was counted at 5-minute intervals based on the entry and exit times of individual vehicles. Based on the counted number of parking spaces and the total number of parking spaces in each parking area, the occupancy rate for each parking area during different time periods was calculated to generate a parking occupancy rate dataset.
[0075] S2. Treat the urban berth area network as a weighted directed graph Construct the adjacency matrix of the graph. Among them, the weighted directed graph Where V is the set of vertices, E is the set of edges, and A is the adjacency matrix of the graph;
[0076] Constructing the adjacency matrix of a graph involves:
[0077] S21. Access the map API to obtain the longitude and latitude of the roadside parking area, as shown in Table 2. Calculate the driving distance between each roadside parking area based on the longitude and latitude of the roadside parking area to generate a distance matrix, as shown in Table 3.
[0078] Table 2 Roadside berth latitude and longitude
[0079]
[0080]
[0081] Table 3 Distance matrix
[0082]
[0083] S22. Based on the generated distance matrix, apply a Gaussian kernel function to each element of the distance matrix to convert the distance into similarity. The Gaussian kernel form is:
[0084]
[0085] Among them, dis(x i →y j) represents the distance between two points in the distance matrix, σ represents the bandwidth parameter of the Gaussian kernel, which is determined by the global standard deviation. The Gaussian kernel gives higher weights to points that are closer.
[0086] S3. Construct a parking space occupancy prediction model, input the information obtained in steps S1 and S2, and perform parking space occupancy prediction based on the parking space occupancy prediction model to obtain roadside parking space occupancy prediction results. For example, input the historical occupancy data of 70 roadside parking areas from 9:00-10:00 on August 6, a total of 12 time steps, to predict the parking space occupancy rate for the next 5 minutes (10:00-10:05). The results are shown in Table 4:
[0087] Table 4 Berth occupancy rate prediction results
[0088] Berth area Occupancy rate Berth area Occupancy rate 1 75.95% 36 11.90% 2 56.63% 37 27.87% 3 14.78% 38 52.94% 4 21.11% 39 25.76% 5 29.34% 40 35.29% 6 17.88% 41 24.84% 7 66.42% 42 16.95% 8 19.28% 43 8.91% 9 34.80% 44 6.45% 10 12.86% 45 36.59% 11 18.37% 46 13.73% 12 8.85% 47 64.52% 13 37.18% 48 7.25% 14 34.09% 49 37.17% 15 27.27% 50 32.47% 16 55.83% 51 16.43% 17 9.64% 52 10.00% 18 9.80% 53 16.19% 19 17.14% 54 7.35% 20 13.94% 55 16.00% 21 25.45% 56 4.03% 22 18.95% 57 36.47% 23 60.87% 58 7.59% 24 37.72% 59 12.22% 25 10.29% 60 17.48% 26 32.35% 61 21.37% 27 13.33% 62 3.85% 28 22.50% 63 15.38% 29 8.45% 64 9.14% 30 52.94% 65 75.00% 31 13.24% 66 17.03% 32 37.36% 67 27.27% 33 15.79% 68 32.47% 34 18.18% 69 62.65% 35 10.53% 70 26.09%
[0089] The parking space occupancy rate prediction model includes:
[0090] Input layer: A 1×1 convolutional layer is used to aggregate the input data and expand the data channel dimension. The 1×1 convolutional layer is a special type of convolution operation in convolutional neural networks. It is usually used to change the number of channels of the feature map while keeping the spatial dimensions (height and width) of the feature map unchanged. The specific process of the convolutional layer is as follows:
[0091] The input of the 1×1 convolutional layer is The dimensions are M, N, C, where M represents the height, N represents the width, and C represents the number of channels. represents a set of real numbers, i.e., the depth of the feature map;
[0092] The convolution kernel used in the 1×1 convolution operation is a convolution kernel with a size of (1, 1, C in , C out ) size weight matrix, where: 1 means the height of the convolution kernel is 1, 1 means the width of the convolution kernel is 1, C in Indicates the number of input channels, C out Represents the number of output channels, and each weight in the convolution kernel performs a convolution operation with the corresponding position in the input tensor;
[0093] After the 1×1 convolution operation, is mapped to That is, the number of output channels is
[0094] Spatiotemporal layer: It includes spatial Transformer and temporal Informer. It is constructed by stacking spatiotemporal Transformer-Informer modules to capture dynamic spatiotemporal dependencies.
[0095] Spatial Transformer: It uses a spatiotemporal position embedding layer, a fixed graph convolution layer, and a dynamic self-attention mechanism layer to extract spatial information. It uses a gating mechanism to fuse the spatial features obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer. Specifically, it includes:
[0096] After the input layer features are aggregated, the spatiotemporal position embedding layer is used to Perform spatiotemporal position embedding, where the spatial and temporal position embeddings are and Considering the connectivity and distance factors between nodes, the graph adjacency matrix is initialized To model spatial dependencies, The initialization adopts the one-hot encoding method. Flatten along the spatial axis and time axis, and get and and with Connect and get the embedded features, expressed as F c Represents a 1×1 convolutional layer, which is used to transform its embedded features into each node at each time step dimensional vector.
[0097] Use fixed graph convolutional layers to extract the adjacency matrix and Extract spatial features from the graph The diagonal elements of the degree matrix D are defined as D ii =∑ i A ij ,i=1,2,…,N, the symmetric normalized Laplace matrix L is defined as L=I n -D -1 / 2 AD -1 / 2 , scale the Laplace matrix, and the scaled Laplace matrix is where λ max represents the maximum eigenvalue of the Laplace matrix, I n Represents the unit matrix, for the embedded features Graph convolution using Chebyshev polynomial approximation to obtain node features The formula is:
[0098]
[0099] in, express The jth channel, θ ij,k represents the learned weight, T k is a Chebyshev polynomial of order k, where k represents the highest order of the Chebyshev polynomial, k = 1,…,K;
[0100] Use the dynamic self-attention mechanism layer to extract spatial information and embed the features of each time step Projection based on Train three subspaces for each node and The formula is:
[0101]
[0102] in, Represents Q S , K S , V S The weight matrix, through Q S With K S Dynamic spatial dependencies between nodes in the dot product calculation Use the Softmax function to normalize the spatial dependence. Control the range of the dot product and make the node features Through the attention weight matrix S S To update, the formula is:
[0103]
[0104] A shared three-layer feedforward neural network and activation function are used to For node feature M S To update, the formula is:
[0105]
[0106] in, Represents the residual connection, W0, W1, W2 represent the parameter matrix of the three layers, U S Represents the spatial features after three layers of neural network and activation function;
[0107] A gating mechanism is used to fuse the spatial information obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer. The formula is:
[0108]
[0109] in, f S and Represents linear projection, respectively and Convert to a one-dimensional vector, Represents the spatial features obtained by the fixed graph convolution layer;
[0110] Through Y' S and X S Weighted with g to get the output Y S , the formula is:
[0111]
[0112] Where, output As the input of the time Informer.
[0113] Temporal Informer: This model uses a sparse self-attention mechanism to extract temporal information and capture long-term dependencies. Informer introduces an attention mechanism and a global feature capture mechanism to effectively capture long-term dependencies in sequences. Specifically, it includes:
[0114] Input features and time embedding D T Splicing G t represents a 1×1 convolutional layer that produces a dimensional vector, X′ T Represents the feature representation after time embedding;
[0115] The probabilistic sparse self-attention mechanism is used to model the temporal dependency and construct three latent subspaces, namely and The formula is:
[0116]
[0117] in, represents the input sequence, represents the weight matrix;
[0118] Traditional self-attention machines use dot-product to calculate time dependencies. Based on the Transformer model, Informer proposed ProbSparse Self-attention, where each key vector only processes a limited number of dominant query vectors, significantly reducing the number of query vectors processed and effectively reducing the time and space complexity of the calculation. In long-term series prediction, Q T It is sparse, which means that there is redundant computation in the original self-attention calculation.
[0119] The initial self-attention mechanism modeling formula is:
[0120]
[0121] Where, q i represents the i-th query vector, k j represents the j-th key vector, v jrepresents the j-th value vector, Indicates that given a query vector q i Under the condition of j The associated value vector v j Calculate;
[0122] The probability sparsity criterion measures p(k j |q i ) and uniform distribution Gap, where L k Indicates Q T The greater the difference between the two distributions, the greater the KL divergence. The KL formula is:
[0123]
[0124] After removing the constant, the sparsity measure is as follows:
[0125]
[0126] However, the above formula is computationally intensive. To reduce the computational complexity, the sparsity measure can be approximately simplified to the following formula:
[0127]
[0128] Where K represents the bond matrix, represents the embedding dimension, is the dot product of the query vector and the key vector, which is used to measure the similarity between them;
[0129] The filtered sparse matrix is calculated according to the sparsity measurement formula According to the sparse matrix The temporal attention is calculated as follows:
[0130]
[0131] The multi-head probabilistic sparse self-attention mechanism can lead to redundancy in feature mapping. Therefore, the Informer model introduces a distillation mechanism to assign higher weights to the data features of important nodes, which helps to extract more key features in the next layer. The distillation mechanism uses one-dimensional convolution and maximum pooling to downsample the time dimension of the input. The formula is as follows:
[0132] Y T =MaxPool(ELU(Conv(S T )));
[0133] In the formula, MaxPool represents the selection of the maximum value within a fixed receptive field and generates a new matrix with reduced dimension, ELU represents the activation function, and Y TRepresents the output after the distillation mechanism.
[0134] Capturing dynamic spatiotemporal dependencies by stacking spatiotemporal Transformer-Informer modules to form a spatiotemporal layer involves: integrating the spatial Transformer module with the temporal Informer module through residual connections to form a spatiotemporal module with spatiotemporal feature processing capabilities; subsequently, stacking spatiotemporal Transformer-Informer modules increases the depth of the neural network to form a spatiotemporal layer that can efficiently capture spatiotemporal dependencies. The specific steps are:
[0135] In the lth spatiotemporal module, the spatial Transformer module is and extract spatial features from the adjacency matrix And as the input of time Informer, the input of time Informer Depend on and Combined, the formula is:
[0136]
[0137] Among them, the input of the lth spatiotemporal module is the output of the l-1th spatiotemporal module, is the output of the temporal Informer module. The spatiotemporal layer consists of multiple spatiotemporal modules, which effectively capture the global spatiotemporal features by increasing the depth of the neural network. After processing by the spatiotemporal layer, the obtained feature representation is
[0138] Prediction layer: Use two 1×1 convolutional layers to make predictions based on the spatiotemporal features output by the last spatiotemporal module to obtain the roadside parking space occupancy prediction results.
[0139] Prediction based on the spatiotemporal features output by the last spatiotemporal module includes: the input of the last spatiotemporal module is the output d of the N nodes at the last time step ST dimensional space-time characteristics Through N nodes, multi-step prediction of the future T traffic conditions is performed to obtain the prediction results The formula is
[0140] Y=Conv(Conv(X ST )).
[0141] To verify the effectiveness of the proposed method, we compared it with nine baseline models, including HA, ARIMA, LSTM, GRU, Informer, T-GCN, STGCN, GraphWavenet, and STTN. The results are shown in Table 5. As can be seen from Table 5, the proposed method showed the highest prediction accuracy in 5-minute, 15-minute, 30-minute, and 60-minute predictions.
[0142] Table 5 Comparison results between the proposed method and the baseline model at different prediction times
[0143]
[0144] Therefore, the present invention adopts the above-mentioned spatiotemporal prediction method of roadside parking space occupancy rate integrating sparse self-attention, which fully considers the temporal and spatial correlation of parking demand, and realizes the accurate prediction of roadside parking space occupancy rate. By predicting the occupancy of parking spaces, urban traffic management departments can better carry out parking guidance and parking management, further improve the efficiency of parking space utilization, and provide citizens with a more convenient parking experience.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention, characterized by the following steps: include: S1. Obtain historical parking data, pre-process the historical parking data, and count the number of parking spaces in different time periods based on the entry and exit times of individual vehicles in each roadside parking area. Calculate the parking occupancy rate for each parking area in different time periods based on the counted number of parking spaces and the total number of parking spaces in each parking area, thereby obtaining a parking occupancy rate dataset. S2. Treat the urban berth area network as a weighted directed graph , construct the adjacency matrix of the graph; Among them, the weighted directed graph ,in is a set of vertices, is the set of edges, Is the adjacency matrix of the graph. Constructing the adjacency matrix of the graph includes: S21. Accessing a map API to obtain the longitude and latitude of the roadside parking area, calculating the driving distance between each roadside parking area based on the longitude and latitude of the roadside parking area, and generating a distance matrix; S22. Based on the generated distance matrix, apply a Gaussian kernel function to each element of the distance matrix to convert the distance into similarity. The Gaussian kernel form is: ; in, represents the distance between two points in the distance matrix, The bandwidth parameter of the Gaussian kernel is determined by the global standard deviation. The Gaussian kernel gives higher weights to points that are closer to each other. S3. Construct a parking space occupancy rate prediction model, input the information obtained in step S1 and step S2, and perform parking space occupancy rate prediction based on the parking space occupancy rate prediction model to obtain a roadside parking space occupancy rate prediction result; Among them, the parking space occupancy rate prediction model includes: Input layer: Use the convolution layer to aggregate the input data and expand the data channel dimension; Spatiotemporal layer: This layer includes spatial transformers and temporal informers. It is constructed by stacking spatiotemporal transformer-informer modules to capture dynamic spatiotemporal dependencies. Spatial Transformer: It uses a spatiotemporal position embedding layer, a fixed graph convolution layer, and a dynamic self-attention mechanism layer to extract spatial information, and uses a gating mechanism to fuse the spatial features obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer; Time Informer: Extracts time information using the Time Informer model based on the sparse self-attention mechanism; Prediction layer: Use two convolutional layers to make predictions based on the spatiotemporal features output by the last spatiotemporal module to obtain the roadside parking space occupancy prediction results.
2. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 1 is characterized by: The convolutional layer input of the input layer is , the dimension is , , ,in, Indicates height, Indicates width, represents the set of real numbers, Indicates the number of channels. After the convolution operation, is mapped to , Indicates the number of output channels.
3. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 2 is characterized in that: The method of extracting spatial information by using a spatiotemporal position embedding layer, a fixed graph convolution layer, and a dynamic self-attention mechanism layer, and fusing spatial features obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer by using a gating mechanism specifically includes: After the input layer features are aggregated, the spatiotemporal position embedding layer is used to Perform spatiotemporal position embedding, where the spatial and temporal position embeddings are and , considering the connectivity and distance factors between nodes, the graph adjacency matrix is initialized , tiled along the spatial axis and time axis, we get and , and with Connect and get the embedded features, expressed as , represents the convolutional layer; Use fixed graph convolutional layers to extract the adjacency matrix and Extract spatial features from the graph The degree matrix The diagonal elements of , the symmetric normalized Laplacian matrix Defined as , scale the Laplace matrix, and the scaled Laplace matrix is ,in represents the largest eigenvalue of the Laplacian matrix, Represents the unit matrix, for the embedded features , node features are obtained using graph convolution approximated by Chebyshev polynomials , the formula is: ; in, express No. channels, represents the learned weights, Yes Chebyshev polynomials of order , represents the highest order of Chebyshev polynomials, ; Use the dynamic self-attention mechanism layer to extract spatial information and embed the features of each time step Projection based on Train three subspaces for each node , and , the formula is: ; in, , , Respectively , , The weight matrix of and Dynamic spatial dependencies between nodes in the dot product calculation , use the Softmax function to normalize the spatial dependence, Indicates the range of control dot product, the node features Through the attention weight matrix To update, the formula is: ; ; A shared three-layer feedforward neural network and activation function are used to Node Features To update, the formula is: ; in, represents the residual connection, 、 , represents the parameter matrix of the three layers, Represents the spatial features after three layers of neural network and activation function; A gating mechanism is used to fuse the spatial information obtained from the fixed graph convolution layer and the dynamic self-attention mechanism layer. The formula is: ; in, , and Represents linear projection, respectively and Convert to a one-dimensional vector, Represents the spatial features obtained by the fixed graph convolution layer; pass and and Weighted output , the formula is: ; Where, output , as the input of the time Informer.
4. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 3 is characterized in that: Extracting temporal information using the time Informer model based on the sparse self-attention mechanism includes: Input features Embedded with time Splicing , represents a 1×1 convolutional layer that produces a dimensional vector, Represents the feature representation after time embedding; The probabilistic sparse self-attention mechanism is used to model the temporal dependency and construct three latent subspaces, namely 、 and , the formula is: ; in, represents the input sequence, , , represents the weight matrix; The modeling formula of the self-attention mechanism is: ; Where, , , Indicates the query vectors, Indicates the key vectors, Indicates the A vector of values, Indicates that given a query vector Under the condition of Related value vector Calculate; Probabilistic sparsity criterion measurement and uniform distribution The gap, express The length of , the sparsity measurement formula is: ; Where, K represents the bond matrix, represents the embedding dimension, is the dot product of the query vector and the key vector, which is used to measure the similarity between them; The filtered sparse matrix is calculated according to the sparsity measurement formula , according to the sparse matrix The temporal attention is calculated as follows: ; The distillation mechanism is introduced to give higher weights to the data features of important nodes of temporal attention. The formula is: ; Where, Indicates selecting the maximum value within a fixed receptive field and generating a new matrix with reduced dimension. represents the activation function, Represents the output after the distillation mechanism.
5. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 4 is characterized by: The method of forming a spatiotemporal layer by stacking spatiotemporal Transformer-Informer modules to capture dynamic spatiotemporal dependencies includes: integrating the spatial Transformer module and the temporal Informer module through residual connections to form a spatiotemporal module with spatiotemporal feature processing capabilities; then, increasing the depth of the neural network by stacking spatiotemporal Transformer-Informer modules to form a spatiotemporal layer that can capture spatiotemporal dependencies.
6. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 5 is characterized by: The process of capturing spatiotemporal dependencies in the spatiotemporal layer includes: In the spatiotemporal modules, the spatial Transformer module is and extract spatial features from the adjacency matrix , Indicates the The output of the spatiotemporal module, the temporal informer combines spatial features and input features , the formula is: ; Where, Represents the output of the time Informer module; The spatiotemporal layer includes multiple spatiotemporal modules. After processing by the spatiotemporal layer, the feature representation is .
7. The spatiotemporal prediction method for roadside parking space occupancy rate integrating sparse self-attention according to claim 6 is characterized in that: The prediction based on the spatiotemporal features output by the last spatiotemporal module includes: the input of the last spatiotemporal module is the last time step The output of the node dimensional space-time characteristics ,pass Nodes for the future Traffic conditions are predicted in multiple steps to obtain the prediction results , the formula is: 。
Citation Information
Patent Citations
Highway traffic flow prediction method based on Transform and graph attention network
CN116092294A
Multi-dimensional roadside parking abnormal occupation identification method and device
CN116720114A