Peak shifting parking management system based on deep learning
Through deep learning technology, especially the Transformer model and hybrid loss function, combined with the self-attention mechanism, the problem of low prediction accuracy of intelligent parking management system during peak hours is solved, and more accurate and efficient parking resource management is achieved, and urban traffic is alleviated. Congestion.
Patent Information
- Application Number
- CN202411069754.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-06
AI Technical Summary
When the existing intelligent parking management system processes large-scale and complex parking data, the prediction accuracy is not high and the processing speed is slow, especially during peak hours, it is difficult to effectively deal with the dynamics and uncertainties of parking demand.
Using a deep learning-based peak-staggered parking management system, the vehicle data is collected and preprocessed through the data acquisition module, the Transformer model is used for prediction, the data is trained in combination with the feature vectors and label data, the model performance is optimized by the mixed loss function, and the model is optimized through The self-attention mechanism calculates the correlation to dynamically adjust the parking space allocation strategy.
It improves the accuracy and efficiency of parking demand forecasts, can manage parking resources more effectively, alleviate urban traffic congestion problems, and provides scientific traffic management policy support.
Smart Images

Figure CN119028167A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of parking management, and in particular to a peak-shifting parking management system based on deep learning. Background Art
[0002] With the acceleration of urbanization, the number of vehicles in cities has increased dramatically, and the problem of parking difficulties has become increasingly prominent. Traditional parking management systems mainly rely on manual management and simple automation technology, which cannot effectively cope with parking demand during peak hours, resulting in uneven allocation of parking space resources and poor parking experience for car owners. In recent years, with the rapid development of artificial intelligence and big data technology, intelligent parking management systems based on deep learning have gradually become an important direction for solving the problem of parking difficulties.
[0003] Most existing intelligent parking management systems use traditional machine learning algorithms, such as support vector machines (SVM), decision trees, and random forests. However, these algorithms have defects such as low prediction accuracy and slow processing speed when processing large-scale and complex parking data. Especially during peak hours, parking demand is highly dynamic and uncertain, and traditional algorithms are difficult to effectively respond to it. This urgently requires technicians in this field to solve the corresponding technical problems. Summary of the invention
[0004] The present invention aims to at least solve the technical problems existing in the prior art, and in particular innovatively proposes a staggered parking management system based on deep learning.
[0005] In order to achieve the above-mentioned object of the present invention, the present invention provides a peak-shift parking management system based on deep learning, comprising:
[0006] The data acquisition module is used to obtain the corresponding data of each parking lot through the cloud, including license plate number, parking time, parking location, parking space utilization rate, fee, vehicle flow, traffic flow and user behavior data;
[0007] Through sensors and license plate recognition cameras in the parking lot, real-time collection of vehicle entry and exit records and parking space utilization rates is carried out. Historical parking data, including vehicle entry and exit times, parking duration, and parking locations, is imported from the parking lot management system. External data such as weather information, traffic conditions, and nearby activities are integrated to improve the accuracy of the prediction model.
[0008] Summarize each vehicle data into a vector,
[0009] Parking time x i1 ,
[0010] Parking fee x i2 ,
[0011] Parking space utilization rate x i3 ,
[0012] Traffic volume x i4 ,
[0013] Traffic flow x i5 ,
[0014] License plate number i1 ,
[0015] Parking location i2 ,
[0016] Vehicle entry and exit time n i3 ,
[0017] Weather Information i4 .
[0018] The model input is the vehicle data vector X i , which contains all the features:
[0019] X i =[x i1 ,x i2 ,x i3 ,x i4 ,x i5 ,n i1 ,n i2 ,n i3 ,n i4 ];
[0020] Among them, each i represents a separate vehicle data, X1~X N The matrix composed represents the vehicle data of N vehicles.
[0021] The difference between the above-mentioned vehicle flow and traffic flow is that the vehicle flow is the flow of cars passing through per unit time, while the traffic flow is the flow of all vehicles passing through per unit time.
[0022] The data preprocessing module is used to fill in the missing values in the vehicle data, so as to effectively process the missing values and standardize the vehicle data;
[0023] Clean up the noise, errors and missing values in the data to ensure the accuracy and completeness of the data, including data with numerical features, such as parking time x i1 , parking fee x i2 , Parking space utilization rate x i3 The missing values are filled with the median;
[0024] x NAN1 =median(x 11 ,x 21 ,x 31 ,......,x N1 )
[0025] x NAN2 =median(x 12 ,x 22 ,x 32 ,......,x N2 )
[0026] x NAN3 =median(x 13 ,x 23 ,x 33 ,......,x N3 )
[0027] where x NAN1 、x NAN2 and x NAN3 Respectively represent the parking time x i1 , parking fee x i2 and parking space utilization rate x i3 For missing values, median() represents the median calculation.
[0028] When obtaining data on parking duration, parking fees, and parking space utilization, deleting missing values will result in information loss, especially when the missing values account for a large proportion or the distribution of missing values is not random. Using median filling can retain the information in the original data while effectively handling missing values, thereby avoiding the impact of information loss on model training results, maintaining the stability and consistency of data distribution, and reducing the impact of data bias.
[0029] For traffic volume x i4 and traffic flow x i5 The missing values are interpolated linearly using the interpolation method;
[0030]
[0031] where x NAN4 and x NAN5 Represents the traffic volume x i4 and traffic flow x i5 The missing value of x prev4 and x next4 They represent the antecedent and posterior terms of the missing values of traffic flow, respectively, and x prev5 and x next5 They represent the antecedent and posterior terms of the missing values of traffic flow,
[0032] Median filling is more suitable for situations where the data distribution is relatively concentrated and there are many outliers. For data with obvious time trends and periodicity such as traffic flow and vehicle flow, linear interpolation is more appropriate. Compared with the smoother processing method of median filling, linear interpolation can capture subtle changes in the data more finely.
[0033] Extract features from the original data to construct feature vectors.
[0034] Label data, license plate number n i1 and parking location n i2 Use label encoding;
[0035] Use sine and cosine functions to calculate the vehicle entry and exit time n i3 Perform periodic encoding to retain the periodic characteristics of time.
[0036] n i3 =[Hour sin ,Hour cos ]
[0037]
[0038] For weather information i4 , one-hot encoding is used for encoding.
[0039] OneHot(Sunny)=[1,0,0]
[0040] OneHot(rainy day)=[0,1,0]
[0041] OneHot(snow)=[0,0,1]
[0042] Hour is the hour part of the current time. sin ,Hour cos ] represents periodic coding, mapping 0 to 23 hours to the range of 0 to 2π, and calculating the result through sin and cos functions. OneHot() represents one-hot coding, converting weather type information into one-hot vector representation;
[0043] License plate number i1 and parking location n i2 The data structure is numbered, vehicle entry and exit time n i3 and weather information i4 The data structures are 2-dimensional vectors and 3-dimensional vectors respectively.
[0044] By respectively i1 , parking fee x i2 , Parking space utilization rate x i3 、Traffic flow x i4 、Traffic flow x i5 Use Z-score standardization to make the data have a uniform scale and improve the model training effect.
[0045]
[0046] Among them, z i1 Is the parking time x i1 The standardized result of μ1 is the parking time x i1 The mean of i1 The standard deviation of i2 Is the parking fee x i2 The standardized result of μ2 is the parking cost x i2 The mean of i2 The standard deviation of i3 is the parking space utilization rate x i3 The standardized result of μ3 is the parking space utilization rate x i3 The mean of σ3 is the parking space utilization rate x i3 The standard deviation of i4 is the traffic volume x i4 The standardized result of μ4 is the traffic flow x i4 The mean of i4 The standard deviation of i5 is the traffic volume x i5 The standardized result of μ5 is the traffic flow x i5 The mean of σ5 is the traffic flow x i5 The standard deviation of .
[0047] Among them, the mean μ j and standard deviation σ j (j takes values of 1, 2, 3, 4, 5) and is calculated as follows:
[0048]
[0049] x ij Represents the jth data feature of the i-th vehicle.
[0050] The model training module is used to use the Transformer model as a deep learning model to take advantage of its advantages in processing time series data.
[0051] Based on the data set and task requirements, define the specific architecture of the Transformer model, the number of attention heads, the embedding dimension, and the dimension of the feedforward neural network.
[0052] The preprocessed data set is divided into training set, validation set and test set to ensure the effectiveness of model training.
[0053] The dataset is divided into 70% training set, 15% validation set and 15% test set according to the ratio.
[0054] Use the training set data to train the Transformer model, adjust model parameters, and optimize model performance.
[0055] The pre-processed vehicle data will be standardized using the Z-score, and the parking time z i1 , Parking fee i2 , Parking space utilization rate i3 、Traffic flow i4 、Traffic flow i5 , license plate number n i1 、Parking location n i2 ; and vehicle entry and exit time n i3 、Weather information i4 Integrate into vehicle data vector Z i , multiple vehicle data vectors Z1, Z2, ..., Z i , …, Z N , combined into the vehicle data feature matrix Z,
[0056] Z i =[z i1 ,z i2 ,z i3 ,z i4 ,z i5 ,n i1 ,n i2 ,n i3 ,n i4 ]
[0057]
[0058] The vehicle data feature matrix Z is input into the transformer model for training and prediction.
[0059]
[0060] in represents the predicted parking demand result, is a (N×M) matrix;
[0061]
[0062] The loss and evaluation index on the validation set are calculated by the mixed loss function. The formula of the mixed loss function is:
[0063]
[0064] Among them, α is the mean square error weight coefficient, β is the mean absolute error, γ is the mean absolute percentage error weight coefficient, and y i,j Represents the true value of the jth feature of the i-th sample. Represents the predicted value of the jth feature of the i-th sample.
[0065] MSE is Mean Squared Error.
[0066]
[0067] MAE is the Mean Absolute Error.
[0068]
[0069] MAPE is the Mean Absolute Percentage Error
[0070]
[0071] The weight coefficients α, β, and γ are calculated as follows: the dynamic adjustment based on the loss value and the dynamic adjustment based on the training stage are combined into a composite dynamic adjustment method.
[0072]
[0073] Among them, L MSE , L MAE and L MAPE They are the loss values of MSE, MAE and MAPE in the current training step, and the weights are dynamically adjusted based on the loss values.
[0074] Among them, α0, β0 and γ0 are the initial setting values of the α mean square error weight coefficient, β mean absolute error, and γ mean absolute percentage error weight coefficient, respectively. t is the current training step number, and T is the total training step number.
[0075] Dynamic adjustment of practical initial setting values helps the model gradually focus on different error indicators during training, thereby optimizing the prediction performance more comprehensively. α0, β0, and γ0 as initial setting values provide a starting point for model training and improve the generalization ability of the model.
[0076] These initial setting values can be flexibly adjusted according to the specific prediction tasks and data set characteristics.
[0077] The Transformer model is used as the prediction model.
[0078] Define the input features of the model, including parking duration, parking fee, parking space utilization rate, vehicle volume, traffic flow, license plate number (encoded), parking location (encoded), vehicle entry and exit time, and weather information.
[0079] Define the output of the model, which is the predicted off-peak parking data.
[0080] Loss function definition:
[0081] Using a hybrid loss function
[0082] Initialize α0, β0, and γ0 to specific values, for example, α0=0.5, β0=0.3, and γ0=0.2.
[0083] Use the training set to train the model and dynamically adjust α, β, and γ according to the number of training steps t and the total number of training steps T.
[0084] Verify the performance of the model on the validation set and adjust hyperparameters as needed.
[0085] Use the test set to evaluate the performance of the model, and calculate MSE, MAE, MAPE and other related indicators to compare the performance differences of the models under different weights and initial setting values.
[0086] The hybrid loss function combines the mean square error (MSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) to optimize the accuracy of model predictions from multiple perspectives. When training the Transformer model for vehicle data prediction, the mean square error (MSE) gives a greater penalty for larger errors, thus helping the model reduce large prediction errors. This makes the model more focused on reducing predictions that deviate significantly from the true value.
[0087] Mean absolute error (MAE) is less sensitive to outliers than MSE because it does not square the error. It helps the model maintain stability when making predictions, especially when facing noise or outliers in the data. Mean absolute percentage error (MAPE) is a relative error metric that is sensitive to the size of the predicted value and helps the model maintain accuracy when dealing with predicted values of different sizes.
[0088] For the training results Update model parameters through backpropagation with dynamic learning rate
[0089]
[0090] Among them, θ t is the current model parameter, θ t+1 are the model parameters for the next stage, is the gradient of the mixed loss function L with respect to the initial parameter θ,
[0091] is the calculation method of learning rate, η0e -λt is the change of learning rate with the number of training steps, ε is a constant to prevent the denominator from being 0, η0 is the initial setting value of the learning rate, λ is the decay rate, t is the current number of training steps, is the historical accumulation of gradients, θτ are the model parameters at the τth training step.
[0092] The model parameters θ are adjusted by the gradient of the loss function, and the learning rate It gradually decreases as the number of training steps increases, which helps the model to converge stably in the later stages of training.
[0093] Simultaneous learning rate As the historical gradients accumulate and change, the learning rate of frequently updated parameters decreases, while the learning rate of less frequently updated parameters increases. The hybrid update method of learning rate is used to achieve adaptive adjustment of model parameters.
[0094] The validation set data is used to validate the model and evaluate the prediction accuracy and generalization ability of the model.
[0095] Use the redefined dynamic learning rate formula For the training set of staggered parking, the learning rate is dynamically adjusted with the number of training steps t. It is larger in the early stage for rapid convergence and smaller in the later stage for fine adjustment, which helps to improve the training efficiency. The adjustment can prevent instability caused by excessive learning rate. The learning rate of each parameter varies according to its gradient history, which helps the model to adapt to the learning needs of different features more flexibly.
[0096] The demand forecasting module is used to input real-time data into the model, and the self-attention mechanism calculates the correlation between each time point. In the self-attention mechanism,
[0097] The vehicle data matrix X is formed N The dimensions are (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of obtaining vehicle data features, d model is the vehicle base dimension.
[0098] Among them, W Q , W K and W V is the parameter weight matrix that needs to be updated, W Q , W K and W V The dimension is (d model , d k ), d model is the vehicle reference dimension, d k For each vehicle real-time dimension, subscript Q is the query matrix, subscript K is the key matrix, and subscript V is the value matrix;
[0099] Use back propagation to update the parameters and set the learning rate Simplified to η, W Q , W K and WV The update method is:
[0100]
[0101] η is the learning rate
[0102] Attention score calculation
[0103]
[0104] Where Z′ is the vehicle data matrix after training;
[0105] Demand forecast calculation, the model calculates based on the input data, and the multi-head attention mechanism captures information from multiple angles.
[0106] MultiHead(Q,K,V)=Concat(head1,...,head h )W O
[0107] in, is the weight of the i-th query matrix, is the weight of the ith bond matrix, is the weight of the i-th value matrix, Concat is the concatenation operation, h is the number of attention heads, and W O is the learnable weight matrix, W O The dimension is (h, d k , d model ).
[0108] The prediction result output is used to output the prediction result to the resource allocation module for dynamically adjusting the parking space allocation strategy and continuously iterating the training process until the transformer model converges.
[0109] Dynamically allocate parking resources according to predicted parking demand to achieve staggered parking management. Based on the information trained by the model, calculate the parking demand forecast results for future time periods, and dynamically adjust the allocation of parking spaces according to the predicted parking demand, increase parking spaces during peak hours, and reduce parking spaces during off-peak hours. In actual operation, sensors and monitoring equipment are used to monitor the use of parking lots in real time, and the allocation strategy is dynamically adjusted based on real-time data. Ensure the optimal use of parking resources and respond to emergencies and changes in demand.
[0110] The application of the peak parking prediction model improves the overall level of urban traffic management. By accurately predicting and recommending parking demand, urban parking resources can be managed more effectively to alleviate urban traffic congestion. It can provide more comprehensive and accurate traffic flow and parking demand data support for urban traffic management departments, helping to formulate more scientific and reasonable traffic management policies and measures.
[0111] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0112] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0113] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0114] Figure 1 It is an overall schematic diagram of the present invention. DETAILED DESCRIPTION
[0115] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0116] like Figure 1 As shown, the present invention discloses a peak-shift parking management system based on deep learning, comprising:
[0117] The data acquisition module is used to obtain the corresponding data of each parking lot through the cloud, including license plate number, parking time, parking location, parking space utilization rate, fee, vehicle flow, traffic flow and user behavior data;
[0118] Through sensors and license plate recognition cameras in the parking lot, real-time collection of vehicle entry and exit records and parking space utilization rates is carried out. Historical parking data, including vehicle entry and exit times, parking duration, and parking locations, is imported from the parking lot management system. External data such as weather information, traffic conditions, and nearby activities are integrated to improve the accuracy of the prediction model.
[0119] Summarize each vehicle data into a vector,
[0120] Parking time x i1 ,
[0121] Parking fee x i2 ,
[0122] Parking space utilization rate x i3 ,
[0123] Traffic volume x i4 ,
[0124] Traffic flow x i5 ,
[0125] License plate number i1 ,
[0126] Parking location i2 ,
[0127] Vehicle entry and exit time n i3 ,
[0128] Weather Information i4 .
[0129] The model input is the vehicle data vector X i , contains all features;
[0130] X i =[x i1 ,x i2 ,x i3 ,x i4 ,x i5 ,n i1 ,n i2 ,n i3 ,n i4 ];
[0131] Among them, each i represents a separate vehicle data, X1~X N The matrix composed represents the vehicle data of N vehicles.
[0132] The difference between the above-mentioned vehicle flow and traffic flow is that the vehicle flow is the flow of cars passing through per unit time, while the traffic flow is the flow of all vehicles passing through per unit time.
[0133] The data preprocessing module is used to fill in the missing values in the vehicle data, so as to effectively process the missing values and standardize the vehicle data;
[0134] Clean up the noise, errors and missing values in the data to ensure the accuracy and completeness of the data, including data with numerical features, such as parking time x i1 , parking fee x i2 , Parking space utilization rate x i3 The missing values are filled with the median;
[0135] xNAN1 =median(x 11 ,x 21 ,x 31 ,......,x N1 )
[0136] x NAN2 =median(x 12 ,x 22 ,x 32 ,......,x N2 )
[0137] x NAN3 =median(x 13 ,x 23 ,x 33 ,......,x N3 )
[0138] where x NAN1 、x NAN2 and x NAN3 Respectively represent the parking time x i1 , parking fee x i2 and parking space utilization rate x i3 For missing values, median() represents the median calculation.
[0139] When obtaining data on parking duration, parking fees, and parking space utilization, deleting missing values will result in information loss, especially when the missing values account for a large proportion or the distribution of missing values is not random. Using median filling can retain the information in the original data while effectively handling missing values, thereby avoiding the impact of information loss on model training results, maintaining the stability and consistency of data distribution, and reducing the impact of data bias.
[0140] For traffic volume x i4 and traffic flow x i5 The missing values are interpolated linearly using the interpolation method;
[0141]
[0142] where x NAN4 and x NAN5 Represents the traffic volume x i4 and traffic flow x i5 The missing value of x prev4 and x next4 They represent the antecedent and posterior terms of the missing values of traffic flow, respectively, and x prev5 and x next5 They represent the antecedent and posterior terms of the missing values of traffic flow,
[0143] Median filling is more suitable for cases where the data distribution is relatively concentrated and there are many outliers. For data such as traffic flow and vehicle flow that have obvious time trends and periodicity, linear interpolation is more appropriate. Compared with the relatively smooth processing method of median filling, linear interpolation can capture subtle changes in the data more precisely.
[0144] Extract features from the original data to construct feature vectors.
[0145] Label data, license plate number n i1 and parking location n i2 Adopt label encoding;
[0146] License plate number Label = g
[0147] Vehicle parking location Label = p
[0148] For example: Label(Beijing A99999) = 1
[0149] Label(Chongqing A012345) = 5
[0150] Label(Parking space No. 56) = 56
[0151] Use the sine function and cosine function to perform periodic encoding on the vehicle entry and exit time n i3 to retain the periodic characteristics of time,
[0152] n i3 = [Hour sin , Hour cos
[0153]
[0154] For weather information n i4 , adopt one-hot encoding for processing,
[0155] OneHot(Sunny) = [1, 0, 0]
[0156] OneHot(Rainy) = [0, 1, 0]
[0157] OneHot(Snowy) = [0, 0, 1]
[0158] Hour is the hour part of the current time, [Hour sin , Hour cos represents periodic encoding, mapping 0 to 23 hours to the range of 0 to 2π, calculating the results through sin and cos functions, OneHot() represents one-hot encoding, and converting weather type information into one-hot vector representation;
[0159] License plate number ni1 and parking location n i2 The data structure is numbered, vehicle entry and exit time n i3 and weather information i4 The data structures are 2-dimensional vectors and 3-dimensional vectors respectively.
[0160] By respectively i1 , parking fee x i2 , Parking space utilization rate x i3 、Traffic flow x i4 、Traffic flow x i5 Use Z-score standardization to make the data have a uniform scale and improve the model training effect.
[0161]
[0162]
[0163] Among them, z i1 Is the parking time x i1 The standardized result of μ1 is the parking time x i1 The mean of i1 The standard deviation of i2 Is the parking fee x i2 The standardized result of μ2 is the parking cost x i2 The mean of i2 The standard deviation of i3 is the parking space utilization rate x i3 The standardized result of μ3 is the parking space utilization rate x i3 The mean of σ3 is the parking space utilization rate x i3 The standard deviation of i4 is the traffic volume x i4 The standardized result of μ4 is the traffic flow x i4 The mean of i4 The standard deviation of i5 is the traffic volume x i5 The standardized result of μ5 is the traffic flow x i5 The mean of σ5 is the traffic flow x i5 The standard deviation of .
[0164] Among them, the mean μ j and standard deviation σ j (j takes values of 1, 2, 3, 4, 5) and is calculated as follows:
[0165]
[0166] x ij Represents the jth data feature of the i-th vehicle.
[0167] The model training module is used to use the Transformer model as a deep learning model to take advantage of its advantages in processing time series data.
[0168] Based on the data set and task requirements, define the specific architecture of the Transformer model, the number of attention heads, the embedding dimension, and the dimension of the feedforward neural network.
[0169] The preprocessed data set is divided into training set, validation set and test set to ensure the effectiveness of model training.
[0170] The dataset is divided into 70% training set, 15% validation set and 15% test set according to the ratio.
[0171] Use the training set data to train the Transformer model, adjust model parameters, and optimize model performance.
[0172] The pre-processed vehicle data will be standardized using the Z-score, and the parking time z i1 , Parking fee i2 , Parking space utilization rate i3 、Traffic flow i4 、Traffic flow i5 , license plate number n i1 、Parking location n i2 ; and vehicle entry and exit time n i3 、Weather information i4 Integrate into vehicle data vector Z i , multiple vehicle data vectors Z1, Z2, ..., Z i , …, Z N , combined into the vehicle data feature matrix Z,
[0173] Z i =[z i1 ,z i2 ,z i3 ,z i4 ,z i5 ,n i1 ,n i2 ,n i3 ,n i4 ]
[0174]
[0175] The vehicle data feature matrix Z is input into the transformer model for training and prediction.
[0176]
[0177] in represents the predicted parking demand result, is a (N×M) matrix;
[0178]
[0179] The loss and evaluation index on the validation set are calculated by the mixed loss function. The formula of the mixed loss function is:
[0180]
[0181] Among them, α is the mean square error weight coefficient, β is the mean absolute error, γ is the mean absolute percentage error weight coefficient, and y i,j Represents the true value of the jth feature of the i-th sample. Represents the predicted value of the jth feature of the i-th sample.
[0182] MSE is Mean Squared Error.
[0183]
[0184] MAE is the Mean Absolute Error.
[0185]
[0186] MAPE is the Mean Absolute Percentage Error
[0187]
[0188] The weight coefficients α, β, and γ are calculated as follows: the dynamic adjustment based on the loss value and the dynamic adjustment based on the training stage are combined into a composite dynamic adjustment method.
[0189]
[0190] Among them, L MSE , L MAE and L MAPE They are the loss values of MSE, MAE and MAPE in the current training step, and the weights are dynamically adjusted based on the loss values.
[0191] Among them, α0, β0 and γ0 are the initial setting values of the α mean square error weight coefficient, β mean absolute error, and γ mean absolute percentage error weight coefficient, respectively. t is the current training step number, and T is the total training step number.
[0192] Dynamic adjustment of practical initial setting values helps the model gradually focus on different error indicators during training, thereby optimizing the prediction performance more comprehensively. α0, β0, and γ0 as initial setting values provide a starting point for model training and improve the generalization ability of the model.
[0193] These initial setting values can be flexibly adjusted according to the specific prediction tasks and data set characteristics.
[0194] The Transformer model is used as the prediction model.
[0195] Define the input features of the model, including parking duration, parking fee, parking space utilization rate, vehicle volume, traffic flow, license plate number (encoded), parking location (encoded), vehicle entry and exit time, and weather information.
[0196] Define the output of the model, which is the predicted off-peak parking data.
[0197] Loss function definition:
[0198] Using a hybrid loss function
[0199] Initialize α0, β0, and γ0 to specific values, for example, α0=0.5, β0=0.3, and γ0=0.2.
[0200] Use the training set to train the model and dynamically adjust α, β, and γ according to the number of training steps t and the total number of training steps T.
[0201] Verify the performance of the model on the validation set and adjust hyperparameters as needed.
[0202] Use the test set to evaluate the performance of the model, and calculate MSE, MAE, MAPE and other related indicators to compare the performance differences of the models under different weights and initial setting values.
[0203] Record some experimental results:
[0204] Experiment 1 (benchmark experiment): α0=0.5, β0=0.3, γ0=0.2
[0205] MSE=100,MAE=20,MAPE=5%,Precision=80%,Recall=75%
[0206] Experiment 2 (increasing MSE weight): α0=0.7, β0=0.2, γ0=0.1
[0207] MSE=80,MAE=25,MAPE=6%,Precision=82%,Recall=74%
[0208] Experiment 3 (increasing MAE weight): α0=0.3, β0=0.5, γ0=0.2
[0209] MSE=120,MAE=18,MAPE=5%,Precision=79%,Recall=76%
[0210] Experiment 4 (balanced weights): α0 = 0.33, β0 = 0.33, γ0 = 0.34
[0211] MSE=105,MAE=21,MAPE=4%,Precision=81%,Recall=77%
[0212] Experiment 1: As a benchmark experiment, the model achieved relatively balanced performance on multiple indicators.
[0213] Experiment 2: After increasing the weight of MSE, the MSE of the model decreased, but MAE and MAPE increased slightly. At the same time, the accuracy increased, but the recall decreased slightly. This shows that the model is more focused on reducing large prediction errors, but may sacrifice some absolute error and relative error performance.
[0214] Experiment 3: After increasing the weight of MAE, the MAE of the model decreased, but the MSE and MAPE increased slightly. The accuracy decreased slightly, but the recall rate increased. This shows that the model is more focused on reducing the absolute error, but may sacrifice some square error and relative error performance.
[0215] Experiment 4: With balanced weights, the model achieved relatively good performance in multiple indicators, especially MAPE and recall rate.
[0216] The hybrid loss function combines the mean square error (MSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) to optimize the accuracy of model predictions from multiple perspectives. When training the Transformer model for vehicle data prediction, the mean square error (MSE) gives a greater penalty for larger errors, thus helping the model reduce large prediction errors. This makes the model more focused on reducing predictions that deviate significantly from the true value.
[0217] Mean absolute error (MAE) is less sensitive to outliers than MSE because it does not square the error. It helps the model maintain stability when making predictions, especially when facing noise or outliers in the data. Mean absolute percentage error (MAPE) is a relative error metric that is sensitive to the size of the predicted value and helps the model maintain accuracy when dealing with predicted values of different sizes.
[0218] For the training results Update model parameters through backpropagation with dynamic learning rate
[0219]
[0220] Among them, θ t is the current model parameter, θ t+1 are the model parameters for the next stage, is the gradient of the mixed loss function L with respect to the initial parameter θ,
[0221] is the calculation method of learning rate, η0e -λt is the change of learning rate with the number of training steps, ε is a constant to prevent the denominator from being 0, η0 is the initial setting value of the learning rate, λ is the decay rate, t is the current number of training steps, is the historical accumulation of gradients, θ τ are the model parameters at the τth training step.
[0222] The model parameters θ are adjusted by the gradient of the loss function, and the learning rate It gradually decreases as the number of training steps increases, which helps the model to converge stably in the later stages of training.
[0223] Simultaneous learning rate As the historical gradients accumulate and change, the learning rate of frequently updated parameters decreases, while the learning rate of less frequently updated parameters increases. The hybrid update method of learning rate is used to achieve adaptive adjustment of model parameters.
[0224] The validation set data is used to validate the model and evaluate the prediction accuracy and generalization ability of the model.
[0225] Use the redefined dynamic learning rate formula For the training set of staggered parking, the learning rate is dynamically adjusted with the number of training steps t. It is larger in the early stage for rapid convergence and smaller in the later stage for fine adjustment, which helps to improve the training efficiency. The adjustment can prevent instability caused by excessive learning rate. The learning rate of each parameter varies according to its gradient history, which helps the model to adapt to the learning needs of different features more flexibly.
[0226] The demand forecasting module is used to input real-time data into the model, and the self-attention mechanism calculates the correlation between each time point. In the self-attention mechanism,
[0227] The vehicle data matrix X is formed N The dimensions are (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of obtaining vehicle data features, d model is the vehicle base dimension.
[0228] Among them, W Q , W K and WV is the parameter weight matrix that needs to be updated, W Q , W K and W V The dimension is (d model , d k ), d model is the vehicle reference dimension, d k For each vehicle real-time dimension, subscript Q is the query matrix, subscript K is the key matrix, and subscript V is the value matrix;
[0229] Use back propagation to update the parameters and set the learning rate Simplified to η, W Q , W K and W V The update method is:
[0230]
[0231]
[0232] η is the learning rate
[0233] Attention score calculation
[0234]
[0235] Where Z′ is the vehicle data matrix after training;
[0236] Demand forecast calculation, the model calculates based on the input data, and the multi-head attention mechanism captures information from multiple angles.
[0237] MultiHead(Q,K,V)=Concat(head1,...,head h )W O
[0238] in, is the weight of the i-th query matrix, is the weight of the ith bond matrix, is the weight of the i-th value matrix, Concat is the concatenation operation, h is the number of attention heads, and W O is the learnable weight matrix, W O The dimension is (h, d k , d model ).
[0239] The prediction result output is used to output the prediction result to the resource allocation module for dynamically adjusting the parking space allocation strategy and continuously iterating the training process until the transformer model converges.
[0240] Dynamically allocate parking resources according to predicted parking demand to achieve staggered parking management. Based on the information trained by the model, calculate the parking demand forecast results for future time periods, and dynamically adjust the allocation of parking spaces according to the predicted parking demand, increase parking spaces during peak hours, and reduce parking spaces during off-peak hours. In actual operation, sensors and monitoring equipment are used to monitor the use of parking lots in real time, and the allocation strategy is dynamically adjusted based on real-time data. Ensure the optimal use of parking resources and respond to emergencies and changes in demand.
[0241] The application of the peak parking prediction model improves the overall level of urban traffic management. By accurately predicting and recommending parking demand, urban parking resources can be managed more effectively to alleviate urban traffic congestion. It can provide more comprehensive and accurate traffic flow and parking demand data support for urban traffic management departments, helping to formulate more scientific and reasonable traffic management policies and measures.
[0242] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A peak-shift parking management system based on deep learning, characterized in that: include: The data acquisition module is used to obtain the corresponding data of each parking lot through the cloud and summarize the data of each vehicle into a vector; The data preprocessing module is used to fill in the missing values in the vehicle data, so as to effectively process the missing values and standardize the vehicle data; The model training module is used to use the Transformer model as a deep learning model, input the preprocessed vehicle data into the Transformer model and perform training; The demand forecasting module is used to input real-time data into the model to perform demand forecasting.
2. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The data acquisition module comprises: Summarize each vehicle data into a vector, Parking time x i1 , Parking fee x i2 , Parking space utilization rate x i3 , Traffic volume x i4 , Traffic flow x i5 , License plate number i1 , Parking location i2 , Vehicle entry and exit time n i3 , Weather Information i4 , Combine the above data into a vehicle data vector X i , which contains all the features: X i =[x i1 ,x i2 ,x i3 ,x i4 ,x i5 ,n i1 ,n i2 ,n i3 ,n i4 ]; Among them, each i represents a separate vehicle data, X1~X N The matrix composed represents the vehicle data of N vehicles.
3. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The data preprocessing module comprises: Clean the noise in the data, including data with numerical features, respectively for parking time x i1 , parking fee x i2 , Parking space utilization rate x i3 The missing values are filled with the median; x NAN1 =median(x 11 ,x 21 ,x 31 ,......,x N1 ) x NAN2 =median(x 12 ,x 22 ,x 32 ,......,x N2 ) x NAN3 =median(x 13 ,x 23 ,x 33 ,......,x N3 ) where x NAN1 、x NAN2 and x NAN3 Respectively represent the parking time x i1 , parking fee x i2 and parking space utilization rate x i3 For missing values, median() indicates median calculation; For traffic volume x i4 and traffic flow x i5 The missing values are interpolated linearly using the interpolation method; where x NAN4 and x NAN5 Represents the traffic volume x i4 and traffic flow x i5 The missing value of x prev4 and x next4 They represent the antecedent and posterior terms of the missing values of traffic flow, respectively, and x prev5 and x next5 They represent the antecedent and posterior terms of the missing values of traffic flow, respectively.
4. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The data preprocessing module also includes: Label data, license plate number n i1 and parking location n i2 Use label encoding; Use sine and cosine functions to calculate the vehicle entry and exit time n i3 Perform periodic encoding to retain the periodic characteristics of time. n i3 =[Hour sin ,Hour cos ] For weather information i4 , one-hot encoding is used for encoding. OneHot(Sunny)=[1,0,0] OneHot(rainy day)=[0,1,0] OneHot(snow)=[0,0,1] Hour is the hour part of the current time. sin ,Hour cos ] represents periodic coding, mapping 0 to 23 hours to the range of 0 to 2π, and calculating the result through sin and cos functions. OneHot() represents one-hot coding, converting weather type information into one-hot vector representation; License plate number i1 and parking location n i2 The data structure is numbered, vehicle entry and exit time n i3 and weather information i4 The data structures are 2-dimensional vectors and 3-dimensional vectors respectively.
5. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The data preprocessing module also includes: By respectively i1 , parking fee x i2 , Parking space utilization rate x i3 、Traffic flow x i4 、Traffic flow x i5 Use Z-score standardization to make the data have a uniform scale. Among them, z i1 Is the parking time x i1 The standardized result of μ1 is the parking time x i1 The mean of i1 The standard deviation of i2 Is the parking fee x i2 The standardized result of μ2 is the parking cost x i2 The mean of i2 The standard deviation of i3 is the parking space utilization rate x i3 The standardized result of μ3 is the parking space utilization rate x i3 The mean of σ3 is the parking space utilization rate x i3 The standard deviation of i4 is the traffic volume x i4 The standardized result of μ4 is the traffic flow x i4 The mean of i4 The standard deviation of i5 is the traffic volume x i5 The standardized result of μ5 is the traffic flow x i5 The mean of σ5 is the traffic flow x i5 The standard deviation of Among them, the mean μ j and standard deviation σ j (j takes values of 1, 2, 3, 4, 5) and is calculated as follows: x ij Represents the jth data feature of the i-th vehicle.
6. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The model training module includes: The pre-processed vehicle data, including the parking time z, will be standardized using the Z-score i1 , Parking fee i2 , Parking space utilization rate i3 、Traffic flow i4 、Traffic flow i5 , license plate number n i1 、Parking location n i2 ; and vehicle entry and exit time n i3 、Weather information i4 Integrate into vehicle data vector Z i , multiple vehicle data vectors Z1, Z2, ..., Z i , …, Z N , combined into the vehicle data feature matrix Z, Z i =[z i1 ,z i2 ,z i3 ,z i4 ,z i5 ,n i1 ,n i2 ,n i3 ,n i4 ] Input the vehicle data feature matrix Z into the transformer model, in It represents the predicted parking demand result, and Transformer() is the model training function.
7. The deep learning-based staggered parking management system according to claim 6 is characterized in that: The model training module also includes: The model training module uses a mixed loss function Calculate the loss and evaluation indicators on the validation set to update the parameters of the training model. The formula of the mixed loss function is: Among them, α is the mean square error weight coefficient, β is the mean absolute error, γ is the mean absolute percentage error weight coefficient, and y i,j represents the true value of the jth feature of the i-th sample, Represents the predicted value of the jth feature of the i-th sample; MSE is the mean squared error: MAE is the mean absolute error: MAPE is the mean absolute percentage error: N represents the total number of vehicles in the vehicle data, and M represents the number of features; The weight coefficients α, β, and γ are calculated as follows. The dynamic adjustment based on the loss value and the dynamic adjustment based on the training stage are combined into a composite dynamic adjustment method: Among them, L MSE , L MAE and L MAPE are the loss values of MSE, MAE and MAPE in the current training step, and the weights are dynamically adjusted based on the loss values. Among them, α0, β0 and γ0 are the initial setting values of the mean square error weight coefficient α, the mean absolute error β, and the mean absolute percentage error γ weight coefficient, respectively. t is the current training step number, and T is the total training step number.
8. The deep learning-based staggered parking management system according to claim 6 is characterized in that: The model training module also includes: For the training results Update model parameters through backpropagation with dynamic learning rate Among them, θ t is the current model parameter, θ t+1 are the model parameters for the next stage, represents the gradient of the mixed loss function L with respect to the initial parameter θ, is the calculation method of learning rate, η0e -λt is the change of learning rate with the number of training steps, ε is a constant to prevent the denominator from being 0, η0 is the initial setting value of the learning rate, λ is the decay rate, t is the current number of training steps, is the historical accumulation of gradients, θ τ are the model parameters at the τth training step.
9. The deep learning-based staggered parking management system according to claim 1 is characterized in that: The demand forecasting module comprises: The vehicle data matrix X is formed N The dimensions are (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of obtaining vehicle data features, d model is the vehicle base dimension, Among them, W Q , W K and W V is the parameter weight matrix that needs to be updated, W Q , W K and W V The dimension is (d model , d k ), d model is the vehicle reference dimension, d k For each vehicle real-time dimension, subscript Q is the query matrix, subscript K is the key matrix, and subscript V is the value matrix; Use the back propagation of gradient descent to update the parameters and set the learning rate Simplified to η, W Q , W K and W V The update method is: Among them, η is the learning rate, which controls the step size of each update, and They are the loss functions The gradient of the weight matrix is Attention score calculation Among them, Z′ is the vehicle data matrix after training; Demand forecast calculation, the model calculates based on the input data, and the multi-head attention mechanism captures information from multiple angles. MultiHead(Q,K,V)=Concat(head1,......,head h )W O in, is the weight of the i-th query matrix, is the weight of the ith bond matrix, W Vi is the weight of the i-th value matrix, Concat is the concatenation operation, h is the number of attention heads, and W O is the learnable weight matrix, W O The dimension is (h, d k , d model ).
Citation Information
Patent Citations
Short-term load prediction method fusing morphological clustering and TCN-Attention
CN111815035A
Time series data prediction method based on exponential smoothing
CN114548479A
Parking demand prediction model and method based on multi-source data and application thereof
CN115640756A
Transform dynamic space-time correlation-based hospital parking lot recommendation method
CN116089744A
Method for predicting number of remaining parking spaces in commercial parking lot based on dynamic space-time trend
CN116187591A
Cited By
Fee deduction method, system and device of intelligent transportation system and medium
CN119314334A
Digital warehousing method and system based on task behaviors
CN119850098A
