A deep learning-based off-peak parking management system
By using a deep learning-based off-peak parking management system, which employs a Transformer model and a hybrid loss function to predict parking demand, the problem of uneven parking space allocation during peak hours has been solved, thus improving the level of urban traffic management.
Patent Information
- Application Number
- CN202411069754.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-08-06
AI Technical Summary
Existing intelligent parking management systems struggle to effectively address the dynamic and uncertain nature of parking demand during peak hours, resulting in uneven allocation of parking space resources and a poor parking experience for drivers.
A deep learning-based off-peak parking management system is adopted. The system collects and integrates vehicle data through a data acquisition module, uses a Transformer model for data preprocessing and training, and combines a hybrid loss function and a self-attention mechanism to predict parking demand and dynamically adjust the parking space allocation strategy.
It improves the accuracy of parking demand forecasting and optimizes the utilization of parking resources, alleviating urban traffic congestion and providing more scientific traffic management support.
Smart Images

Figure CN119028167B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of parking management, and particularly relates to a peak-shaving parking management system based on deep learning. BACKGROUND
[0002] With the acceleration of urbanization, the number of vehicles in cities has increased dramatically, and the problem of parking difficulty has become increasingly prominent. Traditional parking management systems mainly rely on manual management and simple automation technology, which cannot effectively cope with the parking demand during peak hours, leading to uneven allocation of parking space resources, poor parking experience for car owners, and other problems. 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 to solve the problem of parking difficulty.
[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 low prediction accuracy and slow processing speed when dealing with large-scale and complex parking data. In particular, during peak hours, parking demand has high dynamicity and uncertainty, and traditional algorithms are difficult to effectively cope with, which requires technical personnel in the field to solve the corresponding technical problems. SUMMARY
[0004] The present application aims to at least solve the technical problems existing in the prior art, and particularly innovatively proposes a peak-shaving parking management system based on deep learning.
[0005] In order to achieve the above-mentioned purpose of the present application, the present application provides a peak-shaving parking management system based on deep learning, comprising:
[0006] A data acquisition module is used to acquire corresponding data of each parking lot through the cloud, including license plate number, parking duration, parking location, parking space utilization rate, cost, traffic flow, traffic flow, and user behavior data;
[0007] Through sensors and license plate recognition camera devices in the parking lot, the entry and exit records and parking space utilization rate of vehicles are collected in real time. Historical parking data is imported from the parking lot management system, including vehicle entry and exit time, parking duration, and parking location. Weather information, traffic conditions, and nearby activity external data are integrated to improve the accuracy of the prediction model.
[0008] Each vehicle data is summarized as a vector,
[0009] Parking duration x i1 ,
[0010] Parking cost x i2 ,
[0011] Parking space utilization rate x i3 ,
[0012] vehicle flow x i4 ,
[0013] traffic flow x i5 ,
[0014] license plate number n i1 ,
[0015] parking location n i2 ,
[0016] vehicle access time n i3 ,
[0017] weather information n i4 .
[0018] The model input is a vehicle data vector X i , containing all features:
[0019] X i = [x i1 , x i2 , x i3 , x i4 , x i5 , n i1 , n i2 , n i3 , n i4 ];
[0020] where each i represents a single vehicle data, and the matrix composed of X N represents the vehicle data of N vehicles.
[0021] The difference between the vehicle flow and the traffic flow is that the vehicle flow is the passing flow of cars per unit time, and the traffic flow is the passing flow of all traffic tools per unit time.
[0022] The data preprocessing module is used to fill in the missing values in the vehicle data, so as to effectively handle the missing values, and standardize the vehicle data;
[0023] The noise, error and missing value in the data are cleaned up to ensure the accuracy and integrity of the data, including data with numerical features, respectively filling the missing values of parking duration x i1 , parking fee x i2 , and parking space utilization rate x i3 with 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 represent missing values of parking duration x i1 , parking fee x i2 and parking occupancy x i3 respectively, and median() represents median calculation.
[0028] When obtaining data of parking duration, parking fee and parking occupancy, deleting missing values will cause loss of information, especially when the proportion of missing values is large or the distribution of missing values is not random. Using median filling retains the information in the original data, effectively handles missing values, thereby avoiding the influence of information loss on the model training results, and maintaining the stability and consistency of data distribution and reducing the influence of data bias,
[0029] For missing values of traffic flow x i4 and traffic volume x i5 , linear interpolation is used.
[0030]
[0031] where x NAN4 and x NAN5 represent missing values of traffic flow x i4 and traffic volume x i5 , x prev4 and x next4 represent the previous and next items of traffic flow missing values, and x prev5 and x next5 represent the previous and next items of traffic volume missing values,
[0032] Median filling is more suitable for data distribution that is more concentrated and has more outliers. For traffic flow and traffic volume data that have obvious time trend and periodicity, linear interpolation is more appropriate. Compared with the relatively smooth processing method of median filling, linear interpolation can capture subtle changes in data more finely.
[0033] Features are extracted from raw data to construct feature vectors.
[0034] Label class data, license plate number n i1 and parking location n i2 Label encoding is used.
[0035] Periodic encoding is used for vehicle entry and exit time n i3 to retain the periodicity of time,
[0036] n i3 = [Hour sin , Hour cos ]
[0037]
[0038] For weather information n i4 , one-hot encoding is used for encoding processing,
[0039] OneHot (sunny) = [1, 0, 0]
[0040] OneHot (rainy) = [0, 1, 0]
[0041] OneHot (snowy) = [0, 0, 1]
[0042] Hour is the hour part of the current time, [Hour sin , Hour cos ] represents periodic encoding, which maps 0 to 23 hours to the range of 0 to 2π, and calculates the result through sin and cos functions, OneHot() represents one-hot code, which converts weather type information into one-hot vector representation;
[0043] The data structure of license plate number n i1 and parking location n i2 is a number, and the data structure of vehicle entry and exit time n i3 and weather information n i4 is a 2-dimensional vector and a 3-dimensional vector, respectively.
[0044] Z-score standardization is used for parking duration x i1 , parking fee x i2 , parking space utilization rate x i3 , traffic flow x i4 , and traffic flow x i5 to make the data have a uniform scale and improve the model training effect.
[0045]
[0046] where z i1 is the standardized result of parking duration x i1 , μ1 is the mean of parking duration x i1 , σ1 is the standard deviation of parking duration x i1 , z i2 is the standardized result of parking fee x i2 , μ2 is the mean of parking fee x i2 , σ2 is the standard deviation of parking fee x i2 , z i3 is the standardized result of parking space utilization rate x i3 , μ3 is the mean of parking space utilization rate x i3 , σ3 is the standard deviation of parking space utilization rate x i3 , z i4 is the standardized result of traffic flow x i4 , μ4 is the mean of traffic flow x i4 , σ4 is the standard deviation of traffic flow x i4 , z i5 is the standardized result of traffic flow x i5 , μ5 is the mean of traffic flow x i5 , σ5 is the standard deviation of traffic flow x i5 .
[0047] where the mean μ j and the standard deviation σ j (j = 1, 2, 3, 4, 5) are calculated as
[0048]
[0049] x ij represents the jth data feature of the ith vehicle.
[0050] The model training module uses a Transformer model as a deep learning model, taking advantage of its strengths in handling time series data.
[0051] According to the data set and task requirements, define the specific architecture of the Transformer model, the number of attention heads, embedding dimensions, and the dimensions of the feedforward neural network.
[0052] Divide the preprocessed data set into training set, validation set and test set to ensure the effectiveness of model training.
[0053] Divide the data set into 70% training set, 15% validation set and 15% test set according to the proportion.
[0054] Use the training set data to train the Transformer model, adjust the model parameters, and optimize the model performance.
[0055] The vehicle data preprocessed using Z-score standardization is parking duration z i1 , parking fee z i2 , parking occupancy rate z i3 , traffic flow z i4 , traffic flow z i5 , license plate number n i1 , parking location n i2 , and vehicle entry and exit time n i3 , weather information n i4 Integrated into a vehicle data vector Z i A plurality of vehicle data vectors Z1, Z2, …, Z i , …, Z N are combined into a 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] wherein represents the predicted parking demand result, is a matrix of (N x M);
[0061]
[0062] The loss and evaluation indicators on the validation set are calculated by a hybrid loss function, and the formula of the hybrid loss function is:
[0063]
[0064] wherein α is the mean square error weight coefficient, β is the mean absolute error, γ is the mean absolute percentage error weight coefficient, y i,j represents the true value of the jth feature of the ith sample. represents the predicted value of the jth feature of the ith sample.
[0065] MSE is the Mean Squared Error.
[0066]
[0067] MAE is the Mean Absolute Error.
[0068]
[0069] MAPE is the Mean Absolute Percentage Error
[0070]
[0071] The calculation of weight coefficients α, β, γ is as follows: the dynamic adjustment based on loss value and the dynamic adjustment based on training stage are combined into a composite dynamic adjustment method.
[0072]
[0073] where 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.
[0074] where α0, β0 and γ0 are the initial setting values of α mean square error weight coefficient, β average absolute error, γ average 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, thus optimizing the prediction performance more comprehensively. α0, β0 and γ0 as initial setting values provide a starting point for model training, improving the generalization ability of the model.
[0076] These initial setting values can be flexibly adjusted according to the specific prediction task and data set characteristics.
[0077] The Transformer model is used as the prediction model.
[0078] The input features of the model are defined, including parking duration, parking fee, parking space utilization rate, traffic flow, traffic flow, license plate number (after encoding processing), parking location (after encoding processing), vehicle entry and exit time, and weather information.
[0079] The output of the model is defined, i.e. the predicted off-peak parking data.
[0080] Loss function definition:
[0081] Using a hybrid loss function
[0082] Initialize α0, β0, γ0 to specific numerical values, for example α0 = 0.5, β0 = 0.3, γ0 = 0.2.
[0083] Train the model using the training set and dynamically adjust α, β, γ according to the training step t and the total training step T.
[0084] Verify the performance of the model on the validation set and adjust the hyperparameters as needed.
[0085] Evaluate the performance of the model using the test set, calculate MSE, MAE, MAPE and other related indicators to compare the performance of the model under different weights and initial settings.
[0086] The hybrid loss function combines mean squared error (MSE), mean absolute error (MAE) and mean absolute percentage error (MAPE) to optimize the accuracy of model prediction from multiple angles. When training the Transformer model for vehicle data prediction, the mean squared error (MSE) gives greater punishment to larger errors, thus helping the model to reduce large prediction errors. This makes the model pay more attention to reducing those predictions that significantly deviate from the true value.
[0087] The mean absolute error (MAE) is less sensitive to outliers than the 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. The mean absolute percentage error (MAPE) is a relative error indicator that is sensitive to the size of the predicted value, helping the model maintain accuracy when dealing with different scales of predicted values.
[0088] For training results Update model parameters through backpropagation of dynamic learning rate
[0089]
[0090] where θ t is the current model parameter, θ t+1 is the next stage model parameter, is the gradient of the hybrid loss function L with respect to the initial parameter θ,
[0091] is the calculation method of learning rate, η0e -λt is the change value of learning rate with training step, ε is a constant to prevent the denominator from being 0, η0 is the initial setting value of learning rate, λ is the decay rate, t is the current training step, is the historical accumulation of gradient, θτ Model parameters at the t-th training step.
[0092] Model parameters θ are adjusted by the gradient of the loss function, learning rate Gradually reduced as the training step increases, helping the model to stabilize and converge in the later training.
[0093] At the same time, the learning rate Also changes with the accumulation of historical gradients, so that the learning rate of frequently updated parameters decreases, and the learning rate of less frequently updated parameters increases, achieving adaptive adjustment of model parameters through the mixed update method of learning rate.
[0094] Use the validation set data 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 off-peak parking, the learning rate is dynamically adjusted with the training step t, which is larger at the beginning to quickly converge and smaller at the end to fine-tune, which helps to improve the training efficiency. Through the adjustment of the historical accumulation of the gradient, prevent the instability caused by the too large learning rate, the learning rate of each parameter is different due to its gradient history, which helps the model to adapt to the learning needs of different features more flexibly.
[0096] Demand prediction module, used to input real-time data into the model, self-attention mechanism calculates the correlation between each time point. In the self-attention mechanism,
[0097] The vehicle data matrix X N formed has a dimension of (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of the vehicle data feature, d model is the vehicle reference dimension.
[0098] Where, W Q , W K and W V are parameter weight matrices that need to be updated, W Q , W K and W V have a dimension of (d model , d k ), d model is the vehicle reference dimension, d k is the real-time dimension of each vehicle, subscript Q is the query matrix, subscript K is the key matrix, and subscript V is the value matrix.
[0099] Update the parameters using backpropagation, and simplify the learning rate to η, W Q , W K and WV The update mode is:
[0100]
[0101] η is the learning rate
[0102] Attention score calculation
[0103]
[0104] Where Z' is the trained vehicle data matrix;
[0105] Demand prediction calculation, the model calculates according to 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] Where, is the weight of the i-th query matrix, is the weight of the i-th key matrix, is the weight of the i-th value matrix, Concat is the concatenation operation, h is the number of attention heads, W O is a learnable weight matrix, W O The dimension of is (h, d k , d model ).
[0108] Prediction result output, 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] According to the predicted parking demand, dynamically allocate parking resources to realize peak-shaving parking management. According to the information trained by the model, calculate the parking demand prediction result of the future time period, dynamically adjust the allocation of parking spaces according to the predicted parking demand, increase the number of parking spaces during peak hours, and reduce the number of parking spaces during off-peak hours. In actual operation, the use of the parking lot is monitored in real time through sensors and monitoring equipment, and the allocation strategy is dynamically adjusted according to real-time data. Ensure the optimal use of parking resources and respond to unexpected situations and changes in demand.
[0110] The application of the peak-shifting parking prediction model improves the overall level of urban traffic management. By accurately predicting and recommending parking demand, urban parking resources can be more effectively managed, and urban traffic congestion problems can be alleviated. More comprehensive and accurate traffic flow and parking demand data support can be provided to urban traffic management departments to help develop more scientific and reasonable traffic management policies and measures.
[0111] Although embodiments of the present application have been shown and described, it will be apparent to those having ordinary skill in the art that a number of changes, modifications, replacements, and variations can be made thereto without departing from the principles and spirit of the present application, and the scope of the present application is defined by the claims and their equivalents.
[0112] Additional aspects and advantages of the present application will be given in part in the following description, part will become apparent from the following description, or will be understood by practicing the present application. BRIEF DESCRIPTION OF DRAWINGS
[0113] The above and / or additional aspects and advantages of the present application will become apparent and more readily appreciated from the following description, taken in conjunction with the accompanying drawings, in which:
[0114] Figure 1 is a general schematic diagram of the present application. DETAILED DESCRIPTION
[0115] Embodiments of the present application are described in detail below, examples of which are shown in the accompanying drawings, in which the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the accompanying drawings are exemplary and are only used to explain the present application and cannot be understood as limiting the present application.
[0116] As Figure 1 shown, the present application discloses a deep learning-based peak-shifting parking management system, comprising:
[0117] A data acquisition module is used to acquire corresponding data of each parking lot through the cloud, including license plate number, parking duration, parking location, parking space utilization rate, cost, traffic flow, traffic flow, and user behavior data;
[0118] Through sensors and license plate recognition camera devices in the parking lot, the entry and exit records and parking space utilization rate of vehicles are collected in real time. Historical parking data is imported from the parking lot management system, including vehicle entry and exit time, parking duration, and parking location. Weather information, traffic conditions, and nearby activity external data are integrated to improve the accuracy of the prediction model.
[0119] Each vehicle data is summarized as a vector,
[0120] Parking duration x i1 ,
[0121] Parking fee x i2 ,
[0122] Parking space occupancy x i3 ,
[0123] Traffic flow x i4 ,
[0124] Traffic flow x i5 ,
[0125] License plate number n i1 ,
[0126] Parking location n i2 ,
[0127] Vehicle entry and exit time n i3 ,
[0128] Weather information n i4 .
[0129] The model input is a vehicle data vector X i , containing all features;
[0130] X i = [x i1 , x i2 , x i3 , x i4 , x i5 , n i1 , n i2 , n i3 , n i4 ];
[0131] Wherein, each i represents a single vehicle data, and the matrix composed of X N represents the vehicle data of N vehicles.
[0132] The difference between traffic flow and traffic flow is that traffic flow is the passing flow of cars per unit time, and traffic flow is the passing flow of all traffic tools 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 noise, errors and missing values in the data to ensure data accuracy and integrity, including data with numerical features, respectively, the missing values of parking duration x i1 , parking fee x i2 , parking space occupancy x i3 are filled with 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 These represent the parking duration x. i1 Parking fee x i2 Parking space utilization rate x i3 For missing values, median() indicates median calculation.
[0139] When acquiring data on parking duration, parking fees, and parking space utilization, removing missing values can lead to information loss, especially when the proportion of missing values is large or their distribution is not random. Using the median to impute missing values preserves information from the original data while effectively handling missing values, thus avoiding the impact of information loss on model training results, maintaining the stability and consistency of the data distribution, and reducing the impact of data bias.
[0140] For traffic flow x i4 Traffic flow x i5 For missing values, linear interpolation is performed using interpolation methods;
[0141]
[0142] Where x NAN4 and x NAN5 Representing traffic flow x i4 Traffic flow x i5 Missing values, x prev4 and x next4 Let x represent the preceding and following terms of the missing traffic flow values, respectively. prev5 and x next5 These represent the preceding and following terms of the missing traffic flow values, respectively.
[0143] Median filling is more suitable for data distribution is more concentrated, more outliers. For traffic flow and traffic such as this has obvious time trend and periodicity of data, linear interpolation is more appropriate. Compared with the median filling this relatively smooth way of processing, linear interpolation can more finely capture subtle changes in data.
[0144] Features are extracted from the original data to construct a feature vector.
[0145] Label class data, license plate number n i1 And parking location n i2 Label encoding is used;
[0146] License plate number Label = g
[0147] Parking location Label = p
[0148] For example: Label (Jing A99999) = 1
[0149] Label (Yu A012345) = 5
[0150] Label (56 parking space) = 56
[0151] Use the sine and cosine functions to encode the vehicle entry and exit time n i3 Periodic, retain the periodicity of time,
[0152] n i3 = [Hour sin ,Hour cos ]
[0153]
[0154] For weather information n i4 , using one-hot code for encoding 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 ] indicates periodic encoding, mapping 0 to 23 hours to 0 to 2π, calculating the result through sin and cos functions, OneHot() indicates one-hot code, converting weather type information into one-hot vector representation;
[0159] License plate number ni1 and parking location n i2 The data structure of the number, vehicle access time n i3 and weather information n i4 The data structure of the 2-dimensional vector and the 3-dimensional vector respectively.
[0160] By using Z-score standardization on parking duration x i1 , parking fee x i2 , parking occupancy x i3 , traffic flow x i4 , traffic flow x i5 , the data has a unified scale, and the model training effect is improved.
[0161]
[0162]
[0163] Wherein, z i1 is the standardization result of parking duration x i1 , μ1 is the mean of parking duration x i1 , σ1 is the standard deviation of parking duration x i1 , z i2 is the standardization result of parking fee x i2 , μ2 is the mean of parking fee x i2 , σ2 is the standard deviation of parking fee x i2 , z i3 is the standardization result of parking occupancy x i3 , μ3 is the mean of parking occupancy x i3 , σ3 is the standard deviation of parking occupancy x i3 , z i4 is the standardization result of traffic flow x i4 , μ4 is the mean of traffic flow x i4 , σ4 is the standard deviation of traffic flow x i4 , z i5 is the standardization result of traffic flow x i5 , μ5 is the mean of traffic flow x i5 , σ5 is the standard deviation of traffic flow x i5 .
[0164] Wherein, the mean μ j and the standard deviation σ j (j takes the value of 1, 2, 3, 4, 5) are calculated as
[0165]
[0166] x ij represents the jth data feature of the ith vehicle.
[0167] Model training module, using Transformer model as deep learning model, taking advantage of its in processing time series data.
[0168] According to the data set and task requirements, define the specific architecture of the Transformer model, the number of attention heads, embedding dimensions, and the dimensions of the feedforward neural network.
[0169] Divide the preprocessed data set into training set, validation set and test set to ensure the effectiveness of model training.
[0170] According to the proportion, divide the data set into 70% training set, 15% validation set and 15% test set.
[0171] Use the training set data to train the Transformer model, adjust the model parameters, and optimize the model performance.
[0172] The vehicle data preprocessed using Z-score standardization is z i1 , parking fee z i2 , parking occupancy z i3 , traffic flow z i4 , traffic flow z i5 , license plate number n i1 , parking location n i2 ; and vehicle entry and exit time n i3 , weather information n i4 Integrated into vehicle data vector Z i , multiple vehicle data vectors Z1, Z2, …, Z i , …, Z N , combined into 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] Input the vehicle data feature matrix Z into the transformer model for training and prediction.
[0176]
[0177] Where representing a predicted parking demand result, is a matrix of (N x M);
[0178]
[0179] The loss and evaluation indicators on the validation set are calculated by the mixed loss function, and the formula of the mixed loss function is:
[0180]
[0181] Wherein, α is the mean square error weight coefficient, β is the mean absolute error, γ is the mean absolute percentage error weight coefficient, y i,j represents the true value of the jth feature of the ith sample. represents the predicted value of the jth feature of the ith sample.
[0182] MSE is the mean squared error (Mean Squared Error).
[0183]
[0184] MAE is the mean absolute error (Mean Absolute Error).
[0185]
[0186] MAPE is the mean absolute percentage error (Mean Absolute Percentage Error)
[0187]
[0188] The calculation method of the weight coefficients α, β and γ is as follows: based on the dynamic adjustment of the loss value and the dynamic adjustment based on the training phase, a composite dynamic adjustment method is combined.
[0189]
[0190] Wherein, 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 value.
[0191] Wherein, α0, β0 and γ0 are the initial set 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.
[0192] The dynamic adjustment of the initial setting values helps the model gradually focus on different error indicators during the training process, thus optimizing the prediction performance more comprehensively. α0, β0, and γ0 as initial setting values provide a starting point for model training, improving the generalization ability of the model.
[0193] These initial setting values can be flexibly adjusted according to the specific prediction task and data set characteristics.
[0194] Use the Transformer model as the prediction model.
[0195] Define the input features of the model, including parking duration, parking fee, parking space utilization rate, traffic flow, traffic flow, license plate number (after encoding processing), parking location (after encoding processing), vehicle entry and exit time, and weather information.
[0196] Define the output of the model, i.e., the predicted off-peak parking data.
[0197] Loss function definition:
[0198] Use the hybrid loss function
[0199] Initialize α0, β0, and γ0 to specific values, such as α0 = 0.5, β0 = 0.3, and γ0 = 0.2.
[0200] Train the model using the training set and dynamically adjust α, β, and γ according to the training step t and the total training step T.
[0201] Verify the performance of the model on the validation set and adjust the hyperparameters as needed.
[0202] Evaluate the performance of the model using the test set, calculate MSE, MAE, MAPE, and other related indicators to compare the performance differences of the model under different weights and initial setting values.
[0203] Record some experimental results:
[0204] Experiment 1 (baseline experiment): α0 = 0.5, β0 = 0.3, γ0 = 0.2
[0205] MSE = 100, MAE = 20, MAPE = 5%, accuracy = 80%, recall = 75%
[0206] Experiment 2 (increase MSE weight): α0 = 0.7, β0 = 0.2, γ0 = 0.1
[0207] MSE = 80, MAE = 25, MAPE = 6%, accuracy = 82%, recall = 74%
[0208] Experiment 3 (increase MAE weight): α0 = 0.3, β0 = 0.5, γ0 = 0.2
[0209] MSE = 120, MAE = 18, MAPE = 5%, Accuracy = 79%, Recall = 76%
[0210] Experiment 4 (balanced weights): a0 = 0.33, b0 = 0.33, g0 = 0.34
[0211] MSE = 105, MAE = 21, MAPE = 4%, Accuracy = 81%, Recall = 77%
[0212] Experiment 1: As a baseline experiment, the model achieved relatively balanced performance on multiple metrics.
[0213] Experiment 2: After increasing the weight of MSE, the model's MSE decreased, but MAE and MAPE increased slightly. At the same time, the accuracy improved, but the recall decreased slightly. This indicates that the model pays more attention to reducing large prediction errors, but may sacrifice some absolute and relative error performance.
[0214] Experiment 3: After increasing the weight of MAE, the model's MAE decreased, but MSE and MAPE increased slightly. The accuracy decreased slightly, but the recall improved. This indicates that the model pays more attention to reducing absolute error, but may sacrifice some squared error and relative error performance.
[0215] Experiment 4: Under balanced weights, the model achieved relatively good performance on multiple metrics, especially MAPE and recall.
[0216] The hybrid loss function combines mean squared error (MSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) to optimize the accuracy of model predictions from multiple angles. The hybrid loss function helps the model reduce large prediction errors by giving greater penalties to larger errors when using mean squared error (MSE) in training the Transformer model for vehicle data prediction. This makes the model pay more attention to reducing predictions that significantly deviate from the true values.
[0217] Mean absolute error (MAE) is less sensitive to outliers than MSE because it does not square the error. This 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, helping the model maintain accuracy when dealing with different scales of predicted values.
[0218] For training results Update model parameters through backpropagation of dynamic learning rate
[0219]
[0220] where θ t is the current model parameter, θ t+1 is the next stage model parameter, is the gradient of the hybrid loss function L with respect to the initial parameter θ,
[0221] is the calculation method of the learning rate, η0e -λt is the change value of the learning rate with the training step number, ε 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 training step number, is the historical accumulation of the gradient, θ τ is the model parameter at the τth training step.
[0222] The model parameter θ is adjusted by the gradient of the loss function, and the learning rate gradually decreases with the increase of the training step number, which helps the model to converge stably in the later training.
[0223] At the same time, the learning rate also changes with the accumulation of the historical gradient, so that the learning rate of the frequently updated parameters decreases and the learning rate of the less frequently updated parameters increases. Through the mixed updating method of the learning rate, the model parameters are adaptively adjusted.
[0224] The model is verified using the validation set data to evaluate the prediction accuracy and generalization ability of the model.
[0225] The redefined dynamic learning rate formula is used for the training set of off-peak parking. The learning rate is dynamically adjusted with the training step number t, which is larger at the beginning to quickly converge and smaller at the end to fine-tune, which helps to improve the training efficiency. Through the adjustment of the historical accumulation of the gradient , the instability caused by the excessively large learning rate is prevented, and the learning rate of each parameter is different due to its gradient history, which helps the model to adapt more flexibly to the learning needs of different features.
[0226] The demand prediction module is used to input real-time data into the model, and the self-attention mechanism is used to calculate the correlation between each time point.
[0227] The dimension of the vehicle data matrix X N formed in the self-attention mechanism is (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of the vehicle data feature, and d model is the vehicle reference dimension.
[0228] where W Q , W K , and WV is the parameter weight matrix to be updated, W Q , W K and W V The dimension of W model , W k and W model is (d k , d Q ), d K is the vehicle reference dimension, d V is the real-time dimension of each vehicle, subscript Q is the query matrix, subscript K is the key matrix, and subscript V is the value matrix;
[0229] The parameters are updated by back propagation, and the learning rate is simplified as η, and the update method of W Q , W K and W V is:
[0230]
[0231]
[0232] η is the learning rate
[0233] Attention score calculation
[0234]
[0235] Where Z' is the trained vehicle data matrix;
[0236] Demand prediction calculation, the model calculates according to 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] Where, is the weight of the i-th query matrix, is the weight of the i-th key matrix, is the weight of the i-th value matrix, Concat is the concatenation operation, h is the number of attention heads, W O is the learnable weight matrix, and the dimension of W O is (h, d k , d model ).
[0239] Prediction result output, used to output the prediction result to the resource allocation module for dynamically adjusting the parking space allocation strategy, and the training process is iterated until the transformer model converges.
[0240] According to the predicted parking demand, the parking resources are dynamically allocated to realize peak-shifting parking management. According to the information trained by the model, the parking demand prediction result of the future time period is calculated, and the allocation of parking spaces is dynamically adjusted according to the predicted parking demand. In the peak period, the parking spaces are increased, and in the low peak period, the parking spaces are reduced. In actual operation, the use of the parking lot is monitored in real time through sensors and monitoring equipment, and the allocation strategy is dynamically adjusted according to real-time data. Ensure the optimal use of parking resources and respond to sudden situations and demand changes.
[0241] The application of the peak-shifting parking prediction model improves the overall level of urban traffic management. By accurately predicting and recommending parking demand, urban parking resources are more effectively managed, and urban traffic congestion problems are alleviated. More comprehensive and accurate traffic flow and parking demand data support can be provided to urban traffic management departments to help develop more scientific and reasonable traffic management policies and measures.
[0242] Although embodiments of the present application have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, replacements and variations can be made to these embodiments without departing from the principles and purposes of the present application, and the scope of the present application is defined by the claims and their equivalents.
Claims
1. A deep learning-based off-peak parking management system, characterized by, The application relates to a parking demand prediction method and device. The data acquisition module is used for acquiring corresponding data of each parking lot through the cloud and collecting each vehicle data into a vector; The data preprocessing module is used for filling and calculating missing values in the vehicle data, thereby effectively processing the missing values and standardizing the vehicle data; The model training module is used for inputting the preprocessed vehicle data into a Transformer model and training the vehicle data by using the Transformer model as a deep learning model; The vehicle data preprocessed using Z-score standardization includes parking duration z i1 , parking fee z i2 , parking space utilization rate z i3 , traffic flow z i4 , traffic flow z i5 , license plate number n i1 , parking location n i2 ; and vehicle entry / exit time n i3 , weather information n i4 into a vehicle data vector Z i , a plurality of vehicle data vectors Z1, Z2,..., Z i ,..., Z N , combined into a 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 ] The vehicle data feature matrix Z is input into the transformer model, wherein represents the predicted parking demand result, and Transformer() is a model training function. For training results updating model parameters by backpropagation through dynamic learning rate where θ t is the current model parameter, θ t+1 is the next stage model parameter, denotes the gradient of the hybrid loss function L with respect to the initial parameter θ. The learning rate is calculated as η0e -λt Let η0 be the learning rate as a function of training steps, ε be a constant to prevent the denominator from being zero, η0 be the initial learning rate setting, λ be the decay rate, and t be the current training step number. It is the historical accumulation of gradients, θ τ Let be the model parameters at the τ-th training step; The model training module further comprises: The model training module updates the parameters of the training model by a hybrid loss function The loss and evaluation indexes on the verification set are calculated to update the parameters of the training model, and a hybrid loss function formula is: wherein a is a mean square error weight coefficient, β is a mean absolute error weight coefficient, γ is a mean absolute percentage error weight coefficient, y i,j represents a true value of the jth feature of the ith sample, represents a predicted value of the jth feature of the ith sample; MSE is the mean square 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 alpha, beta and gamma 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 mode: wherein L MSE , L MAE and L MAPE are the loss values of MSE, MAE and MAPE in the current training step, respectively, and the weights are dynamically adjusted based on the loss values, Wherein, alpha0, beta0 and gamma0 are initial setting values of the mean square error weight coefficient alpha, the mean absolute error weight coefficient beta and the mean absolute percentage error weight coefficient gamma, t is the current training step number, and T is the total training step number; The demand prediction module is used for inputting real-time data into the model and performing demand prediction; The demand prediction module comprises: The vehicle data matrix X formed N has dimensions (N, I, d model ), N is the total number of vehicles in the vehicle data, I is the length of the vehicle data features, d model is the vehicle reference dimension, where W Q , W K , and W V are parameter weight matrices that need to be updated, the dimensions of W Q , W K , and W V are (d model , d k ), d model is a vehicle reference dimension, d k is a real-time dimension for each vehicle, subscript Q is a query matrix, subscript K is a key matrix, and subscript V is a value matrix; The parameters are updated by back propagation using gradient descent method, and the learning rate is simplified as η, W The update method of η, W Q , W K and W V is: where η is the learning rate, which controls the step size of each update, and are the loss function the gradient of the loss function with respect to the weight matrix, Attention score calculation Wherein, Z' is the trained vehicle data matrix; Demand prediction calculation, the model calculates according to the input data, and the multi-head attention mechanism captures information from multiple angles, MultiHead(Q, K, V) = Concat(head1,..., head h )W O wherein, is the weight of the i-th query matrix, is the weight of the i-th key matrix, is the weight of the i-th value matrix, Concat is a concatenation operation, h is the number of attention heads, W O is a learnable weight matrix, W O has a dimension of (h, d k , d model ).
2. The deep learning-based peak-shaving parking management system of claim 1, wherein, The data acquisition module comprises: Collecting each vehicle data into a vector, Parking duration x i1 , Parking fee x i2 , Parking space utilization rate x i3 , Traffic volume x i4 , Traffic flow x i5 , License plate number n i1 , Parking position n i2 , Vehicle entry and exit time n i3 , Weather information n i4 , Combining the above data into a vehicle data vector X i , comprising all features: X i = [x i1 ,x i2 ,x i3 ,x i4 ,x i5 ,n i1 ,n i2 ,n i3 ,n i4 ] ; where each i represents a single vehicle data, X1~X N The matrix composed of the vehicle data of N vehicles is represented.
3. The deep learning-based peak spreading parking management system of claim 1, wherein, The data preprocessing module comprises: Cleaning the noise in the data, including, data with numerical features, respectively, for parking duration x i1 , parking fee x i2 , parking occupancy x i3 Missing value of median filling; 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 represent the missing values of parking duration x i1 , parking cost x i2 , and parking occupancy x i3 , respectively, and median() represents the median calculation; For the traffic flow x i4 and the missing values of the traffic flow x i5 , linear interpolation is used by interpolation method. where x NAN4 and x NAN5 respectively represent missing values of the vehicle flow x i4 and the traffic flow x i5 , x prev4 and x next4 respectively represent the previous and next items of the missing value of the vehicle flow, and x prev5 and x next5 respectively represent the previous and next items of the missing value of the traffic flow.
4. The deep learning-based peak spreading parking management system of claim 1, wherein, The data preprocessing module further comprises: Tag data, license plate number n i1 and parking location n i2 Tag encoding is used; Using sine and cosine functions for vehicle entry and exit times n i3 Periodic encoding preserves the periodic nature of the time, n i3 = [Hour sin , Hour cos ] For weather information n i4 , a one-hot code is used for encoding processing, OneHot (sunny day) = [1, 0, 0] OneHot (rainy day) = [0, 1, 0] OneHot (snowy day) = [0, 0, 1] Hour is the hour part of the current time, [Hour sin , Hour cos ] represents a periodic encoding that maps 0 to 23 hours to the range 0 to 2π, the result is calculated by the sin and cos functions, OneHot() represents one-hot code, which converts weather type information into one-hot vector representation; The data structure of the license plate number n i1 and the parking position n i2 is a numbered digit, the data structure of the vehicle entry and exit time n i3 and the weather information n i4 is a 2-dimensional vector and a 3-dimensional vector respectively.
5. The deep learning-based peak spreading parking management system of claim 1, wherein, The data preprocessing module further comprises: By respectively on parking time x i1 , parking fee x i2 , parking occupancy x i3 , traffic flow x i4 , traffic flow x i5 Using Z-score standardization, make the data have uniform scale, wherein z i1 is the standardized result of the parking duration x i1 , μ1 is the mean of the parking duration x i1 , σ1 is the standard deviation of the parking duration x i1 , z i2 is the standardized result of the parking fee x i2 , μ2 is the mean of the parking fee x i2 , σ2 is the standard deviation of the parking fee x i2 , z i3 is the standardized result of the parking space usage rate x i3 , μ3 is the mean of the parking space usage rate x i3 , σ3 is the standard deviation of the parking space usage rate x i3 , z i4 is the standardized result of the traffic flow x i4 , μ4 is the mean of the traffic flow x i4 , σ4 is the standard deviation of the traffic flow x i4 , z i5 is the standardized result of the traffic volume x i5 , μ5 is the mean of the traffic volume x i5 , σ5 is the standard deviation of the traffic volume x i5 ; wherein the mean μ j and the standard deviation σ j (j = 1, 2, 3, 4, 5) are calculated as follows: x ij denotes the jth data feature of the ith vehicle.
Citation Information
Patent Citations
Time series data prediction method based on exponential smoothing
CN114548479A
Transform dynamic space-time correlation-based hospital parking lot recommendation method
CN116089744A
Parking space management system based on artificial intelligence
CN116564125A