A method and related equipment for predicting urban population flow
By introducing spatial trend learning module and spatial compression residual learning module into the urban area population flow prediction model, the historical population traffic data is processed to remove redundant information, and the problem of spatial heterogeneity processing in the existing technology is solved, and the problem of spatial heterogeneity processing is realized. Efficient crowd traffic forecast.
Patent Information
- Application Number
- CN202411736894.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-29
AI Technical Summary
The existing urban area population flow prediction methods are difficult to effectively deal with spatial heterogeneity, resulting in limited model prediction capabilities and high training costs.
Adopt urban area population flow prediction model including spatial trend learning module and spatial compression residual learning module. By standardizing, coding, gated cyclic unit processing and feature connection of historical population traffic data, redundant information is removed, and spatial heterogeneity is achieved. Sexual refinement modeling.
By removing redundant information, the training cost of the model is reduced, the prediction accuracy is improved, spatial heterogeneity is refined modeled, and the prediction accuracy of future crowd traffic is improved.
Smart Images

Figure CN119204362B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of urban intelligent computing technology, and in particular to a method for predicting urban area crowd flow and related equipment. Background Art
[0002] In order to optimize the utilization efficiency of existing urban space and improve urban safety management capabilities, achieving real-time and accurate crowd flow prediction in urban areas is a crucial link. Related technologies have received widespread attention in the fields of traffic management, public safety and urban planning.
[0003] Urban area crowd flow prediction refers to predicting the future crowd flow in various areas of the city by mining the spatiotemporal variation patterns contained in historical crowd flow data, including crowd inflow and outflow predictions. Although human activities are highly uncertain and specific at the individual level, at the regional level, crowd activities show significant spatiotemporal dependence, which makes urban area crowd flow predictable. At the same time, with the construction and development of smart cities, urban mobile sensing equipment has been widely used, generating massive urban perception data such as vehicle trajectories and mobile phone signals in real time, which can provide a solid data foundation for urban area crowd flow prediction.
[0004] Spatiotemporal dependency modeling is the basis of the urban area crowd flow prediction model. In addition, due to the differences in the built environment and functional structure of various urban areas, it is difficult to describe the spatiotemporal variation process of urban area crowd flow with a unified spatiotemporal dependency law, that is, the urban area crowd flow is affected by spatial heterogeneity. In this regard, the existing urban area crowd flow prediction methods usually use two strategies, regional division and individual modeling, to deal with spatial heterogeneity. The regional division strategy classifies urban areas by the similarity of geographical environmental variables, and builds an independent prediction model for each category of regions, aiming to extract the commonalities between similar regions, with certain interpretability and low training cost. However, this strategy often depends on environmental variables, has higher requirements for data, and overly weakens the individual differences between regions belonging to the same category, which will greatly limit the prediction ability of the model. The individual modeling strategy builds a model for each region based on regional neighborhood information, aiming to maximize the individual differences between regions, and often has better prediction accuracy. However, due to the existence of spatiotemporal dependency, the changes in crowd flow in each region are manifested as a large number of similar time series, that is, there is a large amount of redundant information. This strategy repeatedly models these redundant information, which will increase the huge training cost. Summary of the invention
[0005] The present invention provides a method and related equipment for predicting crowd flow in an urban area, the purpose of which is to achieve refined modeling of spatial heterogeneity and improve prediction accuracy.
[0006] In order to achieve the above object, the present invention provides a method for predicting crowd flow in an urban area, comprising:
[0007] Step 1, obtaining historical crowd flow data for training;
[0008] Step 2: inputting historical crowd flow data for training into the urban area crowd flow prediction model for training, thereby obtaining a trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module;
[0009] Step 3: Input the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compress and reconstruct the historical crowd flow data of the target urban area through the spatial trend learning module to obtain the spatial heterogeneous trend, and predict the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain the spatiotemporal compression residual;
[0010] Step 4: Combining spatial heterogeneity trends and spatiotemporal compression residuals, calculate the future crowd flow data of the target urban area.
[0011] Furthermore, before inputting the historical crowd flow data for training into the urban area crowd flow prediction model for training, the following steps are also included:
[0012] Sort the historical crowd flow data for training by size to obtain the maximum and minimum values;
[0013] The historical crowd flow data for training is standardized based on the maximum value and the minimum value to obtain the standardized historical crowd flow data;
[0014] The standardized historical crowd flow data is input into the urban area crowd flow prediction model for training.
[0015] Further, the spatial trend learning module includes an encoder, a gated recurrent unit, and a decoder;
[0016] The input end of the encoder is the input end of the urban area crowd flow prediction model, the output end of the encoder is respectively connected to the input end of the gated recurrent unit and the first input end of the decoder, the output end of the gated recurrent unit is connected to the second input end of the decoder, the first output end of the decoder is the first output end of the urban area crowd flow prediction model, and the second output end of the decoder is connected to the first input end of the spatiotemporal compression residual learning module.
[0017] Furthermore, the historical crowd flow data of the target urban area is compressed and reconstructed through the spatial trend learning module to obtain spatial heterogeneous trends, including:
[0018] The historical crowd flow data of the target city area is compressed into the embedding space through the encoder to obtain the base sequence. The compression expression is:
[0019]
[0020] in, represents the base sequence, , Both represent learnable convolutional filters, , Both represent the convolution kernel size, represents the convolution operator, represents the ReLU activation function, Represents the historical crowd flow data of the target urban area;
[0021] The base sequence is predicted through the gated recurrent unit to obtain the future base sequence. The prediction expression is:
[0022]
[0023]
[0024] in, represents the future basis sequence, , Both represent learnable parameters, represents the hidden state output during the prediction process of the gated recurrent unit, represents the gated recurrent unit function;
[0025] The base sequence and the future base sequence are reconstructed into the physical space through the decoder, and the spatiotemporal sequence of the urban area crowd flow and the spatiotemporal sequence of the future urban area crowd flow are obtained. The spatiotemporal sequence of the urban area crowd flow and the spatiotemporal sequence of the future urban area crowd flow are feature-connected to obtain the spatial heterogeneous trend. The expression of feature connection is:
[0026]
[0027] in, represents the spatiotemporal sequence of crowd flow in urban areas, represents the spatiotemporal sequence of crowd flow in future urban areas, represents a spatially heterogeneous trend, Represents the feature concatenation operator.
[0028] Further, the spatiotemporal compression residual learning module includes a residual calculation unit, a first convolutional neural network unit, a deep residual unit, and a second convolutional neural network unit connected in sequence;
[0029] The first input end of the residual calculation unit is the input end of the urban area crowd flow prediction model, and the second input end of the residual calculation unit is connected to the second output end of the decoder;
[0030] The output end of the second convolutional neural network unit is the second output end of the urban area crowd flow prediction model.
[0031] Furthermore, the historical crowd flow data of the target city area is predicted through the spatiotemporal compression residual learning module to obtain the spatiotemporal compression residual, including:
[0032] The historical crowd flow data of the target urban area and the spatiotemporal sequence of the crowd flow in the urban area are input into the residual calculation unit for calculation to obtain the spatiotemporal compressed sensing residual. The calculation expression is:
[0033]
[0034] in, represents the space-time compressed sensing error;
[0035] The space-time compressed sensing residual is input into the first convolutional neural network unit, the deep residual unit, and the second convolutional neural network unit for prediction to obtain the space-time compressed residual. The prediction expression is:
[0036]
[0037] in, represents the space-time compression residual, represents the learnable convolutional filter in the first convolutional neural network unit, represents the convolution kernel size of the first convolutional neural network unit, represents the learnable convolutional filter in the second convolutional neural network unit, represents the convolution kernel size of the second convolutional neural network unit, Represents the deep residual unit function.
[0038] Furthermore, combining the spatial heterogeneity trend and the time-space compression residual, the future crowd flow data of the target urban area is calculated, and the calculation expression is:
[0039]
[0040] in, Represents the future crowd flow data of the target urban area.
[0041] The present invention also provides a device for predicting the flow of people in an urban area, comprising:
[0042] An acquisition module is used to obtain historical crowd flow data for training;
[0043] A training module, used for inputting historical crowd flow data for training into an urban area crowd flow prediction model for training, to obtain a trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module;
[0044] A processing module is used to input the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compress and reconstruct the historical crowd flow data of the target urban area through the spatial trend learning module to obtain spatial heterogeneous trends, and predict the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain spatiotemporal compression residuals;
[0045] The calculation module is used to combine spatial heterogeneity trends and spatiotemporal compression residuals to calculate the future crowd flow data of the target urban area.
[0046] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a method for predicting crowd flow in an urban area is implemented.
[0047] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, a method for predicting crowd flow in an urban area is implemented.
[0048] The above scheme of the present invention has the following beneficial effects:
[0049] The present invention obtains historical crowd flow data for training and inputs it into an urban area crowd flow prediction model including a spatial trend learning module and a spatiotemporal compression residual learning module for training, thereby obtaining a trained urban area crowd flow prediction model; inputs historical crowd flow data of a target urban area into the trained urban area crowd flow prediction model, compresses and reconstructs the historical crowd flow data of the target urban area through the spatial trend learning module, obtains a spatial heterogeneous trend, and predicts the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain a spatiotemporal compression residual; combines the spatial heterogeneous trend and the spatiotemporal compression residual to calculate and obtain the future crowd flow data of the target urban area; compared with the prior art, the present invention integrates the spatiotemporal compression sensing technology into the urban area crowd flow prediction model, simplifies the spatiotemporal prediction problem of the physical space into the spatiotemporal prediction problem of the low-dimensional embedded space by removing a large amount of redundant information in the spatiotemporal sequence of the urban area crowd flow, greatly reduces the training cost of the model, and realizes the refined modeling of spatial heterogeneity by compressing, reconstructing and predicting the urban area crowd flow data, thereby improving the prediction ability of the model and further improving the prediction accuracy of the future crowd flow.
[0050] Other beneficial effects of the present invention will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention;
[0052] Figure 2 A framework diagram of a crowd flow prediction model for an urban area in an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of the structure of a device for predicting crowd flow in an urban area provided by an embodiment of the present invention;
[0054] Figure 4 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0057] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a locking connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0058] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0059] In view of the existing problems, the present invention provides a method for predicting the flow of people in an urban area and related equipment.
[0060] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting crowd flow in an urban area, comprising:
[0061] Step 1, obtaining historical crowd flow data for training;
[0062] Step 2: inputting historical crowd flow data for training into the urban area crowd flow prediction model for training, thereby obtaining a trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module;
[0063] Step 3: Input the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compress and reconstruct the historical crowd flow data of the target urban area through the spatial trend learning module to obtain the spatial heterogeneous trend, and predict the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain the spatiotemporal compression residual;
[0064] Step 4: Combining spatial heterogeneity trends and spatiotemporal compression residuals, calculate the future crowd flow data of the target urban area.
[0065] Specifically, the embodiment of the present invention uses the TaxiBJ dataset as training data. The dataset divides the study area into 1024 urban areas. The time range includes taxi GPS data from July 1, 2013 to October 30, 2013, March 1, 2014 to June 30, 2014, March 1, 2015 to June 30, 2015, and November 1, 2015 to April 10, 2016. The time resolution is 30 minutes. The specific implementation process is as follows:
[0066] First, the TaxiBJ dataset is divided into a training set TS, a validation set VS, and a test set ES. The training set TS is used to update the parameters of the urban area crowd flow prediction model, the validation set VS is used to verify the convergence of the model, and the test set ES is used to evaluate the prediction effect of the model. In this embodiment of the present invention, the data in the training set TS is the historical crowd flow data for training.
[0067] Specifically, before inputting the historical crowd flow data for training into the urban area crowd flow prediction model for training, it also includes:
[0068] Sort the historical crowd flow data for training by size to obtain the maximum and minimum values;
[0069] The historical crowd flow data for training is standardized based on the maximum value and the minimum value to obtain the standardized historical crowd flow data;
[0070] The standardized historical crowd flow data is input into the urban area crowd flow prediction model for training.
[0071] Most preferably, the normalized expression is:
[0072]
[0073] in, Represents a data in the standardized historical crowd flow data, represents a data in the historical crowd flow data used for training, Indicates the maximum value, Indicates the minimum value.
[0074] Most preferably, Figure 2 As shown, the spatial trend learning module includes an encoder, a gated recurrent unit, and a decoder;
[0075] The input end of the encoder is the input end of the urban area crowd flow prediction model, the output end of the encoder is respectively connected to the input end of the gated recurrent unit and the first input end of the decoder, the output end of the gated recurrent unit is connected to the second input end of the decoder, the first output end of the decoder is the first output end of the urban area crowd flow prediction model, and the second output end of the decoder is connected to the first input end of the spatiotemporal compression residual learning module.
[0076] It should be noted that the historical crowd flow data must be organized into a spatiotemporal sequence before being input into the urban area crowd flow prediction model. ,in, represents the field of real numbers, is the number of urban areas, is the length of the time series, is the number of types of crowd flow.
[0077] Specifically, the historical crowd flow data of the target urban area is compressed and reconstructed through the spatial trend learning module to obtain spatial heterogeneous trends, including:
[0078] The historical crowd flow data of the target city area is compressed into the embedding space through the encoder to obtain the base sequence. The compression expression is:
[0079]
[0080] in, represents the base sequence, , Both represent learnable convolutional filters, , Both represent the convolution kernel size, represents the convolution operator, represents the ReLU activation function, , Represents the historical crowd flow data of the target urban area;
[0081] The base sequence is predicted through the gated recurrent unit to obtain the future base sequence. The prediction expression is:
[0082]
[0083]
[0084] in, represents the future basis sequence, , Both represent learnable parameters, represents the hidden state output during the prediction process of the gated recurrent unit, represents the gated recurrent unit function;
[0085] The base sequence and the future base sequence are reconstructed into the physical space through the decoder, and the spatiotemporal sequence of the urban area crowd flow and the spatiotemporal sequence of the future urban area crowd flow are obtained. The spatiotemporal sequence of the urban area crowd flow and the spatiotemporal sequence of the future urban area crowd flow are feature-connected to obtain the spatial heterogeneous trend. The expression of feature connection is:
[0086]
[0087] in, represents the spatiotemporal sequence of crowd flow in urban areas, represents the spatiotemporal sequence of crowd flow in future urban areas, represents a spatially heterogeneous trend, Represents the feature concatenation operator.
[0088] In the embodiment of the present invention, the encoder is constructed based on a convolutional neural network (CNN) to mine spatiotemporal dependencies and convert historical crowd flow data into Compress to embedding space and get the basis sequence ,in, is the number of base sequences in the embedding space; the gated recurrent unit is used to model the temporal dependency of the base sequence, and the future change trend of the base sequence is predicted through the fully connected layer. The future change trend is the future base sequence. ,in, is the predicted base sequence length, , Both represent the learnable parameters of the fully connected layer; the decoder is also built based on the convolutional neural network CNN, which is used to embed the base sequence in the space and Reconstructing the spatiotemporal sequence of crowd flow in urban areas into physical space and .
[0089] In the embodiment of the present invention, for a certain time slice in the base sequence , processed by the gated cycle unit function, the calculation expression is as follows:
[0090]
[0091]
[0092]
[0093]
[0094] in, and They are and go through The output hidden state of represents the reset gate in GRU, , Represent the update gate and candidate hidden state in GRU respectively, are all learnable parameters in GRU, is the dot product operator.
[0095] Most preferably, Figure 2 As shown, the spatiotemporal compression residual learning module includes a residual calculation unit, a first convolutional neural network unit, a deep residual unit, and a second convolutional neural network unit connected in sequence to model the spatiotemporal dependency of residual information;
[0096] The first input end of the residual calculation unit is the input end of the urban area crowd flow prediction model, and the second input end of the residual calculation unit is connected to the second output end of the decoder;
[0097] The output end of the second convolutional neural network unit is the second output end of the urban area crowd flow prediction model.
[0098] Specifically, the historical crowd flow data of the target urban area is predicted through the spatiotemporal compression residual learning module to obtain the spatiotemporal compression residual, including:
[0099] The historical crowd flow data of the target urban area and the spatiotemporal sequence of the crowd flow in the urban area are input into the residual calculation unit for calculation to obtain the spatiotemporal compressed sensing residual. The calculation expression is:
[0100]
[0101] in, represents the space-time compressed sensing error, ;
[0102] The space-time compressed sensing residual is input into the first convolutional neural network unit, the deep residual unit, and the second convolutional neural network unit for prediction to obtain the space-time compressed residual. The prediction expression is:
[0103]
[0104] in, represents the space-time compression residual, , represents the learnable convolutional filter in the first convolutional neural network unit, represents the convolution kernel size of the first convolutional neural network unit, represents the learnable convolutional filter in the second convolutional neural network unit, represents the convolution kernel size of the second convolutional neural network unit, Represents the deep residual unit function, and the expression of the deep residual unit function is:
[0105]
[0106]
[0107] in, and Represents the convolution kernel size in the depth residual unit and The learnable convolutional filter, is the batch normalization function, and They are The mean and variance of is the hyperparameter in the batch normalization function, and is the learnable parameter in the batch normalization function.
[0108] Specifically, combining spatial heterogeneity trends and time-space compression residuals, the future crowd flow data of the target urban area is calculated, and the calculation expression is:
[0109]
[0110] in, Represents the future crowd flow data of the target urban area.
[0111] Specifically, the embodiment of the present invention designs a loss function based on a time regularization term, based on a training set Calculate the loss function value to optimize the network parameters of the urban area crowd flow prediction model, and iterate until the loss function value in the validation set VS reaches the minimum value to obtain the trained urban area crowd flow prediction model. The specific steps include:
[0112] Based on the spatiotemporal sequence of crowd flow in future urban areas , and obtain its basis sequence in the embedding space ;
[0113] Based on the spatiotemporal sequence of crowd flow in historical urban areas and spatially heterogeneous trends , the basis sequence in the embedding space and , the true value of the spatiotemporal sequence of crowd flow in future urban areas and predicted values , define the loss function based on the time regularization term , the formula is as follows:
[0114]
[0115] In the formula, is the number of samples in the training set TS, is an adjustable hyperparameter of the loss function, represents the L2 norm operator;
[0116] The loss function is applied to the training set The calculated error is transferred to each learnable parameter in the urban area crowd flow prediction model through the back propagation algorithm;
[0117] Apply the Adam optimizer to update the learnable parameters in the urban area crowd flow prediction model;
[0118] Iterate the above steps until the loss function value calculated based on the validation set VS reaches the minimum value, stop the iteration process, save the model parameters, and obtain the trained urban area crowd flow prediction model.
[0119] Based on the test set, the embodiment of the present invention compares and analyzes the prediction method provided by the embodiment of the present invention and the existing urban area crowd flow prediction method to verify the effectiveness of the prediction method provided by the embodiment of the present invention. The existing urban area crowd flow prediction method includes: ① Historical Average Model (HA); ② Gated Recurrent Unit Model (GRU); ③ Convolutional Gated Recurrent Unit Model (ConvGRU); ④ Spatiotemporal Deep Residual Network (STResNet); ⑤ Deep Crowd Flow Prediction Model (DeepCrowd); ⑥ Spatiotemporal Correlation Network (STRN); The specific comparison steps include:
[0120] The mean absolute error (MAE) and root mean square error (RMSE) are used as evaluation indicators to compare the prediction results of each model. The calculation formula of the evaluation indicators is as follows:
[0121]
[0122]
[0123] In the formula, is the number of samples in the test set ES, and are the true value and predicted value of the urban area crowd flow in the test set ES, It represents the L1 norm operator. The smaller the MAE and RMSE, the higher the prediction accuracy of the urban area crowd flow prediction model. The evaluation index results of each prediction method are shown in Table 1 below:
[0124] Table 1
[0125]
[0126] It can be seen from Table 1 above that the prediction method provided by the embodiment of the present invention is superior to the other six comparison methods in both evaluation indicators. This shows that the prediction method provided by the embodiment of the present invention can achieve the best prediction effect when applied to the actual urban area crowd flow prediction scenario, can meet the needs of urban dynamic operation monitoring, and serve important applications such as scientific urban management and public safety prevention.
[0127] The embodiment of the present invention obtains historical crowd flow data for training and inputs it into an urban area crowd flow prediction model including a spatial trend learning module and a spatiotemporal compression residual learning module for training, thereby obtaining a trained urban area crowd flow prediction model; inputs historical crowd flow data of a target urban area into the trained urban area crowd flow prediction model, compresses and reconstructs the historical crowd flow data of the target urban area through the spatial trend learning module, obtains a spatial heterogeneous trend, and predicts the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain a spatiotemporal compression residual; combines the spatial heterogeneous trend and the spatiotemporal compression residual to calculate and obtain the future crowd flow data of the target urban area; compared with the prior art, the embodiment of the present invention integrates the spatiotemporal compression sensing technology into the urban area crowd flow prediction model, simplifies the spatiotemporal prediction problem of the physical space into the spatiotemporal prediction problem of the low-dimensional embedded space by removing a large amount of redundant information in the spatiotemporal sequence of the urban area crowd flow, greatly reduces the training cost of the model, and realizes the refined modeling of spatial heterogeneity by compressing, reconstructing and predicting the urban area crowd flow data, thereby improving the prediction ability of the model and further improving the prediction accuracy of the future crowd flow.
[0128] Corresponding to the method for predicting the flow of people in an urban area described in the above embodiment, as Figure 3 As shown, the embodiment of the present invention further provides a device 100 for predicting crowd flow in an urban area, and the device 100 for predicting crowd flow in an urban area includes:
[0129] An acquisition module 101 is used to acquire historical crowd flow data for training;
[0130] A training module 102, which is used to input historical crowd flow data for training into the urban area crowd flow prediction model for training, and obtain a trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module;
[0131] The processing module 103 is used to input the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compress and reconstruct the historical crowd flow data of the target urban area through the spatial trend learning module to obtain the spatial heterogeneous trend, and predict the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain the spatiotemporal compression residual;
[0132] The calculation module 104 is used to calculate the future crowd flow data of the target urban area by combining the spatial heterogeneity trend and the time-space compression residual.
[0133] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0134] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0135] The embodiment of the present invention also provides a terminal device, such as Figure 4 As shown, the terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 4 Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100. When the processor D100 executes the computer program D102, the above-mentioned urban area crowd flow prediction method is implemented.
[0136] The terminal device D10 may be a computing device such as a desktop computer, a notebook, a PDA, a server, a server cluster, a cloud server, etc. The terminal device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will appreciate that Figure 4 This is only an example of the terminal device D10 and does not constitute a limitation on the terminal device D10. The terminal device D10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0137] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0138] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may also be an external storage device of the terminal device D10, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card (Flash Card), etc. equipped on the terminal device D10. Further, the memory D101 may also include both an internal storage unit of the terminal device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.
[0139] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0140] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0141] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, a method for predicting crowd flow in an urban area is implemented.
[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the construction device / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0143] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for predicting crowd flow in an urban area, characterized in that: include: Step 1, obtaining historical crowd flow data for training; Step 2, inputting the training historical crowd flow data into the urban area crowd flow prediction model for training, to obtain the trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module; Step 3, inputting the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compressing and reconstructing the historical crowd flow data of the target urban area through the spatial trend learning module to obtain spatial heterogeneous trends, and predicting the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain spatiotemporal compression residuals; The spatial trend learning module includes an encoder, a gated recurrent unit, and a decoder; The historical crowd flow data of the target urban area is compressed and reconstructed by the spatial trend learning module to obtain spatial heterogeneous trends, including: The encoder is used to compress the historical crowd flow data of the target city area into the embedding space to obtain a base sequence, and the compression expression is: in, represents the base sequence, , Both represent learnable convolutional filters, , Both represent the convolution kernel size, represents the convolution operator, represents the ReLU activation function, Represents the historical crowd flow data of the target urban area; The base sequence is predicted by the gated recurrent unit to obtain the future base sequence. The prediction expression is: in, represents the future basis sequence, , Both represent learnable parameters, represents the hidden state output during the prediction process of the gated recurrent unit, represents the gated recurrent unit function; The base sequence and the future base sequence are reconstructed into physical space respectively by the decoder to obtain the spatiotemporal sequence of urban area crowd flow and the spatiotemporal sequence of future urban area crowd flow, and the spatiotemporal sequence of urban area crowd flow and the spatiotemporal sequence of future urban area crowd flow are feature-connected to obtain spatial heterogeneous trends. The expression of feature connection is: in, represents the spatiotemporal sequence of crowd flow in urban areas, represents the spatiotemporal sequence of crowd flow in future urban areas, represents spatially heterogeneous trends, represents the feature concatenation operator; The spatiotemporal compression residual learning module includes a residual calculation unit, a first convolutional neural network unit, a deep residual unit, and a second convolutional neural network unit connected in sequence; The historical crowd flow data of the target urban area is predicted by the time-space compression residual learning module to obtain the time-space compression residual, including: The historical crowd flow data of the target urban area and the spatiotemporal sequence of the crowd flow in the urban area are input into the residual calculation unit for calculation to obtain the spatiotemporal compressed sensing residual, and the calculation expression is: in, represents the space-time compressed sensing error; The spatiotemporal compressed perception residual is input into the first convolutional neural network unit, the depth residual unit, and the second convolutional neural network unit for prediction to obtain the spatiotemporal compressed residual. The prediction expression is: in, represents the space-time compression residual, represents the learnable convolutional filter in the first convolutional neural network unit, represents the convolution kernel size of the first convolutional neural network unit, represents the learnable convolutional filter in the second convolutional neural network unit, represents the convolution kernel size of the second convolutional neural network unit, represents the deep residual unit function; Step 4: combining the spatial heterogeneity trend and the space-time compression residual to calculate the future crowd flow data of the target urban area.
2. The method for predicting crowd flow in urban areas according to claim 1, characterized in that: Before inputting the historical crowd flow data for training into the urban area crowd flow prediction model for training, the method further includes: Sorting the historical crowd flow data for training to obtain the maximum and minimum values; Standardizing the historical crowd flow data for training based on the maximum value and the minimum value to obtain standardized historical crowd flow data; The standardized historical crowd flow data is input into the urban area crowd flow prediction model for training.
3. The method for predicting crowd flow in urban areas according to claim 2, characterized in that: The input end of the encoder is the input end of the urban area crowd flow prediction model, the output end of the encoder is respectively connected to the input end of the gated loop unit and the first input end of the decoder, the output end of the gated loop unit is connected to the second input end of the decoder, the first output end of the decoder is the first output end of the urban area crowd flow prediction model, and the second output end of the decoder is connected to the first input end of the spatiotemporal compression residual learning module.
4. The method for predicting crowd flow in urban areas according to claim 3, characterized in that: The first input end of the residual calculation unit is the input end of the urban area crowd flow prediction model, and the second input end of the residual calculation unit is connected to the second output end of the decoder; The output end of the second convolutional neural network unit is the second output end of the urban area crowd flow prediction model.
5. The method for predicting crowd flow in urban areas according to claim 4, characterized in that: Combining the spatial heterogeneity trend and the time-space compression residual, the future crowd flow data of the target urban area is calculated, and the calculation expression is: in, Represents the future crowd flow data of the target urban area.
6. A device for predicting crowd flow in urban areas, characterized in that: include: An acquisition module is used to obtain historical crowd flow data for training; A training module, used for inputting the training historical crowd flow data into the urban area crowd flow prediction model for training, so as to obtain the trained urban area crowd flow prediction model, wherein the urban area crowd flow prediction model includes a spatial trend learning module and a spatiotemporal compression residual learning module; A processing module, used for inputting the historical crowd flow data of the target urban area into the trained urban area crowd flow prediction model, compressing and reconstructing the historical crowd flow data of the target urban area through the spatial trend learning module to obtain spatial heterogeneous trends, and predicting the historical crowd flow data of the target urban area through the spatiotemporal compression residual learning module to obtain spatiotemporal compression residuals; The spatial trend learning module includes an encoder, a gated recurrent unit, and a decoder; The historical crowd flow data of the target urban area is compressed and reconstructed by the spatial trend learning module to obtain spatial heterogeneous trends, including: The encoder is used to compress the historical crowd flow data of the target city area into the embedding space to obtain a base sequence, and the compression expression is: in, represents the base sequence, , Both represent learnable convolutional filters, , Both represent the convolution kernel size, represents the convolution operator, represents the ReLU activation function, Represents the historical crowd flow data of the target urban area; The base sequence is predicted by the gated recurrent unit to obtain the future base sequence. The prediction expression is: in, represents the future basis sequence, , Both represent learnable parameters, represents the hidden state output during the prediction process of the gated recurrent unit, represents the gated recurrent unit function; The base sequence and the future base sequence are reconstructed into physical space respectively by the decoder to obtain the spatiotemporal sequence of urban area crowd flow and the spatiotemporal sequence of future urban area crowd flow, and the spatiotemporal sequence of urban area crowd flow and the spatiotemporal sequence of future urban area crowd flow are feature-connected to obtain spatial heterogeneous trends. The expression of feature connection is: in, represents the spatiotemporal sequence of crowd flow in urban areas, represents the spatiotemporal sequence of crowd flow in future urban areas, represents spatially heterogeneous trends, represents the feature concatenation operator; The spatiotemporal compression residual learning module includes a residual calculation unit, a first convolutional neural network unit, a deep residual unit, and a second convolutional neural network unit connected in sequence; The historical crowd flow data of the target urban area is predicted by the time-space compression residual learning module to obtain the time-space compression residual, including: The historical crowd flow data of the target urban area and the spatiotemporal sequence of the crowd flow in the urban area are input into the residual calculation unit for calculation to obtain the spatiotemporal compressed sensing residual, and the calculation expression is: in, represents the space-time compressed sensing error; The spatiotemporal compressed perception residual is input into the first convolutional neural network unit, the depth residual unit, and the second convolutional neural network unit for prediction to obtain the spatiotemporal compressed residual. The prediction expression is: in, represents the space-time compression residual, represents the learnable convolutional filter in the first convolutional neural network unit, represents the convolution kernel size of the first convolutional neural network unit, represents the learnable convolutional filter in the second convolutional neural network unit, represents the convolution kernel size of the second convolutional neural network unit, represents the deep residual unit function; A calculation module is used to calculate the future crowd flow data of the target urban area by combining the spatial heterogeneity trend and the space-time compression residual.
7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for predicting crowd flow in an urban area as described in any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for predicting crowd flow in an urban area as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Dynamic prediction method and device for urban fine population distribution based on depth learning
CN109376969A
Urban people flow prediction method based on space-time dynamic neural network
CN112257934A