Method, device and equipment for predicting number of effective parking spaces of parking lot and storage medium
By classifying and splicing the historical berthing data of the parking lot, the QRPSO algorithm is used to build the LSTM neural network and the GRU residual prediction neural network, and combining the output values of the two to predict the high-precision problem of the number of effective berthing in the parking lot, achieving more accurate berthing prediction.
Patent Information
- Application Number
- CN202411693531.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-25
AI Technical Summary
How to achieve high-precision prediction of effective berths in parking lots, taking into account the hierarchy, periodicity, similarity and predictability of the number of berths.
By obtaining valid berth data in the historical period of all parking lots in a fixed area, the data of the nearest two parking lots are spliced into a data set after classification. Then, the LSTM neural network is built using the QRPSO algorithm, the data set is trained, the trained LSTM neural network and the GRU residual prediction neural network are obtained, and the output values of the two are used for prediction.
Through the combination of LSTM neural network and GRU residual prediction neural network, more accurate prediction values of daily effective berths can be obtained, improving prediction accuracy.
Smart Images

Figure CN119623727A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of parking guidance berth prediction in an intelligent transportation system, and in particular to a method, device, equipment and storage medium for predicting the number of effective parking spaces in a parking lot. Background Art
[0002] The change process of the number of effective parking spaces in a parking lot is hierarchical, periodic, similar and predictable. How to achieve high-precision prediction of the number of effective parking spaces is a difficult problem. In order to match the long-term trend and periodic fluctuation characteristics of the parking space prediction problem, it is urgent to propose a method for predicting the number of effective parking spaces in a parking lot. Summary of the invention
[0003] One object of the present invention is to provide a method for predicting the number of effective parking spaces in a parking lot, which can at least solve the technical problem of how to achieve matching high-precision prediction of the number of effective parking spaces.
[0004] The present invention provides a method for predicting the number of effective parking spaces in a parking lot, comprising the following steps: obtaining effective parking space data of all parking lots in a fixed area in a historical period, and classifying the effective parking space data according to working days, non-working days and non-statutory holidays, and statutory holidays; the first parking lot and the second parking lot in the fixed area are closest to each other, and the classified effective parking space data of the first parking lot and the second parking lot are spliced to obtain a data set; using the QRPSO algorithm to construct an LSTM neural network, using the data set as the input training data of the LSTM neural network to obtain the trained LSTM neural network, and obtaining each of the last iterations in the training process. The absolute error sequence between the output value of the data point and the true value; using the absolute error sequence as the training data of the GRU residual prediction neural network to construct the GRU residual prediction neural network; judging whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtaining the corresponding trained LSTM neural network and GRU residual prediction neural network, using the trained LSTM neural network to predict the number of valid berths on the predicted day to obtain a first output value, using the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day to obtain a second output value, and obtaining the valid berth data for each time period of the predicted day according to the first output value and the second output value.
[0005] Optionally, the step of constructing an LSTM neural network using the QRPSO algorithm includes: using the QRPSO algorithm to optimize the number of hidden layers, the initial learning rate, and the maximum number of iterations of the LSTM neural network to obtain an optimal parameter combination; based on the optimal parameter combination, executing the QRPSO algorithm to optimize the number of neurons in each layer of the LSTM neural network; using the optimal parameter combination and the optimized number of neurons in each layer to construct the LSTM neural network.
[0006] Optionally, when using the QRPSO algorithm to optimize the number of hidden layers, initial learning rate, and maximum number of iterations of the LSTM neural network, the number of particles of the QRPSO algorithm is set to 30, the maximum number of iterations is set to 1000, and the encoding of each particle is as follows:
[0007] Particle=[HiddenLayer, LearningRate, MaxIterNum];
[0008] Among them, HiddenLayer is the number of hidden layers, which is initially set to 2; LearningRate is the learning rate, which is initially set to 1; MaxIterNum is the maximum number of training times, which is initially set to 1000.
[0009] Optionally, when executing the QRPSO algorithm to optimize the number of neurons in each layer of the LSTM neural network, the encoding of each particle of the QRPSO algorithm is as follows:
[0010] Particle′=[num1,num2,...,num k ];
[0011] Among them, num i is the number of neurons in the i-th hidden layer, and k is the number of hidden layers of the optimal particle obtained in step S3.
[0012] Optionally, update the particles using the following statement:
[0013]
[0014] in, is the position of the i-th particle of the QRPSO algorithm at the t+1 iteration; is the historical optimal position of the i-th particle; gbest is the global optimal particle position; g is a random number between 0 and 1; c is a constant with a value of 5; r is a random number between -1 and 1; t is the current iteration number; T is the maximum number of iterations executed by the QRPSO algorithm.
[0015] Optionally, when using the QRPSO algorithm, the following steps are also included:
[0016] Perform particle local search operation, randomly extract two different particles of QRPSO, randomly select the value of a certain dimension of the particle for exchange, if the fitness value of the particle after the exchange is greater than the fitness value before the exchange, then keep the particle after the exchange;
[0017] Perform particle mean smoothing local search operation to calculate the mean particle of all particles in the QRPSO algorithm.
[0018] Optionally, set the fitness function of the QRPSO algorithm as follows:
[0019]
[0020] where y i,forcast is the output prediction value of the LSTM neural network at the i-th point in the training set data, y i,true is the true value of the i-th point in the training set data, N is the size of the training set data, and its value is one tenth of the entire data set.
[0021] The present invention also provides a device for predicting the number of effective parking spaces in a parking lot, comprising:
[0022] A parking space data processing module, wherein the parking space data processing module obtains valid parking space data of all parking lots in a fixed area within a historical period, and classifies the valid parking space data according to working days, non-working days and non-statutory holidays, and statutory holidays;
[0023] A data set acquisition module, wherein the data set acquisition module combines the classified valid parking space data of the first parking lot and the second parking lot that are closest to each other in the fixed area to obtain a data set;
[0024] An LSTM neural network construction module, wherein the LSTM neural network acquisition module uses a QRPSO algorithm to construct an LSTM neural network, uses the data set as input training data of the LSTM neural network to obtain a trained LSTM neural network, and obtains an absolute error sequence between the output value and the true value of each data point in the last iteration during the training process;
[0025] A GRU residual prediction neural network building module, wherein the GRU residual prediction neural network building module uses the absolute error sequence as training data of the GRU residual prediction neural network;
[0026] A berth data prediction module, wherein the berth data prediction module determines whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtains the trained LSTM neural network and the GRU residual prediction neural network corresponding thereto, uses the trained LSTM neural network to predict the number of valid berths on the predicted day to obtain a first output value, uses the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day to obtain a second output value, and the berth data prediction module obtains the valid berth data for each time period of the predicted day according to the first output value and the second output value.
[0027] The present invention also provides an electronic device, comprising: a processor and a memory, wherein computer program instructions are stored in the memory, wherein when the computer program instructions are executed by the processor, the processor executes any one of the above methods.
[0028] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes any one of the above methods.
[0029] The method for predicting the number of effective parking spaces in a parking lot according to an embodiment of the present invention combines the predicted value of the number of effective parking spaces on the prediction day by the LSTM neural network and the predicted residual of the number of effective parking spaces on the prediction day by the GRU neural network to obtain a more accurate predicted value of the number of effective parking spaces on the prediction day.
[0030] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0032] Figure 1 is a flowchart of a method for predicting the number of effective parking spaces in a parking lot according to an embodiment of the present invention;
[0033] Figure 2 is a schematic diagram of an electronic device according to an embodiment of the present invention.
[0034] Reference numerals:
[0035] Electronic device 200;
[0036] Processor 201;
[0037] Memory 202; operating system 2021; application program 2022;
[0038] Network interface 203;
[0039] Input device 204;
[0040] Hard disk 205;
[0041] Display device 206. DETAILED DESCRIPTION
[0042] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0043] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0044] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0045] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0046] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0047] like Figure 1 As shown, the method for predicting the number of effective parking spaces in a parking lot according to an embodiment of the present invention is described in detail below with reference to the accompanying drawings.
[0048] The method for predicting the number of available parking spaces in a parking lot according to an embodiment of the present invention comprises the following steps:
[0049] Get the valid parking space data of all parking lots in a fixed area in the historical period, and classify the valid parking space data according to working days, non-working days and non-legal holidays, and legal holidays. In other words, according to the date regulations of legal holidays, weekends and working days, determine whether it is National Day, Spring Festival, Monday to Friday, Saturday or Sunday, etc., and classify the historical valid parking space data of all parking lots in a certain area. For example, the valid parking space data of the historical period of holidays is recorded as Data a1 , the valid berth data of the historical period of weekends is recorded as Data a2 , the effective berth data of the historical period of the working day is recorded as Data a3 .
[0050] The first parking lot and the second parking lot in a fixed area are closest to each other. The classified valid parking space data of the first parking lot and the second parking lot are spliced to obtain a data set. That is to say, before executing the LSTM neural network training, the historical valid parking space data of different parking lots are spliced into the nearest neighbor data set. For example, for parking lot a in area A, there is a data set Data a1 ,Data a2 ,Data a3 , take the data set Data of another parking lot b that is closest to parking lot a in area A b1 ,Data b2 ,Data b3 , Data a1 The data is spliced into Data b1 After the last piece of data, get Data a1 ';Data a2 The data is spliced into Data b2 After the last piece of data, get Data a2 ';Data a3 The data is spliced into Data b3 After the last piece of data, get Data a3 In addition, the scale of training data can be increased through data splicing operations, which can improve the prediction accuracy of the LSTM neural network. Using data from neighboring parking lots for splicing and training can effectively improve the generalization ability of the LSTM neural network and avoid overfitting.
[0051] The LSTM neural network is constructed using the QRPSO algorithm (Quadratic restructuring particle swarm optimization, QRPSO), and the data set is used as the input training data of the LSTM neural network to obtain the trained LSTM neural network, and the absolute error sequence between the output value and the true value of each data point in the last iteration of the training process is obtained. In other words, a QRPSO-LSTM network is constructed.
[0052] The absolute error sequence is used as the training data of the GRU residual prediction neural network to construct the GRU residual prediction neural network. In other words, an LSTM neural network is trained for each type of data, and the absolute error value of the last training of the LSTM neural network is used as the training data of the GRU neural network to obtain the GRU residual neural network. Among them, the residual prediction neural network can be used to predict the error sequence predicted by the LSTM neural network. During the training process of the LSTM neural network, there will be a certain error in each training iteration. By using these error sequences as training data and as training data for the GRU residual prediction neural network, the parking space error value of the target day can be predicted. By using the LSTM neural network to predict the parking space and the GRU residual prediction neural network to predict the error, the final parking space prediction value can be obtained, which further improves the parking space prediction effect of the parking lot.
[0053] Determine whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtain the corresponding trained LSTM neural network and GRU residual prediction neural network, use the trained LSTM neural network to predict the number of valid berths on the predicted day, and obtain a first output value, use the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day, and obtain a second output value, and obtain the valid berth data for each time period of the predicted day according to the first output value and the second output value.
[0054] Therefore, the method for predicting the number of effective parking spaces in a parking lot according to an embodiment of the present invention combines the predicted value of the number of effective parking spaces on the predicted day by the LSTM neural network and the predicted residual of the number of effective parking spaces on the predicted day by the GRU neural network to obtain a more accurate predicted value of the number of effective parking spaces on the predicted day.
[0055] According to one embodiment of the present invention, the steps of constructing an LSTM neural network using the QRPSO algorithm include:
[0056] The QRPSO algorithm is used to optimize the number of hidden layers, initial learning rate, and maximum number of iterations of the LSTM neural network to obtain the optimal parameter combination. In other words, when constructing the QRPSO-LSTM network, the QRPSO algorithm is used to optimize the number of hidden layers, initial learning rate, maximum number of training times, and number of neurons in each layer of the LSTM neural network to obtain the optimal parameter combination.
[0057] Based on the optimal parameter combination, the QRPSO algorithm is executed to optimize the number of neurons in each layer of the LSTM neural network;
[0058] The LSTM neural network is constructed using the optimal parameter combination and the optimized number of neurons in each layer.
[0059] In this embodiment, the parameter setting in the LSTM neural network is crucial to the prediction performance, and the parameter setting often relies on experience or experimental testing to obtain a set of better parameter combinations. The present invention uses the QRPSO algorithm to optimize the number of hidden layers, initial learning rate, and maximum number of training times of the LSTM neural network. It does not require artificial experimental acquisition or experience-based settings, and obtains a set of optimal parameter combinations optimized by the QRPSO algorithm, which can improve the prediction accuracy of the LSTM neural network. In addition, based on the optimal number of hidden layers, learning rate, and maximum number of iterations obtained by using the QRPSO algorithm, the QRPSO algorithm is used to optimize the number of neurons in each layer of the LSTM neural network, which solves all parameter settings of the LSTM neural network, and the parameter setting process is the optimal combination optimized by the QRPSO algorithm, further improving the prediction accuracy of the LSTM neural network.
[0060] In some specific embodiments of the present invention, when the QRPSO algorithm is used to optimize the number of hidden layers, the initial learning rate, and the maximum number of iterations of the LSTM neural network, the number of particles of the QRPSO algorithm is set to 30, the maximum number of iterations is set to 1000, and the encoding of each particle is as follows:
[0061] Particle=[HiddenLayer, LearningRate, MaxIterNum];
[0062] Among them, HiddenLayer is the number of hidden layers, which is initially set to 2; LearningRate is the learning rate, which is initially set to 1; MaxIterNum is the maximum number of training times, which is initially set to 1000.
[0063] According to one embodiment of the present invention, when executing the QRPSO algorithm to optimize the number of neurons in each layer of the LSTM neural network, the encoding of each particle of the QRPSO algorithm is as follows:
[0064] Particle′=[num1,num2,...,num k ];
[0065] Among them, num i is the number of neurons in the i-th hidden layer, and k is the number of hidden layers of the optimal particle obtained in step S3.
[0066] In some specific embodiments of the present invention, the following expression is used to update the particles:
[0067]
[0068] in, is the position of the i-th particle of the QRPSO algorithm at the t+1 iteration; is the historical optimal position of the i-th particle; gbest is the global optimal particle position; g is a random number between 0 and 1; c is a constant with a value of 5; r is a random number between -1 and 1; t is the current iteration number; T is the maximum number of iterations executed by the QRPSO algorithm.
[0069] According to one embodiment of the present invention, when using the QRPSO algorithm, the following steps are also included:
[0070] Perform particle local search operation, randomly extract two different particles of QRPSO, randomly select the value of a certain dimension of the particle for exchange, if the fitness value of the particle after the exchange is greater than the fitness value before the exchange, then keep the particle after the exchange;
[0071] Perform particle mean smoothing local search operation to calculate the mean particle of all particles in the QRPSO algorithm.
[0072] In some specific embodiments of the present invention, the fitness function of the QRPSO algorithm is set as follows:
[0073]
[0074] where y i,forcast is the output prediction value of the LSTM neural network at the i-th point in the training set data, y i,true is the true value of the i-th point in the training set data, N is the size of the training set data, and its value is one tenth of the entire data set.
[0075] The present invention also provides a device for predicting the number of effective parking spaces in a parking lot, comprising: a parking space data processing module, a data set acquisition module, an LSTM neural network construction module, a GRU residual prediction neural network construction module and a parking space data prediction module.
[0076] Specifically, the parking data processing module obtains the valid parking data of all parking lots in a fixed area within a historical period, and classifies the valid parking data according to working days, non-working days and non-statutory holidays, and statutory holidays. The data set acquisition module splices the classified valid parking data of the first parking lot and the second parking lot closest to the fixed area to obtain a data set. The LSTM neural network acquisition module uses the QRPSO algorithm to construct an LSTM neural network, uses the data set as the input training data of the LSTM neural network to obtain the trained LSTM neural network, and obtains the absolute error sequence between the output value and the true value of each data point in the last iteration of the training process. The GRU residual prediction neural network construction module uses the absolute error sequence as the training data of the GRU residual prediction neural network. The berth data prediction module determines whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtains the corresponding trained LSTM neural network and GRU residual prediction neural network, uses the trained LSTM neural network to predict the number of valid berths on the predicted day, obtains a first output value, uses the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day, obtains a second output value, and the berth data prediction module obtains the valid berth data for each time period of the predicted day based on the first output value and the second output value. It can be seen that the parking lot effective parking space number prediction device according to the embodiment of the present invention can realize the parking lot effective parking space number prediction method of the embodiment of the present invention, and the parking lot effective parking space number prediction method of the embodiment of the present invention has the advantage of improving the prediction accuracy, so the parking lot effective parking space number prediction device of the embodiment of the present invention also has the same advantages, which will not be repeated here.
[0077] The method for predicting the number of available parking spaces in a parking lot according to an embodiment of the present invention will be described in detail below in conjunction with specific embodiments.
[0078] like Figure 1 As shown, the method for predicting the number of effective parking spaces in a parking lot according to an embodiment of the present invention comprises the following steps:
[0079] S1. Classify the valid parking space data of all parking lots in area A during the historical period.
[0080] According to holidays, weekends and weekdays, the valid parking space data of all parking lots in area A in the historical period are classified. For example, the valid parking space data of a parking lot a in the historical period are classified as follows: The valid parking space data of the historical period of holidays is recorded as Data a1 , the valid berth data of the historical period of weekends is recorded as Data a2 , the effective berth data of the historical period of the working day is recorded as Data a3 .
[0081] S2. Construct QRPSO-LSTM neural network.
[0082] The QRPSO algorithm is used to optimize the number of hidden layers, initial learning rate, and maximum number of training times of the LSTM neural network to obtain the optimal parameter combination.
[0083] Among them, the particle update formula of the QRPSO algorithm is as follows:
[0084]
[0085] In formula (1), is the position of the i-th particle of the QRPSO algorithm at the t+1 iteration, is the historical optimal position of the i-th particle, Particle gbest is the global optimal particle position, g is a random number between 0 and 1, c is a constant with a value of 5, r is a random number between -1 and 1, t is the current iteration number, and T is the maximum number of iterations executed by the QRPSO algorithm.
[0086] The QRPSO algorithm particle encoding is as follows:
[0087] Particle=[HiddenLayer,LearningRate,MaxIterNum] (2)
[0088] In formula (2), HiddenLayer is the number of hidden layers, which is initially set to 2; LearningRate is the learning rate, which is initially set to 1; MaxIterNum is the maximum number of training times, which is initially set to 1000.
[0089] The fitness function of the QRPSO algorithm is set as follows:
[0090]
[0091] In formula (3), y i,forcast is the output prediction value of the LSTM neural network at the i-th point in the training set data, y i,true is the true value of the i-th point in the training set data, N is the size of the training set data, and its value is one tenth of the entire data set.
[0092] S3, execute QRPSO algorithm to optimize the number of hidden layers, initial learning rate and maximum number of training times of LSTM neural network parameters. Parameter setting in LSTM neural network is crucial to prediction performance, and parameter setting often relies on experience or experimental testing to obtain a set of better parameter combinations. The present invention uses QRPSO algorithm to optimize the number of hidden layers, initial learning rate and maximum number of training times of LSTM neural network. It does not need to be obtained by artificial experiment or rely on experience setting, and obtains a set of optimal parameter combinations optimized by QRPSO algorithm, which can improve the prediction accuracy of LSTM neural network.
[0093] S3-1. Set the number of particles in the QRPSO algorithm to 30, the maximum number of iterations to 1000, and the encoding of each particle as shown in formula (2).
[0094] S3-2. Use formula (1) to update the particles.
[0095] S3-3, perform particle local search operation. Randomly extract two different particles of QRPSO i and Particle j , randomly select the value of a dimension d of the particle to exchange. If after the exchange, Particle i The fitness value of the Particle after the exchange is greater than the fitness value before the exchange, then the Particle after the exchange is retained. i . j The operation is similar.
[0096] S3-4, perform particle mean smoothing local search operation. Calculate the mean particle of all particles in the QRPSO algorithm. The definition of the mean particle is as follows:
[0097]
[0098] Calculate the fitness value of MeanParticle Mean , if Fitness Mean If the fitness value is greater than that of any particle, the value of the MeanParticle particle is assigned to the particle with the worst fitness.
[0099] S3-5. If the maximum number of iterations is reached, output the optimal particle, otherwise execute S3-2.
[0100] S4. In step S3, the QRPSO algorithm is used to obtain the optimal number of hidden layers, learning rate and maximum number of iterations. In this step S4, the QRPSO algorithm is used to optimize the number of neurons in each layer of the LSTM neural network. This solves all the parameter settings of the LSTM neural network, and the parameter setting process is the optimal combination obtained by the QRPSO algorithm, which further improves the prediction accuracy of the LSTM neural network. Based on the optimal number of hidden layers, learning rate and maximum number of iterations obtained in step S3, the QRPSO algorithm is executed to optimize the number of neurons in each layer of the LSTM neural network. The particle encoding is as follows:
[0101] Particle′=[num1,num2,...,num k ] (5)
[0102] In formula (5), num i is the number of neurons in the i-th hidden layer, and k is the number of hidden layers of the optimal particle obtained in step S3. The fitness function is set as shown in formula (3).
[0103] S4-1. Set the number of particles in the QRPSO algorithm to 20, the maximum number of iterations to 1000, and the encoding of each particle as shown in formula (5).
[0104] S4-2. Use formula (1) to update the particles.
[0105] S4-3, perform particle local search operation. Randomly extract two different particles of QRPSO i ′ and Particle′ j , randomly select the value of a dimension d of the particle to exchange. If after the exchange, Particle i ′ is greater than the fitness value before the exchange, then the Particle after the exchange is retained i '. j The operation is similar.
[0106] S4-4, perform particle mean smoothing local search operation. Calculate the mean particle of all particles in the QRPSO algorithm. The definition of the mean particle is as follows:
[0107]
[0108] Calculate the fitness value Fitness' of MeanParticle' Mean , if Fitness′ Mean If the fitness value of the particle is greater than that of any particle, the value of the MeanParticle′ particle is assigned to the particle with the worst fitness.
[0109] S4-5. If the maximum number of iterations is reached, output the optimal particle, otherwise execute S4-2.
[0110] S5. Execute the nearest neighbor parking lot data splicing operation.
[0111] For parking lot a in area A, there is a data set Data a1 ,Data a2 ,Data a3 , take the data set Data of another parking lot b that is closest to parking lot a in area A b1 ,Data b2 ,Data b3 , Data a1 The data is spliced into Data b1 After the last piece of data, get Data a1 ';Data a2 The data is spliced into Data b2 After the last piece of data, get Data a2 ';Data a3 The data is spliced into Data b3 After the last piece of data, get Data a3 ′. The same operation is performed for other parking lots in area A. This data splicing operation can increase the scale of training data, improve the prediction accuracy of the LSTM neural network, and use the data of neighboring parking lots for splicing and training, which can effectively improve the generalization ability of the LSTM neural network and avoid overfitting.
[0112] S6. Use the optimal number of hidden layers, learning rate, maximum number of iterations, and number of neurons in each layer obtained in steps S3 and S4 to construct an LSTM neural network.
[0113] For parking lot a in area A, the dataset Data a1 ′、Data a2 ′ and Data a3 ′, and use them as the input training data of the LSTM neural network respectively, and train the LSTM1 neural network, LSTM2 neural network and LSTM3 neural network.
[0114] The training accuracy of the LSTM1 neural network is recorded as r1, the training accuracy of the LSTM2 neural network is recorded as r2, and the training accuracy of the LSTM3 neural network is recorded as r3. During the training process of the LSTM1, LSTM2 and LSTM3 neural networks, the output value of each data point in the last iteration and the absolute error sequence of the true value are recorded as Res1, Res2 and Res3.
[0115] S7. Construct a GRU residual prediction neural network. The residual prediction neural network is used to predict the error sequence predicted by the LSTM neural network. During the training process of the LSTM neural network, there will be a certain error in each training iteration. By using these error sequences as training data and as training data for the GRU residual prediction neural network, the parking space error value on the target day can be predicted. By using the LSTM neural network to predict the parking space and the GRU residual prediction neural network to predict the error, the final parking space prediction value can be obtained, further improving the parking space prediction effect of the parking lot.
[0116] The Res1, Res2 and Res3 data obtained in S6 are used as the training data of the GRU residual prediction neural network, and the GRU1 residual prediction neural network, the GRU2 residual prediction neural network and the GRU3 residual prediction neural network are obtained. The hyper parameters used by the GRU1, GRU2 and GRU3 residual neural networks are as follows:
[0117] GRU neural network sequence length (Sequence): 12;
[0118] Number of hidden layers of GRU neural network: 2;
[0119] GRU neural network learning rate (LearningRate): 1.0;
[0120] S8. Predict the effective berth data for the forecast day. For a forecast day, determine whether the forecast day belongs to holidays, weekends, or working days, and obtain the corresponding LSTM i Neural Networks and GRU i Residual prediction neural network, using LSTM i The neural network predicts the number of effective berths on the forecast day and obtains the output value Pnum using GRU i The residual prediction neural network predicts the residual of the number of effective berths on the forecast day and obtains the output value Pe. The effective berth data ForcastValue of each period on the final forecast day is determined by the following formula (7):
[0121] ForcastValue=r i ·Pnum+Pe (7)
[0122] In formula (7), r i For LSTM i The training accuracy of the neural network.
[0123] The number of parked vehicles in parking lot a of area A at each time period on the forecast day is determined by the following formula:
[0124] ForcastCarNum=Totala -ForcastValue (8)
[0125] In formula (8), Total a is the total number of parking spaces in parking lot a.
[0126] S9. End.
[0127] The present invention further provides an electronic device 200, comprising: a processor 201 and a memory 202, wherein the memory 202 stores computer program instructions, wherein when the computer program instructions are executed by the processor 201, the processor 201 executes the steps of the method in the above embodiment.
[0128] Furthermore, if Figure 2 As shown, the electronic device 200 further includes a network interface 203 , an input device 204 , a hard disk 205 , and a display device 206 .
[0129] The above-mentioned interfaces and devices can be interconnected through a bus architecture. The bus architecture can include any number of interconnected buses and bridges. Specifically, one or more central processing units 201 (CPUs) represented by processor 201 and various circuits of one or more memories 202 represented by memory 202 are connected together. The bus architecture can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits together. It can be understood that the bus architecture is used to achieve connection and communication between these components. In addition to the data bus, the bus architecture also includes a power bus, a control bus, and a status signal bus, which are all well known in the art, so they will not be described in detail herein.
[0130] The network interface 203 can be connected to a network (such as the Internet, a local area network, etc.), obtain relevant data from the network, and save it in the hard disk 205.
[0131] The input device 204 can receive various instructions input by the operator and send them to the processor 201 for execution. The input device 204 can include a keyboard or a pointing device (for example, a mouse, a trackball, a touch pad or a touch screen, etc.).
[0132] The display device 206 can display the result obtained by the processor 201 executing the instruction.
[0133] The memory 202 is used to store programs and data necessary for the operation of the operating system 2021, as well as data such as intermediate results during the calculation process of the processor 201.
[0134] It is understood that the memory 202 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. The memory 202 of the apparatus and method described herein is intended to include, but is not limited to, these and any other suitable types of memory 202.
[0135] In some implementations, the memory 202 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof: an operating system 2021 and application programs 2022 .
[0136] The operating system 2021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 2022 includes various application programs 2022, such as a browser, etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 2022.
[0137] The processor 201 executes the steps of the method according to the above embodiment when calling and executing the application 2022 and data stored in the memory 202, specifically, the program or instructions stored in the application 2022.
[0138] The method disclosed in the above embodiment of the present invention can be applied to the processor 201, or implemented by the processor 201. The processor 201 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 201 or the instruction in the form of software. The above processor 201 can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general processor can be a microprocessor or the processor 201 can also be any conventional processor 201, etc. The steps of the method disclosed in conjunction with the embodiment of the present invention can be directly embodied as a hardware decoding processor to be executed, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 202, and the processor 201 reads the information in the memory 202 and completes the steps of the above method in combination with its hardware.
[0139] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions of the present invention or a combination thereof.
[0140] For software implementation, the technology herein can be implemented by modules (e.g., procedures, functions, etc.) that perform the functions herein. The software code can be stored in the memory 202 and executed by the processor 201. The memory 202 can be implemented in the processor 201 or outside the processor 201.
[0141] Specifically, the processor 201 is also used to read the computer program and execute the following steps: the method predicts and outputs the answer to the question asked by the user.
[0142] The present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by the processor 201, the processor 201 executes the steps of the method in the above embodiment.
[0143] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0145] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the sending and receiving methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0146] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A method for predicting the number of effective parking spaces in a parking lot, characterized in that: The steps include: Obtain valid parking space data for all parking lots in a fixed area during a historical period, and classify the valid parking space data according to working days, non-working days and non-statutory holidays, and statutory holidays; A first parking lot and a second parking lot in the fixed area are closest to each other, and the classified valid parking space data of the first parking lot and the second parking lot are spliced to obtain a data set; The LSTM neural network is constructed by using the QRPSO algorithm, the data set is used as the input training data of the LSTM neural network to obtain the trained LSTM neural network, and the absolute error sequence between the output value and the true value of each data point in the last iteration of the training process is obtained; Using the absolute error sequence as training data for a GRU residual prediction neural network to construct a GRU residual prediction neural network; Determine whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtain the corresponding trained LSTM neural network and GRU residual prediction neural network, use the trained LSTM neural network to predict the number of valid berths on the predicted day to obtain a first output value, use the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day to obtain a second output value, and obtain the valid berth data for each time period of the predicted day according to the first output value and the second output value.
2. The method for predicting the number of available parking spaces in a parking lot according to claim 1, characterized in that: The steps of constructing the LSTM neural network using the QRPSO algorithm include: The QRPSO algorithm is used to optimize the number of hidden layers, initial learning rate, and maximum number of iterations of the LSTM neural network to obtain the optimal parameter combination; Based on the optimal parameter combination, the QRPSO algorithm is executed to optimize the number of neurons in each layer of the LSTM neural network; The LSTM neural network is constructed using the optimal parameter combination and the optimized number of neurons in each layer.
3. The method for predicting the number of effective parking spaces in a parking lot according to claim 2, characterized in that: When using the QRPSO algorithm to optimize the number of hidden layers, initial learning rate, and maximum number of iterations of the LSTM neural network, the number of particles in the QRPSO algorithm is set to 30, the maximum number of iterations is set to 1000, and the encoding of each particle is as follows: Particle=[HiddenLayer, LearningRate, MaxIterNum]; Among them, HiddenLayer is the number of hidden layers, which is initially set to 2; LearningRate is the learning rate, which is initially set to 1; MaxIterNum is the maximum number of training times, which is initially set to 1000.
4. The method for predicting the number of available parking spaces in a parking lot according to claim 2, characterized in that: When executing the QRPSO algorithm to optimize the number of neurons in each layer of the LSTM neural network, the encoding of each particle of the QRPSO algorithm is as follows: Particle′=[num1,num2,…,num k ]; Among them, num i is the number of neurons in the i-th hidden layer, and k is the number of hidden layers of the optimal particle obtained in step S3.
5. The method for predicting the number of effective parking spaces in a parking lot according to claim 3 or 4, characterized in that: Use the following declaration to update the particles: in, is the position of the i-th particle of the QRPSO algorithm at the t+1 iteration; is the historical optimal position of the i-th particle; gbest is the global optimal particle position; g is a random number between 0 and 1; c is a constant with a value of 5; r is a random number between -1 and 1; t is the current iteration number; T is the maximum number of iterations executed by the QRPSO algorithm.
6. The method for predicting the number of effective parking spaces in a parking lot according to claim 5, characterized in that: When using the QRPSO algorithm, the following steps are also included: Perform particle local search operation, randomly extract two different particles of QRPSO, randomly select the value of a certain dimension of the particle for exchange, if the fitness value of the particle after the exchange is greater than the fitness value before the exchange, then keep the particle after the exchange; Perform particle mean smoothing local search operation to calculate the mean particle of all particles in the QRPSO algorithm.
7. The method for predicting the number of available parking spaces in a parking lot according to claim 6, characterized in that: The fitness function of the QRPSO algorithm is set as follows: where y i,forcast is the output prediction value of the LSTM neural network at the i-th point in the training set data, y i,true is the true value of the i-th point in the training set data, N is the size of the training set data, and its value is one tenth of the entire data set.
8. A device for predicting the number of effective parking spaces in a parking lot, characterized in that: include: A parking space data processing module, wherein the parking space data processing module obtains valid parking space data of all parking lots in a fixed area within a historical period, and classifies the valid parking space data according to working days, non-working days and non-statutory holidays, and statutory holidays; A data set acquisition module, wherein the data set acquisition module combines the classified valid parking space data of the first parking lot and the second parking lot that are closest to each other in the fixed area to obtain a data set; An LSTM neural network construction module, wherein the LSTM neural network acquisition module uses a QRPSO algorithm to construct an LSTM neural network, uses the data set as input training data of the LSTM neural network to obtain a trained LSTM neural network, and obtains an absolute error sequence between the output value and the true value of each data point in the last iteration during the training process; A GRU residual prediction neural network building module, wherein the GRU residual prediction neural network building module uses the absolute error sequence as training data of the GRU residual prediction neural network; A berth data prediction module, wherein the berth data prediction module determines whether the predicted day is a working day, a non-working day and a non-legal holiday or a statutory holiday, obtains the trained LSTM neural network and the GRU residual prediction neural network corresponding thereto, uses the trained LSTM neural network to predict the number of valid berths on the predicted day to obtain a first output value, uses the GRU residual prediction neural network to predict the residual of the number of valid berths on the predicted day to obtain a second output value, and the berth data prediction module obtains the valid berth data for each time period of the predicted day according to the first output value and the second output value.
9. An electronic device, characterized in that: include: A processor and a memory, wherein computer program instructions are stored in the memory, wherein when the computer program instructions are executed by the processor, the processor is caused to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-step prediction method of parking based on optimized wavelet neural network
CN108091135A
Road parking space prediction method based on optimized LSTM model
CN108961816A
Indoor parking lot remaining parking space prediction method
CN109492808A
CNN-LSTM load prediction-based charging station micro-grid system optimization scheduling method
CN113887858A
Road-based public parking space acquisition method, system and device
CN115798252A