Method, system, device and medium for training a prediction model of building crowd flow
Patent Information
- Application Number
- CN202611139957.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-08-28
AI Technical Summary
这种方法需要追踪个体设备的移动轨迹,存在严重的隐私泄露风险,且难以满足日益严格的隐私保护法规要求
[0015] This invention relies solely on aggregated statistical information about the number of connected devices in each building and its changes as a supervisory signal, eliminating the need to track the individual movement trajectories of any terminal devices to complete model training. Once trained, the model can infer the flow of people between buildings based on the real-time number of connected devices in each building, reducing the collection and processing of personal location information. This achieves accurate inference of crowd flow between buildings while effectively protecting user privacy.
Smart Images

Figure CN122655874A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data analysis, specifically to a training method, system, device, and medium for a predictive model of building crowd flow. Background Technology
[0002] Building crowd flow analysis is a key technical means for refined urban management and building energy efficiency optimization. In the process of smart city construction, accurately grasping the spatiotemporal flow patterns of people between different buildings plays a crucial foundational supporting role in many fields, including urban traffic planning, public safety, emergency evacuation management, commercial facility layout, and building energy consumption control. For example, in campus management, understanding the tidal flow patterns between student dormitories, teaching buildings, and libraries can provide data for the dynamic scheduling of school buses and the rational allocation of classroom resources; in commercial complexes, understanding the crowd interaction patterns between different functional areas helps optimize shop layout and circulation design. With the popularization of the Internet of Things and mobile communication technologies, terminal device connection data recorded by communication devices within buildings is becoming an important data source in the field of crowd flow analysis due to its advantages such as wide coverage, low collection cost, and high temporal resolution.
[0003] However, existing crowd flow analysis methods based on communication device data typically require tracking the sequence of occurrences of unique identifiers (such as MAC addresses) of individual terminal devices across different buildings. This involves matching connection records of the same device at different times and in different buildings to construct an individual's complete movement trajectory, and then calculating crowd flow between buildings. This method requires tracking the movement trajectories of individual devices, posing a serious risk of privacy breaches and failing to meet increasingly stringent privacy protection regulations. Summary of the Invention
[0004] To address the aforementioned problems, this invention provides a training method, system, device, and medium for predicting the flow of people in buildings.
[0005] The first aspect of this invention discloses a training method for a prediction model of crowd flow direction in buildings, comprising: Obtain the number of connected devices and device quantity change tags for each building across multiple time periods; In the coding layer of the prediction model, the attraction mapping function of each building under each preset flow factor is used to calculate the flow factor contribution of each flow factor in each time period based on the number of connected devices; wherein, the attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients; In the decoding layer of the prediction model, a building to any other building is treated as a directed building pair. The flow allocation function corresponding to each directed building pair under each flow factor is used to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor. The flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients. Based on the predicted traffic and device quantity change labels corresponding to each time period, and the preset loss function, the parameters of the prediction model are updated to obtain the prediction model that has been trained.
[0006] Furthermore, the steps for calculating the contribution of each flow factor to each time period based on the number of connected devices, using the attraction mapping function for each building under each preset flow factor, include: For each time period, the number of connected devices for each building is input into the attraction mapping function corresponding to each flow factor for that building, so as to obtain the contribution of each building under each flow factor. For each flow factor, sum the contributions of all buildings under that flow factor to obtain the flow factor contribution for that time period.
[0007] Furthermore, the steps for calculating the predicted flow of each directed building pair in each time period based on the contribution of each flow factor, using the flow allocation function corresponding to each directed building pair under each flow factor, include: For each time period, for each combination of a directed building pair and each flow factor, the flow factor contribution corresponding to the flow factor is input into the flow allocation function corresponding to the combination to obtain the factor component flow of the directed building pair under the flow factor. For each directed building pair, sum the factor component flows under all flow factors to obtain the predicted flow of the directed building pair for that time period.
[0008] Furthermore, the steps to obtain the number of connected devices for each building over multiple time periods include: Obtain the device identifier of the terminal device that establishes a communication connection with the communication device corresponding to each building within each time period; wherein, the communication device is the network device corresponding to the building used to establish a communication connection with the terminal device and provide communication services; The number of device identifiers for terminal devices corresponding to each building in each time period is counted to obtain the number of connected devices for each building in multiple time periods.
[0009] Furthermore, based on the predicted traffic and device quantity change labels corresponding to each time period, and the preset loss function, the parameters of the prediction model are updated to obtain the completed prediction model. The steps include: For each time period, based on the predicted flow of all directed building pairs, the predicted change in the connected equipment corresponding to each building is calculated using the law of conservation of mass. Input the predicted change in the number of connected devices and the change in the number of devices for each building in each time period into the preset loss function to calculate the loss value; Based on the loss value, the learnable encoding coefficients and learnable decoding coefficients are updated using gradient descent until the preset model convergence condition is met, thus obtaining a completed prediction model.
[0010] Furthermore, the building is calculated according to the following formula. In time period Corresponding predicted changes in connected devices : ; in, This represents the preset conversion factor. Indicates the building subscript. Indicates the number of buildings. Indicates the time period From architecture Flow to buildings Predicted traffic, Indicates the time period From architecture Flow to buildings Predicted traffic.
[0011] Furthermore, the loss function for: ; in, Indicates the number of time periods. Indicates the number of buildings. Represents architecture In time period Corresponding equipment quantity change labels Represents architecture In time period The corresponding predicted changes in connected devices.
[0012] The second aspect of this invention discloses a training system for a prediction model of building crowd flow, comprising: The acquisition module is used to acquire the number of connected devices and device quantity change tags for each building over multiple time periods. The first calculation module is used in the coding layer of the prediction model to calculate the contribution of each flow factor corresponding to each flow factor in each time period based on the number of connected devices, using the attraction mapping function of each building under each preset flow factor. The attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients. The second calculation module is used in the decoding layer of the prediction model to treat a building to any other building as a directed building pair, and to use the flow allocation function corresponding to each directed building pair under each flow factor to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor; wherein, the flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients; The training module is used to update the parameters of the prediction model based on the predicted traffic and device quantity change labels corresponding to each time period, as well as the preset loss function, to obtain the completed prediction model.
[0013] A third aspect of the present invention discloses an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a training method for a prediction model of building crowd flow as disclosed in any of the first aspects of the present invention.
[0014] The fourth aspect of the present invention discloses a storage medium storing a computer program, which, when executed by a processor, implements the steps of a training method for a prediction model of building crowd flow as disclosed in any of the first aspects of the present invention.
[0015] This invention relies solely on aggregated statistical information about the number of connected devices in each building and its changes as a supervisory signal, eliminating the need to track the individual movement trajectories of any terminal devices to complete model training. Once trained, the model can infer the flow of people between buildings based on the real-time number of connected devices in each building, reducing the collection and processing of personal location information. This achieves accurate inference of crowd flow between buildings while effectively protecting user privacy. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating a training method for a prediction model of building crowd flow disclosed in an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the predicted flow of multiple directed building pairs disclosed in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a training system for a prediction model of building crowd flow disclosed in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the electronic device disclosed in the embodiments of the present invention. Detailed Implementation
[0018] To enable those skilled in the art to better understand the present invention, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, or product comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, apparatus, or products.
[0020] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0021] Please see Figure 1 As shown, Figure 1 This is a flowchart illustrating a training method for a prediction model of building crowd flow disclosed in an embodiment of the present invention. Figure 1 As shown, the training method for the prediction model of crowd flow in this building can include the following operations: S101. Obtain the number of connected devices and device quantity change tags for each building over multiple time periods; In an optional embodiment, the step of obtaining the number of connected devices for each building over multiple time periods includes: Obtain the device identifier of the terminal device that establishes a communication connection with the communication device corresponding to each building within each time period; wherein, the communication device is the network device corresponding to the building used to establish a communication connection with the terminal device and provide communication services; The number of device identifiers for terminal devices corresponding to each building in each time period is counted to obtain the number of connected devices for each building in multiple time periods.
[0022] In this optional embodiment, the communication equipment includes, but is not limited to, network devices with terminal access capabilities such as routers, switches, and communication base stations. Their deployment location corresponds to the building space; for example, they can be deployed inside the main building or in locations close to the main building, such as courtyards or outside walls, to ensure that their communication coverage is essentially consistent with the building area. Terminal devices include mobile phones, tablets, etc. Personnel within the building can obtain communication messages through their terminal devices via the aforementioned communication equipment. These communication messages include, but are not limited to, various communication contents such as SMS messages, emails, and web page data.
[0023] A time period is a time unit obtained by dividing a continuous time axis according to a preset granularity. For example, it can be divided by hours, so the 24 hours of a day correspond to 24 time periods; it can also be divided by half an hour or finer granularity. The specific granularity can be set according to the actual analysis needs, and the embodiments of the present invention do not limit it in this regard.
[0024] For example: Suppose an area includes three buildings, and the time period is divided into hours. During the time period from 8:00 AM to 9:00 AM, the number of connected devices in buildings 1, 2, and 3 are 320, 280, and 410, respectively. In the previous time period from 7:00 AM to 8:00 AM, the number of connected devices in the three buildings are 280, 260, and 450, respectively. Then, the change labels for the number of devices in the three buildings during the time period from 8:00 AM to 9:00 AM are 40, 20, and -40, respectively. A positive value indicates that the number of connected devices in the corresponding building has increased, a negative value indicates that it has decreased, and a zero value indicates that it remains unchanged.
[0025] As can be seen, this optional embodiment obtains the device identifier of the terminal device directly from the communication device corresponding to the building, and performs statistics on multiple time periods in the time dimension. This ensures that the number of connected devices corresponding to each time period comes from actual terminal devices that have established communication connections with the real communication device, thus guaranteeing the accuracy of the data. At the same time, by clearly defining the communication device as the network device deployed in the corresponding area of the building, the correspondence between the data collection range and the building's spatial location is limited, further improving the accuracy and reliability of the training data source.
[0026] S102. In the coding layer of the prediction model, the attraction mapping function of each building under each preset flow factor is used to calculate the flow factor contribution of each flow factor in each time period based on the number of connected devices; wherein, the attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients. In an optional embodiment, the prediction model is built on a Kolmogorov-Arnold (KAN) network, an end-to-end network structure consisting of an encoding layer and a decoding layer. The encoding layer is configured with an attraction mapping function for each building under various flow factors, used to convert the number of connected devices input into the contribution of each building under each flow factor. The decoding layer is configured with a flow allocation function for each directed building pair under each flow factor, used to convert the flow factor contribution into the predicted flow for each directed building pair. The first and second basis functions are determined before training and remain unchanged during training; only the learnable encoding coefficients and learnable decoding coefficients are updated as model parameters during training. This KAN-based model can also be used as a component to combine with other types of neural networks to build prediction models to adapt to different application scenarios.
[0027] Preset flow factors refer to decoupling the complex flow of people between buildings into several relatively independent behavioral pattern components (i.e., flow factors), each corresponding to an independent driving force or travel tendency for population flow. Flow factors include, but are not limited to: basic diffusion patterns, reflecting the natural trend of populations tending to disperse evenly among buildings; time-driven patterns, reflecting periodic flows driven by work-rest patterns, such as increased flow from dormitory areas to teaching areas during weekday morning rush hours, and reversed flow direction during evening hours; functional attraction patterns, reflecting the differentiated attraction of a building's own functional type to populations, such as teaching buildings having a positive attraction to populations on weekdays, while dormitory areas are an output during this period; saturation-limiting patterns, reflecting the nonlinear inhibition effect under limited building capacity conditions, i.e., when the number of connected devices within a building exceeds a certain threshold, the growth rate of flow from other buildings to that building gradually slows down or even approaches saturation, exhibiting a nonlinear characteristic of diminishing marginal returns; and social aggregation patterns, reflecting the cascading flow effect caused by population aggregation behavior, i.e., when the population density in a certain area reaches a certain level, it triggers population flow between adjacent areas. In this optional embodiment, the number of flow factors can be set as follows: indivual, Indicates the number of buildings.
[0028] In an optional embodiment, the step of calculating the contribution of each flow factor to each time period based on the number of connected devices, using the attraction mapping function of each building under each preset flow factor, includes: For each time period, the number of connected devices for each building is input into the attraction mapping function corresponding to each flow factor for that building, so as to obtain the contribution of each building under each flow factor. For each flow factor, sum the contributions of all buildings under that flow factor to obtain the flow factor contribution for that time period.
[0029] In this optional embodiment, each building is configured with an independent attraction mapping function under each preset flow factor, which is used to map the number of connected devices of the building to the contribution of the building under the flow factor.
[0030] architecture In the Attraction mapping function for each flow factor It can be represented as: ; Time period Next Contribution of each flow factor to the flow factor It can be represented as: ; in, Represents architecture In time period The number of connected devices, Indicates the first The first basis function Represents architecture In the The corresponding flow factor under the first flow factor Learnable coding coefficients of the first basis functions This indicates the number of the first basis functions.
[0031] This invention employs a cubic B-spline function as the first basis function, and the attraction mapping function is constructed by a weighted combination of the first basis function and learnable coding coefficients. (The text then abruptly shifts to a different topic: "With the first...") Taking the first basis function as an example, the input range of the attraction mapping function is first determined, i.e., the range of values for the number of connected devices. The upper and lower bounds can be determined based on the maximum and minimum values of the number of connected devices for all buildings across all time periods; if training data is not yet available, a pre-estimated upper bound can be used as a substitute. After determining the input range, nodes are arranged in a uniform distribution within the range, dividing the input range into several continuous intervals. Based on the arranged nodes, a sequence of cubic B-spline basis functions is generated using the Cox-de Boor recursive formula.
[0032] The number of first basis functions is determined by both the number of nodes and the order of the B-spline. In an optional embodiment, the number of first basis functions is equal to the sum of the number of nodes and the order, minus one. The number of nodes can be set according to the actual fitting accuracy requirements; this embodiment does not impose a specific limitation on this.
[0033] Before model training begins, all learnable coding coefficients are randomly initialized. Specifically, they are initialized to random values following a normal distribution with a mean of 0 and a standard deviation of 0.01. This ensures that the initial values of each learnable coding coefficient are small in absolute value, which helps avoid excessively large output values from the flow allocation functions in the early stages of training. This allows the model to start the optimization process in a stable initial state. As training progresses, the learnable coding coefficients are gradually updated under the drive of gradient descent, eventually converging to the optimal value that accurately fits the flow pattern of the crowd. The above initialization method is only one optional implementation scheme in this embodiment. Other random initialization strategies can also be used, as long as the initial values are small enough to avoid excessively large output values in the early stages of training. Those skilled in the art can choose a suitable initialization method according to actual needs, and this application does not impose specific limitations on it.
[0034] As can be seen, this optional embodiment configures an independent attraction mapping function for each building under each flow factor, so that the number of connected devices of each building can be converted into the contribution of each flow factor according to its own unique pattern before being aggregated. That is, even if different buildings have the same number of connected devices, they will output different contribution values due to their different attraction mapping functions. This accurately portrays the differentiated response characteristics of buildings of different functional types to the same flow factor and improves the accuracy of the flow factor contribution calculation.
[0035] S103. In the decoding layer of the prediction model, a building to any other building is treated as a directed building pair. The flow allocation function corresponding to each directed building pair under each flow factor is used to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor. The flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients. In this optional embodiment, the second basis function is also implemented using a cubic B-spline function, and its generation method will not be described in detail here.
[0036] In an optional embodiment, the step of calculating the predicted flow of each directed building pair in each time period based on the contribution of the flow factors, using the flow allocation function corresponding to each directed building pair under each flow factor, includes: For each time period, for each combination of a directed building pair and each flow factor, the flow factor contribution corresponding to the flow factor is input into the flow allocation function corresponding to the combination to obtain the factor component flow of the directed building pair under the flow factor. For each directed building pair, sum the factor component flows under all flow factors to obtain the predicted flow of the directed building pair for that time period.
[0037] In this optional embodiment, with architecture Pointing to the building As a directed building pair, the first Under various flow factors, the oriented building should have the corresponding flow distribution function. for: ; in, Indicates the first Under various fluid factors, architecture Pointing to the building The directed building corresponds to the first Learnable decoding coefficients of the second basis functions This indicates the number of second basis functions. Indicates the first A second basis function.
[0038] Figure 2 Each purple directed arrow represents a directed building pair, and the number corresponding to each purple directed arrow represents the predicted flow of that directed building pair, for example... Figure 2 The predicted flow from the Central Dormitory to the West Library on the far left is 86.08. This number is rounded down, which means that 86 people travel from the Central Dormitory to the West Library between 8:30 and 9:00.
[0039] As can be seen, this optional embodiment configures independent flow allocation functions for each combination of directed building pairs and each flow factor, so that the same flow factor contribution can be input into the flow allocation functions corresponding to different directed building pairs to obtain different factor component flows. That is, the model can output differentiated flow allocation results based on the different starting and ending buildings, thereby accurately characterizing the differentiated interaction intensity between different building pairs under the same flow factor and improving the accuracy of the predicted flow of directed building pairs.
[0040] S104. Based on the predicted traffic and device quantity change labels corresponding to each time period, and the preset loss function, update the parameters of the prediction model to obtain the completed prediction model.
[0041] In an optional embodiment, the steps of updating the parameters of the prediction model based on the predicted traffic and device quantity change labels corresponding to each time period and a preset loss function to obtain the trained prediction model include: For each time period, based on the predicted flow of all directed building pairs, the predicted change in the connected equipment corresponding to each building is calculated using the law of conservation of mass. Input the predicted change in the number of connected devices and the change in the number of devices for each building in each time period into the preset loss function to calculate the loss value; Based on the loss value, the learnable encoding coefficients and learnable decoding coefficients are updated using gradient descent until the preset model convergence condition is met, thus obtaining a completed prediction model.
[0042] In this optional embodiment, the loss function measures the difference between the predicted change in the number of connected devices and the label of the change in the number of devices. Minimizing this difference allows the traffic allocation pattern learned by the model to explain the actual increase or decrease in the number of connected devices in each building. Smoothing regularization and sparsity regularization can also be added during training to ensure the reasonableness of the solution. Smoothing regularization limits the curvature of each attraction mapping function and traffic allocation function, while sparsity regularization avoids generating too many unreasonable small traffic flows. The above process is repeated until the convergence condition is met. After each training cycle, a validation loss value is calculated based on the validation set. Training is terminated early if the validation loss value does not decrease over multiple consecutive training cycles. The final parameters determine the completed prediction model.
[0043] As can be seen, this optional embodiment transforms the predicted flow rate into the predicted change in connected devices via the law of mass conservation before comparing it with the actual labels. This allows the calculation of the loss function to be based on physical conservation laws. That is, the flow distribution pattern learned by the model must be able to explain the actual increase or decrease in the number of connected devices in each building. This embeds physical laws into the optimization process of model parameters, improving the rationality of model parameter updates and the reliability of the final prediction results.
[0044] In an optional embodiment, the building is calculated according to the following formula. In time period Corresponding predicted changes in connected devices : ; in, This represents a preset conversion factor used to characterize the ratio between the number of connected devices and the actual number of people. Indicates the building subscript. Indicates the number of buildings. Indicates the time period From architecture Flow to buildings Predicted traffic, Indicates the time period From architecture Flow to buildings Predicted traffic.
[0045] In this optional embodiment, the law of conservation of mass refers to the principle of flow balance, which states that the change in the total number of connected devices corresponding to all buildings in the entire study area over time is solely due to the inflow and outflow at the boundaries of each building, and there is no internal generation or disappearance. Based on this, for any building, the change in the number of connected devices is equal to the flow inflow into the building minus the flow outflow from the building.
[0046] As can be seen, this optional embodiment accurately quantifies the net change in the number of connected devices in each building within any given time period, enabling the law of conservation of mass to be incorporated into the model training process in a computable mathematical form, providing a predicted value with clear physical meaning for the loss function, thereby improving the accuracy of the error signal on which the parameter update is based.
[0047] In an optional embodiment, the loss function for: ; in, Indicates the number of time periods. Indicates the number of buildings. Represents architecture In time period Corresponding equipment quantity change labels Represents architecture In time period The corresponding predicted changes in connected devices.
[0048] As can be seen, this optional embodiment uses the mean squared error between the predicted change and the actual change label as the loss function, and uses the average error over all time periods and over all buildings as the optimization objective. This ensures that each update of the model parameters is guided by minimizing the overall prediction bias, thereby changing the model training objective from simply fitting the number of connected devices to fitting the dynamic change process of the number of connected devices. This improves the rationality of the convergence direction of the model parameters and the final prediction accuracy.
[0049] Please see Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a training system for a prediction model of building crowd flow disclosed in an embodiment of the present invention, including: Module 301 is used to obtain the number of connected devices and device quantity change tags for each building over multiple time periods. The first calculation module 302 is used in the coding layer of the prediction model to calculate the contribution of each flow factor corresponding to each flow factor in each time period based on the number of connected devices, using the attraction mapping function of each building under each preset flow factor; wherein, the attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients. The second calculation module 303 is used in the decoding layer of the prediction model to treat a building to any other building as a directed building pair, and to use the flow allocation function corresponding to each directed building pair under each flow factor to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor; wherein, the flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients. The training module 304 is used to update the parameters of the prediction model based on the predicted traffic and device quantity change labels corresponding to each time period and the preset loss function, so as to obtain the prediction model that has been trained.
[0050] Specific limitations regarding the training system for the prediction model of building crowd flow can be found in the above section on the limitations of the training method for the prediction model of building crowd flow, and will not be repeated here. Each module in the training system for the prediction model of building crowd flow can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in an electronic device in hardware format, or stored in the memory of an electronic device in software format, so that the processor can call the corresponding operations of each module.
[0051] It should be noted that, in order to highlight the innovative aspects of this invention, this embodiment does not include modules that are not closely related to solving the technical problems proposed by this invention, but this does not mean that there are no other modules in this embodiment.
[0052] like Figure 4 As shown, the electronic device 1 provided by the present invention may include a memory 12, a processor 13 and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a training program for a prediction model of building crowd flow.
[0053] The memory 12 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 12 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 1. Furthermore, the memory 12 can include both internal and external storage units of the electronic device 1. The memory 12 can be used not only to store application software and various types of data installed on the electronic device 1, such as training code for predictive models of building crowd flow, but also to temporarily store data that has been output or will be output.
[0054] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the electronic device 1, connecting various components of the electronic device 1 via various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., training programs for predicting building crowd flow) and calls data stored in the memory 12 to perform various functions and process data in the electronic device 1.
[0055] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the training method of the above-described prediction model for building crowd flow.
[0056] For example, the computer program can be divided into one or more modules, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the electronic device 1. For example, the computer program can be divided into an acquisition module 301, a first calculation module 302, a second calculation module 303, and a training module 304.
[0057] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium, which can be non-volatile or volatile. The software functional module stored in the storage medium includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute part of the functions of the training method for the prediction model of building crowd flow described in various embodiments of the present invention.
[0058] In summary, the training method, system, device, and medium for a predictive model of crowd flow in buildings disclosed in this invention can infer the crowd flow between buildings based on the number of connected devices in each building in real time. This reduces the collection and processing of personal location information and effectively protects user privacy while achieving accurate inference of crowd flow between buildings. Therefore, this invention effectively overcomes the various shortcomings of the prior art and has high industrial application value.
[0059] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A training method for a predictive model of crowd flow direction in buildings, characterized in that, The method includes: Obtain the number of connected devices and device quantity change tags for each building across multiple time periods; In the coding layer of the prediction model, the attraction mapping function of each building under each preset flow factor is used to calculate the flow factor contribution of each flow factor in each time period based on the number of connected devices; wherein, the attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients; In the decoding layer of the prediction model, a building to any other building is treated as a directed building pair. The flow allocation function corresponding to each directed building pair under each flow factor is used to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor. The flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients. Based on the predicted traffic and device quantity change labels corresponding to each time period, and the preset loss function, the parameters of the prediction model are updated to obtain the prediction model that has been trained.
2. The training method for a prediction model of building crowd flow direction according to claim 1, characterized in that, The steps for calculating the contribution of each flow factor to each time period based on the number of connected devices, using the attraction mapping function for each building under each preset flow factor, include: For each time period, the number of connected devices for each building is input into the attraction mapping function corresponding to each flow factor for that building, so as to obtain the contribution of each building under each flow factor. For each flow factor, sum the contributions of all buildings under that flow factor to obtain the flow factor contribution for that time period.
3. The training method for a prediction model of building crowd flow direction according to claim 1, characterized in that, The steps for calculating the predicted flow of each directed building pair in each time period based on the contribution of flow factors, using the flow allocation function corresponding to each directed building pair under each flow factor, include: For each time period, for each combination of a directed building pair and each flow factor, the flow factor contribution corresponding to the flow factor is input into the flow allocation function corresponding to the combination to obtain the factor component flow of the directed building pair under the flow factor. For each directed building pair, sum the factor component flows under all flow factors to obtain the predicted flow of the directed building pair for that time period.
4. The training method for a prediction model of building crowd flow direction according to claim 1, characterized in that, The steps to obtain the number of connected devices for each building over multiple time periods include: Obtain the device identifier of the terminal device that establishes a communication connection with the communication device corresponding to each building within each time period; wherein, the communication device is the network device corresponding to the building used to establish a communication connection with the terminal device and provide communication services; The number of device identifiers for terminal devices corresponding to each building in each time period is counted to obtain the number of connected devices for each building in multiple time periods.
5. The training method for a prediction model of building crowd flow direction according to claim 1, characterized in that, The steps to update the parameters of the prediction model and obtain the trained prediction model based on the predicted traffic and device quantity change labels corresponding to each time period and the preset loss function include: For each time period, based on the predicted flow of all directed building pairs, the predicted change in the connected equipment corresponding to each building is calculated using the law of conservation of mass. Input the predicted change in the number of connected devices and the change in the number of devices for each building in each time period into the preset loss function to calculate the loss value; Based on the loss value, the learnable encoding coefficients and learnable decoding coefficients are updated using gradient descent until the preset model convergence condition is met, thus obtaining a completed prediction model.
6. The training method for a prediction model of building crowd flow direction according to claim 5, characterized in that, Calculate the building using the following formula. In time period Corresponding predicted changes in connected devices : ; in, This represents the preset conversion factor. Indicates the building subscript. Indicates the number of buildings. Indicates the time period From architecture Flow to buildings Predicted traffic, Indicates the time period From architecture Flow to buildings Predicted traffic.
7. The training method for a prediction model of building crowd flow direction according to claim 1, characterized in that, loss function for: ; in, Indicates the number of time periods. Indicates the number of buildings. Represents architecture In time period Corresponding equipment quantity change labels Represents architecture In time period The corresponding predicted changes in connected devices.
8. A training system for a predictive model of crowd flow direction in buildings, characterized in that, include: The acquisition module is used to acquire the number of connected devices and device quantity change tags for each building over multiple time periods. The first calculation module is used in the coding layer of the prediction model to calculate the contribution of each flow factor corresponding to each flow factor in each time period based on the number of connected devices, using the attraction mapping function of each building under each preset flow factor. The attraction mapping function is a univariate function constructed based on the preset first basis function and learnable coding coefficients. The second calculation module is used in the decoding layer of the prediction model to treat a building to any other building as a directed building pair, and to use the flow allocation function corresponding to each directed building pair under each flow factor to calculate the predicted flow of each directed building pair in each time period based on the contribution of the flow factor; wherein, the flow allocation function is a univariate function constructed based on the preset second basis function and learnable decoding coefficients; The training module is used to update the parameters of the prediction model based on the predicted traffic and device quantity change labels corresponding to each time period, as well as the preset loss function, to obtain the completed prediction model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the training method for the prediction model of building crowd flow as described in any one of claims 1 to 7.
10. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the training method for the prediction model of building crowd flow as described in any one of claims 1 to 7.