A multi-camera indoor pedestrian abnormal trajectory warning method, device and medium
By jointly positioning and constructing the GOLO model and Social-DWTimesNet model with multiple cameras, combined with dilated convolution and weight normalization, and using the PBT algorithm to optimize parameters, the problem of insufficient accuracy and efficiency in indoor pedestrian trajectory prediction is solved, achieving more accuracy and efficiency. trajectory prediction and early warning.
Patent Information
- Application Number
- CN202410147007.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-01
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-02-01
AI Technical Summary
Existing indoor pedestrian trajectory prediction methods have shortcomings in accuracy and efficiency. In particular, the YOLOv5 model is not accurate enough for pedestrian tracking over a period of time, making it difficult to provide accurate trajectory prediction in complex indoor environments.
Multi-camera joint positioning is used to construct the trajectory prediction model S-GOLO, which includes the GOLO model and the Social-DWTimesNet model. It combines dilated convolution and weight standardization, introduces the Social structure, and uses the PBT algorithm to optimize the model parameters to achieve accurate prediction and prediction of pedestrian trajectories. Early warning.
It improves the accuracy and speed of pedestrian trajectory prediction, reduces monitoring blind spots, enriches pedestrian positioning information, solves the problem of interaction between surrounding pedestrians, and saves training time.
Smart Images

Figure CN118037764B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision technology, and in particular relates to a method, device and medium for early warning of abnormal indoor pedestrian trajectories using multiple cameras. Background Art
[0002] Indoor space is where human activities are most concentrated and active, and is also the production and living space for most people, such as shopping malls, homes, factories, etc. These indoor areas have complex layouts and wide spatial distribution, and can be used for various functional needs.
[0003] Thanks to the development of computer vision in recent years, the application of computer vision technology in scenarios such as intelligent security and indoor positioning has become more and more widespread. For indoor area monitoring with limited accuracy and efficiency, it is possible to track the walking path of pedestrians and predict the walking trajectory of the next stage, so as to predict the trend of entering a certain area such as a warehouse or construction area in advance, save the on-site video, avoid disputes afterwards, and then combine the target detection technology to locate pedestrians in the area. The above method can not only detect pedestrians who are already in the indoor area, but also perceive the intention of pedestrians to enter illegal areas in advance and issue warnings.
[0004] Among the current detection methods, YOLOv5 is a stable and commonly used model with good detection effect, but it is still not accurate enough for pedestrian tracking over a period of time. A more accurate pedestrian trajectory prediction method for indoor environments is needed. Summary of the invention
[0005] Purpose of the invention: The present invention proposes a multi-camera indoor pedestrian abnormal trajectory warning method, device and medium, which effectively improves the accuracy of indoor pedestrian trajectory prediction.
[0006] Technical solution: The multi-camera indoor pedestrian abnormal trajectory early warning method described in the present invention comprises the following steps:
[0007] (1) Obtain images from each camera, annotate the target video to be detected, obtain a pedestrian target tracking dataset, and transmit the video to the cloud;
[0008] (2) Establish a two-level coordinate system using the images monitored by cameras at different angles as a plane, jointly locate the target position and record it;
[0009] (3) Constructing a trajectory prediction model S-GOLO including a GOLO model and a Social-DWTimesNet model; the GOLO model is a combination model of YOLOv5 and GRU; the Social-DWTimesNet model replaces the Inception structure with a two-layer convolution structure with a dilation factor based on the TimesNet model, adds weight normalization, and introduces the Social structure;
[0010] (4) The pedestrian target tracking dataset is fed into the GOLO model for pre-training, and its output is the target detection box of the pedestrian in the video frame and the pedestrian trajectory tracking result; the pedestrian historical trajectory in the two-level coordinate system is tracked, and the tracking results are uniformly input into the trajectory prediction model S-GOLO to achieve preliminary prediction of the pedestrian trajectory;
[0011] (5) Using the PBT algorithm to optimize the core parameters of the Social-DWTimesNet model to obtain an optimized trajectory prediction model; the PBT algorithm combines parallel search and sequence optimization;
[0012] (6) The pedestrian positioning and trajectory prediction results are obtained through the optimized trajectory prediction model, and the results are stored in the database to determine the trajectory of pedestrians who are about to enter the illegal area and issue a warning.
[0013] Furthermore, the implementation process of step (2) is as follows:
[0014] Merge the images captured by the camera, establish a vertical coordinate system based on the plane of the video image, and record the coordinates of the center point of the pedestrian detection frame; obtain the image from the overhead camera, establish a horizontal coordinate system, and record the coordinates of the pedestrian's position relative to the ground in the video from a bird's-eye view.
[0015] Furthermore, the expansion factor in step (3) is used to increase the receptive field of the convolution kernel and extract more features. The specific implementation process is as follows:
[0016] In the original features, the dilated convolution can increase the mapping range of the convolution kernel without changing the amount of calculation. The size of the dilated convolution kernel is calculated by the following formula:
[0017] D_kernel=dilation×(kernel_size-1)+1
[0018] Among them, D_kernel represents the size of the dilated convolution kernel, dilation represents the size of the dilation factor, and kernel_size represents the original convolution kernel size;
[0019] After using the dilated convolution, the padding of the original feature is calculated by the following formula:
[0020]
[0021] Among them, stride represents the step size, N represents the image dimension, kernel_size represents the size of the convolution kernel, and dilation represents the size of the expansion factor;
[0022] The convolution used is the SAME mode, that is, the size of the output after convolution is the same as the input size; during calculation, the center of the convolution kernel is aligned with the first point of the input as the starting position of the convolution kernel, and then the padding is filled.
[0023] Furthermore, the weight normalization in step (3) decomposes the neural network weight w into vector directions The modulus g of the vector is converted as follows:
[0024]
[0025] in, is a vector of the same dimension as w, ||v|| is the Euclidean norm, v is the unit vector that determines the direction of w, and g is a scalar that determines the length of w.
[0026] Furthermore, the Social structure described in step (3) connects the DWTimesNet models corresponding to adjacent sequences and introduces a social pooling layer, so that the DWTimesNet models of spatially proximal sequences share hidden states with each other. In a scene, each pedestrian has an independent DWTimesNet for trajectory prediction, and each DWTimesNet is connected to each other through a social pooling layer, so that pedestrians in close space can share each other's motion patterns. The hidden states of all DWTimesNet models within a certain radius are collected together and used as the next The input of the time step; the social pooling layer aggregates the motion states of pedestrians of varying numbers into a tensor of uniform size; with the current position of the observed pedestrian as the center, expand the range by a certain radius to find the surrounding pedestrians, that is, the adjacent nodes; for all adjacent nodes, obtain their hidden states after passing through DWTimesNet at the current moment, and the dimension of each state is D; divide the area within a certain radius of the pedestrian to be searched into grids, and the grid shape is N0×N0; aggregate the hidden states of adjacent nodes distributed in the same grid, that is, simply add them, and finally get a tensor of size N0×N0×D:
[0027]
[0028] in, is the hidden state of DWTimesNet corresponding to the jth person at time t-1, L mn[x,y] is a binary function used to determine whether (x,y) is located in the (m,n) cell of the grid. i It represents the adjacent set corresponding to the i-th person.
[0029] Furthermore, the PBT algorithm in step (5) combines parallel search and sequence optimization to achieve the following process:
[0030] Randomly initialize multiple Social-DWTimesNet model parameters to be optimized. During training, set a checkpoint every few steps. Adjust the parameters of each group of Social-DWTimesNet models according to the pros and cons of all Social-DWTimesNet models. If the fit of each group of models is better, continue training. Otherwise, replace them with better model parameters and add random perturbations for further training. Get the optimal model hyperparameters.
[0031] Furthermore, the implementation process of the PBT algorithm in step (5) to optimize the core parameters of the Social-DWTimesNet model is as follows:
[0032] Randomly initialize a set of parameters of the Social-DWTimesNet model, including learning rate, model dimension, and batch_size; create a group of PBT algorithms through this set of models;
[0033] Each group of Social-DWTimesNet models in the group is trained and evaluated separately. The trajectory prediction data is used for training and the error index of the trajectory prediction results is used for evaluation to measure its performance on the task.
[0034] Some noise is introduced into each Social-DWTimesNet model, and the model parameters are updated; selective parameter exchange is performed according to the performance of the model, and the parameters of the Social-DWTimesNet model with the best performance are copied and applied to other Social-DWTimesNet models in the group; the optimized Social-DWTimesNet model is obtained after multiple iterations.
[0035] A device according to the present invention includes a memory and a processor, wherein:
[0036] A memory for storing computer programs that can be run on the processor;
[0037] The processor is used to execute the steps of the above-mentioned multi-camera indoor pedestrian abnormal trajectory warning method when running the computer program.
[0038] A storage medium described in the present invention stores a computer program on the storage medium, and when the computer program is executed by at least one processor, the steps of the indoor pedestrian abnormal trajectory warning method with multiple cameras as described above are implemented.
[0039] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects: When predicting the walking trajectory of pedestrians, the present invention improves the convolution module and adds weight normalization to address the problems of long running time and insufficient accuracy of the original TimesNet model, and introduces a Social structure to solve the problem of mutual influence between surrounding pedestrians, thereby improving the applicability and prediction speed of the model in pedestrian trajectory prediction; when setting the parameters of the model, a PBT algorithm combining the two characteristics of parallel search and sequence optimization is used, which makes it possible to utilize the optimization information between different parameters of the same model while saving training time; the present invention uses multiple cameras with different viewing angles to monitor indoor areas, reduces monitoring blind spots, and enriches the relevant information of pedestrian positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flow chart of a multi-camera pedestrian abnormal trajectory warning method.
[0041] Figure 2 It is a schematic diagram of the GOLO model structure;
[0042] Figure 3 This is a schematic diagram of the structure of Social-DWTimesNet;
[0043] Figure 4 It is a schematic diagram of the PBT algorithm. DETAILED DESCRIPTION
[0044] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0045] like Figure 1 As shown, the present invention proposes a multi-camera indoor pedestrian abnormal trajectory warning method, which specifically includes the following steps:
[0046] Step 1: Use cameras at different angles to obtain indoor surveillance images, annotate the target video to be detected, obtain the indoor pedestrian target tracking dataset, and transmit the video to the local computer.
[0047] Step 2: Use the images monitored by the roof camera and the corner camera as the plane to establish a horizontal ground coordinate system and a vertical coordinate system, jointly locate the target position and record it. The precise coordinates of the pedestrian are: in, represents the coordinate value of the i-th pedestrian on the x-axis in the vertical coordinate system, represents the coordinate value of the i-th pedestrian on the y-axis in the vertical coordinate system, represents the coordinate value of the i-th pedestrian on the x-axis in the horizontal coordinate system, It represents the coordinate value of the i-th pedestrian on the y-axis in the horizontal coordinate system.
[0048] Step 3: If Figure 2 , Figure 3 As shown, a trajectory prediction model S-GOLO including a GOLO model and a Social-DWTimesNet model is constructed; the GOLO model is a combination model of YOLOv5 and GRU (Gated Recurrent Unit); the Social-DWTimesNet model replaces the Inception structure with a two-layer convolution structure with a dilation factor on the basis of the TimesNet model, adds weight normalization, and introduces the Social structure to track indoor pedestrian targets.
[0049] YOLOv5 has an outstanding target detection capability, but it lacks target tracking over a period of time. The GRU network structure makes up for this problem and takes the temporal relationship of the target into consideration.
[0050] The Social-DWTimesNet model improves the convolution structure based on the TimesNet model. It replaces the Inception structure with a two-layer convolution structure with a dilation factor, adds weight normalization, and introduces the Social structure.
[0051] The dilation factor is used to increase the receptive field of the convolution kernel, thereby extracting more features. In the original features, the dilated convolution can increase the mapping range of the convolution kernel, while the amount of calculation will not change. The size of the dilated convolution kernel can be calculated by the following formula:
[0052] D_kernel=dilation×(kernel_size-1)+1
[0053] Among them, D_kernel represents the size of the dilated convolution kernel, dilation represents the size of the dilation factor, and kernel_size represents the original convolution kernel size.
[0054] After using the dilated convolution, the padding of the original feature can be calculated by the following formula:
[0055]
[0056] Among them, stride represents the step size, N represents the image dimension, kernel_size represents the size of the convolution kernel, and dilation represents the size of the expansion factor.
[0057] The convolution used in the model is the SAME mode, that is, the size of the output after convolution is the same as the input size (stride = 1). When calculating, align the center of the convolution kernel with the first point of the input as the starting position of the convolution kernel, and then fill in the padding.
[0058] Weight Normalization is a type of normalization that can speed up model convergence. It decomposes the neural network weight w into vector directions. The modulus g of the vector is converted as follows:
[0059]
[0060] in, is a vector of the same dimension as w, ||v|| is the Euclidean norm, v is the unit vector that determines the direction of w, and g is a scalar that determines the length of w.
[0061] The Social structure takes into account the problem of indoor pedestrians being close to each other and the influence between individuals, which enhances the original model's ability to predict pedestrian trajectories. The Social structure connects the DWTimesNet models corresponding to adjacent sequences and introduces a social pooling layer, so that the DWTimesNet models of spatially proximal sequences share hidden states with each other.
[0062] In a scene, each pedestrian has an independent DWTimesNet model for trajectory prediction. The DWTimesNet modules are connected to each other through the social pooling layer, which enables pedestrians in close space to share each other's motion patterns. The hidden states of all DWTimesNets within a certain radius are gathered together and used as input for the next time step. The number of pedestrians around each pedestrian is not fixed. In order to overcome the problem of uneven numbers of pedestrians around, the social pooling layer aggregates the motion states of pedestrians of varying numbers into a tensor of uniform size.
[0063] The steps of the social pooling layer to aggregate tensors are:
[0064] Taking the current position of the observed pedestrian as the center, expand the range within a certain radius to search for pedestrians around, that is, adjacent nodes; for all adjacent nodes, obtain their hidden states after passing through DWTimesNet at the current moment, and the dimension of each state is D; divide the area within a certain radius of the pedestrian to be searched into grids, and the grid shape is N0×N0; aggregate the hidden states of adjacent nodes distributed in the same grid, that is, simply add them, and finally get a tensor of size N0×N0×D, which can be calculated using the following formula:
[0065]
[0066] in, is the hidden state of DWTimesNet corresponding to the jth person at time t-1, L mn [x,y] is a binary function used to determine whether (x,y) is located in the (m,n) cell of the grid. i It represents the adjacent set corresponding to the i-th person.
[0067] Step 4: The pedestrian target tracking dataset is fed into the GOLO model for pre-training, and its output is the target detection box of the pedestrian in the video frame and the trajectory tracking result of the pedestrian; the historical trajectory of the pedestrian in the two-level coordinate system is tracked, and the tracking results are uniformly input into the trajectory prediction model S-GOLO to achieve preliminary prediction of the pedestrian trajectory.
[0068] Step 5: Use the PBT algorithm to optimize the core parameters of the Social-DWTimesNet model.
[0069] The PBT algorithm combines the two parameter adjustment ideas of parallel search and sequential optimization: randomly initialize multiple model parameters to be optimized, set a checkpoint every few steps during training; adjust the parameters of its own model according to the pros and cons of other models, and continue training if the fit of its own model is better, otherwise replace (exploit) with better model parameters, add random perturbations (explore) and then train again; after a period of training, the optimal model hyperparameters are obtained.
[0070] The PBT algorithm optimizes the core parameters of the Social-DWTimesNet model: randomly initialize a set of Social-DWTimesNet model parameters, including learning rate, model dimension, and batch_size; create a group of PBT algorithms through this group of models; train and evaluate each model in the group separately, use trajectory prediction data for training, and use the error indicator of trajectory prediction results for evaluation to measure its performance on the task; introduce some noise to each Social-DWTimesNet model and update the model parameters; perform selective parameter exchange based on the performance of the model, copy the parameters of the Social-DWTimesNet model with the best performance, and apply it to other models in the group; obtain the optimized Social-DWTimesNet model after multiple iterations.
[0071] Step 6: Obtain the results of pedestrian positioning and trajectory prediction through the optimized trajectory prediction model, and store the results in the database to determine the trajectory of pedestrians who are about to enter illegal areas (such as warehouses, construction areas, near safes, etc.) and issue warnings.
[0072] The trajectory is the specific coordinate data of the pedestrian's trajectory, including the pedestrian's dual-coordinate positioning. The walking route is drawn in the video based on the trajectory coordinates in the server for visualization and subsequent management.
[0073] The present invention also provides a device, including a memory and a processor, wherein: the memory is used to store a computer program that can be run on the processor; the processor is used to execute the steps of the above-mentioned multi-camera indoor pedestrian abnormal trajectory warning method when running the computer program.
[0074] The present invention also provides a storage medium having a computer program stored thereon, and when the computer program is executed by at least one processor, the steps of the method for early warning of abnormal indoor pedestrian trajectories using multiple cameras as described above are implemented.
[0075] The present invention is not limited to the above-mentioned specific implementation cases. Within the knowledge scope of those skilled in the art, any equivalent replacement or change of the technical solution and the inventive concept according to the present invention should be included in the protection scope of the present invention.
Claims
1. A multi-camera indoor pedestrian abnormal trajectory early warning method, characterized in that: The following steps are involved: (1) Obtain images from each camera, annotate the target video to be detected, obtain a pedestrian target tracking dataset, and transmit the video to the cloud; (2) Using the images monitored by cameras at different angles as the plane, a two-level coordinate system is established to jointly locate and record the target position; (3) Constructing a trajectory prediction model S-GOLO including a GOLO model and a Social-DWTimesNet model; the GOLO model is a combination model of YOLOv5 and GRU; the Social-DWTimesNet model replaces the Inception structure with a two-layer convolution structure with a dilation factor based on the TimesNet model, adds weight normalization, and introduces the Social structure; (4) The pedestrian target tracking dataset is fed into the GOLO model for pre-training, and its output is the target detection box of the pedestrian in the video frame and the trajectory tracking result of the pedestrian; Track the pedestrian's historical trajectory in the two-level coordinate system, and input the tracking results into the trajectory prediction model S-GOLO to achieve preliminary prediction of pedestrian trajectory; (5) Using the PBT algorithm to optimize the core parameters of the Social-DWTimesNet model to obtain an optimized trajectory prediction model; the PBT algorithm combines parallel search and sequence optimization; (6) The pedestrian positioning and trajectory prediction results are obtained through the optimized trajectory prediction model, and the results are stored in the database to determine the trajectory of pedestrians who are about to enter the illegal area and issue a warning; The Social structure described in step (3) connects the DWTimesNet models corresponding to adjacent sequences and introduces a social pooling layer. The DWTimesNet models of spatially proximal sequences share hidden states with each other. In a scene, each pedestrian has an independent DWTimesNet for trajectory prediction. The DWTimesNet models are connected to each other through the social pooling layer, so that pedestrians in close space can share each other's motion patterns. The hidden states of all DWTimesNet models within a certain radius are collected together and used as the input of the next time step. The social pooling layer The motion states of pedestrians of varying numbers are aggregated into a tensor of uniform size; with the current position of the observed pedestrian as the center, the surrounding pedestrians, i.e., adjacent nodes, are searched for within a certain radius; for all adjacent nodes, their hidden states after passing through DWTimesNet at the current moment are obtained, and the dimension of each state is D; the area within a certain radius of the pedestrian being searched is divided into grids, and the grid shape is N0×N0, where N0 means that the area contains N0 grids in both the vertical and horizontal directions; the hidden states of adjacent nodes distributed in the same grid are aggregated, i.e., simply added, and finally a tensor of size N0×N0×D is obtained: in, represents the trajectory characteristics of the i-th pedestrian at position (m, n) at time t, is the hidden state of DWTimesNet corresponding to the jth person at time t-1, L mn [x,y] is a binary function used to determine whether (x,y) is located in the (m,n) cell of the grid. i It represents the adjacent set corresponding to the i-th person, and denote the x and y coordinates of pedestrian j at time t, respectively. and They represent the x and y coordinates of pedestrian i at time t respectively.
2. The method for early warning of abnormal indoor pedestrian trajectories using multiple cameras according to claim 1, characterized in that: The implementation process of step (2) is as follows: Merge the images captured by the camera, establish a vertical coordinate system based on the plane of the video image, and record the coordinates of the center point of the pedestrian detection frame; obtain the image from the overhead camera, establish a horizontal coordinate system, and record the coordinates of the pedestrian's position relative to the ground in the video from a bird's-eye view.
3. The method for early warning of abnormal indoor pedestrian trajectories using multiple cameras according to claim 1, characterized in that: The expansion factor in step (3) is used to increase the receptive field of the convolution kernel and extract more features. The specific implementation process is as follows: In the original features, the dilated convolution can increase the mapping range of the convolution kernel without changing the amount of calculation. The size of the dilated convolution kernel is calculated by the following formula: D_kernel=dilation×(kernel_size-1)+1 Among them, D_kernel represents the size of the dilated convolution kernel, dilation represents the size of the dilation factor, and kernel_size represents the original convolution kernel size; After using the dilated convolution, the padding of the original feature is calculated by the following formula: Among them, stride represents the step size, N represents the image dimension, kernel_size represents the size of the convolution kernel, and dilation represents the size of the expansion factor; The convolution used is the SAME mode, that is, the size of the output after convolution is the same as the input size; during calculation, the center of the convolution kernel is aligned with the first point of the input as the starting position of the convolution kernel, and then the padding is filled.
4. The method for early warning of abnormal indoor pedestrian trajectories using multiple cameras according to claim 1, characterized in that: The weight normalization in step (3) decomposes the neural network weight w into vector directions The modulus g of the vector is converted as follows: in, is a vector of the same dimension as w, ||v|| is the Euclidean norm, v is the unit vector that determines the direction of w, and g is a scalar that determines the length of w.
5. The method for early warning of abnormal indoor pedestrian trajectories using multiple cameras according to claim 1, characterized in that: The PBT algorithm described in step (5) combines parallel search and sequence optimization to achieve the following process: Randomly initialize multiple Social-DWTimesNet model parameters to be optimized. During training, set a checkpoint every few steps; adjust the parameters of each group of Social-DWTimesNet models according to the pros and cons of all Social-DWTimesNet models.
6. The method for early warning of abnormal indoor pedestrian trajectories using multiple cameras according to claim 1, characterized in that: The implementation process of the PBT algorithm in step (5) to optimize the core parameters of the Social-DWTimesNet model is as follows: Randomly initialize a set of parameters of the Social-DWTimesNet model, including learning rate and model dimension; create a group of PBT algorithms through this set of models; Each group of Social-DWTimesNet models in the group is trained and evaluated separately. The trajectory prediction data is used for training and the evaluation indicators of the trajectory prediction results are used for evaluation to measure its performance on the task. Some noise is introduced into each Social-DWTimesNet model, and the model parameters are updated; selective parameter exchange is performed according to the performance of the model, and the parameters of the Social-DWTimesNet model with the best performance are copied and applied to other Social-DWTimesNet models in the group; the optimized Social-DWTimesNet model is obtained after multiple iterations.
7. A device, characterized in that: comprising a memory and a processor, wherein: A memory for storing computer programs that can be run on the processor; A processor is used to execute the steps of the multi-camera indoor pedestrian abnormal trajectory warning method as described in any one of claims 1 to 6 when running the computer program.
8. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by at least one processor, implements the steps of the multi-camera indoor pedestrian abnormal trajectory warning method as described in any one of claims 1 to 6.
