A method for detecting abnormal passenger flow in public transportation
Through the improved object detection algorithm and LSTM model, the video data of public transportation is analyzed, real-time detection of passenger flow in public transportation and prediction of passenger flow in the future is achieved, the problem of abnormal prediction of passenger flow in public transportation is solved, and traffic management efficiency is improved.
Patent Information
- Application Number
- CN202111495301.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2041-12-08
AI Technical Summary
How to extract intuitive, accurate and real-time traffic flow information from massive dynamic traffic flow data, realize real-time detection of passenger flow in public transportation and forecasting of passenger flow at future moments, so as to guide passenger flow before abnormal public transportation passenger flow.
An improved object detection algorithm is used to detect public transportation video data, and a passenger flow prediction model based on the object detection results is constructed using the LSTM model. Parameter optimization of the passenger flow prediction model through conjugate gradient algorithm to achieve accurate prediction of the passenger flow at the next moment.
Real-time detection of passenger flow in public transportation and passenger flow prediction at future moments are realized, and passenger flow can be guided before abnormal passenger flow in public transportation, improving traffic management efficiency and traveler experience.
Smart Images

Figure CN114170550B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video detection, and in particular to a method for detecting abnormal passenger flow in public transportation. Background Art
[0002] With the advancement of urbanization and the rapid growth of motor vehicle ownership, the rapid increase in travel demand has made the phenomenon of urban transportation system supply and demand increasingly serious. How to extract intuitive, accurate and real-time traffic flow information from massive dynamic traffic flow data, and reduce the travel time of travelers by establishing a reasonable model for scientific and rapid passenger flow, has a decisive impact on traffic managers to achieve traffic control and the effective use of public transportation systems.
[0003] In view of this, the present invention proposes a method for detecting abnormal passenger flow in public transportation, which monitors the passenger flow in public transportation in real time by utilizing a target detection algorithm, and predicts the passenger flow at future moments according to the real-time monitoring results, so as to guide the passenger flow before abnormal public transportation passenger flow occurs. Summary of the invention
[0004] The present invention provides a method for detecting abnormal passenger flow in public transportation, the purpose of which is to (1) realize real-time detection of passenger flow in public transportation; and (2) realize prediction of passenger flow in public transportation.
[0005] To achieve the above object, the present invention provides a method for detecting abnormal passenger flow in public transportation, comprising the following steps:
[0006] S1: Collect public transportation video data and use the improved target detection algorithm to perform target detection on the video frames in the collected video data;
[0007] S2: Based on the target detection results in the collected video data, the LSTM model is used to build a passenger flow prediction model based on the target detection results;
[0008] S3: Optimize the parameters of the constructed passenger flow prediction model using the conjugate gradient algorithm to obtain the passenger flow prediction model after parameter tuning;
[0009] S4: Perform target detection on real-time public transportation video, and use the target detection result as the input of the passenger flow prediction model. The passenger flow prediction model predicts the passenger flow at the next moment, and compares the predicted passenger flow at the next moment with the set passenger flow threshold. If the predicted passenger flow is greater than the passenger flow threshold, it means that there is an abnormal public transportation passenger flow and passenger flow diversion is required.
[0010] As a further improvement method of the present invention:
[0011] In the step S1, after collecting the public transportation video data, the collected public transportation video data is divided into a plurality of video frames, including:
[0012] Public transportation video data is collected, and the collected public transportation video data is divided into a number of video frames, and the divided video frames are as follows:
[0013]
[0014] in:
[0015] Indicates t i In a specific embodiment of the present invention, any adjacent time t i ,t i+1 The time difference of the video frames is 10 seconds;
[0016] n represents the total number of video frames into which the public transportation video data is segmented.
[0017] In the step S1, the improved target detection algorithm is used to perform target detection on the video frames in the collected video data, including:
[0018] The improved target detection algorithm is used to perform target detection on the video frames in the collected video data. The process of the improved target detection algorithm is as follows:
[0019] 1) Input the video frames in the video frame set one by one, and input t k Video frame at time Extracting video frames using convolutional neural networks The feature map, where k = 0, 1, 2, ..., n-1, the extraction formula of the feature map is:
[0020]
[0021] in:
[0022] Conv(·) represents convolution processing of the input image; in a specific embodiment of the present invention, the convolution kernel size used in the convolution processing is 5*5 pixels;
[0023] f k Represents a video frame The extracted feature map;
[0024] Then the set of feature maps generated by the convolutional neural network is {f0,f1,…,f k ,…,f n-1};
[0025] 2) The generated feature maps are input into the region generation network in sequence. The region generation network divides the feature map into 4 sub-regions of equal size and generates M anchor boxes in each sub-region;
[0026] 3) Manually annotate anchor frames through some video frames, randomly select K annotated anchor frames as class centers, calculate the distances between other annotated anchor frames and the K class centers, select the class center with the closest distance and incorporate it into the class, and calculate the mean length and width of all annotated anchor frames of each class. j , weight j , where length j represents the mean length of the anchor box in the jth class, weight j Represents the mean width of the anchor box in the jth class, forming a length j is length, weight j The wide anchor box is used as the class center of the jth class; reclassify until the algorithm stops;
[0027] 4) Repeat step 3) 10 times, and finally obtain the average of the length and width of the K class center anchor boxes as the length and width of the generated anchor box;
[0028] 5) The probability of the existence of an object in each anchor box is determined by using a region generation network, and the loss function of the region generation network is:
[0029]
[0030] in:
[0031] p i is the true probability of the existence of the target in the i-th training anchor box, p i ={0,1},p i = 0 means that there is no target in the i-th training anchor box, p i =1 means there is an object in the i-th training anchor box; Represents the probability that the i-th training anchor box output by the region generation network has an object;
[0032] u i represents the location coordinates of the target, Represents the position coordinates of the i-th training anchor box output by the region generation network;
[0033] L cls represents the binary classification loss, L reg represents the position regression loss;
[0034] 6) The anchor frame is modified in the candidate area containing the target, that is, the intersecting anchor frames are regarded as an anchor frame set, and the anchor frames are scored according to the target detection probability in the anchor frame set. The anchor frame ci The probability of the existence of the target is p, then the anchor box c i The score is p; select the highest score and the corresponding anchor box in the anchor box set, and traverse the remaining anchor boxes c j , if the anchor box c j If the IOU area of the anchor box with the current highest score is greater than the threshold ε, the anchor box c j Delete, the calculation formula of the IOU area is:
[0035] IOU(c j ,c max )=area(c j ∩c max ) / area(c j ∪c max )
[0036] in:
[0037] area(·) represents the area of the anchor box;
[0038] c max Indicates the anchor box corresponding to the highest score in the anchor box set;
[0039] 7) The feature map marked by the anchor box is used as the target detection result, where the position marked by the anchor box is the detected target, and the target detection result vector is: F = {f′0, f′1, …, f′ k ,…,f′ n-1}, where f′ k For video frames The corresponding target detection results marked with anchor boxes.
[0040] In step S2, the LSTM model is used to build a passenger flow prediction model based on the target detection results, including:
[0041] The LSTM model is used to construct a passenger flow prediction model. The steps of constructing the passenger flow prediction model are as follows:
[0042] Construct the forget gate of the passenger flow prediction model:
[0043]
[0044] in:
[0045] F is the target detection result vector;
[0046] W, U are weight matrices; V represents a diagonal matrix;
[0047] is the current time t n-1 The activity value, Indicates the cell state at the previous moment;
[0048] Update the forget gate parameters of the passenger flow prediction model:
[0049]
[0050] The output of the passenger flow prediction model is:
[0051]
[0052] in:
[0053] Indicates that at the future time t n passenger flow.
[0054] In step S3, the conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model, including:
[0055] The objective function of establishing the passenger flow prediction model is:
[0056]
[0057] in:
[0058] With t k-1 The target detection result before time t is used as the input of the passenger flow prediction model, and the output is t k Passenger flow at any given moment;
[0059] Represents the t detected by the target detection algorithm k Passenger flow at any given moment;
[0060] F represents the target detection result input into the passenger flow prediction model;
[0061] The conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model. The parameter optimization process is as follows:
[0062] 1) Calculate the gradient g of the objective function G(F), then at t k The objective function gradient at the moment is g k ;
[0063] 2) Initialize the target detection result at time t0 to 0, t k Target detection results at each moment Indicates t k The target detection result vector {f′0,f′1,…,f′ k-1}; The initial value of t is 0;
[0064] 3) If || g k||<∈, then stop parameter optimization, and the model parameters are optimal parameters, where ∈ represents the optimization threshold; otherwise go to 4); in a specific embodiment of the present invention, the parameters to be optimized include a weight matrix and a diagonal matrix;
[0065] 4) Take the step size coefficient Parameter factor d k satisfy Where T represents transpose;
[0066] 5) Calculate the step size coefficient:
[0067]
[0068] Determine the step size coefficient α of the algorithm according to the above two formulas;
[0069] 6) Then t k Time turns to t k +αd k moment, and return to step 3).
[0070] In the step S4, target detection is performed on the real-time public transportation video, and the target detection result is used as the input of the passenger flow prediction model, including:
[0071] An improved target detection algorithm is used to perform target detection on real-time public transportation videos. The target detection results at the current moment and the target detection results at historical moments are used as inputs to the passenger flow prediction model after parameter optimization. The passenger flow prediction model outputs the prediction results for the passenger flow at the next moment in public transportation.
[0072] The step S4 compares the predicted passenger flow at the next moment with the set passenger flow threshold, including:
[0073] According to the passenger flow prediction model, the predicted passenger flow at the next moment in public transportation is compared with the set passenger flow threshold. For comparison, if the predicted passenger flow is greater than the passenger flow threshold This indicates that there is an abnormality in the passenger flow of public transportation and passenger flow diversion is required;
[0074] In a specific embodiment of the present invention, the present invention monitors the passenger flow in public transportation in real time by utilizing a target detection algorithm, and predicts the passenger flow at future moments based on the real-time monitoring results, thereby guiding the passenger flow before abnormal public transportation passenger flow occurs.
[0075] Compared with the prior art, the present invention proposes a method for detecting abnormal passenger flow in public transportation, which has the following advantages:
[0076] First, this scheme improves the traditional target detection algorithm, inputs the video frames in the video frame set in sequence, and k Video frame at time Extracting video frames using convolutional neural networks The feature map, where k = 0, 1, 2, ..., n-1, the extraction formula of the feature map is:
[0077]
[0078] Where: Conv(·) represents the convolution processing of the input image; f k Represents a video frame The extracted feature map; then the set of feature maps generated by the convolutional neural network is {f0,f1,…,f k ,…,f n-1}; The generated feature maps are input into the region generation network in sequence. The region generation network divides the feature map into 4 sub-regions of equal size and generates M anchor boxes in each sub-region; the anchor boxes are manually annotated through some video frames, and K annotated anchor boxes are randomly selected as class centers. For other annotated anchor boxes, the distances with the K class centers are calculated respectively, and the class center with the closest distance is selected and incorporated into the class. For all the annotated anchor boxes of each class, the mean length and width of the annotated anchor boxes are calculated. j , weight j , where length j represents the mean length of the anchor box in the jth class, weight j Represents the mean width of the anchor box in the jth class, forming a length j is length, weight j The widest anchor box is used as the class center of the jth class; reclassification is performed until the algorithm stops, and the average of the length and width of the K class center anchor boxes finally obtained is used as the length and width of the generated anchor box; the probability of the existence of an object in each anchor box is determined by using the region generation network, and the loss function of the region generation network is:
[0079]
[0080] Where: p i is the true probability of the existence of the target in the i-th training anchor box, p i ={0,1},p i = 0 means that there is no target in the i-th training anchor box, p i =1 means there is an object in the i-th training anchor box; represents the probability that the i-th training anchor box output by the region generation network has an object; u i represents the location coordinates of the target, Represents the position coordinates of the i-th training anchor box output by the region generation network; L cls represents the binary classification loss, L reg represents the position regression loss; the anchor frame is modified in the candidate area containing the target, that is, the intersecting anchor frames are regarded as an anchor frame set, and the anchor frames are scored according to the target detection probability in the anchor frame set. The anchor frame c i The probability of the existence of the target is p, then the anchor box c i The score is p; select the highest score and the corresponding anchor box in the anchor box set, and traverse the remaining anchor boxes c j , if the anchor box c j If the IOU area of the anchor box with the current highest score is greater than the threshold ε, the anchor box c j Delete, the calculation formula of the IOU area is:
[0081] IOU(c j ,c max )=area(c j ∩c max ) / area(c j ∪c max )
[0082] Among them: area(·) represents the area of the anchor box; c max represents the anchor box with the highest score in the anchor box set; the feature map marked by the anchor box is used as the target detection result, where the position marked by the anchor box is the detected target, and the target detection result vector is: F = {f′0, f′1, …, f′ k ,…,f′ n-1}, where f′ k For video frames The corresponding target detection result with anchor box mark. Compared with the traditional target detection algorithm, the present invention uses clustering method to determine the optimal scale of the target mark anchor box, avoiding the problem of inaccurate target detection quantity caused by the target mark anchor box being too large or too small, and achieving more accurate target detection.
[0083] At the same time, this scheme proposes a passenger flow prediction model optimization strategy based on the conjugate gradient algorithm, by establishing the objective function of the passenger flow prediction model:
[0084]
[0085] in: With t k-1 The target detection result before time t is used as the input of the passenger flow prediction model, and the output is t k Passenger flow at any given moment; Represents the t detected by the target detection algorithm kThe passenger flow at the moment; F represents the target detection result of the input passenger flow prediction model; the conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model, and the parameter optimization process is as follows: 1) Calculate the gradient g of the objective function G(F), then at t k The objective function gradient at the moment is g k ; 2) Initialize the target detection result 0 at time t0, t k Target detection results at each moment Indicates t k The target detection result vector {f′0,f′1,…,f′ k-1}; The initial value of t is 0; 3) If || g k ||<∈, then stop parameter optimization, at this time the model parameters are the optimal parameters, where ∈ represents the optimization threshold; otherwise go to 4); 4) take the step size coefficient Parameter factor d k satisfy Where T represents transpose; 5) Calculate the step size coefficient:
[0086]
[0087] According to the above two formulas, the step coefficient α of the algorithm is determined; 6) then t k Time turns to t k +αd k time, and returns to step 3). Therefore, compared with the traditional solution, this solution uses the target detection algorithm to monitor the passenger flow in public transportation in real time, and predicts the passenger flow at future times based on the real-time monitoring results, so as to guide the passenger flow before the public transportation passenger flow abnormality occurs. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 A schematic diagram of a flow chart of a method for detecting abnormal passenger flow in public transportation provided by an embodiment of the present invention;
[0089] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0090] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0091] S1: Collect public transportation video data, and use an improved target detection algorithm to perform target detection on video frames in the collected video data.
[0092] In the step S1, after collecting the public transportation video data, the collected public transportation video data is divided into a plurality of video frames, including:
[0093] Public transportation video data is collected, and the collected public transportation video data is divided into a number of video frames, and the divided video frames are as follows:
[0094]
[0095] in:
[0096] Indicates t i In a specific embodiment of the present invention, any adjacent time t i ,t i+1 The time difference of the video frames is 10 seconds;
[0097] n represents the total number of video frames into which the public transportation video data is segmented.
[0098] In the step S1, the improved target detection algorithm is used to perform target detection on the video frames in the collected video data, including:
[0099] The improved target detection algorithm is used to perform target detection on the video frames in the collected video data. The process of the improved target detection algorithm is as follows:
[0100] 1) Input the video frames in the video frame set one by one, and input t k Video frame at time Extracting video frames using convolutional neural networks The feature map, where k = 0, 1, 2, ..., n-1, the extraction formula of the feature map is:
[0101]
[0102] in:
[0103] Conv(·) represents convolution processing of the input image; in a specific embodiment of the present invention, the convolution kernel size used in the convolution processing is 5*5 pixels;
[0104] f k Represents a video frame The extracted feature map;
[0105] Then the set of feature maps generated by the convolutional neural network is {f0,f1,…,f k ,…,f n-1};
[0106] 2) The generated feature maps are input into the region generation network in sequence. The region generation network divides the feature map into 4 sub-regions of equal size and generates M anchor boxes in each sub-region;
[0107] 3) Manually annotate anchor frames through some video frames, randomly select K annotated anchor frames as class centers, calculate the distances between other annotated anchor frames and the K class centers, select the class center with the closest distance and incorporate it into the class, and calculate the mean length and width of all annotated anchor frames of each class. j , weight j , where length j represents the mean length of the anchor box in the jth class, weight j Represents the mean width of the anchor box in the jth class, forming a length j is length, weight j The wide anchor box is used as the class center of the jth class; reclassify until the algorithm stops;
[0108] 4) Repeat step 3) 10 times, and finally obtain the average of the length and width of the K class center anchor boxes as the length and width of the generated anchor box;
[0109] 5) The probability of the existence of an object in each anchor box is determined by using a region generation network, and the loss function of the region generation network is:
[0110]
[0111] in:
[0112] p i is the true probability of the existence of the target in the i-th training anchor box, p i ={0,1},p i = 0 means that there is no target in the i-th training anchor box, p i =1 means there is an object in the i-th training anchor box; Represents the probability that the i-th training anchor box output by the region generation network has an object;
[0113] u i represents the location coordinates of the target, Represents the position coordinates of the i-th training anchor box output by the region generation network;
[0114] L cls represents the binary classification loss, L reg represents the position regression loss;
[0115] 6) The anchor frame is modified in the candidate area containing the target, that is, the intersecting anchor frames are regarded as an anchor frame set, and the anchor frames are scored according to the target detection probability in the anchor frame set. The anchor frame c i The probability of the existence of the target is p, then the anchor box c i The score is p; select the highest score and the corresponding anchor box in the anchor box set, and traverse the remaining anchor boxes c j , if the anchor box cj If the IOU area of the anchor box with the current highest score is greater than the threshold ε, the anchor box c j Delete, the calculation formula of the IOU area is:
[0116] IOU(c j ,c max )=area(c j ∩c max ) / area(c j ∪c max )
[0117] in:
[0118] area(·) represents the area of the anchor box;
[0119] c max Indicates the anchor box corresponding to the highest score in the anchor box set;
[0120] 7) The feature map marked by the anchor box is used as the target detection result, where the position marked by the anchor box is the detected target, and the target detection result vector is: F = {f′0, f′1, …, f′ k ,…,f′ n-1}, where f′ k For video frames The corresponding target detection results marked with anchor boxes.
[0121] S2: Based on the target detection results in the collected video data, the LSTM model is used to build a passenger flow prediction model based on the target detection results.
[0122] In step S2, the LSTM model is used to build a passenger flow prediction model based on the target detection results, including:
[0123] The LSTM model is used to construct a passenger flow prediction model. The steps of constructing the passenger flow prediction model are as follows:
[0124] Construct the forget gate of the passenger flow prediction model:
[0125]
[0126] in:
[0127] F is the target detection result vector;
[0128] W, U are weight matrices; V represents a diagonal matrix;
[0129] is the current time t n-1 The activity value, Indicates the cell state at the previous moment;
[0130] Update the forget gate parameters of the passenger flow prediction model:
[0131]
[0132] The output of the passenger flow prediction model is:
[0133]
[0134] in:
[0135] Indicates that at the future time t n passenger flow.
[0136] S3: Use the conjugate gradient algorithm to optimize the parameters of the constructed passenger flow prediction model to obtain the passenger flow prediction model after parameter tuning.
[0137] In step S3, the conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model, including:
[0138] The objective function of establishing the passenger flow prediction model is:
[0139]
[0140] in:
[0141] With t k-1 The target detection result before time t is used as the input of the passenger flow prediction model, and the output is t k Passenger flow at any given moment;
[0142] Represents the t detected by the target detection algorithm k Passenger flow at any given moment;
[0143] F represents the target detection result input into the passenger flow prediction model;
[0144] The conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model. The parameter optimization process is as follows:
[0145] 1) Calculate the gradient g of the objective function G(F), then at t k The objective function gradient at the moment is g k ;
[0146] 2) Initialize the target detection result at time t0 to 0, t k Target detection results at each moment Indicates t k The target detection result vector {f′0,f′1,…,f′ k-1}; The initial value of t is 0;
[0147] 3) If || gk ||<∈, then stop parameter optimization, and the model parameters are optimal parameters, where ∈ represents the optimization threshold; otherwise go to 4); in a specific embodiment of the present invention, the parameters to be optimized include a weight matrix and a diagonal matrix;
[0148] 4) Take the step size coefficient Parameter factor d k satisfy Where T represents transpose;
[0149] 5) Calculate the step size coefficient:
[0150]
[0151] Determine the step size coefficient α of the algorithm according to the above two formulas;
[0152] 6) Then t k Time turns to t k +αd k moment, and return to step 3).
[0153] S4: Perform target detection on real-time public transportation video, and use the target detection result as the input of the passenger flow prediction model. The passenger flow prediction model predicts the passenger flow at the next moment, and compares the predicted passenger flow at the next moment with the set passenger flow threshold. If the predicted passenger flow is greater than the passenger flow threshold, it means that there is an abnormal public transportation passenger flow and passenger flow diversion is required.
[0154] In the step S4, target detection is performed on the real-time public transportation video, and the target detection result is used as the input of the passenger flow prediction model, including:
[0155] An improved target detection algorithm is used to perform target detection on real-time public transportation videos. The target detection results at the current moment and the target detection results at historical moments are used as inputs to the passenger flow prediction model after parameter optimization. The passenger flow prediction model outputs the prediction results for the passenger flow at the next moment in public transportation.
[0156] The step S4 compares the predicted passenger flow at the next moment with the set passenger flow threshold, including:
[0157] According to the passenger flow prediction model, the predicted passenger flow at the next moment in public transportation is compared with the set passenger flow threshold. For comparison, if the predicted passenger flow is greater than the passenger flow threshold This indicates that there is an abnormality in the passenger flow of public transportation and passenger flow diversion is required;
[0158] In a specific embodiment of the present invention, the present invention monitors the passenger flow in public transportation in real time by utilizing a target detection algorithm, and predicts the passenger flow at future moments based on the real-time monitoring results, thereby guiding the passenger flow before abnormal public transportation passenger flow occurs.
[0159] It should be noted that the serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0161] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting abnormal passenger flow in public transportation, characterized in that: The method comprises: S1: Collect public transportation video data and use the improved target detection algorithm to perform target detection on the video frames in the collected video data; The improved target detection algorithm process is as follows: S11: Input the video frames in the video frame set in sequence, Video frame at time , extracting video frames using convolutional neural networks The feature map of , the extraction formula of the feature map is: in: Indicates that convolution processing is performed on the input image; Represents a video frame The extracted feature map; Then the set of feature maps generated by the convolutional neural network is ; S12: The generated feature maps are sequentially input into the region generation network, which divides the feature maps into four sub-regions of equal size and generates M anchor boxes in each sub-region; S13: Manually annotate anchor frames through some video frames, randomly select K annotated anchor frames as class centers, calculate the distances between other annotated anchor frames and the K class centers, select the class center with the closest distance and incorporate it into the class, and calculate the mean length and width of all annotated anchor frames of each class. , ,in represents the mean length of the anchor box in the jth class, Represents the mean width of the labeled anchor box in the jth class, forming a For long, The wide anchor box is used as the class center of the jth class; reclassify until the algorithm stops; S14: Repeat step S13 10 times, and finally obtain the average of the length and width of the K class center anchor boxes as the length and width of the generated anchor box; S15: Determine the probability of the existence of an object in each anchor box using a region generation network, where the loss function of the region generation network is: in: is the true probability of the existence of the target in the i-th training anchor frame, , Indicates that there is no target in the i-th training anchor box. Indicates that there is a target in the i-th training anchor box; Represents the probability that the i-th training anchor box output by the region generation network has an object; represents the location coordinates of the target, Represents the position coordinates of the i-th training anchor box output by the region generation network; represents the binary classification loss, represents the position regression loss; S16: The anchor frame is modified in the candidate area containing the target, that is, the intersecting anchor frames are regarded as an anchor frame set, and the anchor frames are scored according to the target detection probability in the anchor frame set. The probability of the existence of a target is p, then the anchor box The score is p; select the highest score and the corresponding anchor box in the anchor box set, and traverse the remaining anchor boxes , if the anchor frame The IOU area with the current highest score anchor box is greater than the threshold , then the anchor box Delete, the calculation formula of the IOU area is: in: represents the area of the anchor box; Indicates the anchor box corresponding to the highest score in the anchor box set; S17: The feature map marked by the anchor frame is used as the target detection result, where the position marked by the anchor frame is the detected target, and the target detection result vector is obtained as: ,in For video frames The corresponding target detection results marked with anchor boxes; S2: Based on the target detection results in the collected video data, the LSTM model is used to build a passenger flow prediction model based on the target detection results; S3: Optimize the parameters of the constructed passenger flow prediction model using the conjugate gradient algorithm to obtain the passenger flow prediction model after parameter tuning; S4: Perform target detection on real-time public transportation video, and use the target detection result as the input of the passenger flow prediction model. The passenger flow prediction model predicts the passenger flow at the next moment, and compares the predicted passenger flow at the next moment with the set passenger flow threshold. If the predicted passenger flow is greater than the passenger flow threshold, it means that there is an abnormal public transportation passenger flow and passenger flow diversion is required.
2. A method for detecting abnormal passenger flow in public transportation according to claim 1, characterized in that: In the step S1, after collecting the public transportation video data, the collected public transportation video data is divided into a plurality of video frames, including: Public transportation video data is collected, and the collected public transportation video data is divided into a number of video frames, and the divided video frames are as follows: ; in: express Video frame at the moment; n represents the total number of video frames into which the public transportation video data is segmented.
3. A method for detecting abnormal passenger flow in public transportation as claimed in claim 1, characterized in that: In step S2, the LSTM model is used to build a passenger flow prediction model based on the target detection results, including: The LSTM model is used to construct a passenger flow prediction model. The steps of constructing the passenger flow prediction model are as follows: Construct the forget gate of the passenger flow prediction model: in: is the target detection result vector; W, U are weight matrices; V represents a diagonal matrix; For the current moment The activity value, Indicates the cell state at the previous moment; Update the forget gate parameters of the passenger flow prediction model: The output of the passenger flow prediction model is: in: Indicates in the future passenger flow.
4. A method for detecting abnormal passenger flow in public transportation as claimed in claim 1, characterized in that: In step S3, the conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model, including: The objective function of establishing the passenger flow prediction model is: in: by The target detection result before time is used as the input of the passenger flow prediction model, and the output Passenger flow at any given moment; Indicates the target detection algorithm detected Passenger flow at any given moment; F represents the target detection result input into the passenger flow prediction model; The conjugate gradient algorithm is used to optimize the parameters of the passenger flow prediction model. The parameter optimization process is as follows: 1) Calculate the objective function Gradient , then in The objective function gradient at time is ; 2) Initialization The target detection result at the moment is 0, Target detection results at each moment ,express The target detection result vector before time ;The initial value of t is 0; 3) If , then stop parameter optimization, at this time the model parameters are the optimal parameters, where Indicates the optimization threshold; otherwise go to 4); 4) Take the step size coefficient , parameter factor satisfy , where T represents transpose; 5) Calculate the step size coefficient: According to the above two formulas, the step coefficient of the algorithm is determined ; 6) Then Always turn moment, and return to step 3).
5. A method for detecting abnormal passenger flow in public transportation as claimed in claim 1, characterized in that: In the step S4, target detection is performed on the real-time public transportation video, and the target detection result is used as the input of the passenger flow prediction model, including: An improved target detection algorithm is used to perform target detection on real-time public transportation videos. The target detection results at the current moment and the target detection results at historical moments are used as inputs to the passenger flow prediction model after parameter optimization. The passenger flow prediction model outputs the prediction results for the passenger flow at the next moment in public transportation.
6. A method for detecting abnormal passenger flow in public transportation as claimed in claim 5, characterized in that: The step S4 compares the predicted passenger flow at the next moment with the set passenger flow threshold, including: According to the passenger flow prediction model, the predicted passenger flow at the next moment in public transportation is compared with the set passenger flow threshold. For comparison, if the predicted passenger flow is greater than the passenger flow threshold , it means that there is abnormal passenger flow in public transportation and passenger flow diversion is needed.
Citation Information
Patent Citations
Passenger volume prediction method of urban rail transit
CN108197739A
Public place entrance pedestrian volume prediction method based on LSTM
CN112508305A