Passenger flow volume detection method based on image acquisition
Through image acquisition technology, combined with Kalman filter and target detection model, accurate detection of passenger flow is achieved, which solves the problems of inaccurate detection results and limited use scenarios in the existing technology, and is suitable for high-accuracy passenger flow in a variety of scenarios. Quantity monitoring.
Patent Information
- Application Number
- CN202411116303.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-10-29
AI Technical Summary
The detection results of existing passenger flow detection technology are not accurate enough and the usage scenarios are limited. Especially when the passenger flow is large, the accuracy decreases.
Using a method based on image acquisition, the Kalman filter is used to predict the target position, combined with the target detection model to generate the image to be detected, for target detection and tracking, and the tracking algorithm is selected through face recognition to achieve accurate detection of passengers getting on and off the vehicle.
It improves the accuracy of passenger flow detection, is suitable for a variety of usage scenarios, and ensures the reliability of detection results under high passenger flow conditions.
Smart Images

Figure CN118865263A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to passenger flow detection, and in particular to a passenger flow detection method based on image acquisition. Background Art
[0002] With the continuous acceleration of urban rail transit construction, new challenges have been raised for the scientific and safe operation of rail transit. Passenger flow detection is a commonly used technical means in the field of rail transit. Through the spatiotemporal analysis of passenger flow, high-quality data can be provided for the intelligent dispatching and emergency management of rail transit.
[0003] The purpose of passenger flow detection is to count the number of passengers getting on and off a certain station within a certain period of time. The existing technology is mainly based on the baseline detection method. The core principle is to draw a baseline at the door position. If the target crosses the baseline from inside the car to outside the car, it is judged as getting off the car; if the target crosses the baseline from outside the car to inside the car, it is judged as getting on the car. This detection method is simple to implement, but the usage scenarios are very limited. The surveillance camera generally needs to be installed directly above the door, and when the passenger flow is large, the accuracy of the detection result will decrease. Summary of the invention
[0004] 1. Technical issues to be solved
[0005] In view of the above-mentioned shortcomings of the prior art, the present invention provides a passenger flow detection method based on image acquisition, which can effectively overcome the defects of the prior art such as inaccurate detection results and limited usage scenarios.
[0006] (II) Technical solution
[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0008] A passenger flow detection method based on image acquisition comprises the following steps:
[0009] S1. Obtain video data of the collection area when passengers get on and off the bus;
[0010] S2, using the Kalman filter to predict the target position in the current frame image according to the previous frame image, and obtain a prediction result;
[0011] S3, generating an image to be detected according to the prediction result and the current frame image, and inputting the image to be detected into the target detection model to obtain a detection result;
[0012] S4, matching the prediction result and the detection result, and determining a first passenger flow detection result according to the matching result;
[0013] S5, extracting a target image from the current frame image based on the detection result, and performing face recognition on the target image;
[0014] S6. Selecting a corresponding target tracking algorithm according to the face recognition result, and using the target tracking algorithm to track the target;
[0015] S7. Determine a second passenger flow detection result according to the target tracking result, and obtain a final passenger flow detection result in combination with the first passenger flow detection result.
[0016] Preferably, in S2, a Kalman filter is used to predict the target position in the current frame image according to the previous frame image to obtain a prediction result, including:
[0017] According to the state estimation value of the previous frame image and the system noise covariance matrix, the target position in the current frame image is predicted using the state transfer equation to obtain the prediction result;
[0018] The forecast state covariance matrix is updated to reflect the uncertainty of the updated forecast state;
[0019] Among them, for the first frame image in the video data, the first frame image is directly input into the target detection model to obtain the detection result.
[0020] Preferably, generating the image to be detected according to the prediction result and the current frame image in S3 includes:
[0021] A target position mask is generated according to the prediction results, and the target position mask and the current frame image are superimposed according to different weights to generate an image to be detected.
[0022] Preferably, in S3, the image to be detected is input into the target detection model to obtain the detection result, including:
[0023] Input the image to be detected into the YOLOv5 model to obtain the detection result;
[0024] Among them, the YOLOv5 model includes an input end, a Backbone layer, a Neck layer, and a Head layer connected in sequence. The Backbone layer includes a Conv module, a C3 module, and an SPPF module. The Neck layer adopts an SPPF and CSP-PAN structure, and the Head layer consists of three convolutional layers.
[0025] Preferably, matching the prediction result and the detection result in S4 includes:
[0026] Calculate the intersection-and-union ratio of the prediction results and the detection results, and construct the cost matrix based on the intersection-and-union ratio;
[0027] Based on the cost matrix, the KM algorithm is used to match the prediction results and detection results to obtain the target trajectory.
[0028] Preferably, determining the first passenger flow detection result according to the matching result in S4 includes:
[0029] A first passenger flow detection result is determined according to a positional relationship between the target trajectory and the collection area.
[0030] Preferably, in S6, a corresponding target tracking algorithm is selected according to the face recognition result, and the target tracking algorithm is used to perform target tracking, including:
[0031] Based on the face recognition result, a first target image having a positive face in the current frame image is determined, and based on the face recognition result, facial features of the first target image are acquired, and target tracking is performed according to the facial features.
[0032] Preferably, the target tracking according to facial features includes:
[0033] Obtain a preset facial feature database, match facial features in the facial feature database, and track the target based on the matching results.
[0034] Preferably, in S6, a corresponding target tracking algorithm is selected according to the face recognition result, and the target tracking algorithm is used to perform target tracking, including:
[0035] Based on the face recognition result, a second target image without a positive face in the current frame image is determined, and target motion features and target appearance features of the second target image are extracted, and target tracking is performed according to the target motion features and target appearance features.
[0036] Preferably, the target tracking according to the target motion characteristics and the target appearance characteristics includes:
[0037] The target motion features and target appearance features are jointly measured, and the measurement results are cascade matched, and the target is tracked based on the matching results.
[0038] (III) Beneficial effects
[0039] Compared with the prior art, the passenger flow detection method based on image acquisition provided by the present invention has the following beneficial effects:
[0040] 1) Obtain video data of passengers passing through the collection area when getting on and off the bus, use a Kalman filter to predict the target position in the current frame image according to the previous frame image to obtain a prediction result, generate an image to be detected according to the prediction result and the current frame image, and input the image to be detected into a target detection model to obtain a detection result, match the prediction result and the detection result, determine a first passenger flow detection result according to the matching result, use a Kalman filter to predict the target position in the current frame image to obtain a prediction result, use the target detection model to perform target detection on the image to be detected to obtain a detection result, match the prediction result and the detection result to obtain a target trajectory, and determine the first passenger flow detection result according to the positional relationship between the target trajectory and the collection area;
[0041] 2) Based on the detection results, the target image is extracted from the current frame image, and face recognition is performed on the target image. The corresponding target tracking algorithm is selected according to the face recognition result, and the target is tracked by using the target tracking algorithm. The second passenger flow detection result is determined according to the target tracking result. Different target tracking algorithms can be used according to positive faces and non-positive faces to achieve accurate tracking of the target, thereby ensuring the accuracy of the second passenger flow detection result. In addition, a more accurate final passenger flow detection result can be obtained in combination with the first passenger flow detection result, thereby achieving accurate detection of passenger flow. At the same time, the technical solution of the present application can be applicable to various types of usage scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 It is a schematic diagram of the process of the present invention;
[0044] Figure 2 A schematic diagram of a process for determining a first passenger flow detection result according to a matching result in the present invention;
[0045] Figure 3 It is a schematic diagram of a flow chart of determining a second passenger flow detection result according to a target tracking result in the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] A passenger flow detection method based on image acquisition, such as Figure 1 and Figure 2 As shown, ① obtain the video data of the passengers passing through the collection area when getting on and off the bus.
[0048] ② Use the Kalman filter to predict the target position in the current frame image based on the previous frame image to obtain the prediction result, which specifically includes:
[0049] According to the state estimation value of the previous frame image and the system noise covariance matrix, the target position in the current frame image is predicted using the state transfer equation to obtain the prediction result;
[0050] The forecast state covariance matrix is updated to reflect the uncertainty of the updated forecast state;
[0051] Among them, for the first frame image in the video data, the first frame image is directly input into the target detection model to obtain the detection result.
[0052] ③ Generate the image to be detected based on the prediction result and the current frame image, and input the image to be detected into the target detection model to obtain the detection result.
[0053] 1) Generate the image to be detected based on the prediction result and the current frame image, including:
[0054] A target position mask is generated according to the prediction results, and the target position mask and the current frame image are superimposed according to different weights to generate an image to be detected.
[0055] 2) Input the image to be detected into the target detection model to obtain the detection results, including:
[0056] Input the image to be detected into the YOLOv5 model to obtain the detection result;
[0057] Among them, the YOLOv5 model includes an input end, a Backbone layer, a Neck layer, and a Head layer connected in sequence. The Backbone layer includes a Conv module, a C3 module, and an SPPF module. The Neck layer adopts an SPPF and CSP-PAN structure, and the Head layer consists of three convolutional layers.
[0058] ④ Match the prediction result and the detection result, and determine the first passenger flow detection result according to the matching result.
[0059] 1) Match the prediction results and the test results, including:
[0060] Calculate the intersection-and-union ratio of the prediction results and the detection results, and construct the cost matrix based on the intersection-and-union ratio;
[0061] Based on the cost matrix, the KM algorithm is used to match the prediction results and detection results to obtain the target trajectory.
[0062] 2) Determining a first passenger flow detection result according to the matching result, including:
[0063] A first passenger flow detection result is determined according to a positional relationship between the target trajectory and the collection area.
[0064] The above technical scheme obtains video data of passengers passing through the collection area when getting on and off the bus, uses a Kalman filter to predict the target position in the current frame image based on the previous frame image to obtain a prediction result, generates an image to be detected based on the prediction result and the current frame image, and inputs the image to be detected into a target detection model to obtain a detection result, matches the prediction result and the detection result, determines a first passenger flow detection result based on the matching result, uses a Kalman filter to predict the target position in the current frame image to obtain a prediction result, uses a target detection model to perform target detection on the image to be detected to obtain a detection result, matches the prediction result and the detection result to obtain a target trajectory, and determines the first passenger flow detection result based on the positional relationship between the target trajectory and the collection area.
[0065] like Figure 1 and Figure 3 As shown, ⑤ extract the target image from the current frame image based on the detection result, and perform face recognition on the target image.
[0066] ⑥ Select the corresponding target tracking algorithm based on the face recognition results, and use the target tracking algorithm to track the target.
[0067] 1) Select the corresponding target tracking algorithm according to the face recognition result, and use the target tracking algorithm to track the target, including:
[0068] Based on the face recognition result, a first target image having a positive face in the current frame image is determined, and based on the face recognition result, facial features of the first target image are acquired, and target tracking is performed according to the facial features.
[0069] Specifically, target tracking is performed based on facial features, including:
[0070] Obtain a preset facial feature database, match facial features in the facial feature database, and track the target based on the matching results.
[0071] 2) Select a corresponding target tracking algorithm based on the face recognition result, and use the target tracking algorithm to track the target, including:
[0072] Based on the face recognition result, a second target image without a positive face in the current frame image is determined, and target motion features and target appearance features of the second target image are extracted, and target tracking is performed according to the target motion features and target appearance features.
[0073] Specifically, target tracking is performed based on target motion features and target appearance features, including:
[0074] The target motion features and target appearance features are jointly measured, and the measurement results are cascade matched, and the target is tracked based on the matching results.
[0075] ⑦ Determine the second passenger flow detection result according to the target tracking result, and combine it with the first passenger flow detection result to obtain the final passenger flow detection result.
[0076] The above technical solution extracts the target image from the current frame image based on the detection result, and performs face recognition on the target image, selects the corresponding target tracking algorithm according to the face recognition result, and uses the target tracking algorithm to track the target, and determines the second passenger flow detection result according to the target tracking result. It can adopt different target tracking algorithms according to the positive face and the non-positive face to achieve accurate tracking of the target, ensure the accuracy of the second passenger flow detection result, and combine with the first passenger flow detection result to obtain a more accurate final passenger flow detection result, thereby achieving accurate detection of passenger flow.
[0077] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A passenger flow detection method based on image acquisition, characterized in that: The following steps are involved: S1. Obtain video data of the collection area when passengers get on and off the bus; S2, using the Kalman filter to predict the target position in the current frame image according to the previous frame image, and obtain a prediction result; S3, generating an image to be detected according to the prediction result and the current frame image, and inputting the image to be detected into the target detection model to obtain a detection result; S4, matching the prediction result and the detection result, and determining a first passenger flow detection result according to the matching result; S5, extracting a target image from the current frame image based on the detection result, and performing face recognition on the target image; S6. Selecting a corresponding target tracking algorithm according to the face recognition result, and using the target tracking algorithm to track the target; S7. Determine a second passenger flow detection result according to the target tracking result, and obtain a final passenger flow detection result in combination with the first passenger flow detection result.
2. The passenger flow detection method based on image acquisition according to claim 1 is characterized in that: In S2, the Kalman filter is used to predict the target position in the current frame image according to the previous frame image, and the prediction result is obtained, including: According to the state estimation value of the previous frame image and the system noise covariance matrix, the target position in the current frame image is predicted using the state transfer equation to obtain the prediction result; The forecast state covariance matrix is updated to reflect the uncertainty of the updated forecast state; Among them, for the first frame image in the video data, the first frame image is directly input into the target detection model to obtain the detection result.
3. The passenger flow detection method based on image acquisition according to claim 2 is characterized in that: In S3, the image to be detected is generated according to the prediction result and the current frame image, including: A target position mask is generated according to the prediction results, and the target position mask and the current frame image are superimposed according to different weights to generate an image to be detected.
4. The passenger flow detection method based on image acquisition according to claim 3 is characterized in that: In S3, the image to be detected is input into the target detection model to obtain the detection results, including: Input the image to be detected into the YOLOv5 model to obtain the detection result; Among them, the YOLOv5 model includes an input end, a Backbone layer, a Neck layer, and a Head layer connected in sequence. The Backbone layer includes a Conv module, a C3 module, and an SPPF module. The Neck layer adopts an SPPF and CSP-PAN structure, and the Head layer consists of three convolutional layers.
5. The passenger flow detection method based on image acquisition according to claim 4 is characterized in that: S4 matches the prediction results with the detection results, including: Calculate the intersection-and-union ratio of the prediction results and the detection results, and construct the cost matrix based on the intersection-and-union ratio; Based on the cost matrix, the KM algorithm is used to match the prediction results and detection results to obtain the target trajectory.
6. The passenger flow detection method based on image acquisition according to claim 5 is characterized in that: Determining a first passenger flow detection result according to the matching result in S4 includes: A first passenger flow detection result is determined according to a positional relationship between the target trajectory and the collection area.
7. The passenger flow detection method based on image acquisition according to claim 1 is characterized in that: In S6, a corresponding target tracking algorithm is selected according to the face recognition result, and the target tracking algorithm is used to track the target, including: Based on the face recognition result, a first target image having a positive face in the current frame image is determined, and based on the face recognition result, facial features of the first target image are acquired, and target tracking is performed according to the facial features.
8. The passenger flow detection method based on image acquisition according to claim 7 is characterized in that: The target tracking according to the facial features includes: Obtain a preset facial feature database, match facial features in the facial feature database, and track the target based on the matching results.
9. The passenger flow detection method based on image acquisition according to claim 1 or 7, characterized in that: In S6, a corresponding target tracking algorithm is selected according to the face recognition result, and the target tracking algorithm is used to track the target, including: Based on the face recognition result, a second target image without a positive face in the current frame image is determined, and target motion features and target appearance features of the second target image are extracted, and target tracking is performed according to the target motion features and target appearance features.
10. The passenger flow detection method based on image acquisition according to claim 9 is characterized in that: The target tracking according to the target motion characteristics and the target appearance characteristics includes: The target motion features and target appearance features are jointly measured, and the measurement results are cascade matched, and the target is tracked based on the matching results.
