Pedestrian flow prediction method, device and equipment
By combining historical pedestrian flow data from the target location and adjacent locations, and using an LSTM model to construct a pedestrian flow prediction model, the problem of inaccurate prediction based on historical data for a single attraction is solved, and more accurate pedestrian flow prediction for attractions is achieved.
Patent Information
- Application Number
- CN202511699929.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-13
AI Technical Summary
In existing technologies, the LSTM deep learning-based method for predicting tourist flow at scenic spots only uses historical data of a single scenic spot for prediction, resulting in inaccurate prediction results.
By acquiring the feature dataset of the target location and combining it with the historical pedestrian flow data of multiple adjacent locations that form an adjacent relationship with it, an LSTM model is used for training to construct a target pedestrian flow prediction model, taking into account the spatial location relationship and influencing factors between attractions.
It improves the accuracy of visitor flow forecasting, and can more comprehensively reflect the mutual influence between various attractions within the scenic area system, providing more accurate forecast results.
Smart Images

Figure CN121525969A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data processing technology, and in particular to a method, apparatus and equipment for predicting pedestrian traffic. Background Technology
[0002] For tourism management, visitor flow forecasting data is a crucial basis for tourism planning and decision-making. By analyzing short-term and long-term visitor flow trends, we can understand the attractiveness of attractions and market demand, thereby formulating reasonable development strategies and making advance arrangements for personnel and facility resource allocation. Furthermore, by releasing visitor flow forecast information in advance, tourists can choose suitable times to visit, avoiding peak hours, thus dispersing crowds, reducing congestion at attractions, and providing a better visiting environment.
[0003] Traditional methods for predicting visitor flow at tourist attractions based on LSTM deep learning rely on individual attractions and their historical data for self-learning and visitor flow prediction, which can easily lead to biased prediction results. Summary of the Invention
[0004] The purpose of this invention is to provide a method, apparatus, and device for predicting visitor flow, which solves the problem that existing methods for predicting visitor flow at tourist attractions rely solely on historical data from a single attraction, resulting in inaccurate predictions.
[0005] To achieve the above objectives, embodiments of the present invention provide a method for predicting pedestrian traffic, comprising:
[0006] Obtain the first feature dataset corresponding to the target location at the time to be predicted; wherein, the first feature dataset includes expected weather data, expected temperature data, date data, and date type;
[0007] The first feature dataset is input into the trained target pedestrian flow prediction model to obtain the predicted pedestrian flow for the time to be predicted; wherein the target pedestrian flow prediction model is trained and determined based on the first historical pedestrian flow data of at least one adjacent location that is adjacent to the target location.
[0008] Optionally, the method further includes:
[0009] Identify at least one adjacent location that is adjacent to the target location;
[0010] Based on the second historical pedestrian flow data of the target location at the first historical time, and the first historical pedestrian flow data of each of the at least one adjacent location at the first historical time, obtain the first weighted historical pedestrian flow data;
[0011] According to the first weighted historical passenger flow data and second feature data corresponding to the target place at the first historical time, a model is trained to obtain the target passenger flow prediction model, and the second feature data includes weather data, temperature data, date data, and date type.
[0012] Optionally, the method, wherein determining at least one adjacent relationship place in an adjacent relationship with the target place comprises:
[0013] obtaining first location data of a first place and second location data of the target place;
[0014] in a case where a spatial distance between the first location data and the second location data is less than or equal to a first preset threshold, determining the first place as one adjacent relationship place in an adjacent relationship with the target place;
[0015] in a case where the spatial distance between the first location data and the second location data is greater than the first preset threshold, a connecting straight line of the first location data and the second location data passes through at least one map interest point, and in a case where any one of the first place and the target place is within a first radiation range of the at least one map interest point or the at least one map interest point is within a second radiation range of any one of the first place and the target place, determining the first place as one adjacent relationship place in an adjacent relationship with the target place.
[0016] Optionally, the method, wherein the first weighted historical passenger flow data is obtained according to second historical passenger flow data of the target place at the first historical time and the first historical passenger flow data of each of the at least one adjacent relationship place at the first historical time, and the method comprises:
[0017] obtaining a Pearson correlation coefficient of the second historical passenger flow data and the first historical passenger flow data of each of the adjacent relationship places;
[0018] obtaining a corresponding weighting coefficient of each of the adjacent relationship places according to the Pearson correlation coefficient;
[0019] obtaining the first weighted historical passenger flow data according to the second historical passenger flow data, the first historical passenger flow data of each of the adjacent relationship places, and the corresponding weighting coefficient.
[0020] Optionally, the method, wherein the Pearson correlation coefficient of the second historical passenger flow data and the first historical passenger flow data of each of the adjacent relationship places is obtained, and the method comprises:
[0021] obtaining a first mean value of the second historical passenger flow data and a second mean value of the first historical passenger flow data;
[0022] obtaining a covariance according to the first historical passenger flow data, the second historical passenger flow data, the first mean value and the second mean value;
[0023] obtaining a standard deviation according to the first historical passenger flow data, the second historical passenger flow data, the first mean value and the second mean value;
[0024] obtaining the Pearson correlation coefficient according to the covariance and the standard deviation.
[0025] Optionally, the method, wherein the obtaining the weighting coefficient corresponding to each of the adjacent relationship locations according to the Pearson correlation coefficient comprises:
[0026] obtaining a first ratio of the Pearson correlation coefficient of the target location and a plurality of the adjacent relationship locations;
[0027] dividing a first numerical value according to the first ratio to obtain a plurality of the weighting coefficients; wherein the sum of the plurality of the weighting coefficients is the first numerical value.
[0028] Optionally, the method, wherein the obtaining the first weighted historical passenger flow data according to the second historical passenger flow data, the first historical passenger flow data of each of the adjacent relationship locations and the corresponding weighting coefficient comprises:
[0029] multiplying the absolute value of the difference between the second historical passenger flow data and the first historical passenger flow data of the adjacent relationship location by the corresponding weighting coefficient to obtain the weighted passenger flow data corresponding to the adjacent relationship location;
[0030] adding the second historical passenger flow data and the weighted passenger flow data to obtain the first weighted historical passenger flow data.
[0031] Optionally, the method, wherein the obtaining the target passenger flow prediction model according to the first weighted historical passenger flow data and the second feature data set corresponding to the target location at the first historical time comprises:
[0032] obtaining an input layer neuron number according to the first weighted historical passenger flow data and the second feature data set;
[0033] constructing a to-be-trained prediction model according to the input layer neuron number;
[0034] Input the people flow training input data in the first weighted historical people flow data and the feature training input data in the second feature data set into the to-be-trained prediction model to obtain training output data, wherein the feature training input data is data in the second feature data set corresponding to the people flow training input data;
[0035] Adjust the to-be-trained prediction model according to a comparison result of the training output data and people flow result data in the first weighted historical people flow data to obtain the target people flow prediction model, wherein the time corresponding to the people flow result data is after the time corresponding to the people flow training input data.
[0036] To achieve the above object, embodiments of the present application provide a people flow prediction device, comprising:
[0037] The first obtaining module is configured to obtain a first feature data set corresponding to a to-be-predicted time of a target location, wherein the first feature data set comprises predicted weather data, predicted temperature data, date data and date type.
[0038] The second obtaining module is configured to input the first feature data set into a target people flow prediction model trained, to obtain predicted people flow of the to-be-predicted time, wherein the target people flow prediction model is determined based on at least first historical people flow data of at least one neighboring location in a neighboring relationship with the target location.
[0039] To achieve the above object, embodiments of the present application provide a people flow prediction device, comprising: a transceiver, a processor, a memory, and a program or instructions stored on the memory and executable on the processor; wherein the processor executes the program or instructions to implement the people flow prediction method as described above.
[0040] To achieve the above object, embodiments of the present application provide a readable storage medium having a program or instructions stored thereon, wherein the program or instructions are executed by a processor to implement the steps of the people flow prediction method as described above.
[0041] To achieve the above object, embodiments of the present application provide a computer program product, comprising computer instructions, wherein the computer instructions are executed by a processor to implement the steps of the people flow prediction method as described above.
[0042] The above technical solutions of the present application have the following advantages:
[0043] The embodiment of the present application adopts the target passenger flow prediction model determined by training the first historical passenger flow data of at least one adjacent relationship place in adjacent relationship with the target place, inputs the first feature data set corresponding to the to-be-predicted time of the target place into the target passenger flow prediction model, and predicts the passenger flow of the target place at the to-be-predicted time, so as to obtain the predicted scenic spot passenger flow considering the connection between scenic spots. By mining the influence of the spatial position relationship of the scenic spots on the passenger flow, the prediction accuracy is improved. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 A schematic diagram of the passenger flow prediction method according to the embodiment of the present application;
[0045] Figure 2 A schematic diagram of the determination of the adjacent relationship place according to the passenger flow prediction method according to the embodiment of the present application;
[0046] Figure 3 A schematic diagram of the passenger flow prediction device according to the embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the technical problems, technical solutions and advantages of the present application clearer, the following will be described in detail with reference to the drawings and specific embodiments.
[0048] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily mean the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.
[0049] In various embodiments of the present application, it should be understood that the size of the serial number of the following processes does not mean the order of execution, and the execution order of the processes should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0050] In addition, the terms "system" and "network" are often used interchangeably in this document.
[0051] In the embodiments provided by the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that the determination of B according to A does not mean that B is determined only according to A, but B can also be determined according to A and / or other information.
[0052] For the convenience of understanding, some contents related to the embodiments of the present application are described as follows:
[0053] AsFigure 1 As shown, the human flow prediction method of the embodiment of the present application comprises the following steps:
[0054] In step S10, a first feature data set corresponding to a to-be-predicted time of a target location is obtained; the first feature data set comprises predicted weather data, predicted temperature data, date data, and date type.
[0055] It should be noted that when the human flow of a certain scenic spot (i.e., the target location) in a future day or time period needs to be predicted, the input features corresponding to the to-be-predicted time (i.e., the first feature data set comprising the predicted weather data, the predicted temperature data, the date data, and the date type) are first obtained, wherein the predicted weather data and the predicted temperature data can be obtained by means of weather forecasting, the date data comprises Monday to Sunday, and the date type comprises weekdays, holidays, and holidays.
[0056] In step S20, the first feature data set is input into a trained target human flow prediction model to obtain the predicted human flow of the to-be-predicted time; the target human flow prediction model is determined based on at least the first historical human flow data of at least one adjacent location in adjacent relationship with the target location.
[0057] It should be noted that inputting the first feature data set into the target human flow prediction model can obtain the predicted human flow of the target location in the to-be-predicted time. In the training process of the target human flow prediction model, the historical human flow of at least one adjacent location in adjacent relationship with the target location is involved, thereby helping to more comprehensively understand the mutual influence between various scenic spots in the scenic spot system, rather than being limited to the historical human flow data of a single scenic spot itself.
[0058] In this embodiment, the target human flow prediction model determined based on the first historical human flow data of at least one adjacent location in adjacent relationship with the target location is used to input the first feature data set corresponding to the to-be-predicted time of the target location into the target human flow prediction model, and the predicted human flow of the target location in the to-be-predicted time is predicted, thereby obtaining the predicted scenic spot human flow considering the connection between scenic spots, improving the prediction accuracy by mining the influence of the spatial position relationship of scenic spots on human flow.
[0059] Optionally, the method further comprises:
[0060] determining at least one adjacent location in adjacent relationship with the target location;
[0061] According to the second historical passenger flow data of the target location at the first historical time and the first historical passenger flow data of each of the at least one adjacent relationship location at the first historical time, first weighted historical passenger flow data is obtained;
[0062] According to the first weighted historical passenger flow data and a second feature data set corresponding to the target location at the first historical time, model training is performed to obtain the target passenger flow prediction model, and the second feature data set includes weather data, temperature data, date data and date type.
[0063] In this embodiment, as Figure 2As shown, the first example is provided, the target point A is set, all the points in the administrative division (or other forms of regional division) where the target point A is located are connected with the target point A, a relationship graph is constructed, and the points C, D and E connected with the target point A by solid lines are determined as the adjacent relationship points constituting the adjacent relationship with the target point according to the determination principle. By determining the adjacent relationship points and constructing the graph, the spatial relationship between the points can be intuitively presented, which helps to more comprehensively understand the mutual influence between the points in the point system, rather than being limited to the historical flow data of a single point itself. The second historical flow data of the target point at the first historical time is obtained, which is a sequence of hourly flow data of the target point A between 8:00 am and 6:00 pm on a certain day (i.e. the first historical time) in the first example. The corresponding first historical flow data is a sequence of hourly flow data of the points C, D and E at the first historical time. The first weighted historical flow data is obtained according to the second historical flow data and the first historical flow data. The weighted historical flow data is calculated based on the point adjacent relationship graph, which can mine the influence of the spatial position relationship of the points on the flow, considers the potential influence of the surrounding points on the flow of the target point, makes the flow data more comprehensive and representative, and more conforms to the characteristics of the flow of tourists in the points in the actual situation. In addition, the feature data such as date, holiday, weather and temperature also needs to be considered. These factors have an important influence on the flow of points in practice. For example, holidays usually bring a peak of flow, weather and temperature affect the willingness and comfort of tourists, and there are flow differences between weekdays and weekends in the date. In the actual operation process of the points, the time series data often has complex patterns such as periodicity, seasonality, trend and irregular fluctuations. By comprehensively considering these factors, the change rule of the flow can be more accurately captured. Therefore, the second feature data including the weather data, temperature data, date data and date type corresponding to the target point at the first historical time is trained with the first weighted historical flow data to obtain the target flow prediction model.
[0064] Optionally, the method, wherein determining at least one adjacent relationship point constituting an adjacent relationship with the target point comprises:
[0065] obtaining first position data of a first point and second position data of the target point;
[0066] in a case where the spatial distance between the first position data and the second position data is less than or equal to a first preset threshold, determining the first point as an adjacent relationship point constituting an adjacent relationship with the target point;
[0067] If the spatial distance between the first location data and the second location data is greater than a first preset threshold, and the connecting line between the first location data and the second location data passes through at least one location, and if either the first location or the target location is within the first radiation range of at least one map point of interest or if at least one map point of interest is within the second radiation range of either the first location or the target location, then the first location is determined as an adjacent location that forms an adjacent relationship with the target location.
[0068] In this embodiment, the first location or target location is typically an area enclosed by a boundary. The latitude and longitude coordinates of the center of this area are selected as the location data of this location, thereby obtaining the first location data of the first location and the second location data of the target location. Subsequent descriptions of the attractions refer to the location data of this location. Figure 2 As shown in the first example, attractions within the same administrative plan as the target location A include attractions B, C, D, and E. Attractions D and E are located at a spatial distance from attraction A that is less than or equal to the first preset threshold. Attraction C is located at a spatial distance greater than the first preset threshold from attraction A, but the straight line connecting attractions C and A passes through a point of interest (POI) within the coverage area R (i.e., the second radiation range) of attraction A. Attraction B is located at a spatial distance greater than the first preset threshold from attraction A, and there is no POI on the straight line connecting attractions B and A. Therefore, attractions C, D, and E are determined to be adjacent to the target location, while attraction B is not.
[0069] The radius of the first radiation range and the radius of the second radiation range of the map point of interest are preset based on the scale of people flow at that location. For example, the map point of interest can be a shopping mall, a subway station, a farmers' market, etc. The radius of the first radiation range corresponding to the farmers' market is smaller than the radius of the first radiation range corresponding to the shopping mall.
[0070] Optionally, the method, wherein obtaining first weighted historical pedestrian flow data based on second historical pedestrian flow data of the target location at the first historical time, and first historical pedestrian flow data of each of the at least one adjacent location at the first historical time, includes:
[0071] Obtain the Pearson correlation coefficient between the second historical pedestrian flow data and the first historical pedestrian flow data of each of the adjacent locations;
[0072] According to the Pearson correlation coefficient, a weighting coefficient corresponding to each of the adjacent relationship sites is obtained.
[0073] According to the second historical passenger flow data, the first historical passenger flow data of each of the adjacent relationship sites, and the corresponding weighting coefficient, the first weighted historical passenger flow data is obtained.
[0074] In the first example in this embodiment, the second historical passenger flow data is a passenger flow data sequence of the A scenic spot at 8:00 am to 6:00 pm on a certain day (i.e. the first historical time) at an interval of one hour, and the corresponding first historical passenger flow data is a passenger flow data sequence of the C scenic spot, the D scenic spot, and the E scenic spot at the first historical time at an interval of one hour, and the specific data is as follows:
[0075] The A scenic spot: {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10}, as sequence A;
[0076] The C scenic spot: {c1, c2, c3, c4, c5, c6, c7, c8, c9, c10}, as sequence C;
[0077] The D scenic spot: {d1, d2, d3, d4, d5, d6, d7, d8, d9, d10}, as sequence D;
[0078] The E scenic spot: {e1, e2, e3, e4, e5, e6, e7, e8, e9, e10}, as sequence E.
[0079] The Pearson correlation coefficients between sequence A and sequence C, sequence D, and sequence E are r A,C , r A,D , and r A,E , respectively, and the spatial passenger flow weighting coefficients w1, w2, and w3 of the C scenic spot, the D scenic spot, and the E scenic spot to the A scenic spot are calculated. A,C , r A,D , and r A,E , respectively, and the spatial passenger flow weighting coefficients w1, w2, and w3 of the C scenic spot, the D scenic spot, and the E scenic spot to the A scenic spot are calculated.
[0080] Optionally, the method, wherein the Pearson correlation coefficient of the second historical passenger flow data and the first historical passenger flow data of each of the adjacent relationship sites is obtained, includes:
[0081] A first mean value of the second historical passenger flow data and a second mean value of the first historical passenger flow data are obtained.
[0082] obtaining a covariance according to the first historical people flow data, the second historical people flow data, the first mean value and the second mean value;
[0083] obtaining a standard deviation according to the first historical people flow data, the second historical people flow data, the first mean value and the second mean value;
[0084] obtaining the Pearson correlation coefficient according to the covariance and the standard deviation.
[0085] In this embodiment, taking the calculation of the Pearson correlation coefficient between the C scenic spot and the A scenic spot as an example, first, the mean values of the sequence A and the sequence C are calculated and (i.e. the first mean value and the second mean value) are:
[0086] ;
[0087] ;
[0088] Then, the covariance of the sequence A and the sequence C is calculated :
[0089] ;
[0090] wherein, represents the i-th data in the sequence A, represents the i-th data in the sequence C.
[0091] Next, the standard deviations of the sequence A and the sequence C are calculated and :
[0092] ;
[0093] ;
[0094] According to the covariance and the standard deviation, the Pearson correlation coefficient r A,C is obtained:
[0095] ;
[0096] In the same way, the Pearson correlation coefficients r A,D and r A,E can be obtained.
[0097] Optionally, the method, wherein the method further comprises:
[0098] obtaining a first ratio of the Pearson correlation coefficients of the target point and the plurality of adjacent relationship points;
[0099] dividing the first value according to the first ratio to obtain the plurality of weighting coefficients; wherein the sum of the plurality of weighting coefficients is the first value.
[0100] In this embodiment, taking the first example as an example, the weighting coefficients w1, w2 and w3 of the spatial flow of the C scenic spot, the D scenic spot and the E scenic spot to the A scenic spot are calculated in the following way:
[0101] ;
[0102] ;
[0103] wherein, the first ratio, the first value.
[0104] Optionally, the method, wherein the first weighted historical flow data is obtained according to the second historical flow data, the first historical flow data of each adjacent relationship point and the corresponding weighting coefficient, comprising:
[0105] multiplying the absolute value of the difference between the second historical flow data and the first historical flow data of the adjacent relationship point by the corresponding weighting coefficient to obtain the weighted flow data corresponding to the adjacent relationship point;
[0106] adding the second historical flow data and the weighted flow data to obtain the first weighted historical flow data.
[0107] In this embodiment, in the first example, the first weighted historical flow data is obtained in the following way:
[0108] ;
[0109] ;
[0110] ;
[0111] ;
[0112] Thus, the first weighted historical flow data: {A1, A2, A3, A4, A5, A6, A7, A8, A9, A10} is obtained.
[0113] Optionally, the method, wherein the target people flow prediction model is obtained according to the first weighted historical people flow data and a second feature data set corresponding to the first historical time of the target location, and the method comprises:
[0114] obtaining an input layer neuron quantity according to the first weighted historical people flow data and the second feature data set;
[0115] constructing a to-be-trained prediction model according to the input layer neuron quantity;
[0116] inputting people flow training input data in the first weighted historical people flow data and feature training input data in the second feature data set into the to-be-trained prediction model to obtain training output data, wherein the feature training input data is data in the second feature data set corresponding to the people flow training input data;
[0117] adjusting the to-be-trained prediction model according to a comparison result of the training output data and people flow result data in the first weighted historical people flow data to obtain the target people flow prediction model, wherein the time corresponding to the people flow result data is after the time corresponding to the people flow training input data.
[0118] In this embodiment, the first weighted historical people flow data and the second feature data set are used as features to construct a training sample library, and linear normalization is performed on the data in each dimension, such as a max-min linear normalization method, to constrain data of different dimensions in the range of [0, 1]. The first weighted historical people flow data is linearly normalized by the following formula:
[0119] ;
[0120] wherein, is the minimum value in the first weighted historical people flow data, is the maximum value in the first weighted historical people flow data, is the i-th data in the first weighted historical people flow data.
[0121] For weather data, first, encoding is performed, for example, sunny is encoded as 0, cloudy is encoded as 1, rainy is encoded as 2, etc., and then linear normalization is performed.
[0122] For temperature data, the temperature is directly mapped to the interval [0, 1].
[0123] For date data, the date data is first encoded, for example, Monday is encoded as 0, Tuesday is encoded as 1, …, and Sunday is encoded as 6, and then linear normalization is performed.
[0124] For date type, the date type is first encoded, for example, 0 for weekday, 1 for holiday, and 2 for holiday, and then linear normalization is performed.
[0125] Long Short-Term Memory (LSTM) is a special recurrent neural network (RNN) that has a natural advantage in processing and predicting long-term dependencies in time series data, and can effectively capture long-term dependencies in time series data. The forget gate determines which information to discard from the memory unit, the input gate determines which new information to update to the memory unit, and the output gate determines which information to output from the memory unit as the hidden state and final output at the current time. These gate structures and memory units work together to enable LSTM to retain and utilize important information in long time series, overcoming the shortcomings of traditional RNN.
[0126] The number of neurons in the input layer, hidden layer and output layer is determined. The number of input layer neurons is obtained according to the first weighted historical passenger flow data and the second feature data set, and is determined according to the number of input features, wherein the first weighted historical passenger flow data, the weather data, the temperature data, the date data and the date type, a total of five input features, so the number of input layer neurons is set to 5.
[0127] The number of hidden layer neurons can be determined by testing different values, and is set in the range of 10-50. In the first example, 20 is taken as an example for illustration.
[0128] The number of output layer neurons is 1, which is used to predict the passenger flow.
[0129] The learning rate is set to 0.01, and the number of iterations is set to 1000 or less. Thus, the to-be-trained prediction model is constructed.
[0130] The first weighted historical passenger flow data is divided into a training set and a test set according to a certain proportion. For example, the first 80% of the data is used as the training set, and the last 20% of the data is used as the test set. In the present application, the training set is divided into the passenger flow training input data and the passenger flow result data, and the feature training input data in the second feature data set corresponding to the passenger flow training input data is input into the to-be-trained prediction model together with the passenger flow training input data, and the is calculated by forward propagation.
[0131] The training output data and the passenger flow result data are used to calculate the loss function value, and the mean squared error (MSE) is used as the loss function, and the formula is:
[0132] ;
[0133] Where n is the number of samples, The training output data (predicted values) are the training output data. The data represents the actual flow of people.
[0134] Based on the loss function value, the weights of the LSTM model are updated using the backpropagation algorithm. By continuously adjusting the weights, the loss function value is gradually reduced until the model converges.
[0135] The trained model is evaluated using a test set.
[0136] The input features from the test set are fed into the model to obtain the predicted output. Then, evaluation metrics are calculated, such as Mean Squared Error (MSE) and Mean Absolute Error (MAE). In this embodiment of the invention, MAE is used to evaluate model accuracy. The formula for calculating MAE is:
[0137] ;
[0138] Where n is the number of samples, For test output data (predicted values). The actual pedestrian flow data (actual value) corresponding to the test output data.
[0139] The performance of a model is judged by evaluation metrics. If the evaluation metrics meet the requirements, the model can be used for actual prediction; if they do not meet the requirements, the model needs to be adjusted, such as adjusting model parameters or increasing training data.
[0140] LSTM models are suitable for processing data with time-series characteristics and can effectively capture long-term dependencies in the sequence. In tourist attraction flow prediction, considering that visitor flow is influenced by various factors at multiple past time points, and taking into account both short-term fluctuations and long-term trends, combining these two aspects for prediction, LSTM models can better learn these complex relationships, thereby improving prediction accuracy. This invention comprehensively considers the spatial correlation between attractions and the impact of visitor flow at one attraction on visitor flow at adjacent attractions. This consideration of mutual influence allows the model to more accurately simulate the flow and distribution of tourists within attractions, thereby improving the model's prediction results and performance, ultimately increasing prediction accuracy, and providing a more reliable decision-making basis for the operation and management of tourist attractions.
[0141] The advantages of the embodiments of the present invention are reflected in several aspects, mainly including the following:
[0142] 1. For the management of scenic spots:
[0143] (1) Optimal allocation of resources: Accurate prediction of the number of tourists at different times can help the management of scenic spots to reasonably arrange staff, material reserves, equipment maintenance, etc. in advance. For example, when predicting the peak tourist period, increase the number of security personnel and cleaning personnel to ensure the order and environmental sanitation of the scenic spot; prepare sufficient food, beverages and other materials in advance to meet the consumption needs of tourists; and carry out advance maintenance and maintenance of transportation tools and amusement facilities in the scenic spot to ensure their normal operation.
[0144] (2) Improve the experience of tourists: Through accurate prediction of the flow of people, the scenic spot can take measures to guide tourists in advance, reduce the waiting time of tourists, and optimize the tourist route. For example, set up guide signs near popular scenic spots to guide tourists to relatively less crowded areas; according to the changes in the number of tourists, flexibly adjust the operation frequency of transportation tools in the scenic spot to improve the convenience of tourists. This helps to improve the satisfaction of tourists and enhance the reputation and competitiveness of the scenic spot.
[0145] (3) Marketing decision support: According to the predicted flow trend, the management of scenic spots can develop more targeted marketing strategies. For example, in periods when the number of tourists is low, launch preferential activities, special theme activities, etc. to attract more tourists; in the tourism peak season, strengthen cooperation with surrounding hotels, catering enterprises, etc. and launch joint marketing activities to improve the comprehensive income of the scenic spot.
[0146] 2. For businesses around the scenic spot:
[0147] (1) Business planning and operation: Businesses can reasonably plan the operating hours, types of goods and inventory of their stores based on the scenic spot flow prediction information. For example, in the peak tourist period, extend the operating hours of the store and increase the inventory of popular goods; in the period when the number of tourists is low, adjust the display and promotion strategy of the goods to improve the attractiveness of the goods.
[0148] (2) Investment decision reference: For businesses that want to invest in the scenic spot, flow prediction information is an important reference. It can help them evaluate the commercial potential of different areas, choose the right store location and business project, reduce investment risk and improve investment return rate.
[0149] 3. For tourism-related service platforms:
[0150] (1) Personalized service recommendation: The tourism service platform can provide personalized tourism suggestions and services for users based on the tourist flow prediction results. For example, recommend less crowded tourist attractions or tour time periods to users to help them avoid peak tourist flow; customize exclusive tourism routes for users based on their interests and the tourist flow of the attractions to improve their tourism experience.
[0151] (2) Improve platform competitiveness: Accurate tourist flow prediction information can improve the professionalism and credibility of the tourism service platform, attracting more users to use the platform. At the same time, the platform can cooperate with attractions, businesses, etc. to provide one-stop tourism services, including ticket booking, hotel booking, transportation booking, etc., increasing the platform's revenue sources.
[0152] 4. For government-related departments:
[0153] (1) Traffic management and planning: Government departments can make traffic diversion and management in advance based on tourist flow prediction information. For example, increase the number of public transportation trips to attractions during peak tourist periods, optimize traffic signal settings, and strengthen traffic control on roads around attractions to ensure the safety and smoothness of tourist travel.
[0154] (2) Tourism industry development planning: Tourist flow prediction data can provide scientific basis for government to develop tourism industry development planning. Government departments can reasonably plan the development and utilization of tourism resources based on tourist flow trends and changes in tourist demand, etc. to promote the sustainable development of the tourism industry.
[0155] As shown in Figure 3 To achieve the above purposes, an embodiment of the present application provides a people flow prediction device, which comprises:
[0156] The first acquisition module 301 is configured to acquire a first feature data set of a target location corresponding to a to-be-predicted time; wherein the first feature data set comprises predicted weather data, predicted temperature data, date data, and date type.
[0157] The second acquisition module 302 is configured to input the first feature data set into a trained target people flow prediction model to obtain a predicted people flow of the to-be-predicted time; wherein the target people flow prediction model is determined based on at least first historical people flow data of at least one adjacent relationship location having an adjacent relationship with the target location.
[0158] Optionally, the device further comprises:
[0159] The first determination module is configured to determine at least one adjacent relationship location having an adjacent relationship with the target location.
[0160] a third obtaining module, configured to obtain first weighted historical passenger flow data according to second historical passenger flow data of the target location at the first historical time and the first historical passenger flow data of each of the at least one adjacent relationship location at the first historical time;
[0161] a fourth obtaining module, configured to obtain the target passenger flow prediction model by performing model training according to the first weighted historical passenger flow data and a second feature data set corresponding to the target location at the first historical time, the second feature data set including weather data, temperature data, date data and date type.
[0162] Optionally, the apparatus, wherein the first determining module comprises:
[0163] a first obtaining unit, configured to obtain first position data of a first location and second position data of the target location;
[0164] a first determining unit, configured to determine the first location as one adjacent relationship location having an adjacent relationship with the target location in a case where a spatial distance between the first position data and the second position data is less than or equal to a first preset threshold.
[0165] a second determining unit, configured to determine the first location as one adjacent relationship location having an adjacent relationship with the target location in a case where the spatial distance between the first position data and the second position data is greater than the first preset threshold, a connecting straight line of the first position data and the second position data passes through at least one map interest point, and any one of the first location and the target location is within a first radiation range of the at least one map interest point or the at least one map interest point is within a second radiation range of any one of the first location and the target location.
[0166] Optionally, the apparatus, wherein the third obtaining module comprises:
[0167] a second obtaining unit, configured to obtain a Pearson correlation coefficient of the second historical passenger flow data and the first historical passenger flow data of each of the adjacent relationship locations;
[0168] a third obtaining unit, configured to obtain a weighting coefficient corresponding to each of the adjacent relationship locations according to the Pearson correlation coefficient;
[0169] a fourth obtaining unit, configured to obtain the first weighted historical passenger flow data according to the second historical passenger flow data, the first historical passenger flow data of each of the adjacent relationship locations and the corresponding weighting coefficient.
[0170] Optionally, the apparatus, wherein the second obtaining unit comprises:
[0171] a first obtaining component, configured to obtain a first mean value of the second historical passenger flow data and a second mean value of the first historical passenger flow data;
[0172] a second obtaining component, configured to obtain a covariance according to the first historical passenger flow data, the second historical passenger flow data, the first mean value and the second mean value;
[0173] a third obtaining component, configured to obtain a standard deviation according to the first historical passenger flow data, the second historical passenger flow data, the first mean value and the second mean value;
[0174] a fourth obtaining component, configured to obtain the Pearson correlation coefficient according to the covariance and the standard deviation.
[0175] Optionally, the apparatus, wherein the third obtaining unit comprises:
[0176] a fifth obtaining component, configured to obtain a first ratio of the Pearson correlation coefficient of the target location and a plurality of the adjacent relationship locations;
[0177] a sixth obtaining component, configured to divide a first value according to the first ratio to obtain a plurality of the weighting coefficients; wherein the sum of the plurality of the weighting coefficients is the first value.
[0178] Optionally, the apparatus, wherein the fourth obtaining unit comprises:
[0179] a seventh obtaining component, configured to multiply the absolute value of the difference between the second historical passenger flow data and the first historical passenger flow data of the adjacent relationship location by the corresponding weighting coefficient to obtain the weighted passenger flow data corresponding to the adjacent relationship location;
[0180] an eighth obtaining component, configured to add the second historical passenger flow data and the weighted passenger flow data to obtain the first weighted historical passenger flow data.
[0181] Optionally, the apparatus, wherein the fourth obtaining module comprises:
[0182] a ninth obtaining component, configured to obtain an input layer neuron number according to the first weighted historical passenger flow data and the second feature data set;
[0183] a first processing component, configured to construct a to-be-trained prediction model according to the input layer neuron number;
[0184] The tenth obtaining component is configured to input the people flow training input data in the first weighted historical people flow data and the feature training input data in the second feature data set into the to-be-trained prediction model to obtain training output data, wherein the feature training input data is data in the second feature data set corresponding to the people flow training input data;
[0185] The eleventh obtaining component is configured to adjust the to-be-trained prediction model according to a comparison result of the training output data and people flow result data in the first weighted historical people flow data to obtain the target people flow prediction model, wherein the people flow result data corresponds to a time after a time corresponding to the people flow training input data.
[0186] It should be noted that the above device provided by the embodiments of the present application can realize all the method steps achieved by the above method embodiments and achieve the same technical effects, and the same parts and beneficial effects of the method embodiments will not be described in detail herein.
[0187] To achieve the above object, the embodiments of the present application provide a people flow prediction device, comprising a transceiver, a processor, a memory, and a program or instructions stored on the memory and executable on the processor; wherein the processor implements the above people flow prediction method when executing the program or instructions.
[0188] To achieve the above object, the embodiments of the present application provide a readable storage medium having a program or instructions stored thereon, wherein the program or instructions are executed by a processor to implement the steps of the above people flow prediction method.
[0189] To achieve the above object, the embodiments of the present application provide a computer program product, comprising computer instructions, wherein the computer instructions are executed by a processor to implement the steps of the above people flow prediction method.
[0190] It should be further noted that the people flow prediction device described in this specification includes but is not limited to smart phones, tablet computers, etc., and many functional components described are referred to as modules to more specifically emphasize the independence of their implementation.
[0191] In the embodiments of the present application, the modules can be implemented by software to be executed by various types of processors. For example, an identified executable code module can include one or more physical or logical blocks of computer instructions, which can be constructed as objects, processes or functions, for example. However, the executable code of the identified module need not be physically located together, but can include different instructions stored in different locations which, when logically combined together, constitute the module and achieve the specified purpose of the module.
[0192] Indeed, a module of executable code can be a single instruction, or many instructions, and can even be distributed over several different code segments, among different programs, and across several memory devices. Similarly, operational data can be identified and illustrated herein within modules, and can be embodied in any suitable form and organized within any suitable type of data structure. The operational data can be collected as a single data set, or can be distributed over different locations including over different storage devices, and can exist, at least partially, merely as electronic signals on a system or network.
[0193] Where a module can be implemented in software, the module can be stored in any suitable storage medium as a plurality of instructions for a computer based system. The plurality of instructions can be executable by the computer based system to carry out the functions of the module. The storage medium can comprise memory or memor'devices, such as primary memory (e.g. random access memory (RAM)) or secondary memory (e.g. disc or tape). Suitable storage media for storing instructions include memory or storage means which can comprise one or more types of computer-readable storage media. Such media can store data which is readable by a computer including computer-readable instructions, data structures, program components, or other data. Examples of computer- readable storage media include memory devices such as primary and secondary memory devices, e.g. read-only memory (ROM), random access memory (RAM), magnetic disk storage media, optical storage media, flash memory devices, electrical, optical, acoustical or other form of propagated signals (e.g. carrier waves, infrared signals, digital signals, etc.), etc. Accordingly, the present application should not be construed as limited to any particular programming language or computer-readable storage media.
[0194] The exemplary embodiments described herein are not the only way(s) in which the present application can be embodied. It will be apparent to those skilled in the art that numerous different forms and embodiments can be possible without departing from the spirit and teachings of the present application. Therefore, the present application is not to be limited to the specific exemplary embodiments described herein. Rather, the scope of the present application is to be defined as set forth in the claims following these descriptive writings. In the drawings, the size and relative sizes of components can be exaggerated for clarity. The terms used herein are merely descriptive, but not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising", when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. Unless otherwise indicated herein, statements of a value range are inclusive of the values defining the range as well as any sub-ranges therebetween.
[0195] The above description is the preferred embodiment of the present application. It is to be understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reviewing the above description. The scope of the application should, therefore, be determined not with reference to the above description, but instead with reference to the appended claims, along with their full scope of equivalents.
Claims
1. A method for predicting pedestrian flow, characterized in that, include: Obtain the first feature dataset corresponding to the target location at the time to be predicted; wherein, the first feature dataset includes expected weather data, expected temperature data, date data, and date type; The first feature dataset is input into the trained target pedestrian flow prediction model to obtain the predicted pedestrian flow for the time to be predicted; wherein the target pedestrian flow prediction model is trained and determined based on the first historical pedestrian flow data of at least one adjacent location that is adjacent to the target location.
2. The method according to claim 1, characterized in that, The method further includes: Identify at least one adjacent location that is adjacent to the target location; Based on the second historical pedestrian flow data of the target location at the first historical time, and the first historical pedestrian flow data of each of the at least one adjacent location at the first historical time, obtain the first weighted historical pedestrian flow data; The target pedestrian flow prediction model is obtained by training the model based on the first weighted historical pedestrian flow data and the second feature dataset corresponding to the target location at the first historical time. The second feature dataset includes weather data, temperature data, date data, and date type.
3. The method according to claim 2, characterized in that, Determining at least one adjacent location that forms an adjacent relationship with the target location includes: Acquire first location data of the first location and second location data of the target location; If the spatial distance between the first location data and the second location data is less than or equal to a first preset threshold, the first location is determined as an adjacent location that forms an adjacent relationship with the target location; If the spatial distance between the first location data and the second location data is greater than a first preset threshold, and the straight line connecting the first location data and the second location data passes through at least one map point of interest, and if either the first location or the target location is within the first radiation range of at least one map point of interest, or if at least one map point of interest is within the second radiation range of either the first location or the target location, then the first location is determined as an adjacent location that forms an adjacent relationship with the target location.
4. The method according to claim 2, characterized in that, Based on the second historical pedestrian flow data of the target location at the first historical time, and the first historical pedestrian flow data of each of the at least one adjacent location at the first historical time, first weighted historical pedestrian flow data is obtained, including: Obtain the Pearson correlation coefficient between the second historical pedestrian flow data and the first historical pedestrian flow data of each of the adjacent locations; The weighting coefficient corresponding to each of the adjacent locations is obtained based on the Pearson correlation coefficient. The first weighted historical pedestrian flow data is obtained based on the second historical pedestrian flow data, the first historical pedestrian flow data of each of the adjacent locations, and the corresponding weighting coefficient.
5. The method according to claim 4, characterized in that, Obtaining the Pearson correlation coefficient between the second historical pedestrian flow data and the first historical pedestrian flow data of each of the adjacent locations includes: Obtain the first mean of the second historical pedestrian flow data and the second mean of the first historical pedestrian flow data; The covariance is obtained based on the first historical pedestrian flow data, the second historical pedestrian flow data, the first mean, and the second mean; The standard deviation is obtained based on the first historical pedestrian flow data, the second historical pedestrian flow data, the first mean, and the second mean; The Pearson correlation coefficient is obtained based on the covariance and the standard deviation.
6. The method according to claim 4, characterized in that, The weighted coefficients for each of the adjacent locations are obtained based on the Pearson correlation coefficient, including: Obtain the first ratio of multiple Pearson correlation coefficients between the target location and multiple adjacent locations; The first value is divided according to the first ratio to obtain multiple weighting coefficients; wherein the sum of the multiple weighting coefficients is the first value.
7. The method according to claim 4, characterized in that, Based on the second historical pedestrian flow data, the first historical pedestrian flow data for each of the adjacent locations, and the corresponding weighting coefficients, the first weighted historical pedestrian flow data is obtained, including: Multiply the absolute value of the difference between the second historical pedestrian flow data and the first historical pedestrian flow data of the adjacent locations by the corresponding weighting coefficient to obtain the weighted pedestrian flow data corresponding to the adjacent locations. The second historical pedestrian flow data is added to the weighted pedestrian flow data to obtain the first weighted historical pedestrian flow data.
8. The method according to claim 2, characterized in that, The target pedestrian flow prediction model is obtained by training a model based on the first weighted historical pedestrian flow data and the second feature dataset corresponding to the target location at the first historical time, including: The number of neurons in the input layer is obtained based on the first weighted historical pedestrian flow data and the second feature dataset. A prediction model to be trained is constructed based on the number of neurons in the input layer. The pedestrian flow training input data from the first weighted historical pedestrian flow data and the feature training input data from the second feature dataset are input into the prediction model to be trained to obtain training output data; wherein, the feature training input data is the data in the second feature dataset corresponding to the pedestrian flow training input data; The prediction model to be trained is adjusted based on the comparison results between the training output data and the pedestrian flow result data in the first weighted historical pedestrian flow data to obtain the target pedestrian flow prediction model; wherein the time corresponding to the pedestrian flow result data is after the time corresponding to the pedestrian flow training input data.
9. A pedestrian flow prediction device, characterized in that, include: The first acquisition module is used to acquire a first feature dataset corresponding to the target location at the time to be predicted; wherein, the first feature dataset includes expected weather data, expected temperature data, date data, and date type; The second acquisition module is used to input the first feature dataset into the trained target pedestrian flow prediction model to acquire the predicted pedestrian flow for the time to be predicted; wherein the target pedestrian flow prediction model is trained and determined based on the first historical pedestrian flow data of at least one adjacent location that is adjacent to the target location.
10. A pedestrian flow prediction device, comprising: A transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; characterized in that, when the processor executes the program or instructions, it implements the pedestrian flow prediction method as described in any one of claims 1-8.
11. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps in the pedestrian flow prediction method as described in any one of claims 1-8.
12. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of the pedestrian flow prediction method as described in any one of claims 1-8.