Macro crowd simulation method, device and equipment
By constructing the crowd trajectory data into particles and calculating the initial motion trajectory information using smooth particle fluid dynamics physical formulas, and combining the multi-exit neural network model training with optimal initial weights and deviations, the problem of poor accuracy and physical consistency in macroscopic crowd simulation is solved, and the accuracy and robustness of high-density crowd simulation is achieved.
Patent Information
- Application Number
- CN202411277423.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2044-09-12
AI Technical Summary
The existing macro population simulation methods are insufficient in the long-term simulation state, and the generalization and physical consistency of neural network models are poor, making it difficult to effectively simulate the movement trajectory of high-density populations.
The population trajectory data is constructed into particles, and the initial motion trajectory information is calculated using the smooth particle fluid dynamics physical formula, and a target multi-exit neural network model including the optimal initial weight and the optimal initial deviation are constructed. By training this model for multi-exit prediction, the physical consistency and generalization of the model are enhanced.
It improves the accuracy and robustness of the crowd simulation model in long-term and high-density states, reduces prediction losses, and ensures the accuracy of crowd simulation and the compliance of physical laws.
Smart Images

Figure CN119475938B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crowd simulation, and in particular to a macro crowd simulation method, device and equipment. Background Art
[0002] When a large crowd gathers, it is very easy to cause crowd congestion, pushing, or even trampling if an emergency occurs. To address this, researchers have proposed a macroscopic crowd simulation method to simulate the spatiotemporal changes in crowd state. Starting from a global perspective, it weakens the interaction between individuals and focuses on the overall movement of the crowd.
[0003] Currently, macro-crowd simulation methods are mainly divided into two categories: numerical simulation-based methods and data-driven methods. Numerical simulation-based macro-crowd simulation methods are based on physical formulas and have a strong theoretical foundation and interpretability. They are relatively close to real pedestrian motion in terms of macro-statistical indicators (such as the speed-density relationship). However, due to the complexity and heterogeneity of human behavior, the generated pedestrian motion trajectories differ significantly from real pedestrian motion trajectories. Data-driven macro-crowd simulation methods use various machine learning techniques to analyze and predict crowd behavior. Based on real-world data, they can generate motion trajectories that are highly similar to real pedestrian motion by learning and reusing the features of real pedestrian motion data, with high fidelity. However, they also face the problems of poor interpretability of black-box problems, strong data dependence, and poor generalization. Furthermore, as the simulation time increases, the prediction loss increases superlinearly. Summary of the Invention
[0004] In view of this, the present invention provides a macro crowd simulation method, device and equipment, which can solve the current technical problems of insufficient crowd simulation accuracy, poor generalization of neural network models and poor physical consistency under long-term simulation conditions.
[0005] According to a first aspect of the present invention, a macro crowd simulation method is provided, the method comprising:
[0006] Constructing crowd trajectory data into particles, obtaining initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment, and calculating first motion trajectory information of the particles after the preset initial moment based on the initial crowd data based on the smoothed particle fluid dynamics physics formula;
[0007] Constructing a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information; training the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model;
[0008] Crowd data to be predicted for position is acquired, and multi-outlet prediction is performed on the crowd data using the multi-outlet neural network model to obtain motion trajectory information after the moment the crowd data is located.
[0009] According to a second aspect of the present invention, a macro crowd simulation device is provided, the device comprising:
[0010] an acquisition module, configured to construct crowd trajectory data into particles, acquire initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment, and calculate first motion trajectory information of the particles after the preset initial moment based on the initial crowd data based on the physical formula of smoothed particle fluid dynamics;
[0011] a training module, configured to construct a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information, and train the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model;
[0012] The prediction module is used to obtain crowd data to be predicted, perform multi-export prediction on the crowd data using the multi-export neural network model, and obtain movement trajectory information after the moment the crowd data is located.
[0013] According to a third aspect of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned macro-crowd simulation method is implemented.
[0014] According to the fourth aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned macro-crowd simulation method when executing the program.
[0015] By means of the above technical solution, the present invention provides a macro crowd simulation method, device and equipment. First, crowd trajectory data is constructed into particles, and the initial crowd data of the particles at a preset initial moment and the real motion trajectory information after the preset initial moment are obtained. Based on the smooth particle fluid dynamics physics formula, the first motion trajectory information of the particles after the preset initial moment is calculated according to the initial crowd data; then, a target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations is constructed according to the initial crowd data, the first motion trajectory information and the real motion trajectory information; the target initial multi-outlet neural network model is trained according to the initial crowd data, the real motion trajectory information and the first motion trajectory information to obtain a trained multi-outlet neural network model; finally, crowd data to be predicted for position is obtained, and the multi-outlet neural network model is used to perform multi-outlet prediction on the crowd data to obtain motion trajectory information after the moment when the crowd data is located. Through the technical solution of the present invention, the first motion trajectory information calculated based on the smooth particle fluid dynamics physical formula is physical information. The physical information is injected into the target initial multi-outlet neural network model, so that the model follows the laws of physics, enhances the physical consistency, generalization and robustness of the crowd simulation model, reduces the prediction loss of the model under long-term simulation conditions, and ensures the accuracy of crowd simulation under long-term and high-density crowd simulation conditions. The initial parameters of the target initial multi-outlet neural network model are the optimal initial weights and the optimal initial deviations, which can accelerate the loss convergence of the model.
[0016] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation on the local application. In the drawings:
[0018] Figure 1 A schematic diagram of a process flow of a macro crowd simulation method provided by an embodiment of the present invention is shown;
[0019] Figure 2 A schematic flow chart of another macro crowd simulation method provided by an embodiment of the present invention is shown;
[0020] Figure 3 A schematic structural diagram of a macro crowd simulation device provided by an embodiment of the present invention is shown;
[0021] Figure 4 A schematic structural diagram of another macro-crowd simulation device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0022] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other.
[0023] This embodiment provides a macro crowd simulation method, such as Figure 1 As shown, the method includes:
[0024] 101. Construct crowd trajectory data into particles, obtain initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment, and calculate the first motion trajectory information of the particles after the preset initial moment based on the initial crowd data based on the smooth particle fluid dynamics physics formula.
[0025] Among them, each point of the crowd trajectory data is regarded as a particle. Both the initial crowd data at the preset initial moment and the real motion trajectory information after the preset initial moment are historical data and can be directly obtained. The first motion trajectory information is calculated according to the initial crowd data based on the smooth particle fluid dynamics physics formula. The initial crowd data at the preset initial moment is data at one moment, the real motion trajectory information after the preset initial moment is data at multiple moments, and the first motion trajectory information after the preset moment is also data at multiple moments.
[0026] The smoothed particle fluid dynamics physics formulation discretizes pedestrian flow into a finite number of non-connected discrete elements (particles). It is a simulation method in which particles move according to the forces caused by density and velocity differences.
[0027] The initial crowd data includes the coordinates, velocity, acceleration, etc. of each particle at a preset initial moment, the real motion trajectory information includes the coordinates, velocity, acceleration, etc. of each particle at each moment after the preset initial moment, and the first motion trajectory information includes the coordinates, velocity, acceleration, etc. of each particle at each moment after the preset initial moment, wherein each moment corresponding to the real motion trajectory information is equal to each moment corresponding to the first motion trajectory information.
[0028] It should be noted that the real motion trajectory information is real information, and the first motion trajectory information is physical information calculated by the physical formula of smooth particle fluid dynamics. The real information and physical information are used together as constraints for the initial population data training model to make the trained model close to reality while conforming to the laws of physics, thereby improving the prediction accuracy of the model.
[0029] 102. Construct a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information; train the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model.
[0030] It should be noted that the model to be trained is the target initial multi-outlet neural network model. Before training it, its structure is first constructed to obtain its optimal initial parameters (the optimal initial parameters do not include the optimal initial weights and the optimal initial deviations), thereby constructing the target initial multi-outlet neural network model, and then training it.
[0031] For this embodiment, as an implementation method, the real motion trajectory information is used as a constraint, and the first motion trajectory information is also used as another constraint to jointly train the target initial multi-output neural network model.
[0032] 103. Acquire crowd data for which position prediction is to be performed, perform multi-outlet prediction on the crowd data using the multi-outlet neural network model, and obtain movement trajectory information after the moment the crowd data is located.
[0033] After the trained multi-output neural network model is obtained in step 102 of the embodiment, the multi-output neural network model can be directly applied. Specifically, crowd data to be predicted at the time when the crowd data is present is obtained.
[0034] The multi-export neural network model is used to predict the crowd data, and the coordinates of each target particle at each target moment after the moment of the crowd data are obtained, thereby simulating the movement trajectory information of the crowd.
[0035] The present invention provides a macro crowd simulation method, device and equipment. First, crowd trajectory data is constructed into particles, and initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment are obtained. Based on the smooth particle fluid dynamics physics formula, the first motion trajectory information of the particles after the preset initial moment is calculated according to the initial crowd data; then, a target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations is constructed according to the initial crowd data, the first motion trajectory information and the real motion trajectory information; the target initial multi-outlet neural network model is trained according to the initial crowd data, the real motion trajectory information and the first motion trajectory information to obtain a trained multi-outlet neural network model; finally, crowd data to be predicted for position is obtained, and the multi-outlet neural network model is used to perform multi-outlet prediction on the crowd data to obtain motion trajectory information after the moment when the crowd data is located. Through the technical solution of the present invention, the first motion trajectory information calculated based on the smooth particle fluid dynamics physical formula is physical information. The physical information is injected into the target initial multi-outlet neural network model, so that the model follows the laws of physics, enhances the physical consistency, generalization and robustness of the crowd simulation model, reduces the prediction loss of the model under long-term simulation conditions, and ensures the accuracy of crowd simulation under long-term and high-density crowd simulation conditions. The initial parameters of the target initial multi-outlet neural network model are the optimal initial weights and the optimal initial deviations, which can accelerate the loss convergence of the model.
[0036] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another macro crowd simulation method is provided, such as Figure 2 As shown, the method includes:
[0037] 201. Construct crowd trajectory data into particles, and obtain initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment.
[0038] For this embodiment, the specific implementation is the same as step 101 in the embodiment, and will not be repeated here.
[0039] 202. For each particle, obtain, based on the initial population data, a first coordinate of the particle, a first other particle within a smooth core radius of the particle, a second coordinate of the first other particle, and a mass of the first other particle.
[0040] Where i represents a particle, j represents the first other particle of particle i within the smooth core radius h, and the first coordinate x of particle i is obtained. i , get the second coordinate x of the first other particle j j, get the mass m of the first other particle j j .
[0041] 203. Based on a smooth particle fluid dynamics physics formula, calculate a first density of the particle according to the smooth core radius, the first coordinate, the second coordinate, and the mass.
[0042] For steps 202-205 of the embodiment, based on the smoothed particle hydrodynamics (SPH) physical formula, the smoothed particle hydrodynamics physical formula is improved with the dynamic individual static density, and the first motion trajectory information calculated thereby is used as the physical information, wherein the smoothed particle hydrodynamics (SPH) physical formula is: the pedestrian flow is discretized into a finite number of non-connected discrete elements (particles), which is a simulation method in which particles move according to the force caused by density and velocity differences.
[0043] Calculate the first density ρ of the particle i The formula is as follows:
[0044]
[0045] Where N is the total number of first other particles j, and W is the smoothing kernel function, a weight function that typically decreases with the length of its parameter r. This ensures that particles farther away have less impact on the computational effort. h is the support radius of W. If r ≥ h, then W(r, h) = 0.
[0046] 204. Calculate a first dynamic personal static density of the particle according to the first density, and determine a second dynamic personal static density of the first other particle according to the first dynamic personal static density.
[0047] It should be noted that dynamic individual static density refers to a dynamic threshold of the surrounding crowd density that each particle can accept in crowd simulation. This density threshold is not fixed but can be adjusted according to environmental conditions and particle behavior.
[0048] For this embodiment, since the simulation is not of a fluid with fixed physical properties, but of a crowd of conscious individuals, the crowd will be affected by changes in the surrounding environment. Therefore, each particle is given a dynamic individual static density that changes with time instead of the density calculated based on step 203 of the embodiment, which will not adapt to environmental changes. In addition, the pressure and permeability of step 205 of the embodiment are both calculated based on the dynamic individual static density, making the improved smooth particle fluid dynamics physics formula more suitable for crowds.
[0049] This dynamic individual static density is calculated based on the surrounding density perceived by the agent within a certain time window. The first dynamic individual static density is calculated using the following formula:
[0050]
[0051] Calculate the second dynamic individual static density using the following formula:
[0052]
[0053] is the first dynamic individual static density, is the second dynamic individual rest density, T ρ is a large period of time, and Δt is the time interval within the large period of time.
[0054] 205. Calculate first motion trajectory information of the particle after the preset initial moment according to the first dynamic individual static density and the second dynamic individual static density.
[0055] In this embodiment, the calculating of the first motion trajectory information of the particle after the preset initial moment according to the first dynamic personal static density and the second dynamic personal static density includes: calculating the first pressure of the particle according to the first dynamic personal static density, calculating the penetration force of the particle according to the first dynamic personal static density, the second dynamic personal static density, the mass, the first coordinate, the second coordinate, and the smooth core radius; and calculating the second pressure of the first other particle according to the second dynamic personal static density.
[0056] The formula for calculating the first pressure is:
[0057] The formula for calculating the second pressure is:
[0058] where k is a constant (traditionally a physical gas constant that depends on temperature), and ρ 0 is the static density that the simulated material attempts to achieve, is the first dynamic individual static density, It is the second dynamic personal static density.
[0059] The formula for calculating penetration is:
[0060] Where ξ is the permeability factor, μ i represents the penetration force vector, and N is the total number of the first other particles j.
[0061] calculating an acceleration of the particle according to a navigation item of the particle, an artificial viscosity item, a boundary force generated by an obstacle corresponding to the particle, the mass, the first pressure, the first dynamic personal rest density, the second pressure, the second dynamic personal rest density, the penetration force, the first coordinate, the second coordinate, and the smooth kernel radius;
[0062] The particle's navigation item ∈ i , artificial viscosity term Π ij , the boundary force B generated by the obstacle corresponding to the particle i The calculations of are all existing technologies. All three are irrelevant to the dynamic individual static density and will not be described here.
[0063] Calculate the particle's acceleration a i The formula is as follows:
[0064]
[0065] in, Represents the gradient.
[0066] A first predicted coordinate of the particle at a first time to be predicted is obtained based on the acceleration, and a second predicted coordinate of the particle at a second time to be predicted is continuously calculated based on the first predicted coordinate until an end point is reached, thereby obtaining first motion trajectory information of the particle after the preset initial time.
[0067] Among them, the first motion trajectory information after the preset initial moment includes the first predicted coordinates, the first velocity, and the first acceleration at the first to-be-predicted moment after the preset initial moment; the second predicted coordinates, the second velocity, and the second acceleration at the second to-be-predicted moment;... the last predicted coordinates, the last velocity, and the last acceleration at the last to-be-predicted moment; by mathematically integrating the acceleration (i.e., the first acceleration) over time, the first predicted coordinates of the particle at the first to-be-predicted moment can be obtained, and the process of steps 202-205 of the embodiment is repeated according to the first predicted coordinates to obtain the second predicted coordinates at the second to-be-predicted moment, until the end point is reached, and the last predicted coordinates at the last to-be-predicted moment are obtained. The predicted coordinates, velocity, and acceleration at each to-be-predicted moment together constitute the first motion trajectory information of the particle after the preset initial moment.
[0068] 206. Construct a target initial multi-export neural network model including optimal initial weights and optimal initial deviations based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information.
[0069] For this embodiment, the target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations is constructed based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information, including: constructing the initial multi-outlet neural network model using an encoder, a processor, and a decoder; creating a solution space including initial weights and initial deviations using the Harris Hawk algorithm, training the initial multi-outlet neural network model using the initial crowd data by simulating the hunting process of the Harris Hawk to obtain a first prediction result, calculating a first loss based on the first prediction result and the actual motion trajectory information, and calculating a second loss based on the first prediction result and the first motion trajectory information, iteratively training until a preset stopping condition is reached, and obtaining the optimal initial weights and optimal initial deviations in the solution space; and determining the initial multi-outlet neural network model including the optimal initial weights and the optimal initial deviations as the target initial multi-outlet neural network model.
[0070] Among them, the encoder is a multi-layer perceptron, the processor is a multi-layer perceptron with residual, and the decoder is a multi-layer perceptron, which constitutes an initial multi-output neural network model.
[0071] The Harris Hawk algorithm (HHO) is an improved Harris Hawks optimization algorithm (HHO) based on the concept of external archiving. It is used to optimize the weights and biases of a multilayer perceptron (MLP) neural network. This algorithm enhances the HHO search process by retaining an archive of the best solutions in each iteration, allowing these best solutions to be used in future iterations. A solution space of size HIS × N is randomly generated according to the Harris Hawk algorithm. Each solution represents a set of initial weights and initial biases. A K value (K = HIS * archive rate) is then calculated based on the archiving rate and HIS, and an external archive of size K × N is constructed. The first run is completely randomly generated. Except for the first run, K solutions are selected from the external archive to populate the solution space. The remaining solutions are randomly generated. Two techniques are used to search for prey in the solution space: one uses the help of family members, and the other observes from a high tree. The prey's energy value determines whether to attack and capture the prey. If |E| ≥ 1, the search continues; otherwise, the capture is initiated. Prey found during the search phase is attacked and captured. The predation process selects different strategies according to the energy of the prey, including soft encirclement, hard encirclement, soft encirclement accompanied by rapid dive, and hard encirclement accompanied by rapid dive. The iterative operation is preset a number of times, and the Harris Eagle algorithm is used to cyclically optimize all solutions in the solution space. Then, each group of solutions (a group of initial weights and initial deviations) is substituted into the model for prediction to obtain a first prediction result. Then, if the optimal weight and optimal deviation of the student model in step 207 of the embodiment are to be found, the first loss is calculated based on the first prediction result and the actual motion trajectory information, and these solutions are sorted according to the first loss, and the k solutions with the smallest loss are selected and released into the archive for the next operation; if the optimal weight and optimal deviation of the teacher model in step 207 of the embodiment are to be found, the second loss is calculated based on the first prediction result and the first motion trajectory information, and these solutions are sorted according to the second loss, and the k solutions with the smallest loss are selected and released into the archive for the next operation.
[0072] The initial multi-export neural network model is trained using the initial crowd data to obtain a first prediction result, including: constructing the initial crowd data into a grid, and using the encoder to encode the grid into an initial graph structure; for each particle, filtering the initial graph structure according to a neighbor list to obtain a target graph structure corresponding to the particle, wherein the target graph structure includes a target edge set and a target node set; using the processor to pass messages along the target edge set to obtain updated node features and updated edge features in each round, and every N rounds of message passing as a message block MessageBlock, and using the decoder to predict the position of the message block to obtain a second prediction result, until a preset number of rounds are completed, and the second prediction result is weighted summed to obtain the first prediction result.
[0073] The initial crowd data is constructed into a grid, and the encoder is used to encode the grid into an initial graph structure to facilitate subsequent message transmission. Specifically, each particle is {P1, P2, P3...P n}, the corresponding first coordinate is {(x1,y1), (x2,y2), (x3,y3)...(x n ,y n )}, use the encoder to encode the initial graph structure: mesh=<V,E> ,in:
[0074] (1) V is a set of nodes, each of which represents a two-dimensional coordinate point in space.
[0075] (2) E is the edge set, which is the line segment connecting two nodes and defines the adjacency relationship between the nodes.
[0076] Among them, since for each particle, if all other particles are used to predict its position, the amount of calculation is large, therefore, for this embodiment, all second other particles within a preset distance from the particle are included in the neighbor list, and particles that do not belong to the neighbor list are ignored when predicting the position of the particle, thereby reducing the amount of calculation and improving efficiency. Among them, the preset distance can be greater than or equal to the smooth kernel radius.
[0077] The initial graph structure is filtered using a neighbor list, ignoring any nodes and edges outside the neighbor list for the particle. This results in a target graph structure corresponding to the particle. When predicting the particle's position, only the target set of nodes and edges in the target graph structure is considered. Using a neighbor list to decouple particle collections can effectively reduce the number and complexity of neural network input parameters in large-scale crowd simulations.
[0078] In the processing-decoding stage, multiple outlets {E1, E2, E3...En} are constructed. After every N rounds of message passing, a second prediction result is obtained through the decoder and used as the output of one outlet. This continues until the preset number of rounds is completed and all outlets have completed output. The second prediction results output by all outlets are weightedly summed to obtain the first prediction result. Multiple rounds of message passing are performed to gradually integrate local messages so that each particle can fully grasp the information of all other second particles in its neighbor list, thereby enhancing the robustness of the model.
[0079] G E (e is , v i ,v s )→e′ is
[0080] G V (v i ,∑e′ is )→v′ i
[0081] Among them, G E , G V is a multilayer perceptron with residuals, used for edge embedding and node updating, respectively, e ij ∈E represents the target edge connecting the target node, v i ∈V represents the target node, the subscript s represents the second other particle in the neighbor list of particle i, and e′ is represents the updated edge obtained by N rounds of message passing, v′ i Indicates the updated node obtained after N rounds of message passing.
[0082] Among them, the second prediction results corresponding to the exits {E1, E2, E3...En} are {P1, P2, P3...Pn}, and the first prediction results are:
[0083]
[0084] w i is the weight corresponding to the export.
[0085] 207. Train the target initial multi-outlet neural network model according to the initial crowd data, the real motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model.
[0086] The training of the target initial multi-export neural network model according to the initial crowd data, the real motion trajectory information, and the first motion trajectory information to obtain a trained multi-export neural network model includes: (1) constructing a teacher model and a student model corresponding to the target initial multi-export neural network model, wherein the optimal initial weights and the optimal initial deviations of the teacher model and the student model are different, the number of layers of the teacher model is deeper than the number of layers of the student model, and the dimension of the teacher model is wider than the dimension of the student model;
[0087] It's important to note that both the teacher model and the student model are target-initial multi-output neural network models. The teacher model has a deeper network layer and wider dimensions, while the student model has a shallower network layer and narrower dimensions. Training a lightweight student model through knowledge distillation reduces model complexity and improves crowd simulation accuracy in long-duration simulations and high-density crowd scenarios, alleviating the pressure on management and control in high-density crowd areas during disasters.
[0088] (2) Constructing a replica model of the student model; that is, the replica model is exactly the same as the student model.
[0089] (3) performing knowledge distillation on the replication model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the teacher model to obtain an updated replication model;
[0090] The step of performing knowledge distillation on the copy model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the teacher model to obtain an updated copy model includes: predicting the initial crowd data according to the teacher model and the copy model, respectively, obtaining a third prediction result and a fourth prediction result for each exit, calculating a first teacher distillation loss according to the third prediction result and the fourth prediction result, calculating a first prediction loss according to the fourth prediction result and the real motion trajectory information, and calculating a second prediction loss according to the fourth prediction result and the first motion trajectory information;
[0091] Since both the teacher model and the copy model are target multi-outlet neural network models, the initial population data is predicted according to the teacher model to obtain the third prediction results of each outlet, and the initial population data is predicted according to the copy model to obtain the fourth prediction results of each outlet. The prediction process is the same as the above-mentioned second prediction result, and will not be repeated here.
[0092] The formula for calculating the first teacher distillation loss according to the third prediction result and the fourth prediction result is:
[0093]
[0094] Among them, y t1 is the third prediction result obtained by the teacher model for the i-th exit, y s1 is the fourth prediction result of the i-th outlet obtained by the replication model, n is the number of outlets, w i is the weight corresponding to the export.
[0095] The formula for calculating the first prediction loss according to the fourth prediction result and the true motion trajectory information is:
[0096]
[0097] Among them, y i真 is the real position of the particle in the real motion trajectory information, y i1 is the fourth prediction result of the i-th export of the replication model, n is the number of exports, w i is the weight corresponding to the export.
[0098] The formula for calculating the second prediction loss according to the fourth prediction result and the first motion trajectory information is:
[0099]
[0100] Among them, y i物 is the position of the particle calculated by the smooth particle fluid dynamics physics formula in the first motion trajectory information, y s1 is the fourth prediction result of the i-th export of the replication model, n is the number of exports, w i is the weight corresponding to the export.
[0101] For updating the weights and biases of the replication model according to the first teacher distillation loss, the first prediction loss, and the second prediction loss, an updated replication model is obtained:
[0102] The first teacher distillation loss, the first prediction loss, and the second prediction loss are weighted and summed to obtain a loss value. The weights and biases are modified using backpropagation to reduce the loss value, and the weights and biases at this time are obtained, thereby obtaining the updated copy model.
[0103] (4) providing feedback to the teacher model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated replica model to obtain an updated teacher model to improve the teaching ability of the teacher model;
[0104] The performing of knowledge distillation on the teacher model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated replica model to obtain the updated teacher model includes: selecting samples from the initial crowd data, predicting the samples according to the updated replica model to obtain a fifth prediction result for each exit, calculating a third prediction loss according to the fifth prediction result and the first motion trajectory information, and updating the weight and bias of the teacher model according to the third prediction loss to obtain the updated teacher model;
[0105] The sample is part of the data selected from the initial population data. The sample is predicted based on the updated replication model to obtain the fifth prediction result of each exit. The prediction process is the same as the above-mentioned second prediction result, which will not be repeated here.
[0106] The formula for calculating the third prediction loss based on the fifth prediction result and the first motion trajectory information is as follows:
[0107]
[0108] Among them, y i物 is the position of the particle calculated by the smooth particle fluid dynamics physics formula in the first motion trajectory information, y s2 is the fifth prediction result of the updated replication model for the i-th exit, n is the number of exits, wi is the weight corresponding to the export.
[0109] The weights and biases of the teacher model are updated according to the third prediction loss to obtain an updated teacher model.
[0110] Use backpropagation to modify the weights and biases to reduce the third prediction loss, and obtain the weights and biases at this time, thereby obtaining the updated teacher model.
[0111] (5) Performing knowledge distillation on the student model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated teacher model to obtain a trained multi-export neural network model.
[0112] Among them, the knowledge distillation of the student model is performed according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated teacher model to obtain a trained multi-export neural network model, including: predicting the initial crowd data according to the updated teacher model and the student model respectively, and obtaining the sixth prediction result and the seventh prediction result of each exit respectively, calculating the second teacher distillation loss according to the sixth prediction result and the seventh prediction result, calculating the fourth prediction loss according to the seventh prediction result and the real motion trajectory information, calculating the fifth prediction loss according to the seventh prediction result and the first motion trajectory information, calculating the total self-distillation loss according to the seventh prediction result, calculating the total loss according to the second teacher distillation loss, the fourth prediction loss, the fifth prediction loss and the total self-distillation loss, updating the weights and bias of the student model according to the total loss, and obtaining a trained multi-export neural network model.
[0113] The updated teacher model is used to predict the initial population data and obtain the sixth prediction result of each exit. The student model is used to predict the initial population data and obtain the seventh prediction result of each exit. The prediction process is the same as the above-mentioned second prediction result and will not be repeated here.
[0114] The formula for calculating the second teacher distillation loss based on the sixth prediction result and the seventh prediction result is as follows:
[0115]
[0116] Among them, y t3 is the sixth prediction result of the updated teacher model for the i-th exit, y s3 is the seventh prediction result of the student model for the i-th exit, n is the number of exits, w i is the weight corresponding to the export.
[0117] The formula for calculating the fourth prediction loss based on the seventh prediction result and the true motion trajectory information is as follows:
[0118]
[0119] Among them, y i真 is the real position of the particle in the real motion trajectory information, y s3 is the seventh prediction result of the student model for the i-th exit, n is the number of exits, w i is the weight corresponding to the export.
[0120] The formula for calculating the fifth prediction loss based on the seventh prediction result and the first motion trajectory information is as follows:
[0121]
[0122] Among them, y i物 is the position of the particle calculated by the smooth particle fluid dynamics physics formula in the first motion trajectory information, y s3 is the seventh prediction result of the student model for the i-th exit, n is the number of exits, w i is the weight corresponding to the export.
[0123] The formula for calculating the total self-distillation loss according to the seventh prediction result is as follows:
[0124]
[0125] Among them, y i is the seventh prediction result of the student model’s layer i exit, y L is the seventh prediction result of the L-th layer exit of the student model, where L is the layer above layer i, SELoss i is the self-distillation loss at the L-th layer outlet, n is the number of outlets, w i is the weight corresponding to the export.
[0126] The total self-distillation loss function is as follows:
[0127]
[0128] The formula for calculating the total loss according to the second teacher distillation loss TSLoss2, the fourth prediction loss TPLoss4, the fifth prediction loss TPLoss5 and the total self-distillation loss SELoss is as follows:
[0129] Among them, the fourth prediction loss and the fifth prediction loss are weightedly summed to obtain TPLoss.
[0130] TotalLoss=α*TSLoss3+β*SELoss+γ*TPLoss
[0131] α, β, γ∈(0,1), and α+β+γ=1.
[0132] The weights and biases of the student model are updated according to the total loss to obtain a trained multi-output neural network model.
[0133] Use backpropagation to modify the weights and biases to reduce the total loss value, and obtain the weights and biases at this time, so as to obtain the updated student model, that is, the trained multi-output neural network model.
[0134] In summary, when calculating the prediction loss, both the real position of the particles in the real motion trajectory information is used as a constraint to calculate the prediction loss, and the position of the particles in the first motion trajectory information calculated by the smooth particle fluid dynamics physics formula is also used as a constraint to calculate the prediction loss. This not only allows the model to be trained in the direction of real data, but also allows the model to be trained in the direction of physical data, following the laws of physics. It can efficiently and accurately solve high-dimensional and complex scientific computing problems, enhance the physical consistency, robustness and generalization of macro crowd simulation, and ensure the accuracy of crowd simulation under long-term simulation conditions.
[0135] 208. Acquire crowd data for which position prediction is to be performed, perform multi-outlet prediction on the crowd data using the multi-outlet neural network model, and obtain motion trajectory information after the moment the crowd data is located.
[0136] This embodiment is the same as step 103 in the embodiment, and will not be described again here.
[0137] In summary, the crowd trajectory data is first constructed into particles using the physics formula of smoothed particle hydrodynamics. The dynamic individual static density and the physics formula of smoothed particle hydrodynamics are combined to generate the first motion trajectory information. An initial multi-outlet neural network model based on a mesh graph structure is then constructed using an encoding-processing-decoding architecture. The initial multi-outlet neural network model is iteratively trained using the Harris Eagle algorithm to find the optimal initial weights and initial biases, resulting in the target initial multi-outlet neural network model. The first motion trajectory information is then divided into batches using a neighbor list and injected as physical information into the target initial multi-outlet neural network model for model training. After every N rounds of message passing, a message block is generated. The decoder predicts the position of the message block and uses it as the output of one outlet, thereby obtaining the output of multiple outlets. Local messages are gradually integrated through multiple message blocks, ensuring that each node has complete information about all nodes in its neighbor list. Finally, based on meta-learning-based multi-objective teacher-student collaborative distillation, a teacher model and a student model are constructed. The two models have the same structure, but the teacher model has a deeper network layer and a wider dimension, while the student model has a shallower network layer and a narrower dimension. During the distillation process, a teacher distillation loss function is designed to help the student model learn from the teacher model. At the same time, a self-distillation loss function is designed, using deep MessageBlocks to distill shallow MessageBlocks to help the student model self-learn. Node messages are gradually integrated from local nodes to the entire neighbor list. A prediction loss function is also designed to help the student model's predictions more closely resemble actual conditions, making the simulation more realistic. This results in strong robustness, generalization, and physical consistency. It can also be combined with knowledge distillation to train a relatively lightweight model, reducing model complexity to a certain extent while ensuring the accuracy of the crowd simulation model under long-term simulation conditions.
[0138] The present invention provides a macro crowd simulation method, device and equipment. First, crowd trajectory data is constructed into particles, and initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment are obtained. Based on the smooth particle fluid dynamics physics formula, the first motion trajectory information of the particles after the preset initial moment is calculated according to the initial crowd data; then, a target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations is constructed according to the initial crowd data, the first motion trajectory information and the real motion trajectory information; the target initial multi-outlet neural network model is trained according to the initial crowd data, the real motion trajectory information and the first motion trajectory information to obtain a trained multi-outlet neural network model; finally, crowd data to be predicted for position is obtained, and the multi-outlet neural network model is used to perform multi-outlet prediction on the crowd data to obtain motion trajectory information after the moment when the crowd data is located. Through the technical solution of the present invention, the first motion trajectory information calculated based on the smooth particle fluid dynamics physical formula is physical information. The physical information is injected into the target initial multi-outlet neural network model, so that the model follows the laws of physics, enhances the physical consistency, generalization and robustness of the crowd simulation model, reduces the prediction loss of the model under long-term simulation conditions, and ensures the accuracy of crowd simulation under long-term and high-density crowd simulation conditions. The initial parameters of the target initial multi-outlet neural network model are the optimal initial weights and the optimal initial deviations, which can accelerate the loss convergence of the model.
[0139] Further, as Figure 1 and Figure 2 The specific implementation of the method shown in the embodiment of the present invention provides a macro crowd simulation device, such as Figure 3 As shown, the device includes: an acquisition module 31, a training module 32, and a prediction module 33;
[0140] An acquisition module 31 is configured to construct crowd trajectory data into particles, obtain initial crowd data of the particles at a preset initial time and real motion trajectory information after the preset initial time, and calculate first motion trajectory information of the particles after the preset initial time based on the initial crowd data based on the smoothed particle fluid dynamics physics formula;
[0141] a training module 32 for constructing a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information, and training the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model;
[0142] The prediction module 33 is used to obtain crowd data to be predicted, perform multi-export prediction on the crowd data using the multi-export neural network model, and obtain movement trajectory information after the moment the crowd data is located.
[0143] Accordingly, in order to calculate the first motion trajectory information of the particle after the preset initial moment according to the initial crowd data based on the smooth particle fluid dynamics physical formula, the acquisition module 31 may specifically include: a first calculation unit 311 and a second calculation unit 312;
[0144] The first calculation unit 311 may be specifically configured to obtain, for each particle, a first coordinate of the particle, a first other particle within a smooth core radius of the particle, a second coordinate of the first other particle, and a mass of the first other particle based on the initial population data; calculate a first density of the particle based on the smooth core radius, the first coordinate, the second coordinate, and the mass based on a smooth particle fluid dynamics physics formula; calculate a first dynamic individual static density of the particle based on the first density; and determine a second dynamic individual static density of the first other particle based on the first dynamic individual static density.
[0145] The second calculation unit 312 may be specifically configured to calculate first motion trajectory information of the particle after the preset initial moment according to the first dynamic individual static density and the second dynamic individual static density.
[0146] Correspondingly, in order to calculate the first motion trajectory information of the particle after the preset initial moment based on the first dynamic personal static density and the second dynamic personal static density, the second calculation unit 312 can also be used to calculate the first pressure of the particle based on the first dynamic personal static density, calculate the penetration force of the particle based on the first dynamic personal static density, the second dynamic personal static density, the mass, the first coordinate, the second coordinate and the smooth core radius; calculate the second pressure of the first other particle based on the second dynamic personal static density; calculate the acceleration of the particle based on the navigation item of the particle, the artificial viscosity item, the boundary force generated by the obstacle corresponding to the particle, the mass, the first pressure, the first dynamic personal static density, the second pressure, the second dynamic personal static density, the penetration force, the first coordinate, the second coordinate and the smooth core radius; obtain the first predicted coordinate of the particle at the first predicted moment based on the acceleration, and continue to calculate the second predicted coordinate of the particle at the second predicted moment based on the first predicted coordinate until the end point is reached, so as to obtain the first motion trajectory information of the particle after the preset initial moment.
[0147] Accordingly, in order to construct a target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations based on the initial crowd data, the first motion trajectory information and the actual motion trajectory information, the training module 32 can be specifically used to construct the initial multi-outlet neural network model using an encoder, a processor and a decoder; use the Harris Hawk algorithm to create a solution space including initial weights and initial deviations, and train the initial multi-outlet neural network model using the initial crowd data by simulating the hunting process of the Harris Hawk to obtain a first prediction result, calculate a first loss based on the first prediction result and the actual motion trajectory information, and calculate a second loss based on the first prediction result and the first motion trajectory information, iterate the training until a preset stop condition is reached, and obtain the optimal initial weights and optimal initial deviations in the solution space; and determine the initial multi-outlet neural network model including the optimal initial weights and the optimal initial deviations as the target initial multi-outlet neural network model.
[0148] Accordingly, in order to use the initial crowd data to train the initial multi-export neural network model to obtain a first prediction result, the training module 32 can be specifically used to construct the initial crowd data into a grid, and use the encoder to encode the grid into an initial graph structure; for each particle, the initial graph structure is filtered according to the neighbor list to obtain the target graph structure corresponding to the particle, wherein the target graph structure includes a target edge set and a target node set; using the processor along the target edge set, each round of message transmission obtains updated node features and updated edge features, and every N rounds of message transmission is regarded as a message block. The decoder is used to perform position prediction on the message block to obtain a second prediction result, until the preset number of rounds is completed, and the second prediction result is weighted summed to obtain the first prediction result.
[0149] Correspondingly, in order to train the target initial multi-outlet neural network model according to the initial crowd data, the real motion trajectory information and the first motion trajectory information to obtain a trained multi-outlet neural network model, the training module 32 can also be used to construct a teacher model and a student model corresponding to the target initial multi-outlet neural network model, wherein the optimal initial weights and the optimal initial deviations of the teacher model and the student model are different, the number of layers of the teacher model is deeper than the number of layers of the student model, and the dimension of the teacher model is wider than the dimension of the student model; construct a copy model of the student model; perform knowledge distillation on the copy model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the teacher model to obtain an updated copy model; perform feedback on the teacher model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated copy model to obtain an updated teacher model; perform knowledge distillation on the student model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated teacher model to obtain a trained multi-outlet neural network model.
[0150] Correspondingly, in order to perform knowledge distillation on the copy model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the teacher model to obtain an updated copy model, the training module 32 can also be used to predict the initial crowd data according to the teacher model and the copy model respectively, and obtain the third prediction result and the fourth prediction result of each exit accordingly, calculate the first teacher distillation loss according to the third prediction result and the fourth prediction result, calculate the first prediction loss according to the fourth prediction result and the real motion trajectory information, calculate the second prediction loss according to the fourth prediction result and the first motion trajectory information, update the weight and bias of the copy model according to the first teacher distillation loss, the first prediction loss and the second prediction loss to obtain the updated copy model.
[0151] Correspondingly, in order to provide feedback to the teacher model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated copy model to obtain the updated teacher model, the training module 32 can also be used to select samples from the initial crowd data, predict the samples according to the updated copy model to obtain the fifth prediction result of each exit, calculate the third prediction loss according to the fifth prediction result and the first motion trajectory information, and update the weight and bias of the teacher model according to the third prediction loss to obtain the updated teacher model.
[0152] Correspondingly, in order to perform knowledge distillation on the student model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated teacher model, and obtain a trained multi-export neural network model, the training module 32 can also be used to predict the initial crowd data according to the updated teacher model and the student model respectively, and obtain the sixth prediction result and the seventh prediction result of each exit respectively, calculate the second teacher distillation loss according to the sixth prediction result and the seventh prediction result, calculate the fourth prediction loss according to the seventh prediction result and the real motion trajectory information, calculate the fifth prediction loss according to the seventh prediction result and the first motion trajectory information, calculate the total self-distillation loss according to the seventh prediction result, calculate the total loss according to the second teacher distillation loss, the fourth prediction loss, the fifth prediction loss and the total self-distillation loss, update the weights and bias of the student model according to the total loss, and obtain a trained multi-export neural network model.
[0153] It should be noted that for other corresponding descriptions of the functional units involved in the macro crowd simulation device provided in this embodiment, please refer to Figures 1 to 2 The corresponding description will not be repeated here.
[0154] Based on the above Figures 1 to 2 The method shown in FIG. 1 is a method for performing the above-mentioned operations. Accordingly, this embodiment further provides a storage medium, which may be volatile or non-volatile, and stores a computer program thereon. When the program is executed by a processor, the above-mentioned operations are performed. Figures 1 to 2 The macro crowd simulation method shown.
[0155] Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present invention.
[0156] Based on the above Figures 1 to 2 The method shown and Figure 3 、 Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the virtual device shown in the figure further provides a computer device, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 2 The macro crowd simulation method shown.
[0157] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and may optionally include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Wi-Fi interface), etc.
[0158] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0159] The storage medium may also include an operating system and network communication module. Operating systems are programs that manage the hardware and software resources of the computer device, supporting the execution of information processing programs and other software and / or programs. The network communication module facilitates communication between components within the storage medium and with other hardware and software within the information processing device.
[0160] Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform, or by hardware.
[0161] The present invention provides a macro crowd simulation method, device and equipment. First, crowd trajectory data is constructed into particles, and initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment are obtained. Based on the smooth particle fluid dynamics physics formula, the first motion trajectory information of the particles after the preset initial moment is calculated according to the initial crowd data; then, a target initial multi-outlet neural network model including optimal initial weights and optimal initial deviations is constructed according to the initial crowd data, the first motion trajectory information and the real motion trajectory information; the target initial multi-outlet neural network model is trained according to the initial crowd data, the real motion trajectory information and the first motion trajectory information to obtain a trained multi-outlet neural network model; finally, crowd data to be predicted for position is obtained, and the multi-outlet neural network model is used to perform multi-outlet prediction on the crowd data to obtain motion trajectory information after the moment when the crowd data is located. Through the technical solution of the present invention, the first motion trajectory information calculated based on the smooth particle fluid dynamics physical formula is physical information. The physical information is injected into the target initial multi-outlet neural network model, so that the model follows the laws of physics, enhances the physical consistency, generalization and robustness of the crowd simulation model, reduces the prediction loss of the model under long-term simulation conditions, and ensures the accuracy of crowd simulation under long-term and high-density crowd simulation conditions. The initial parameters of the target initial multi-outlet neural network model are the optimal initial weights and the optimal initial deviations, which can accelerate the loss convergence of the model.
[0162] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and that the modules or processes in the accompanying drawings are not necessarily required for the implementation of the present invention. Those skilled in the art will appreciate that the modules in the devices in the implementation scenarios can be distributed in the devices of the implementation scenarios according to the implementation scenario descriptions, or can be modified accordingly and located in one or more devices different from the implementation scenarios. The modules in the above-mentioned implementation scenarios can be combined into one module, or can be further split into multiple submodules.
[0163] The serial numbers of the present invention are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosures are only a few specific implementation scenarios of the present invention, but the present invention is not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present invention.
Claims
1. A macro crowd simulation method, characterized in that: The method comprises: Constructing crowd trajectory data into particles, obtaining initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment, and calculating first motion trajectory information of the particles after the preset initial moment based on the initial crowd data based on the smoothed particle fluid dynamics physics formula; Constructing a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information; training the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model; Acquire crowd data for which position prediction is to be performed, perform multi-export prediction on the crowd data using the multi-export neural network model, and obtain movement trajectory information after the moment of the crowd data; The constructing of a target initial multi-export neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the real motion trajectory information includes: Construct an initial multi-output neural network model using an encoder, processor, and decoder; A solution space including initial weights and initial biases is created using a Harris Hawk algorithm, and the initial multi-export neural network model is trained using the initial population data by simulating a Harris Hawk hunting process to obtain a first prediction result. A first loss is calculated based on the first prediction result and the true motion trajectory information, and a second loss is calculated based on the first prediction result and the first motion trajectory information. Training is iteratively performed until a preset stopping condition is met, and optimal initial weights and optimal initial biases are obtained in the solution space. Determining the initial multi-outlet neural network model including the optimal initial weights and the optimal initial deviations as a target initial multi-outlet neural network model; The training of the target initial multi-outlet neural network model according to the initial crowd data, the real motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model includes: Constructing a teacher model and a student model corresponding to the target initial multi-output neural network model, wherein the optimal initial weights and the optimal initial deviations of the teacher model and the student model are different, the number of layers of the teacher model is deeper than the number of layers of the student model, and the dimension of the teacher model is wider than the dimension of the student model; constructing a replica model of the student model; performing knowledge distillation on the replication model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the teacher model to obtain an updated replication model; providing feedback to the teacher model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated replication model to obtain an updated teacher model; The student model is subjected to knowledge distillation based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated teacher model to obtain a trained multi-output neural network model.
2. The method according to claim 1, characterized in that The calculating, based on the smooth particle fluid dynamics physics formula and according to the initial crowd data, the first motion trajectory information of the particle after the preset initial moment includes: For each particle, obtaining, according to the initial population data, a first coordinate of the particle, a first other particle within a smooth core radius of the particle, a second coordinate of the first other particle, and a mass of the first other particle; Calculating a first density of the particle according to the smooth core radius, the first coordinate, the second coordinate, and the mass based on a smooth particle fluid dynamics physics formula; calculating a first dynamic personal rest density of the particle according to the first density; determining a second dynamic personal rest density of the first other particle based on the first dynamic personal rest density; First motion trajectory information of the particle after the preset initial moment is calculated according to the first dynamic individual static density and the second dynamic individual static density.
3. The method according to claim 2, characterized in that The calculating the first motion trajectory information of the particle after the preset initial moment according to the first dynamic individual static density and the second dynamic individual static density includes: calculating a first pressure of the particle according to the first dynamic personal rest density, and calculating a penetration force of the particle according to the first dynamic personal rest density, the second dynamic personal rest density, the mass, the first coordinate, the second coordinate, and the smooth core radius; calculating a second pressure of the first other particle according to the second dynamic individual static density; calculating an acceleration of the particle according to a navigation item of the particle, an artificial viscosity item, a boundary force generated by an obstacle corresponding to the particle, the mass, the first pressure, the first dynamic personal rest density, the second pressure, the second dynamic personal rest density, the penetration force, the first coordinate, the second coordinate, and the smooth kernel radius; A first predicted coordinate of the particle at a first time to be predicted is obtained based on the acceleration, and a second predicted coordinate of the particle at a second time to be predicted is continuously calculated based on the first predicted coordinate until an end point is reached, thereby obtaining first motion trajectory information of the particle after the preset initial time.
4. The method according to claim 1, wherein The using the initial population data to train the initial multi-export neural network model to obtain a first prediction result includes: constructing the initial crowd data into a grid, and encoding the grid into an initial graph structure using the encoder; For each particle, the initial graph structure is filtered according to the neighbor list to obtain a target graph structure corresponding to the particle, wherein the target graph structure includes a target edge set and a target node set; The processor is used to pass messages along the target edge set to obtain updated node features and updated edge features in each round. Every N rounds of message passing are used as a message block. The decoder is used to predict the position of the message block to obtain a second prediction result. Until the preset number of rounds is completed, the second prediction results are weighted and summed to obtain a first prediction result.
5. The method according to claim 1, wherein The performing knowledge distillation on the replication model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the teacher model to obtain an updated replication model includes: Predict the initial crowd data according to the teacher model and the replica model respectively, obtain a third prediction result and a fourth prediction result for each exit, calculate a first teacher distillation loss according to the third prediction result and the fourth prediction result, calculate a first prediction loss according to the fourth prediction result and the true motion trajectory information, calculate a second prediction loss according to the fourth prediction result and the first motion trajectory information, update the weight and bias of the replica model according to the first teacher distillation loss, the first prediction loss, and the second prediction loss, and obtain an updated replica model; The providing feedback to the teacher model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated replication model to obtain an updated teacher model includes: Selecting samples from the initial crowd data, predicting the samples based on the updated replication model to obtain fifth prediction results for each exit, calculating a third prediction loss based on the fifth prediction results and the first motion trajectory information, and updating the weights and biases of the teacher model based on the third prediction loss to obtain an updated teacher model; The performing of knowledge distillation on the student model based on the initial crowd data, the real motion trajectory information, the first motion trajectory information, and the updated teacher model to obtain a trained multi-export neural network model includes: The initial crowd data is predicted respectively according to the updated teacher model and the student model, and the sixth prediction result and the seventh prediction result of each exit are obtained. The second teacher distillation loss is calculated according to the sixth prediction result and the seventh prediction result, the fourth prediction loss is calculated according to the seventh prediction result and the true motion trajectory information, the fifth prediction loss is calculated according to the seventh prediction result and the first motion trajectory information, the total self-distillation loss is calculated according to the seventh prediction result, the total loss is calculated according to the second teacher distillation loss, the fourth prediction loss, the fifth prediction loss and the total self-distillation loss, the weight and bias of the student model are updated according to the total loss, and the trained multi-export neural network model is obtained.
6. A macro crowd simulation device, characterized in that: The device comprises: an acquisition module, configured to construct crowd trajectory data into particles, acquire initial crowd data of the particles at a preset initial moment and real motion trajectory information after the preset initial moment, and calculate first motion trajectory information of the particles after the preset initial moment based on the initial crowd data based on the physical formula of smoothed particle fluid dynamics; a training module, configured to construct a target initial multi-outlet neural network model including an optimal initial weight and an optimal initial deviation based on the initial crowd data, the first motion trajectory information, and the actual motion trajectory information, and train the target initial multi-outlet neural network model based on the initial crowd data, the actual motion trajectory information, and the first motion trajectory information to obtain a trained multi-outlet neural network model; A prediction module is used to obtain crowd data for which position prediction is to be performed, and to perform multi-export prediction on the crowd data using the multi-export neural network model to obtain movement trajectory information after the moment the crowd data is located; The training module is configured to construct an initial multi-outlet neural network model using an encoder, a processor, and a decoder; create a solution space including initial weights and initial biases using a Harris Hawk algorithm; train the initial multi-outlet neural network model using the initial population data by simulating a Harris Hawk hunting process to obtain a first prediction result; calculate a first loss based on the first prediction result and the true motion trajectory information; and calculate a second loss based on the first prediction result and the first motion trajectory information; iterate the training until a preset stopping condition is met, and obtain optimal initial weights and optimal initial biases in the solution space; and determine the initial multi-outlet neural network model including the optimal initial weights and the optimal initial biases as a target initial multi-outlet neural network model; The training module is used to construct a teacher model and a student model corresponding to the target initial multi-export neural network model, wherein the optimal initial weights and the optimal initial deviations of the teacher model and the student model are different, the number of layers of the teacher model is deeper than the number of layers of the student model, and the dimension of the teacher model is wider than the dimension of the student model; construct a copy model of the student model; perform knowledge distillation on the copy model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the teacher model to obtain an updated copy model; perform feedback on the teacher model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated copy model to obtain an updated teacher model; perform knowledge distillation on the student model according to the initial crowd data, the real motion trajectory information, the first motion trajectory information and the updated teacher model to obtain a trained multi-export neural network model.
7. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the macro-crowd simulation method according to any one of claims 1 to 5 is implemented.
8. A computer device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein: When the processor executes the computer program, the macro-crowd simulation method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Crowd behavior simulation model training method, crowd simulation method, device and equipment
CN115713030A
Unmanned aerial vehicle city inspection system and method
CN115713174A