Real-time vacant parking space prediction method based on LSTM network

Through the real-time parking space prediction method based on LSTM network, the inefficient management problem caused by static data analysis in the existing technology is solved, and efficient and accurate parking lot management and traffic flow optimization are achieved.

CN120636192APending Publication Date: 2025-09-12CHINA THREE GORGES UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510720580.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing parking management systems rely on static data analysis and cannot effectively predict dynamic parking demand. They have high computational costs and insufficient prediction accuracy, resulting in low management efficiency.

Method used

A real-time parking space prediction method based on LSTM network is adopted. Through data preprocessing, LSTM model construction, loss function design, Adam optimizer training and result visualization, real-time prediction and confidence interval analysis of parking quantity are achieved.

Benefits of technology

It improves parking lot management efficiency and service quality, can quickly respond to real-time changes, significantly reduce computing costs, capture complex nonlinear relationships, and improve prediction accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120636192A_ABST
    Figure CN120636192A_ABST
Patent Text Reader

Abstract

The invention discloses a real-time vacant parking space prediction method based on an LSTM network. The method comprises the steps of data preprocessing, building an LSTM network model by using Python and Pytorch frameworks, designing a loss function and training the model; in the training process, an Adam optimizer is used to optimize the model, then test set data is input into the trained LSTM model for prediction, then the predicted parking number is subjected to reverse normalization, and finally, a predicted value and actual data are subjected to visual comparison and a confidence interval is added. According to the method, the deep learning technology of the LSTM network is used, the possible remaining parking spaces are efficiently predicted from the parking numbers in the parking lot in different time periods, the problems that in the prior art, the calculated amount is too large, and an accurate prediction result cannot be efficiently obtained are solved, and the method has remarkable advantages in the aspects of improving the calculation efficiency and the processing capacity and is suitable for popularization and application. The method is suitable for an intelligent traffic system and urban intelligent management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent traffic management and urban data processing, and in particular relates to a real-time parking space prediction method based on an LSTM network. Background Art

[0002] With the acceleration of urbanization and the continued growth of motor vehicle ownership, urban traffic congestion is becoming increasingly serious, with parking difficulties being a major contributing factor. Traditional parking management systems typically rely on manual counting or simple sensor systems to record parking space usage. This approach is not only inefficient but also fails to provide accurate parking forecasts, resulting in wasted resources and a poor user experience. Current technical challenges primarily stem from limited data processing capabilities. Traditional parking management systems primarily rely on simple statistical analysis of static data (such as parking records within a fixed time period), lacking the ability to predict dynamically changing parking demand. Even some systems that integrate sensor technology can only provide current parking space occupancy status and are unable to effectively predict future parking trends. Second, computational costs are high. To improve prediction accuracy, large amounts of historical data and complex mathematical models are required for analysis. However, these models typically require high computing resources and struggle to respond quickly to real-time demand changes in practical applications. Third, prediction accuracy is insufficient. Existing prediction methods often rely on linear regression or other simple machine learning algorithms, which fail to fully capture the nonlinear and time-series characteristics that influence parking demand fluctuations. This results in inaccurate predictions that fail to meet practical management needs.

[0003] In recent years, deep learning techniques, particularly long short-term memory (LSTM) networks, have demonstrated remarkable performance in time series forecasting. LSTMs effectively handle long-term dependencies and are particularly well-suited for datasets with pronounced periodicity and seasonality, such as parking lot population patterns. By training an LSTM model, historical parking data can be leveraged to automatically learn and predict parking lot population trends over a specific time period. Compared to traditional methods, LSTMs maintain high prediction accuracy while significantly reducing computational costs. Furthermore, thanks to their efficient forward propagation mechanism, LSTM models can rapidly update predictions upon receiving new observations, ensuring that management decisions are always based on the latest information. Crucially, leveraging the powerful expressive power of deep learning, LSTMs can naturally capture complex nonlinear relationships in multidimensional parameter spaces, eliminating the need to explicitly define specific association rules between individual variables. Therefore, a real-time parking space prediction method based on LSTM networks is needed to address this problem. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a real-time parking space prediction method based on LSTM network, which aims to solve the problem that the existing technology has too much calculation amount and cannot efficiently obtain accurate calculation results. It has the characteristics of significantly improving parking lot management efficiency and service quality, and providing strong data support for urban traffic planning.

[0005] In order to achieve the above technical effects, the technical solution adopted by the present invention is: A real-time parking space prediction method based on LSTM network includes the following steps: S1, data preprocessing: Collect parking information data of parking lots, including parking entry and exit times; Count the number of parking lots in each time period, and finally use the number of parking lots as a feature for feature normalization; S2, build LSTM network model using Python and Pytorch framework; S3, design loss function; S4, training model; S5, use the Adam optimizer to optimize the model during training; S6: Input the test set data into the trained LSTM model for prediction, and then denormalize the predicted parking quantity; S7, result analysis, visually compares the predicted number and the actual number and adds confidence intervals.

[0006] Preferably, in step S1, parking data of the parking lot is collected, including the parking entry time and the exit time, and the number of parking lots in each time period is counted. Finally, the method for normalizing the parking number feature is as follows: Select all vehicle parking information in the target parking lot within a fixed time period and determine the parking entry and exit time of each vehicle; The collected parking data is divided into a period T as a time period, and the number of vehicles parked in the parking lot within each period T is counted; The processed parking lot data is divided into training set and test set in the ratio of 8:2, and the number of parking lots is normalized by MinMaxScaler.

[0007] Preferably, in step S2, building the LSTM network model includes building a deep learning network with three cores: a forget gate, an input gate, and an output gate.

[0008] Preferably, the forget gate formula is expressed as: ; in, is the weight matrix of the forget gate; is the bias term of the forget gate; is the sigmoid activation function.

[0009] Preferably, the input gate formula is expressed as: ; ; in, is the input of the input gate; is a candidate cell state; and are the weight matrices of the input gate and candidate state respectively; and are the bias terms of the input gate and candidate state respectively.

[0010] Preferably, the output gate formula is expressed as: ; ; in, is the input of the input gate; is the hidden state at the current time step; is the weight matrix of the output gate; is the bias term of the output gate.

[0011] Preferably, in step S3, the loss function is designed as: ; Where, N is the number of samples in the dataset, It is i The actual observed value of the sample, It is i The predicted value of the sample.

[0012] Preferably, in step S5, the parameter update formula of the Adam optimizer is: ; Where, It's time t Parameters, It's time t The first moment estimate of and It is a hyperparameter, usually set to 0.9 and 0.999; It's time t The second moment estimate of is a constant used to prevent the denominator from being zero.

[0013] Furthermore, the learning rate (LR) is a crucial hyperparameter in deep learning training, controlling the magnitude of model weight updates. The StepLR scheduler is a learning rate adjustment strategy that periodically reduces the learning rate at predetermined intervals, thereby helping the model converge more effectively during training.

[0014] Preferably, in steps S6 and S7, the parking data of the test set is input into the trained LSTM model and then visually compared and the confidence interval is calculated. The derivation formula of the confidence interval is: ; Where, represents the predicted value, is the standard deviation of the residuals; SE The calculation formula is as follows: ; ; Where, n is the number of elements in the sample; is the residual of each sample element; is the value of each sample element, is the predicted value of each sample element.

[0015] Preferably, the upper and lower bounds of the confidence interval are: Upper Bound= +Z·SE; Lower Bound= -Z·SE; In the formula, Lower Bound represents the lower bound of the confidence interval, and Upper Bound represents the upper bound of the confidence interval. represents the predicted value, is the standard deviation of the residuals.

[0016] The beneficial effects of the present invention are as follows: This invention provides a method and system for real-time parking lot parking quantity prediction based on a long short-term memory (LSTM) network. Compared to traditional methods (such as basic recurrent neural networks (RNNs), these methods offer significant technical advantages and practical application value. First, LSTMs are capable of capturing long-term dependencies. RNNs are prone to vanishing gradients when processing long sequences, making it difficult to learn effective long-term dependency confidence, which in turn affects prediction accuracy. Second, LSTMs can automatically learn and adapt to complex nonlinear patterns in data without explicitly defining specific mathematical formulas or transformation rules. This feature makes them superior when dealing with complex parking demand fluctuations (such as those caused by holidays and special events). RNNs, however, perform poorly when handling complex nonlinear patterns due to structural limitations. In summary, the LSTM-based real-time parking lot parking quantity prediction method not only outperforms traditional RNN methods in prediction accuracy, but also demonstrates significant advantages in robustness, flexibility, and computational efficiency. These features make it an ideal choice for addressing urban parking difficulties, effectively improving parking lot management efficiency, optimizing urban traffic flow distribution, and enhancing user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a flow chart of the algorithm of the present invention; Figure 2 This is a visualization diagram of the results of the method of the present invention. DETAILED DESCRIPTION

[0018] Example 1: like Figure 1 As shown in FIG, a real-time parking space prediction method based on an LSTM network includes the following steps: S1, data preprocessing: Collect parking information data of parking lots, including parking entry and exit times; Count the number of parking lots in each time period, and finally use the number of parking lots as a feature for feature normalization; S2, build LSTM network model using Python and Pytorch framework; S3, design loss function; S4, training model; S5, use the Adam optimizer to optimize the model during training; S6: Input the test set data into the trained LSTM model for prediction, and then denormalize the predicted parking quantity; S7, result analysis, visually compares the predicted number and the actual number and adds confidence intervals.

[0019] Preferably, in step S1, parking data of the parking lot is collected, including the parking entry time and the exit time, and the number of parking lots in each time period is counted. Finally, the method for normalizing the parking number feature is as follows: Select all vehicle parking information in the target parking lot within a fixed time period and determine the parking entry and exit time of each vehicle; The collected parking data is divided into a period T as a time period, and the number of vehicles parked in the parking lot within each period T is counted; The processed parking lot data is divided into training set and test set in the ratio of 8:2, and the number of parking lots is normalized by MinMaxScaler.

[0020] Preferably, in step S2, building the LSTM network model includes building a deep learning network with three cores: a forget gate, an input gate, and an output gate.

[0021] Preferably, the forget gate formula is expressed as: ; in, is the weight matrix of the forget gate; is the bias term of the forget gate; is the sigmoid activation function.

[0022] Preferably, the input gate formula is expressed as: ; ; in, is the input of the input gate; is a candidate cell state; and are the weight matrices of the input gate and candidate state respectively; and are the bias terms of the input gate and candidate state respectively.

[0023] Preferably, the output gate formula is expressed as: ; ; in, is the input of the input gate; is the hidden state at the current time step; is the weight matrix of the output gate; is the bias term of the output gate.

[0024] Preferably, in step S3, the loss function is designed to be: ; Where, Nis the number of samples in the dataset, It is i The actual observed value of the sample, It is i The predicted value of the sample.

[0025] Preferably, in step S5, the parameter update formula of the Adam optimizer is: ; Where, It's time t Parameters, It's time t The first moment estimate of and It is a hyperparameter, usually set to 0.9 and 0.999; It's time t The second moment estimate of is a constant used to prevent the denominator from being zero.

[0026] Furthermore, the learning rate (LR) is a crucial hyperparameter in deep learning training, controlling the magnitude of model weight updates. The StepLR scheduler is a learning rate adjustment strategy that periodically reduces the learning rate at predetermined intervals, thereby helping the model converge more effectively during training.

[0027] Preferably, in steps S6 and S7, the parking data of the test set is input into the trained LSTM model and then visually compared and the confidence interval is calculated. The derivation formula of the confidence interval is: ; Where, represents the predicted value, is the standard deviation of the residuals; SE The calculation formula is as follows: ; ; Where, n is the number of elements in the sample; is the residual of each sample element; is the value of each sample element, is the predicted value of each sample element.

[0028] Preferably, the upper and lower bounds of the confidence interval are: Upper Bound= +Z·SE; Lower Bound= -Z·SE; In the formula, Lower Bound represents the lower bound of the confidence interval, and Upper Bound represents the upper bound of the confidence interval. represents the predicted value, is the standard deviation of the residuals.

[0029] Furthermore, to adapt the data to the neural network input, the parking quantity needs to be normalized during data processing. When visualizing the results, the predicted parking quantity also needs to be denormalized to restore it to its original size range.

[0030] Example 2: The Xintiandi parking lot on University Road in Yichang City, Hubei Province was selected, and all vehicle parking information from October 2023 to February 2024 was collected to determine the parking time and exit time of each vehicle. The predicted output results were visually compared with the real data and confidence intervals were added to evaluate the effectiveness of the model.

[0031] This was verified through experiments, the experimental contents are as follows: Set the initial model parameters to {width = 64, depth = 3, lr = 0.001}, where width is the model width, depth is the model depth, and lr is the model initial learning rate. After building the model in step S2, perform training and testing to conduct preliminary error analysis.

[0032] Finally, the prediction results of the test phase are compared and visualized, and the confidence interval is added together with the downward trend of the error in the training phase to comprehensively evaluate the prediction accuracy of the model.

[0033] like Figure 2 The figure shows a comparison of the predicted values ​​and true values ​​of this method. It can be seen from the figure that the predicted values ​​and true values ​​have a high degree of overlap, and the deviation values ​​on the horizontal axis of the time step fall within the confidence interval, indicating that the prediction method has good accuracy and usability.

Claims

1. A real-time parking space prediction method based on LSTM network, characterized in that: The following steps are involved: S1, data preprocessing: Collect parking information data of parking lots, including parking entry and exit times; Count the number of parking lots in each time period, and finally use the number of parking lots as a feature for feature normalization; S2, build LSTM network model using Python and Pytorch framework; S3, design loss function; S4, training model; S5, use the Adam optimizer to optimize the model during training; S6: Input the test set data into the trained LSTM model for prediction, and then denormalize the predicted parking quantity; S7, result analysis, visually compares the predicted number and the actual number and adds confidence intervals.

2. The real-time parking space prediction method based on LSTM network according to claim 1 is characterized in that: In step S1, parking data of the parking lot is collected, including the entry time and exit time, and the number of parking lots in each time period is counted. Finally, the method for normalizing the number of parking lots is as follows: Select all vehicle parking information in the target parking lot within a fixed time period and determine the parking entry and exit time of each vehicle; The collected parking data is divided into a period T as a time period, and the number of vehicles parked in the parking lot within each period T is counted; The processed parking lot data is divided into training set and test set according to a fixed ratio, and the number of parking lots is normalized by MinMaxScaler.

3. The real-time parking space prediction method based on LSTM network according to claim 1 is characterized in that: In step S2, building an LSTM network model includes building a deep learning network with three cores: a forget gate, an input gate, and an output gate.

4. The real-time parking space prediction method based on LSTM network according to claim 3 is characterized in that: Forget gate formula expression: ; in, is the weight matrix of the forget gate; is the bias term of the forget gate; is the sigmoid activation function.

5. The real-time parking space prediction method based on LSTM network according to claim 3 is characterized in that: The input gate formula is expressed as: ; ; in, is the input of the input gate; is a candidate cell state; and are the weight matrices of the input gate and candidate state respectively; and are the bias terms of the input gate and candidate state respectively.

6. The real-time parking space prediction method based on LSTM network according to claim 3 is characterized in that: The output gate formula is expressed as: ; ; in, is the input of the input gate; is the hidden state at the current time step; is the weight matrix of the output gate; is the bias term of the output gate.

7. The method for real-time parking space prediction based on LSTM network according to claim 1, characterized in that: In step S3, the loss function is designed as: ; Where, N is the number of samples in the dataset, It is i The actual observed value of the sample, It is i The predicted value of the sample.

8. The method for real-time parking space prediction based on LSTM network according to claim 1, characterized in that: In step S5, the parameter update formula of the Adam optimizer is: ; Where, It's time t Parameters, It's time t The first moment estimate of and is a hyperparameter; It's time t The second moment estimate of is a constant used to prevent the denominator from being zero.

9. The method for real-time parking space prediction based on LSTM network according to claim 1, characterized in that: In steps S6 and S7, the test set parking data is input into the trained LSTM model and then visualized and compared before calculating the confidence interval. The confidence interval is derived as follows: ; Where, represents the predicted value, is the standard deviation of the residuals; SE The calculation formula is as follows: ; ; Where, n is the number of elements in the sample; is the residual of each sample element; is the value of each sample element, is the predicted value of each sample element.

10. The real-time parking space prediction method based on LSTM network according to claim 9, characterized in that: The upper and lower bounds of the confidence interval are: Upper Bound= +Z·SE; Lower Bound= -Z·SE; In the formula, Lower Bound represents the lower bound of the confidence interval, and Upper Bound represents the upper bound of the confidence interval. represents the predicted value, is the standard deviation of the residuals.

Citation Information

Cited By

  • Urban parking lot prediction method driven by artificial intelligence algorithm

    CN121257877A