A streaming data processing method and system for smart city management
By evaluating the peak demand period for buses and the congestion tendency of traffic, the number of hidden units in the LSTM model is adjusted, which solves the resource waste and inaccuracy problems of the traditional LSTM model in predicting bus departure time intervals and achieves more efficient streaming data processing.
Patent Information
- Application Number
- CN202510896366.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-07-01
AI Technical Summary
Traditional LSTM models cannot adaptively determine the number of hidden units when predicting bus departure time intervals, resulting in wasted computing resources and inaccurate predictions during peak passenger flow periods, reducing the processing efficiency of streaming data in smart city management.
By collecting bus location and passenger data, evaluating the passenger demand peak prediction and road congestion tendency, adjusting the number of hidden units in the LSTM model to adapt to changes in different time periods and road conditions, and optimizing the determination of departure time intervals.
The streaming data processing efficiency of the LSTM model in smart city management is improved, the rationality and accuracy of bus departure time intervals are ensured, and the waste of computing resources is reduced.
Smart Images

Figure CN120412285B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bus dispatching, and in particular to a streaming data processing method and system applied to smart city management. Background Art
[0002] Streaming data refers to a data stream that is continuously generated in real time in chronological order. It is widely used in various fields of smart city management. For example, in smart public transportation applications, by processing the collected streaming data such as bus GPS and user IC cards, the departure intervals of vehicles at bus stops can be predicted.
[0003] Traditionally, a long short-term memory (LSTM) model is often used to determine bus departure intervals. This model takes streaming data such as bus location information and user IC card verification information as input and predicts the next departure interval through model training. The number of hidden units in the model's hidden layer is a key training parameter, controlling the model capacity and determining the LSTM's dimension and computational accuracy. Traditionally, the number of hidden units is often set to a fixed value. However, in real-world scenarios, bus passenger demand experiences peaks and troughs at different times. Using a fixed number of hidden units makes it difficult for the LSTM model's computational accuracy to adapt to peak demand periods, resulting in excessive waste of computing resources during low demand periods, reducing the model's efficiency in predicting departure intervals. Furthermore, bus passenger loads and road conditions vary significantly across different periods. Using the same computational level for predicting each departure interval can lead to inaccurate judgments about computing resource requirements, reducing the LSTM model's efficiency in processing streaming data for smart city management. Summary of the Invention
[0004] In order to solve the problem that the existing LSTM model cannot adaptively determine the number of hidden units in the model when predicting the time interval of bus occurrence, the purpose of the present invention is to provide a streaming data processing method and system for smart city management. The technical solutions adopted are as follows:
[0005] In a first aspect, the present invention provides a streaming data processing method applied to smart city management, the method comprising the following steps:
[0006] Collect the location information of buses on the target road section in the city and the passenger load of buses at each stop within a preset time period. The preset time period includes historical time periods and the current time;
[0007] The peak passenger demand prediction degree of each station is obtained based on the number of passengers boarded by the previous bus passing through each station at the current moment, the time interval between the current moment and the previous moment when the bus passed through the corresponding station, and the number of passengers boarded at each station in the historical period. The excellence of the bus in responding to the passenger demand of each station is determined based on the passenger load of the bus approaching each station at the current moment and the peak passenger demand prediction degree of the station on the road section to be traveled between the bus approaching each station and the bus approaching each station.
[0008] The comprehensive response excellence is calculated based on the number of buses approaching each stop at the current moment, the distance between the buses and the stops, and the passenger demand response excellence. The number of hidden units in the LSTM model is adjusted based on the travel time of buses at adjacent stops within a preset time period and the comprehensive response excellence.
[0009] The adjusted LSTM model is used to determine the bus departure time interval.
[0010] Preferably, obtaining the passenger demand peak prediction degree of each station according to the number of passengers boarded by the previous bus passing each station at the current moment, the time interval between the current moment and the time when the previous bus passed each station, and the number of passengers boarded at each station in a historical period includes:
[0011] For either site:
[0012] The number of passengers boarding the bus that passed through the station at the current moment is recorded as the first number of the station; the time interval between the current moment and the time when the bus that passed through the station last time passed through the station is recorded as the first time interval of the station;
[0013] multiplying the negative correlation mapping value of the first time interval of any site by the first number of any site as the first eigenvalue of any site;
[0014] taking a comprehensive characteristic value as a product of a negative correlation mapping value of an average value of the first time interval of all sites and an average value of the first quantity of all sites;
[0015] Determine the normalized result of the ratio of the first characteristic value of any site to the comprehensive characteristic value as the popularity response degree of any site;
[0016] The passenger demand peak prediction degree of any station is obtained according to the number of passengers boarding at any station by buses passing through the any station in the first historical sub-time period.
[0017] Preferably, obtaining the passenger demand peak prediction degree of any station according to the number of passengers boarding at any station by buses passing through the any station in the first historical sub-time period includes:
[0018] Record the number of passengers who boarded a bus that passed through any station at the time corresponding to the current time in the first historical sub-time period as a second number;
[0019] Calculating a first ratio between the second number and an average number of passengers boarding the buses passing through the any one station during the first historical sub-time period;
[0020] The product of the first ratio and the popularity reflection degree of any one of the sites is used as the passenger demand peak prediction degree of any one of the sites.
[0021] Preferably, determining the excellence of the buses approaching each station in responding to passenger demand at each station based on the passenger load of the buses approaching each station at the current moment and the predicted peak passenger demand of stations on the road sections to be traveled between the buses approaching each station and each station comprises:
[0022] For either site:
[0023] Determine the fullness of the target bus based on the quantitative relationship between the number of passengers on the target bus at the current moment and the rated passenger capacity;
[0024] Calculating the cumulative sum of the passenger demand peak prediction degrees of all stations on the road section to be traveled between the target bus and any of the stations at the current moment;
[0025] Combining the cumulative sum, the full load degree of the target bus, and the predicted passenger demand peak degree at any station, to obtain the passenger demand handling excellence of the target bus for the any station, wherein the cumulative sum, the full load degree of the target bus, and the predicted passenger demand peak degree at any station are all negatively correlated with the passenger demand handling excellence;
[0026] The target bus is any bus that is currently heading towards any of the stations.
[0027] Preferably, determining the fullness of the target bus according to the quantitative relationship between the number of passengers on the target bus at the current moment and the rated passenger capacity includes:
[0028] The ratio between the number of passengers on the target bus at the current moment and the corresponding rated passenger capacity is determined as the full load degree of the target bus.
[0029] Preferably, obtaining the comprehensive response excellence degree according to the number of buses heading to each station at the current moment, the distance between the buses heading to each station and the station, and the passenger demand response excellence degree includes:
[0030] For either site:
[0031] Calculating respectively the average distance between all buses currently traveling toward the said any station and the said any station, and a first average value of the excellence of all buses currently traveling toward the said any station in handling passenger demand for the said any station;
[0032] Based on the number of all buses heading toward any one of the stations at the current moment, the average distance and the first average value, the comprehensive response excellence of the station is obtained. The number of all buses heading toward any one of the stations at the current moment and the first average value are both positively correlated with the comprehensive response excellence, and the average distance is negatively correlated with the comprehensive response excellence.
[0033] Preferably, the method of adjusting the number of hidden units of the LSTM model based on the driving time of the bus at adjacent stops and the comprehensive response excellence within a preset time period includes:
[0034] For any station: calculate the second average of the travel time of all buses from the previous station to the station during the historical period; record the travel time of the last bus that passed by the station from the previous station to the station at the current moment as the first travel time; and normalize the difference between the first travel time and the second average as the traffic congestion tendency degree of the station.
[0035] The product of each station's comprehensive response excellence and the corresponding traffic congestion tendency is used as the demand degree of each station; the average demand degree of all stations is used as the vehicle demand urgency indicator;
[0036] The number of hidden units of the LSTM model is adjusted according to the vehicle demand urgency indicator.
[0037] Preferably, adjusting the number of hidden units of the LSTM model according to the vehicle demand urgency indicator includes:
[0038] The ratio between the vehicle demand urgency index and the preset urgency index is used as an adjustment coefficient;
[0039] The result of rounding up the product of the adjustment coefficient and the preset number of hidden units of the LSTM model is used as the adjusted number of hidden units of the LSTM model.
[0040] Preferably, the method of determining the bus departure time interval using the adjusted LSTM model includes:
[0041] The current bus position and bus passenger load on the target road section are input into the adjusted LSTM model, and the next bus departure time interval is output.
[0042] In a second aspect, the present invention provides a streaming data processing system for smart city management, wherein the system implements the above method, and the system includes:
[0043] A data collection module is used to collect the location information of buses on target sections of the city and the passenger load of buses at each stop within a preset time period. The preset time period includes historical time periods and the current time;
[0044] An analysis module is used to obtain a predicted degree of peak passenger demand at each station based on the number of passengers boarded by the previous bus passing through each station at the current moment, the time interval between the current moment and the last time the bus passed through the station, and the number of passengers boarded at each station during a historical period; and to determine the degree of excellence of buses approaching each station in responding to passenger demand at each station based on the passenger load of buses approaching each station at the current moment and the predicted degree of peak passenger demand at stations on the road sections to be traveled between the buses approaching each station and the stations;
[0045] An adjustment module is used to obtain a comprehensive response excellence based on the number of buses currently approaching each stop, the distance between the buses approaching each stop, and the passenger demand response excellence. The module also adjusts the number of hidden units in the LSTM model based on the travel time of buses at adjacent stops within a preset time period and the comprehensive response excellence.
[0046] The processing module is used to determine the bus departure time interval using the adjusted LSTM model.
[0047] The present invention has at least the following beneficial effects:
[0048] The present invention first evaluates the passenger demand peak prediction degree of the station based on the number of passengers boarded by the last bus passing through the station, the time interval between the current moment and the last bus passing through the station, and the number of passengers boarded at the station in the historical period. Based on the passenger demand peak prediction degree, the passenger carrying situation of the buses is analyzed to obtain the excellence of the buses heading to each station in responding to the passenger demand of each station. The comprehensive response excellence of each station is determined by comprehensively considering the number of buses heading to each station at the current moment and the distance between the buses and the stations. Then, the road congestion performance of the station is reflected by combining the driving time of the buses at adjacent stations within a preset time period, and the number of hidden units in the hidden layer of the LSTM model is adjusted. Furthermore, the departure time interval of the buses is determined based on the streaming data input by the LSTM model. The method provided by the present invention adaptively adjusts the number of hidden units in the hidden layer of the LSTM model based on the bus passenger demand, bus status and road conditions in actual scenarios. On the basis of ensuring the rationality of the determined bus departure time interval, the processing efficiency of the LSTM model for streaming data in smart city management is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 A flow chart of a streaming data processing method for smart city management provided by an embodiment of the present invention;
[0051] Figure 2 This is a structural block diagram of a streaming data processing system for smart city management provided by an embodiment of the present invention;
[0052] Figure 3 This is the calculation result diagram of the customer demand peak prediction degree;
[0053] Figure 4 A comparison chart of the LSTM prediction accuracy of the solution provided by the embodiment of the present invention and the existing LSTM prediction accuracy;
[0054] Figure 5 A comparison chart of the loss function curve of the solution provided in an embodiment of the present invention and the loss function curve of the existing LSTM model. DETAILED DESCRIPTION
[0055] In order to further illustrate the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the following is a detailed description of a streaming data processing method and system for smart city management proposed in accordance with the present invention in combination with the accompanying drawings and preferred embodiments.
[0056] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0057] The following describes in detail a specific solution of a streaming data processing method and system for smart city management provided by the present invention with reference to the accompanying drawings.
[0058] An embodiment of a streaming data processing method applied to smart city management:
[0059] The specific scenario targeted by this embodiment is: smart public transportation is an important branch of smart city management. In order to meet passengers' demand for buses while avoiding waste of resources, it is necessary to adjust the bus departure time interval in real time according to passengers' demand for transportation.
[0060] This embodiment proposes a streaming data processing method for smart city management. Figure 1 As shown, a streaming data processing method applied to smart city management in this embodiment includes the following steps:
[0061] Step S1, collecting location information of buses on a target road section in a city and the passenger carrying situation of buses at each stop within a preset time period, wherein the preset time period includes a historical time period and the current time.
[0062] Smart bus applications often collect and process streaming data such as bus GPS and passenger boarding verification information to determine the location information of bus stops and the passenger capacity of buses at different stops.
[0063] This embodiment uses a travel path in a city as an example for analysis and explanation. It should be noted that the travel path is the complete travel section of the bus of the corresponding shift. In this embodiment, the travel path is recorded as the target section. First, the streaming data of the buses on the target section is collected. Specifically, the location information of each bus is read through the navigation system, and the number of verifications of passengers getting on the bus when arriving at the station is read through the bus card reading system. This verification number is used to represent the number of passengers getting on the bus at each station. It should be noted that mobile phones and transportation cards are both passenger boarding verification applications. The bus's travel time information is read through the bus stop clock system, including the travel time from a single stop to the next stop, and the stop time at a single stop. This embodiment obtains the location information of all buses on the target road section at each moment within a preset time period, the number of passengers boarding the buses at each stop, divides the preset time period, and extracts the historical time period and the current time period from the division results, with the last moment in the current time period being the current moment. In this embodiment, the preset time period is the set consisting of all historical moments whose time interval with the current moment is less than or equal to the preset first duration, as well as the current moment. The historical time period is the time period consisting of all days within the preset time period except the current moment; the current time period is the set consisting of all historical moments whose time interval with the current moment is less than or equal to the preset second duration. In this embodiment, the preset first duration is 3 months, and the preset second duration is 1 hour. Therefore, the preset time period in this embodiment is the last 3 months, the historical time period is the time in the last 3 months except the current day, and the current time period is the last hour. In specific applications, implementers can set the preset first duration and the preset second duration according to specific circumstances.
[0064] The streaming data are cleaned and preprocessed. Finally, the preprocessed streaming data are uploaded to the bus station data collection system for subsequent analysis. It should be noted that the data mentioned later are all preprocessed data.
[0065] So far, this embodiment has obtained the location information of buses on the target road section in the city and the passenger carrying capacity of the buses at each stop within the preset time period.
[0066] Step S2: Obtain the predicted degree of passenger demand peak at each station based on the number of passengers boarding the previous bus passing through each station at the current moment, the time interval between the current moment and the time when the previous bus passed through the corresponding station, and the number of passengers boarding the bus at each station in the historical period; determine the excellence of the bus in responding to the passenger demand of each station based on the passenger load of the bus heading toward each station at the current moment and the predicted degree of passenger demand peak at the stations on the road section to be traveled between the bus heading toward each station and each station.
[0067] LSTM models are often used in streaming data processing for smart public transportation to determine the next bus departure time. In addition to streaming data inputs such as bus status information, navigation location information, and bus passenger load, the number of hidden units in the LSTM model's hidden layer also plays a decisive role in the model's computational power. While a large number of hidden units improves computational accuracy, it consumes significant computing resources. Traditionally, the LSTM model's hidden layer has a fixed number of hidden units. However, this approach struggles to adapt to peaks and troughs in passenger demand and lacks additional analysis based on bus status and road conditions, resulting in reduced processing efficiency for smart bus streaming data. Therefore, this embodiment integrates actual passenger demand, bus status, and road conditions for a collaborative analysis. During the process of determining departure time intervals, the number of hidden units in the model's hidden layer is adaptively adjusted, thereby optimizing the rationality of the departure interval results and improving the LSTM model's processing efficiency for streaming data used in smart city management.
[0068] The purpose of this embodiment is to adjust the number of hidden units in the hidden layer of the LSTM model in real time, so as to obtain more accurate bus departure intervals by adjusting the optimized model. The number of hidden units represents the computing power of the model, which is related to the vehicle demand performance reflected by passenger demand, bus status, and road conditions in the smart bus scenario. Therefore, this embodiment first evaluates the peak passenger demand prediction degree of each bus stop, and then obtains the vehicle demand urgency index based on the response of the dispatched buses to passenger demand. The vehicle demand urgency index is then used to adjust the number of hidden unit parameters in the LSTM model.
[0069] Taking into account the different levels of passenger demand at different bus stops, for example, bus stops near shopping malls often have higher passenger demand than those in residential areas, and the number of passengers boarding buses at popular stops increases significantly. Therefore, for a single stop, the passenger demand situation can be reflected by the passenger level of the last passing bus at that stop. At the same time, the closer the time interval between the last passing bus and the current moment, the higher the confidence level that the last passing bus reflects the passenger demand situation at that stop. Therefore, the popularity reflection degree of each stop is calculated to reflect the confidence level of the passenger demand situation at the corresponding stop.
[0070] Specifically, for any station: video data of the bus exit when it stops is collected by a surveillance camera above the bus exit, and the video data is used to identify and count the number of passengers boarding the bus using a multi-target tracking algorithm. The number of passengers boarding the bus on the previous bus passing through the station at the current moment is recorded as the first number of the station; the time interval between the current moment and the last bus passing through the station is recorded as the first time interval of the station; the product of the negative correlation mapping value of the first time interval of the station and the first number of the station is recorded as the first characteristic value of the station. Using this method, the first time interval and first characteristic value of all stations on the target section can be obtained. Each station has a corresponding first time interval and a corresponding first characteristic value. The product of the negative correlation mapping value of the average value of the first time interval of all stations on the target section and the average value of the first number of all stations is used as the comprehensive characteristic value.
[0071] For any station: the normalized result of the ratio of the first eigenvalue of the station to the comprehensive eigenvalue is determined as the popularity of the station; if the number of passengers who boarded the bus that passed by the station last time is more than that of other stations, and the distance from the last passing bus to the current time is closer, then the popularity of the station is higher. It should be noted that there are many methods for normalizing data. In this embodiment, the maximum and minimum value normalization method is used for data normalization. As other implementation methods, the implementer can also use other existing normalization methods for processing. Using this method, the popularity of each station can be obtained.
[0072] For the same bus stop, the passenger demand situation in different time periods is also different. For example, the passenger demand situation during rush hour is generally more prominent than that at other times, so it can be reflected by historical data. If the number of passengers at the bus station during the same period in the historical data is higher than that at other periods, it means that the peak performance of this period is stronger. Therefore, the passenger demand peak prediction degree of each station is calculated based on the popularity reflection degree.
[0073] Specifically, for any station: the number of passengers boarding a bus that passed through the station at the time corresponding to the current time within the first historical sub-time period is recorded as the second number; the ratio of the second number to the average number of passengers boarding a bus that passed through the station during the first historical sub-time period is calculated and recorded as the first ratio; the product of the first ratio and the station's popularity response is used as the predicted passenger demand peak degree for the station. In this embodiment, the first historical sub-time period is specifically the same hour on the same day of the week before the current time. For example, if the current time is 8:29 on Wednesday, the first historical sub-time period is the time period from 8:00 to 9:00 on Wednesday of the previous week. For another example, if the current time is 15:33 on Sunday, the first historical sub-time period is the time period from 15:00 to 16:00 on Sunday of the previous week.
[0074] In this embodiment, a specific calculation formula for the passenger demand peak prediction degree is given. The passenger demand peak prediction degree of the i-th station can be expressed as:
[0075]
[0076] in, represents the passenger demand peak prediction degree of the i-th station, represents the number of passengers who boarded the bus that passed the i-th stop at the time corresponding to the current time in the first historical sub-time period at the i-th stop, that is, the second number; represents the average number of passengers boarding the bus at the i-th station during the first historical sub-time period. represents the time interval between the current moment and the last time a bus passed the i-th station, that is, the first time interval of the i-th station; represents the number of passengers who boarded the bus that passed the i-th station at the current moment, that is, the first number of the i-th station; represents the average value of the first time interval of all stations, represents the average of the first quantity for all sites, Represents the normalization function.
[0077] It should be noted that the time corresponding to the current moment in the first historical sub-time period is: the same time point as the current moment in the first historical sub-time period; for example: if the current moment is 8:29 on Wednesday, then the time corresponding to the first historical sub-time period and the current moment is 8:29 on Wednesday of the week before the current moment.
[0078] represents the negative correlation mapping value of the first time interval of the i-th station, represents the first eigenvalue of the i-th site, The negative correlation mapping value representing the average value of the first time interval of all stations on the target road segment, represents the comprehensive eigenvalue, represents the popularity of the i-th site, Indicates the first ratio.
[0079] The more passengers boarding the i-th station at the same moment in the first historical sub-time period than in other time periods, the more likely this time period is to be a peak period. At the same time, if the popularity of the i-th station is higher, it further indicates that the real-time passenger demand peak prediction performance of the i-th station is greater.
[0080] By using the above method, the passenger demand peak prediction degree of all stations on the target section can be obtained. Figure 3 As shown in the figure, this figure is the calculation result of the passenger demand peak prediction degree of each station.
[0081] Since passengers may get on and off the bus at various stops, the bus's load conditions may vary. The higher the bus's load level, the weaker its ability to continue carrying passengers at the bus stop. In other words, the bus's ability to respond to passenger demand at subsequent bus stops is worse. Therefore, it is necessary to analyze the load level of buses that have already departed.
[0082] For either site:
[0083] Next, this embodiment is described by taking any bus currently traveling toward the station as an example. The method provided in this embodiment can be used to process other buses currently traveling toward the station.
[0084] Specifically, any bus currently traveling toward the station is designated as a target bus. The ratio of the number of passengers on the target bus at the current moment to its rated passenger capacity is used to determine the target bus's load factor. The cumulative sum of the predicted peak passenger demand scores for all stations on the route between the target bus and the station is calculated. This cumulative sum, the target bus's load factor, and the predicted peak passenger demand score for the station are combined to determine the target bus's excellent response to passenger demand at the station. The cumulative sum, the target bus's load factor, and the predicted peak passenger demand score for the station are all negatively correlated with the excellent response to passenger demand.
[0085] Among them, the negative correlation relationship means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by actual application.
[0086] In this embodiment, a specific calculation formula for the passenger demand response excellence is given. The passenger demand response excellence of the target bus for the i-th station can be expressed as:
[0087]
[0088] in, It represents the excellence of the yth bus heading towards the i-th station in responding to the passenger demand of the i-th station at the current moment. It represents the cumulative sum of the passenger demand peak prediction degrees of all stations on the road section between the yth bus heading towards the ith station at the current moment and the ith station. represents the full load of the yth bus heading towards the i-th station at the current moment, represents the passenger demand peak prediction degree of the i-th station.
[0089] If the passenger demand peak prediction degree of the i-th station is lower, it means that the difficulty of the incoming bus in responding to the passenger demand of the station is lower. At the same time, the smaller the cumulative sum of the passenger demand peak prediction degrees of all stations on the road section to be traveled between the y-th bus heading towards the i-th station and the i-th station, it means that the possibility of the y-th bus heading towards the i-th station excessively consuming response resources in advance when arriving at the i-th station is lower; the lower the full load of the y-th bus, the further it means that the y-th bus heading towards the i-th station has better performance in responding to the passenger demand of the station.
[0090] By adopting the above method, the degree of excellence in responding to passenger demand at each station by each bus currently traveling toward each station can be obtained.
[0091] Step S3: Obtain the comprehensive response excellence based on the number of buses heading towards each station at the current moment, the distance between the buses heading towards each station and the passenger demand response excellence; and adjust the number of hidden units of the LSTM model based on the travel time of the buses at adjacent stations within a preset time period and the comprehensive response excellence.
[0092] For a bus stop on a target route, the more buses that have already departed and are heading toward that stop, and the closer the remaining distance each incoming bus has to that stop, the more quickly and efficiently the incoming buses can meet the stop's passenger demand. This indicates that the incoming buses are more trustworthy in their ability to meet the stop's passenger demand. Therefore, the comprehensive responsiveness of each stop is determined by combining the number of buses currently approaching the stop, the distance between the incoming buses and the stop, and the responsiveness of each bus to the stop's passenger demand.
[0093] Specifically, for any station, the average distance between all buses currently approaching the station and the station is calculated. The average of the bus's service excellence scores for the station is calculated, and this average is recorded as the first average. Based on the number of buses currently approaching the station, the average distance, and the first average, the station's comprehensive service excellence score is calculated. The number of buses currently approaching the station and the first average are both positively correlated with the comprehensive service excellence score, while the average distance is negatively correlated with the comprehensive service excellence score.
[0094] Among them, a positive correlation relationship indicates that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. It can be an additive relationship, a multiplicative relationship, etc., which is determined by actual application; a negative correlation relationship indicates that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtractive relationship, a division relationship, etc., which is determined by actual application.
[0095] In this embodiment, a specific calculation formula for the comprehensive response excellence is given. The comprehensive response excellence of the i-th site can be expressed as:
[0096]
[0097] in, represents the comprehensive response excellence of the i-th site, represents the number of buses heading towards the i-th station at the current moment, represents the average distance between all buses heading towards the station at the current moment and the i-th station, It represents the average value of the excellence in responding to the passengers of the ith station by all buses heading to the station at the current moment, that is, the first average value.
[0098] The closer the distance between all buses heading towards the i-th station and the i-th station, and the more buses that arrive at the same time, the more trustworthy the level of response of the arriving buses to the passenger needs of the station will be, and the higher the comprehensive response excellence of the i-th station should be.
[0099] By using the above method, the comprehensive response excellence of all stations on the target section can be obtained.
[0100] Considering that the road conditions on bus routes are constantly changing, when the road conditions are relatively congested, the speed of the approaching bus is affected. The longer the time it takes for the approaching bus to reach the bus stop, the more passengers may be at the bus stop because they do not receive any relief from the bus during the waiting period. Therefore, the congestion trend of the road conditions near each stop is analyzed next.
[0101] For any station: calculate the average of the travel time of all buses from the previous station to the station during the historical period, and record this average as the second average; record the travel time of the last bus that passed the station from the previous station to the station at the current moment as the first time; take the normalized result of the difference between the first time and the second average as the traffic congestion tendency of the station; the greater the travel time of the last bus that passed the station from the previous station to the station at the current moment is than the historical level, the more serious the traffic congestion in the vicinity of the station at the current moment, that is, the greater the traffic congestion tendency. It should be noted that there are many methods for normalizing data. In this embodiment, the maximum and minimum value normalization method is used for data normalization. As other implementation methods, the implementer can also use other normalization methods for processing. Through the above method, the traffic congestion tendency of each station can be obtained.
[0102] If the overall response excellence of all buses approaching a bus stop is low, and the real-time congestion trend in the area near the bus stop is high, then the bus's performance in responding to the existing passenger demand at the bus stop is low, and the bus station needs to urgently shorten its departure intervals and dispatch new buses to provide reinforcement. Based on this, this embodiment combines the overall response excellence and congestion trend to evaluate the urgency of vehicle demand and obtain a vehicle demand urgency index.
[0103] Specifically, the product of the comprehensive response excellence of each station and its traffic congestion tendency is used as the demand degree of each station; the average demand degree of all stations is used as the vehicle demand urgency indicator.
[0104] The higher the urgency of bus demand, the shorter the departure interval should be and the faster buses should be dispatched to meet complex passenger demands and road conditions. In this case, the computing resource accuracy of the LSTM model should be ensured to be high, so the number of hidden units in the hidden layer of the LSTM model needs to be increased.
[0105] Based on the above characteristics, the ratio between the bus demand urgency index and the preset urgency index is used as the adjustment coefficient; the product of the adjustment coefficient and the preset number of hidden units in the LSTM model is rounded up to an integer, which is used as the adjusted number of hidden units in the LSTM model. It should be noted that the preset urgency index can be a value set by the implementer based on experience, or it can be the average value of the preset urgency index at historical moments determined based on historical bus driving conditions. This will not be further elaborated here. In this embodiment, the preset number is 80. In specific applications, the implementer can set it according to specific circumstances.
[0106] Build an LSTM model structure, in which the output layer uses a fully connected layer to output the departure time interval of the bus, and the hidden layer stacks 2 layers of LSTM units. The preset number of each layer is the adjusted number of hidden units of the LSTM model determined by the above method, and the tanh activation function is used; the loss function during training is the mean square error or mean absolute error; the Adam optimizer is used, the learning rate setting range is 0.001-0.01, and the impulse factor is used to avoid local optimality. The input of the model is the streaming data of the bus, and the output is the next departure interval of the bus, where the streaming data of the bus includes the location of the bus and the passenger capacity of the bus at each station. The LSTM model is trained and verified, and the training is terminated when the error of the verification set no longer decreases to prevent overfitting; the construction, training and verification process of the LSTM model are all existing technologies and will not be described in detail here. Figure 5 As shown in FIG, this figure is a comparison diagram of the loss function curve of the solution provided in this embodiment and the loss function curve of the existing LSTM model.
[0107] Step S4: Use the adjusted LSTM model to determine the bus departure time interval.
[0108] The real-time collected bus streaming data of the target road section is input into the trained LSTM model through the neural network input layer, and the model outputs the next bus departure time interval. Finally, the bus is accurately dispatched based on the predicted next departure time interval, realizing the real-time adjustment of the bus departure time interval in the process of smart city management. Figure 4 As shown in FIG, this figure is a comparison chart of the LSTM prediction accuracy of the solution provided in this embodiment and the existing LSTM prediction accuracy.
[0109] This embodiment first evaluates the peak passenger demand prediction degree of a station based on the number of passengers boarded by the last bus passing through the station, the time interval between the current and last buses passing through the station, and the number of passengers boarding the station during a historical period. Based on the peak passenger demand prediction degree, the bus passenger load is analyzed to determine the degree of excellence in responding to passenger demand of buses approaching each station. The comprehensive response excellence of each station is determined by combining the number of buses approaching each station at the current moment and the distance between the bus and the station. Furthermore, the traffic congestion at the station is reflected by the travel time of buses at adjacent stations within a preset time period. The number of hidden units in the hidden layer of the LSTM model is adjusted. Furthermore, the bus departure time interval is determined based on the streaming data input to the LSTM model. The method provided in this embodiment adaptively adjusts the number of hidden units in the hidden layer of the LSTM model based on bus passenger demand, bus status, and road conditions in actual scenarios. This ensures the rationality of the determined bus departure time interval and improves the efficiency of the LSTM model in processing streaming data in smart city management.
[0110] An embodiment of a streaming data processing system applied to smart city management:
[0111] See Figure 2 , which shows a structural block diagram of a streaming data processing system applied to smart city management provided by an embodiment of the present invention. The system may include a data acquisition module, an analysis module, an adjustment module and a processing module.
[0112] The data collection module is used to collect the location information of buses on the target road section in the city and the passenger load of buses at each stop within a preset time period. The preset time period includes historical time periods and the current time.
[0113] An analysis module is used to obtain a predicted degree of peak passenger demand at each station based on the number of passengers boarded by the previous bus passing through each station at the current moment, the time interval between the current moment and the last time the bus passed through the station, and the number of passengers boarded at each station during a historical period; and to determine the degree of excellence of buses approaching each station in responding to passenger demand at each station based on the passenger load of buses approaching each station at the current moment and the predicted degree of peak passenger demand at stations on the road sections to be traveled between the buses approaching each station and the stations;
[0114] An adjustment module is used to obtain a comprehensive response excellence based on the number of buses currently approaching each stop, the distance between the buses approaching each stop, and the passenger demand response excellence. The module also adjusts the number of hidden units in the LSTM model based on the travel time of buses at adjacent stops within a preset time period and the comprehensive response excellence.
[0115] The processing module is used to determine the bus departure time interval using the adjusted LSTM model.
[0116] It should be understood that Figure 2The structural block diagram of a streaming data processing system for smart city management and its modules can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented using hardware, software, or a combination of software and hardware. The hardware portion can be implemented using dedicated logic, while the software portion can be stored in memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated hardware. Those skilled in the art will appreciate that the above-described methods and systems can be implemented using computer-executable instructions and / or contained in processor control code, such as provided on a carrier medium such as a disk, CD, or DVD-ROM, a programmable memory such as read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The systems and their modules described herein can be implemented not only using hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips or transistors, or programmable hardware devices such as field programmable gate arrays or programmable logic devices, but can also be implemented using software executed by various types of processors, or a combination of such hardware circuits and software (e.g., firmware).
[0117] For more details about the above modules, please refer to other places in this manual and will not be repeated here.
[0118] In other embodiments, a streaming data processing device for smart city management is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and execute the executable program code from the memory, causing the device to execute the aforementioned streaming data processing method for smart city management. The device can specifically be a chip, component, or module. The chip may include a connected processor and memory; the memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute the streaming data processing method for smart city management provided in the aforementioned embodiment.
[0119] In other embodiments, a computer program product is also provided. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement a streaming data processing method for smart city management provided in the above embodiment.
[0120] In other embodiments, a computer-readable storage medium is also provided, which stores computer program code. When the computer program code runs on a computer, the computer executes the above-mentioned related method steps to implement a streaming data processing method for smart city management provided in the above embodiment.
[0121] Among them, the provided systems, electronic devices, computer program products, and computer-readable storage media are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0122] It should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A streaming data processing method applied to smart city management, characterized in that: The method comprises the following steps: Collect the location information of buses on the target road section in the city and the passenger load of buses at each stop within a preset time period. The preset time period includes historical time periods and the current time; The peak passenger demand prediction degree of each station is obtained based on the number of passengers boarded by the previous bus passing through each station at the current moment, the time interval between the current moment and the previous moment when the bus passed through the corresponding station, and the number of passengers boarded at each station in the historical period. The excellence of the bus in responding to the passenger demand of each station is determined based on the passenger load of the bus approaching each station at the current moment and the peak passenger demand prediction degree of the station on the road section to be traveled between the bus approaching each station and the bus approaching each station. The comprehensive response excellence is calculated based on the number of buses approaching each stop at the current moment, the distance between the buses and the stops, and the passenger demand response excellence. The number of hidden units in the LSTM model is adjusted based on the travel time of buses at adjacent stops within a preset time period and the comprehensive response excellence. Use the adjusted LSTM model to determine the bus departure time interval; Based on the travel time of buses at adjacent stops and the overall response excellence within a preset time period, the number of hidden units in the LSTM model is adjusted, including: For any station: calculate the second average of the travel time of all buses from the previous station to any station during the historical period; record the travel time of the last bus that passed by any station from the previous station to any station at the current moment as the first travel time; and normalize the difference between the first travel time and the second average as the traffic congestion tendency degree of any station. The product of each station's comprehensive response excellence and the corresponding traffic congestion tendency is used as the demand degree of each station; the average demand degree of all stations is used as the vehicle demand urgency indicator; Adjust the number of hidden units in the LSTM model based on the urgency of vehicle demand; The number of hidden units in the LSTM model is adjusted based on the urgency of vehicle demand, including: The ratio between the vehicle demand urgency index and the preset urgency index is used as the adjustment coefficient; The product of the adjustment coefficient and the preset number of hidden units of the LSTM model is rounded up to an integer, and the result is used as the adjusted number of hidden units of the LSTM model.
2. A streaming data processing method for smart city management according to claim 1, characterized in that: Based on the number of passengers boarding the previous bus at each station at the current moment, the time interval between the current moment and the previous bus passing through the corresponding station, and the number of passengers boarding the bus at each station in the historical period, the passenger demand peak prediction degree of each station is obtained, including: For either site: The number of passengers boarding the last bus passing through any station at the current moment is recorded as the first number of any station; the time interval between the current moment and the time when the last bus passing through any station passes through any station is recorded as the first time interval of any station; The product of the negative correlation mapping value of the first time interval of any site and the first quantity of any site is recorded as the first eigenvalue of any site; The product of the negative correlation mapping value of the average value of the first time interval of all stations and the average value of the first quantity of all stations is taken as the comprehensive characteristic value; The normalized result of the ratio of the first eigenvalue to the comprehensive eigenvalue of any site is determined as the popularity response degree of any site; The passenger demand peak prediction degree of any station is obtained according to the number of passengers boarding the buses passing through any station in the first historical sub-time period at any station.
3. A streaming data processing method for smart city management according to claim 2, characterized in that: The passenger demand peak prediction degree of any station is obtained based on the number of passengers boarding the buses passing through any station in the first historical sub-time period, including: The number of passengers who boarded a bus that passed through any station at the time corresponding to the current time in the first historical sub-time period is recorded as the second number; calculating a first ratio between the second number and an average number of passengers boarding at any station on buses passing through any station during the first historical sub-time period; The product of the first ratio and the popularity reflection degree of any station is used as the customer demand peak prediction degree of any station.
4. The method for processing streaming data for smart city management according to claim 1, characterized in that: Based on the current passenger load of buses approaching each station and the predicted peak passenger demand of stations on the road sections between the buses approaching each station and the stations, the degree of excellence of the buses approaching each station in responding to passenger demand at each station is determined, including: For either site: Determine the fullness of the target bus based on the quantitative relationship between the number of passengers on the target bus at the current moment and the rated passenger capacity; Calculate the cumulative sum of the passenger demand peak prediction degrees of all stations on the route to be traveled between the target bus and any station at the current moment; The target bus's excellent response to passenger demand at any station is obtained by combining the cumulative sum, the target bus's full load degree, and the passenger demand peak prediction degree at any station. The cumulative sum, the target bus's full load degree, and the passenger demand peak prediction degree at any station are all negatively correlated with the excellent response to passenger demand. The target bus is any bus heading towards any station at the current moment.
5. A streaming data processing method for smart city management according to claim 4, characterized in that: The fullness of the target bus is determined based on the quantitative relationship between the number of passengers on the target bus at the current moment and the rated passenger capacity, including: The ratio between the number of passengers on the target bus at the current moment and the corresponding rated passenger capacity is determined as the full load degree of the target bus.
6. A streaming data processing method for smart city management according to claim 1, characterized in that: Based on the number of buses heading to each stop at the current moment, the distance between the buses heading to each stop and the stop, and the passenger demand response excellence, a comprehensive response excellence is obtained, including: For either site: Calculate the average distance between all buses currently heading towards any station and any station, and the first average value of the passenger demand response excellence of all buses currently heading towards any station for any station; Based on the number, average distance and first average value of all buses heading towards any station at the current moment, the comprehensive response excellence of any station is obtained. The number and first average value of all buses heading towards any station at the current moment are positively correlated with the comprehensive response excellence, and the average distance is negatively correlated with the comprehensive response excellence.
7. The method for processing streaming data for smart city management according to claim 1, characterized in that: The adjusted LSTM model is used to determine the bus departure time interval, including: The current bus position and bus passenger load on the target road section are input into the adjusted LSTM model, and the next bus departure time interval is output.
8. A streaming data processing system for smart city management, the system is used to implement the method of claim 1, characterized in that the system include: A data collection module is used to collect the location information of buses on target sections of the city and the passenger load of buses at each stop within a preset time period. The preset time period includes historical time periods and the current time; An analysis module is used to obtain a predicted degree of peak passenger demand at each station based on the number of passengers boarded by the previous bus passing through each station at the current moment, the time interval between the current moment and the last time the bus passed through the station, and the number of passengers boarded at each station during a historical period; and to determine the degree of excellence of buses approaching each station in responding to passenger demand based on the passenger load of buses approaching each station at the current moment and the predicted degree of peak passenger demand at stations on the road sections to be traveled between the buses approaching each station and the stations; An adjustment module is used to obtain a comprehensive response excellence based on the number of buses currently approaching each stop, the distance between the buses approaching each stop, and the passenger demand response excellence. The module also adjusts the number of hidden units in the LSTM model based on the travel time of buses at adjacent stops within a preset time period and the comprehensive response excellence. The processing module is used to determine the bus departure time interval using the adjusted LSTM model.