Parking lot effective parking space quantity prediction method, device and equipment and storage medium
By optimizing the LSTM neural network and GRU residual prediction neural network using the QRPSO algorithm, the accuracy problem of predicting the number of effective parking spaces in a parking lot was solved, and higher accuracy in predicting the number of parking spaces was achieved.
Patent Information
- Application Number
- CN202411693531.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-11-25
AI Technical Summary
How to achieve high-precision prediction of the effective number of parking spaces, especially considering the hierarchical, periodic, and predictable nature of changes in the number of parking spaces.
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. Combined with the GRU residual prediction neural network, the LSTM neural network and the GRU residual prediction neural network are constructed by classifying and stitching historical parking space data to predict the number of effective parking spaces in the parking lot.
The accuracy of predicting the number of effective parking spaces has been improved by combining the predicted values of the LSTM neural network and the prediction residuals of the GRU neural network, thus achieving a more accurate prediction of the number of parking spaces.
Smart Images

Figure CN119623727B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of parking induction berth prediction in intelligent transportation systems, and particularly relates to a parking lot effective berth quantity prediction method, device, equipment and storage medium. BACKGROUND
[0002] The change process of the effective berth quantity of a parking lot has hierarchy, periodicity, similarity and predictability, and how to achieve high-precision effective berth quantity prediction is a difficult problem. In order to match the long-term trend and periodic fluctuation characteristics of the berth prediction problem, it is urgent to propose an effective berth quantity prediction method for a parking lot. SUMMARY
[0003] An object of the present application is to provide an effective berth quantity prediction method for a parking lot, which can at least solve the technical problem of how to achieve high-precision effective berth quantity prediction.
[0004] The present application provides an effective berth quantity prediction method for a parking lot, comprising the following steps: obtaining the effective berth data of all parking lots in a fixed area within a historical period, classifying the effective berth data according to weekdays, 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, the classified effective berth data of the first parking lot and the second parking lot are spliced to obtain a data set; an LSTM neural network is constructed using a QRPSO algorithm, the data set is used as input training data of the LSTM neural network to obtain a trained LSTM neural network, and the absolute error sequence of the output value and the true value of each data point in the last iteration in the training process is obtained; the absolute error sequence is used as training data of a GRU residual prediction neural network, and a GRU residual prediction neural network is constructed; it is judged whether the prediction day belongs to a weekday, a non-working day and a non-statutory holiday or a statutory holiday, the corresponding trained LSTM neural network and GRU residual prediction neural network are obtained, the trained LSTM neural network is used to predict the effective berth quantity of the prediction day, a first output value is obtained, the GRU residual prediction neural network is used to predict the residual of the effective berth quantity of the prediction day, a second output value is obtained, and the effective berth data of each period of the prediction day is obtained according to the first output value and the second output value.
[0005] Optionally, the step of constructing the LSTM neural network using the QRPSO algorithm comprises: 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; on the basis of the optimal parameter combination, executing the QRPSO algorithm to optimize the number of neurons in each layer of the LSTM neural network; and using the optimal parameter combination and the optimized number of neurons in each layer to construct the LSTM neural network.
[0006] Optionally, 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:
[0007] Particle=[HiddenLayer,LearningRate,MaxIterNum];
[0008] wherein HiddenLayer is the number of hidden layers, is initialized to 2, LearningRate is the learning rate, is initialized to 1, and MaxIterNum is the maximum number of training, is initialized to 1000.
[0009] Optionally, when the QRPSO algorithm is executed 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] wherein 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, the particle is updated using the following formula:
[0013]
[0014] wherein, 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, and is set to 5; r is a random number between -1 and 1; t is the current iteration number; and T is the maximum number of iterations of the QRPSO algorithm.
[0015] Optionally, when the QRPSO algorithm is used, the following steps are further included:
[0016] A particle local search operation is performed, two different particles of the QRPSO are randomly extracted, a value of a certain dimension of the particles is randomly selected for exchange, and if the fitness value of the particle after the exchange is greater than the fitness value before the exchange, the particle after the exchange is retained;
[0017] A particle mean value smoothing local search operation is performed, and a mean particle of all particles in the QRPSO algorithm is calculated.
[0018] Optionally, the fitness function of the QRPSO algorithm is set as follows:
[0019]
[0020] Where y i,forcast is the output prediction value of the i-th point of the LSTM neural network on the training set data, y i,true is the true value of the i-th point of the training set data, and N is the size of the training set data, which is one-tenth of the entire data set.
[0021] The application also provides a parking lot effective parking space number prediction device, comprising:
[0022] A parking space data processing module, which acquires effective parking space data of all parking lots in a fixed area within a historical period, and classifies the effective parking space data according to weekdays, non-working days and non-statutory holidays, and statutory holidays;
[0023] A data set acquisition module, which splices the classified effective parking space data of the first parking lot and the second parking lot closest to the fixed area to obtain a data set;
[0024] An LSTM neural network construction module, which constructs an LSTM neural network by using a QRPSO algorithm, takes the data set as input training data of the LSTM neural network to obtain a trained LSTM neural network, and acquires an absolute error sequence of each data point in the last iteration of the training process and a true value;
[0025] A GRU residual prediction neural network construction module, which takes the absolute error sequence as training data of a GRU residual prediction neural network;
[0026] The berth data prediction module judges whether the prediction day belongs to a weekday, a non-workday, a non-statutory holiday or a statutory holiday, obtains a trained LSTM neural network and a GRU residual prediction neural network corresponding thereto, uses the trained LSTM neural network to predict the number of effective berths on the prediction day, obtains a first output value, uses the GRU residual prediction neural network to predict the residual of the number of effective berths on the prediction day, obtains a second output value, and obtains the effective berth data of each period of the prediction day according to the first output value and the second output value.
[0027] The application further provides an electronic device, comprising a processor and a memory, wherein computer program instructions are stored in the memory, and when the computer program instructions are executed by the processor, the processor executes the method.
[0028] The application further 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 the method.
[0029] The parking lot effective berth number prediction method according to the embodiment of the application combines the predicted value of the number of effective berths on the prediction day by the LSTM neural network and the predicted residual of the number of effective berths on the prediction day by the GRU neural network, and obtains a more accurate predicted value of the number of effective berths on the prediction day.
[0030] Other features and advantages of the application will become apparent from the following detailed description of illustrative embodiments thereof, which proceeds with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0031] The accompanying drawings incorporated in and forming a part of the specification illustrate embodiments of the application and, together with the description, serve to explain the principles of the application.
[0032] Figure 1 is a flowchart of a parking lot effective berth number prediction method according to an embodiment of the application;
[0033] Figure 2 is a schematic diagram of an electronic device according to an embodiment of the application.
[0034] Reference Signs:
[0035] The electronic device 200;
[0036] The processor 201;
[0037] The memory 202; the operating system 2021; the application program 2022;
[0038] a network interface 203;
[0039] an input device 204;
[0040] a hard disk 205;
[0041] a display device 206. DETAILED DESCRIPTION
[0042] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of the components and steps, numerical expressions, and numerical values set forth in these embodiments are not limiting to the scope of the present application unless specifically stated otherwise.
[0043] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting to the scope of the application and its applications or uses.
[0044] Techniques, methods, and apparatus known to those of ordinary skill in the relevant art can not be discussed in detail herein, but should be considered as part of the specification, where appropriate.
[0045] In all examples shown and discussed herein, any specific values should be interpreted as merely illustrative and not as a limitation. Thus, other examples of the exemplary embodiments can have different values.
[0046] It should be noted that like references and characters herein relate to like items throughout the figures, and once an item is defined in one figure, it need not be discussed further in subsequent figures.
[0047] As Figure 1 shown, a parking lot effective berth quantity prediction method according to an embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0048] The parking lot effective berth quantity prediction method according to an embodiment of the present application includes the following steps:
[0049] The historical period effective berth data of all parking lots in a fixed area is obtained, and the effective berth data is classified according to weekdays, non-working days and non-statutory holidays, and statutory holidays. That is, according to the date provisions of statutory holidays, weekends and weekdays, it is determined whether it is National Day, Spring Festival, Monday to Friday, Saturday or Sunday, etc., and the historical effective berth quantity data of all parking lots in a certain area is classified. For example, the effective berth data of the historical period of the holiday is recorded as Data a1 , the effective berth data of the historical period of the double holiday is recorded as Data a2 , and the effective berth data of the historical period of the weekday is recorded as Data a3 .
[0050] The first parking lot and the second parking lot in the fixed area are closest, and the classified effective parking space data of the first parking lot and the second parking lot are spliced to obtain a data set. That is, before performing LSTM neural network training, the historical effective parking space data of different parking lots is spliced into a nearest neighbor data set. For example, for parking lot a in area A, the data set Data a1 , Data a2 , Data a3 , the data set Data b1 of another parking lot b closest to parking lot a in area A is taken, Data b2 , Data b3 , the data of Data a1 is spliced after the last data of Data b1 to obtain Data a1 '; the data of Data a2 is spliced after the last data of Data b2 to obtain Data a2 '; the data of Data a3 is spliced after the last data of Data b3 to obtain Data a3 '. In addition, the data splicing operation can increase the scale of the training data, can improve the prediction accuracy of the LSTM neural network, and the data of the adjacent parking lot is spliced and trained, which can effectively improve the generalization ability of the LSTM neural network and avoid overfitting.
[0051] The QRPSO algorithm (Quadratic restructuring particle swarm optimization, QRPSO) is used to construct an LSTM neural network, the data set is used as input training data of the LSTM neural network to obtain a trained LSTM neural network, and the absolute error sequence of the output value and the true value of each data point in the last iteration in the training process is obtained. That is, a QRPSO-LSTM network is constructed.
[0052] The absolute error sequence is taken as the training data of the GRU residual prediction neural network to construct the GRU residual prediction neural network. That is, one 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 taken as the training data of the GRU neural network to obtain the GRU residual neural network. The residual prediction neural network can be used to predict the error sequence of the LSTM neural network prediction. In the training process of the LSTM neural network, there is a certain error in each training iteration. By taking these error sequences as training data, as the training data of the GRU residual prediction neural network, the error value of the parking space 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, and the parking space prediction effect of the parking lot can be further improved.
[0053] It is judged whether the prediction day belongs to a working day, a non-working day, a non-statutory holiday or a statutory holiday, and the trained LSTM neural network and GRU residual prediction neural network corresponding thereto are obtained. The trained LSTM neural network is used to predict the number of effective parking spaces on the prediction day to obtain a first output value, and the GRU residual prediction neural network is used to predict the residual of the number of effective parking spaces on the prediction day to obtain a second output value. The effective parking space data of each period of the prediction day is obtained according to the first output value and the second output value.
[0054] Therefore, the parking lot effective parking space number prediction method according to the embodiment of the application combines the prediction value of the number of effective parking spaces on the prediction day by the LSTM neural network and the prediction residual of the number of effective parking spaces on the prediction day by the GRU neural network to obtain a more accurate prediction value of the number of effective parking spaces on the prediction day.
[0055] According to an embodiment of the application, the steps of constructing the LSTM neural network using the QRPSO algorithm include:
[0056] The number of hidden layers, the initial learning rate and the maximum number of iterations of the LSTM neural network are optimized using the QRPSO algorithm to obtain the optimal parameter combination. That is, when constructing the QRPSO-LSTM network, the number of hidden layers, the initial learning rate, the maximum number of training and the number of neurons in each layer of the LSTM neural network are optimized using the QRPSO algorithm to obtain the optimal parameter combination.
[0057] On the basis of the optimal parameter combination, the QRPSO algorithm is used to optimize the number of neurons in each layer of the LSTM neural network.
[0058] The optimal parameter combination and the optimized number of neurons in each layer are used to construct the LSTM neural network.
[0059] In the embodiment, the parameter settings in the LSTM neural network are crucial to the prediction performance, and the settings of the parameters often depend on experience or experimental tests to obtain a set of optimal parameter combinations. The QRPSO algorithm is used to optimize the number of hidden layers, the initial learning rate, and the maximum number of training times of the LSTM neural network, so that the optimal parameter combinations optimized by the QRPSO algorithm can be obtained without human experimental acquisition or experience setting, and the prediction accuracy of the LSTM neural network can be improved. In addition, on the basis of obtaining the optimal parameter combinations of the number of hidden layers, the learning rate, and the maximum number of iterations by using the QRPSO algorithm, the number of neurons in each layer of the LSTM neural network is optimized by using the QRPSO algorithm, so that all the parameter settings of the LSTM neural network are solved, and the parameter setting process is all the optimal combinations optimized by the QRPSO algorithm, and the prediction accuracy of the LSTM neural network is further improved.
[0060] In some specific embodiments of the application, 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 1000, and the encoding of each particle is as follows:
[0061] Particle=[HiddenLayer,LearningRate,MaxIterNum];
[0062] Where HiddenLayer is the number of hidden layers, initialized to 2, LearningRate is the learning rate, initialized to 1, and MaxIterNum is the maximum number of training times, initialized to 1000.
[0063] According to one embodiment of the application, when the QRPSO algorithm is used 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] Where 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 application, the particles are updated as follows:
[0067]
[0068] Where, is the position of the i th particle in the QRPSO algorithm at the t+1 th 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, and the value is 5; r is a random number between-1 and 1; t is the current iteration number; and T is the maximum iteration number of the QRPSO algorithm.
[0069] According to one embodiment of the present application, when the QRPSO algorithm is used, the following steps are further included:
[0070] The particle local search operation is performed, two different particles of the QRPSO are randomly extracted, the value of a certain dimension of the particle is randomly selected for exchange, and if the fitness value of the particle after the exchange is greater than the fitness value before the exchange, the particle after the exchange is reserved;
[0071] The particle mean value smoothing local search operation is performed, and the mean particle of all particles in the QRPSO algorithm is calculated.
[0072] In some specific embodiments of the present application, the fitness function of the QRPSO algorithm is set as follows:
[0073]
[0074] where y i,forcast is the output prediction value of the i th point of the LSTM neural network on the training set data, y i,true is the true value of the i th point of the training set data, and N is the size of the training set data, and the value is one-tenth of the entire data set.
[0075] The present application also provides a parking lot effective parking space number prediction device, which comprises 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 space data processing module acquires historical valid parking space data for all parking lots within a fixed area, classifying the valid parking space data into weekdays, non-working days (excluding public holidays), and statutory holidays. The dataset acquisition module concatenates the classified valid parking space data from the closest first and second parking lots within the fixed area to obtain a dataset. The LSTM neural network acquisition module constructs an LSTM neural network using the QRPSO algorithm, using the dataset as input training data to obtain the trained LSTM neural network, and acquires the absolute error sequence between the output value and the true value for each data point in the last iteration during training. The GRU residual prediction neural network construction module uses the absolute error sequence as training data for the GRU residual prediction neural network. The parking space data prediction module determines whether the prediction day is a weekday, a non-working day, and a non-statutory or statutory holiday. It then obtains the corresponding trained LSTM neural network and GRU residual prediction neural network. The trained LSTM neural network is used to predict the number of available parking spaces on the prediction day, obtaining a first output value. The GRU residual prediction neural network is used to predict the residual of the number of available parking spaces on the prediction day, obtaining a second output value. Based on the first and second output values, the parking space data prediction module obtains the available parking space data for each time period of the prediction day. Therefore, the parking lot available parking space quantity prediction device according to the embodiments of the present invention can implement the parking lot available parking space quantity prediction method of the embodiments of the present invention. Since the parking lot available parking space quantity prediction method of the embodiments of the present invention has the advantage of improving prediction accuracy, the parking lot available parking space quantity prediction device of the embodiments of the present invention also has the same advantages, which will not be elaborated here.
[0077] The method for predicting the effective number of parking spaces according to an embodiment of the present invention will be described in detail below with reference to specific embodiments.
[0078] like Figure 1 As shown, the parking lot effective parking space quantity prediction method according to an embodiment of the present invention includes the following steps:
[0079] S1. Classify the valid parking space data of all parking lots in area A for the historical time period.
[0080] The effective parking space data of all parking lots in area A are classified according to holidays, weekends, and weekdays. For example, the effective parking space data of a certain parking lot a is classified as follows: the effective parking space data of the historical period during holidays is denoted as Data. a1 The effective berth data for historical periods on weekends is denoted as Data. a2 The effective berth data for historical periods on weekdays is denoted as Data. a3 .
[0081] S2, constructing a QRPSO-LSTM neural network.
[0082] The number of hidden layers, the initial learning rate, and the maximum number of training of the LSTM neural network are optimized using the QRPSO algorithm to obtain the optimal parameter combination.
[0083] 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 of the QRPSO algorithm.
[0086] The particle coding of the QRPSO algorithm is as follows:
[0087] Particle = [HiddenLayer, LearningRate, MaxIterNum] (2)
[0088] In formula (2), HiddenLayer is the number of hidden layers, initialized to 2; LearningRate is the learning rate, initialized to 1; and MaxIterNum is the maximum number of training, initialized 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 i-th point of the LSTM neural network on the training set data, y i,true is the true value of the i-th point of the training set data, and N is the size of the training set data, taking a value of one-tenth of the entire data set.
[0092] S3, execute the QRPSO algorithm to optimize the number of hidden layers of the LSTM neural network, the initial learning rate and the maximum number of training parameters. The parameter setting in the LSTM neural network is crucial to the prediction performance, and the setting of the parameters often depends on experience or experimental test to obtain a set of optimal parameter combination. The present application uses the QRPSO algorithm to optimize the number of hidden layers of the LSTM neural network, the initial learning rate and the maximum number of training parameters, so that it is not necessary to obtain or rely on experience to set, but to obtain a set of optimal parameter combination optimized by the QRPSO algorithm, which can improve the prediction accuracy of the LSTM neural network.
[0093] S3-1, set the number of particles of 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, update the particles using formula (1).
[0095] S3-3, perform the particle local search operation. Randomly extract two different particles Particle i and Particle j of the QRPSO, randomly select the value of a certain dimension d of the particle to exchange, if the fitness value of Particle i after the exchange is greater than the fitness value before the exchange, then keep the Particle i after the exchange. The operation of Particle j is the same.
[0096] S3-4, perform the particle mean value smoothing local search operation. Calculate the mean particle of all particles in the QRPSO algorithm, and the definition of the mean particle is as follows:
[0097]
[0098] Calculate the fitness value Fitness Mean of MeanParticle, if Fitness Mean is greater than the fitness value of any particle, then assign the value of MeanParticle particle 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 optimal combination of hidden layer number, learning rate, and maximum iteration count was obtained using the QRPSO algorithm. In this step S4, the QRPSO algorithm is used to optimize the number of neurons per layer of the LSTM neural network. This resolves all parameter settings for the LSTM neural network, and the parameter settings are all optimized using the optimal combination obtained by the QRPSO algorithm, further improving the prediction accuracy of the LSTM neural network. Based on obtaining the optimal number of hidden layers, learning rate, and maximum iteration count in step S3, the QRPSO algorithm is executed to optimize the number of neurons per layer of the LSTM neural network. The particle encoding is as follows:
[0101] Particle′=[num1,num2,...,num k (5)
[0102] In equation (5), num i Let be the number of neurons in the i-th hidden layer, and k be 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 and the maximum number of iterations to 1000. The encoding of each particle is shown in formula (5).
[0104] S4-2. Update the particles using formula (1).
[0105] S4-3, Perform a local particle search operation. Randomly select two different particles from the QRPSO. i ′ and Particle′ j Randomly select the value of a certain dimension d of the particle and swap them. If the particle... i If the fitness value of a particle after the swap is greater than its fitness value before the swap, then the particle after the swap is retained. i ′。 For Particle′ j The operation is the same.
[0106] S4-4. Perform particle mean smoothing local search operation. Calculate the mean particle for all particles in the QRPSO algorithm. The mean particle is defined as follows:
[0107]
[0108] Calculate the fitness value of MeanParticle′. Mean If Fitness′ Mean If the fitness value is greater than that of any particle, then 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 perform S4-2.
[0110] S5, perform a nearest neighbor parking lot data splicing operation.
[0111] For parking lot a in region A, there is a data set Data a1 , Data a2 , Data a3 , take the data set Data b1 of another parking lot b closest to parking lot a in region A b2 , Data b3 , Data a1 , splice the data of Data b1 after the last data of Data a1 , to obtain Data a2 '; splice the data of Data b2 after the last data of Data a2 , to obtain Data a3 '; splice the data of Data b3 after the last data of Data a3 . The same operation is performed for other parking lots in region A. This data splicing operation can increase the size of the training data, improve the prediction accuracy of the LSTM neural network, and use the data of adjacent 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 per layer obtained in steps S3 and S4 to build an LSTM neural network.
[0113] For parking lot a in region A, data sets Data a1 ', Data a2 ' and Data a3 ' are respectively taken as input training data of the LSTM neural network, and LSTM1, LSTM2 and LSTM3 neural networks are trained.
[0114] Let the training accuracy of LSTM1 neural network be r1, the training accuracy of LSTM2 neural network be r2, and the training accuracy of LSTM3 neural network be r3. Let the absolute error sequence of the output value of each data point in the last iteration in the training process of LSTM1, LSTM2 and LSTM3 neural networks and the true value be Res1, Res2 and Res3.
[0115] S7, constructing 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 taking these error sequences as training data and as training data for the GRU residual prediction neural network, the 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, further improving the parking space prediction effect of the parking lot.
[0116] Res1, Res2 and Res3 data obtained in S6 are taken as training data of the GRU residual prediction neural network respectively to obtain GRU1 residual prediction neural network, GRU2 residual prediction neural network and GRU3 residual prediction neural network. The hyperparameters used by GRU1, GRU2 and GRU3 residual neural networks are as follows:
[0117] The sequence length of the GRU neural network (Sequence): 12;
[0118] The number of hidden layers of the GRU neural network (Layer): 2;
[0119] The learning rate of the GRU neural network (LearningRate): 1.0;
[0120] S8, predicting the effective parking space data of the prediction day. For a prediction day, determine which category the prediction day belongs to among holidays, double holidays and weekdays, obtain the corresponding LSTM i neural network and GRU i residual prediction neural network, use the LSTM i neural network to predict the number of effective parking spaces of the prediction day, obtain the output value Pnum, use the GRU i residual prediction neural network to predict the residual of the number of effective parking spaces of the prediction day, obtain the output value Pe, and finally determine the effective parking space data ForcastValue of each period of the prediction day by the following formula (7):
[0121] ForcastValue=r i ·Pnum+Pe (7)
[0122] In formula (7), r i is the training accuracy of the LSTM i neural network.
[0123] The number of parked vehicles of each period of the parking lot a in the prediction day area A is determined by the following formula:
[0124] ForcastCarNum=Totala ForecastValue (8)
[0125] Total in formula (8) is a the total number of parking spaces of the parking lot a.
[0126] S9, end.
[0127] The application further provides an electronic device 200, comprising a processor 201 and a memory 202, wherein the memory 202 stores computer program instructions, and 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] Further, as shown in the figure, the electronic device 200 further comprises a network interface 203, an input device 204, a hard disk 205, and a display device 206. Figure 2
[0129] The various interfaces and devices described above can be interconnected through a bus architecture. The bus architecture can include any number of interconnected buses and bridges. Various circuits represented by the processor 201, one or more central processing units 201 (CPUs), and one or more memories 202 represented by the memory 202 are connected together. The bus architecture can also connect various other circuits such as peripheral devices, voltage stabilizers, and power management circuits. It can be understood that the bus architecture is used to realize the connection communication between these components. In addition to including a data bus, the bus architecture also includes a power bus, a control bus, and a status signal bus, which are well known in the art, and therefore 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 can be saved in the hard disk 205.
[0131] The input device 204 can receive various instructions input by an operator and send them to the processor 201 for execution. The input device 204 can include a keyboard or a pointing device (e.g., a mouse, a trackball, a touchpad, or a touch screen, etc.).
[0132] The display device 206 can display the results obtained by the processor 201 executing the instructions.
[0133] The memory 202 is used to store programs and data necessary for the operation of the operating system 2021, as well as intermediate results and other data in the calculation process of the processor 201.
[0134] It is to be understood that the memory 202 in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memory. Among them, the non-volatile memory can 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 can be a random access memory (RAM) used as an external cache. The memory 202 of the apparatus and method described herein is intended to include, but not limited to, these and any other suitable types of memory 202.
[0135] In some embodiments, the memory 202 stores the following elements, executable modules or data structures, or a subset of them, or an expanded set of them: an operating system 2021 and an application program 2022.
[0136] Among them, the operating system 2021 contains various system programs, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 2022 contains various application programs 2022, such as browser (Browser) and the like, for implementing various application services. The program for implementing the method of the embodiments of the present application can be contained in the application program 2022.
[0137] The above processor 201, when calling and executing the application program 2022 and data stored in the memory 202, specifically, the program or instruction stored in the application program 2022, executes the steps of the method according to the above embodiments.
[0138] The method disclosed in the above embodiment of the present application can be applied to the processor 201 or implemented by the processor 201. The processor 201 can be an integrated circuit chip having a signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit or an instruction in the form of software in the processor 201. The processor 201 described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general processor can be a microprocessor or the processor 201 can also be any conventional processor 201 and the like. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, and the like storage media mature in the art. The storage medium is located in the memory 202, and the processor 201 reads the information in the memory 202 and combines the hardware to complete the steps of the above method.
[0139] It can be understood that the embodiments described herein can be realized by 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, micro-controllers, microprocessors, other electronic units for executing functions of the present application, or a combination thereof.
[0140] For software implementation, the techniques herein can be implemented by modules (for example, procedures, functions, and so on) for performing the functions of the present application. 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 further configured to read a computer program and execute the following steps: the method predicts and outputs the question answer of the user's question.
[0142] The present application also provides a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program is run by the processor 201, so that the processor 201 executes the steps of the method of the above embodiment.
[0143] In several embodiments provided by the present application, it should be understood that the disclosed methods and devices can be implemented in other manners. For example, the embodiments of the device described above are merely schematic. For example, the division of the units is only a logical function division. For another example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0144] In addition, each function unit in the various embodiments of the present application can be integrated into a processing unit, or each unit can be a separate physical unit, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.
[0145] The integrated unit implemented in the form of software function units can be stored in a computer readable storage medium. The software function unit stored in the storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute part of the steps of the transceiving method of the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0146] Although some specific embodiments of the present application have been described in detail by examples, those skilled in the art should understand that the above examples are only for illustration, and are not intended to limit the scope of the present application. Those skilled in the art should understand that the above embodiments can be modified without departing from the scope and spirit of the present application. The scope of the present application is defined by the appended claims.
Claims
1. A method of predicting the number of available parking spaces in a parking lot, characterized by, The method comprises the following steps: obtaining historical period effective parking space data of all parking lots in a fixed area, and classifying the effective parking space data according to weekdays, non-weekdays and non-statutory holidays, and statutory holidays; the first parking lot and the second parking lot in the fixed area are closest, and the classified effective parking space data of the first parking lot and the second parking lot are spliced to obtain a data set; constructing an LSTM neural network by using a QRPSO algorithm, taking the data set as input training data of the LSTM neural network to obtain a trained LSTM neural network, and obtaining an absolute error sequence of an output value and a true value of each data point in the last iteration in the training process; the step of constructing the LSTM neural network by using the QRPSO algorithm comprises: optimizing the number of hidden layers, the initial learning rate and the maximum iteration number of the LSTM neural network by using the QRPSO algorithm to obtain an optimal parameter combination; on the basis of the optimal parameter combination, the number of neurons in each layer of the LSTM neural network is optimized by using the QRPSO algorithm; when the number of neurons in each layer of the LSTM neural network is optimized by using the QRPSO algorithm, the coding of each particle of the QRPSO algorithm is as follows: ; wherein, num i for the first i the number of neurons of the hidden layer, k the number of hidden layers of the optimal particle obtained using the QRPSO algorithm; the particle is updated using the following public announcement: ; wherein, is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; i is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; t is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; i is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; g is a random number between 0 and 1 ; c is a constant, which is 5; r is a random number between -1 and 1 ; t is the current iteration number; T is the maximum iteration number for the execution of the QRPSO algorithm; when using the QRPSO algorithm, the following steps are also included: performing a particle local search operation, randomly selecting two different particles of the QRPSO, randomly selecting a value of a certain dimension of the particles to exchange, and retaining the particles after the exchange if the fitness value of the particles after the exchange is greater than the fitness value before the exchange; performing a particle mean value smoothing local search operation, and calculating a mean particle of all particles in the QRPSO algorithm; constructing the LSTM neural network by using the optimal parameter combination and the optimized number of neurons in each layer; constructing a GRU residual prediction neural network by taking the absolute error sequence as training data of the GRU residual prediction neural network; judging whether a prediction day belongs to a weekday, a non-weekday and a non-statutory holiday or a statutory holiday, obtaining the trained LSTM neural network and the GRU residual prediction neural network corresponding to the prediction day, predicting the effective parking space number of the prediction day by using the trained LSTM neural network to obtain a first output value, predicting the residual of the effective parking space number of the prediction day by using the GRU residual prediction neural network to obtain a second output value, and obtaining the effective parking space data of each period of the prediction day according to the first output value and the second output value.
2. The method of claim 1, wherein when the number of hidden layers, the initial learning rate and the maximum iteration number of the LSTM neural network are optimized by using the QRPSO algorithm, the number of particles of the QRPSO algorithm is set to 30, the maximum iteration number is set to 1000, and the coding of each particle is as follows: ; wherein HiddenLayer is the number of hidden layers, initialized to 2, LearningRate is the learning rate, initialized to 1; MaxIterNum is the maximum number of training iterations, initialized to 1000.
3. The method of claim 2, wherein the fitness function of the QRPSO algorithm is set as follows: ; wherein is the output prediction value of the i-th point of the LSTM neural network on the training set data, is the true value of the i-th point of the training set data, N is the size of the training set data, which is one-tenth of the entire data set.
4. A parking lot effective stall number prediction device characterized by comprising: comprises: a parking space data processing module, which obtains historical period effective parking space data of all parking lots in a fixed area, and classifies the effective parking space data according to weekdays, non-weekdays and non-statutory holidays, and statutory holidays; The dataset acquisition module splices the classified effective parking space data of the first parking lot and the second parking lot closest to the fixed area to obtain a dataset; The LSTM neural network acquisition module constructs an LSTM neural network using a QRPSO algorithm, takes the dataset as input training data of the LSTM neural network, and obtains a trained LSTM neural network, and obtains an absolute error sequence of an output value and a true value of each data point in the last iteration in the training process. The step of constructing the LSTM neural network using the QRPSO algorithm comprises: The number of hidden layers, the initial learning rate, and the maximum number of iterations of the LSTM neural network are optimized using the QRPSO algorithm to obtain an optimal parameter combination. On the basis of the optimal parameter combination, the number of neurons in each layer of the LSTM neural network is optimized using the QRPSO algorithm. ; wherein, When the number of neurons in each layer of the LSTM neural network is optimized using the QRPSO algorithm, the coding of each particle of the QRPSO algorithm is as follows: i for the first i the number of neurons of the hidden layer, k the optimal particle obtained using the QRPSO algorithm; the particle is updated using the following public announcement: ; wherein, is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; i is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; t is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; i is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; is the position of the i-th particle at the j-th iteration of the QRPSO algorithm; g is a random number between 0 and 1 ; c is a constant having a value of 5; r is a random number between -1 and 1 ; t is the current iteration number; T is the maximum iteration number for which the QRPSO algorithm is executed; when using the QRPSO algorithm, the following steps are also included: num The particle local search operation is performed, two different particles of the QRPSO are randomly extracted, and the value of a certain dimension of the particles is randomly selected for exchange. The mean particle of all particles in the QRPSO algorithm is calculated. The LSTM neural network is constructed using the optimal parameter combination and the optimized number of neurons in each layer. The GRU residual prediction neural network construction module takes the absolute error sequence as training data of a GRU residual prediction neural network.
5. An electronic device, comprising: The parking space data prediction module determines whether the prediction day is a weekday, a non-weekday, a non-statutory 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 effective parking spaces on the prediction day to obtain a first output value, and uses the GRU residual prediction neural network to predict the residual of the number of effective parking spaces on the prediction day to obtain a second output value. The computer readable storage medium stores a computer program, and the computer program is run by the processor to make the processor execute the method in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is run by the processor to make the processor execute the method in any one of claims 1-4.
Citation Information
Patent Citations
Indoor parking lot remaining parking space prediction method
CN109492808A
QPSO-LSTM-based wind power prediction method
CN118396074A