A method and device for counting target traffic
By detecting and tracking multiple frame images, counting the target traffic in combination with the rule diagram of the monitoring area, and deduplication processing, the problem of repeated counting of targets in the camera-acquired image is solved, and the accuracy of statistics is improved.
Patent Information
- Application Number
- CN202110780273.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-09
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-07-09
AI Technical Summary
In the prior art, the problem of repeating the same target counting for the incoming and outgoing images acquired by the camera has not been effectively solved.
By detecting and tracking multiple frame images, counting the target traffic based on the rule diagram drawn in the monitoring area, and deduplication of the same target is performed on the preliminary statistical results within the preset time period to obtain the target statistical results.
The problem of camera collecting images to repeatedly count the same target in the target inlet and exit count is solved, and the accuracy of passenger flow inlet and exit statistics is improved.
Smart Images

Figure CN113592785B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and device for counting target traffic. Background Art
[0002] With the rapid development of the economy, the improvement of people's living standards, and the continuous expansion and prosperity of the scale of urban commercial areas, more and more people go shopping, dining, and entertainment in commercial areas. These large central business districts have become the representative of the city's image and the most economically active areas. However, with the continuous increase in urban population, and at the same time during rush hours, the passenger flow of buses, subways and shopping malls is increasing. It is particularly important to count the passenger flow of each scene in real time and realize intelligent vehicle dispatching. At the same time, it can also avoid possible dangerous things, such as overloading, trampling, etc. Passenger flow statistics are generally counted or roughly estimated by drivers or crew members, and face detection is used to count the number of people through cameras installed on the car. Manual counting is time-consuming and labor-intensive, and face detection to count the number of people may miss or misdetect. Over time, the statistical error will become larger and larger. At the same time, for large scenes, one camera cannot cover all scenes or facades, and counting with multiple cameras will face the problem of repeated counting of the same target.
[0003] Regarding the related art of counting the entry and exit of objects through images captured by cameras, there is a problem of repeated counting of the same object, and no solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a method and device for counting target flow, so as to at least solve the problem of repeated counting of the same target when counting the entry and exit of targets through images captured by a camera in the related art.
[0005] According to an embodiment of the present invention, a method for collecting target traffic statistics is provided, including:
[0006] Perform target detection on multiple frames of images to obtain detection results;
[0007] Perform target tracking on the multiple frames of images according to the detection results to obtain tracking results;
[0008] Counting the target traffic according to the rule map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results;
[0009] The preliminary statistical results within a preset time period are subjected to deduplication processing for the same target to obtain the target statistical results.
[0010] Optionally, statistics are collected on the target traffic according to the regular map drawn based on the monitoring area and the tracking result, and preliminary statistical results are obtained, including:
[0011] Determine whether each target in the tracking result enters a second area from a first area of the regular graph, the regular graph comprising a regular area and a trip line, the trip line dividing the regular area into a first area and a second area;
[0012] If the judgment result is that the target enters the second area from the first area of the rule graph, the target is determined to have entered, the number of triggered entries is increased by 1, and the entry statistics result is obtained;
[0013] If the judgment result is that the target enters the first area from the second area, the target is determined to be out, the number of out-tripping triggers is increased by 1, and the out-tripping statistical result is obtained, wherein the preliminary statistical result includes the entry statistical result and the out-tripping statistical result.
[0014] Optionally, performing deduplication processing on the same target on the preliminary statistical results within a preset time period to obtain the target statistical results includes:
[0015] Obtaining the entry statistics result and the exit statistics result within the preset time period;
[0016] The statistical result for the same target in the entry statistical result is updated to 1 to obtain the target entry statistical result;
[0017] And the statistical results for the same target in the outgoing statistical results are updated to 1 to obtain the target outgoing statistical results, wherein the target statistical results include the target ingoing statistical results and the target outgoing statistical results.
[0018] Optionally, target detection is performed on multiple frames of images, and the detection results obtained include:
[0019] Using a face, head, shoulders and body detection model to perform face, head, shoulders and body detection on the multiple frames of video to obtain feature information including multiple targets, wherein the feature information includes the face, head, shoulders and body of each target;
[0020] Create identification ID information for the multiple targets respectively;
[0021] The detection result including the ID information and feature information is recorded.
[0022] Optionally, performing target tracking on the multiple frames of images according to the detection result to obtain the tracking result includes:
[0023] Perform the following operations on each frame of the multiple frames of images until the tracking result is obtained, wherein the image being operated is determined as the current frame of image:
[0024] Matching the current frame image with the previous frame image according to the detection result to obtain a first matching result;
[0025] If the matching result is that there is at least one matching target between the current frame image and the previous frame image, the ID information of the target in the current frame image is changed to the ID information of the corresponding successfully matched target in the previous frame image.
[0026] Optionally, the method further comprises:
[0027] Based on the Kalman filter algorithm, the estimated position of each target in the previous frame image in the current frame image is determined;
[0028] Obtaining the current position of each target in the current frame image;
[0029] Matching the estimated position with the current position to obtain a second matching result;
[0030] The matching target between the current frame image and the previous frame image is determined according to the first matching result and the second matching result.
[0031] Optionally, before performing target detection on the multiple frames of images to obtain the detection results, the method further includes:
[0032] Draw a regular area smaller than the monitoring area according to a preset rule;
[0033] Obtaining the center of the regular area and obtaining the target flow direction;
[0034] A trip line is set for the regular area according to the center of the regular area and the target flow direction, wherein the trip line divides the regular area into a first area and a second area, and the trip line is used to count the target inflow and outflow flow.
[0035] Optionally, setting a mixing line for the regular area according to the center of the regular area and the target flow direction includes:
[0036] If the target flow direction includes only one flow direction, a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the mixing line;
[0037] If the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, a prompt is given to select the first flow direction or the second flow direction, and the first flow direction or the second flow direction is determined as the target flow direction according to the selection instruction, and a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the mixing line.
[0038] Optionally, before performing target detection on the multiple frames of images to obtain the detection results, the method further includes:
[0039] receiving a first drawing instruction for drawing a regular area smaller than the monitoring area;
[0040] generating the regular area according to the first drawing instruction;
[0041] receiving a second drawing instruction for dividing the regular area into lines;
[0042] The mixing line is generated according to the second drawing instruction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
[0043] According to another embodiment of the present invention, a target traffic statistics device is provided, including:
[0044] A detection module is used to perform target detection on multiple frames of images and obtain detection results;
[0045] A tracking module, used for tracking the target on the multiple frames of images according to the detection result to obtain a tracking result;
[0046] A statistical module, used to count the target traffic according to the regular map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results;
[0047] The deduplication module is used to perform deduplication processing on the same target of the preliminary statistical results within a preset time period to obtain target statistical results.
[0048] Optionally, the statistics module includes:
[0049] A judgment submodule, used for judging whether each target in the tracking result enters the second area from the first area of the regular graph, the regular graph comprising a regular area and a trip line, the trip line dividing the regular area into the first area and the second area;
[0050] A first determination submodule is used for determining that the target is entering the second area from the first area of the rule graph, and triggering the entry count to increase by 1 to obtain the entry statistics result if the judgment result is that the target enters the second area from the first area of the rule graph;
[0051] The second determination submodule is used to, if the judgment result is that the target enters the first area from the second area, determine that the target is to go out, trigger the number of times of going out to increase by 1, and obtain the statistical result of going out, wherein the preliminary statistical result includes the statistical result of entering and the statistical result of going out.
[0052] Optionally, the deduplication module includes:
[0053] An acquisition submodule, used for acquiring the entry statistics result and the exit statistics result within the preset time period;
[0054] A first updating submodule, used for updating the statistical results for the same target in the entry statistical results to 1, so as to obtain the target entry statistical results;
[0055] The second updating submodule is used to update the statistical results for the same target in the outgoing statistical results to 1, so as to obtain the target outgoing statistical results, wherein the target statistical results include the target ingoing statistical results and the target outgoing statistical results.
[0056] Optionally, the detection module includes:
[0057] A detection submodule, configured to perform face, head, shoulders and body detection on the multiple frames of video using a face, head, shoulders and body detection model to obtain feature information of multiple targets, wherein the feature information includes the face, head, shoulders and body of each target;
[0058] A creation submodule is used to create identification ID information for each of the multiple targets;
[0059] The recording submodule is used to record the detection result including the ID information and feature information.
[0060] Optionally, the tracking module includes:
[0061] The execution submodule is used to perform the following operations on each frame image of the multiple frames until the tracking result is obtained, wherein the image being operated is determined as the current frame image:
[0062] Matching the current frame image with the previous frame image according to the detection result to obtain a first matching result;
[0063] If the matching result is that there is at least one matching target between the current frame image and the previous frame image, the ID information of the target in the current frame image is changed to the ID information of the corresponding successfully matched target in the previous frame image.
[0064] Optionally, the device further comprises:
[0065] A first determination module is used to determine the estimated position of each target in the previous frame image in the current frame image based on a Kalman filter algorithm;
[0066] A first acquisition module, used for acquiring the current position of each target in the current frame image;
[0067] A matching module, used for matching the estimated position with the current position to obtain a second matching result;
[0068] The second determination module is used to determine the matching target between the current frame image and the previous frame image according to the first matching result and the second matching result.
[0069] Optionally, the device further comprises:
[0070] A drawing module, used for drawing a regular area smaller than the monitoring area according to a preset rule;
[0071] A second acquisition module is used to acquire the center of the regular area and acquire the target flow direction;
[0072] A setting module is used to set a mixing line for the regular area according to the center of the regular area and the target flow direction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
[0073] Optionally, the setting module includes:
[0074] A first setting submodule is used for setting a straight line passing through the center of the regular area and perpendicular to the target flow direction as the mixing line if the target flow direction includes only one flow direction;
[0075] The second setting submodule is used to prompt the user to select the first flow direction or the second flow direction if the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, determine the first flow direction or the second flow direction as the target flow direction according to the selection instruction, and set a straight line passing through the center of the regular area and perpendicular to the target flow direction as the mixing line.
[0076] Optionally, the device further comprises:
[0077] A first receiving module, configured to receive a first drawing instruction for drawing a regular area smaller than the monitoring area;
[0078] A first generating module, configured to generate the regular area according to the first drawing instruction;
[0079] A second receiving module is used to receive a second drawing instruction of a mixing line dividing the regular area;
[0080] The second generating submodule is used to generate the mixing line according to the second drawing instruction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
[0081] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0082] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0083] Through the present invention, target detection is performed on multiple frames of images to obtain detection results; target tracking is performed on the multiple frames of images based on the detection results to obtain tracking results; target flow is counted based on a regular map drawn based on the monitoring area and the tracking results to obtain preliminary statistical results; and the preliminary statistical results within a preset time period are deduplicated for the same targets to obtain target statistical results. This can solve the problem of repeated counting of the same target when counting the entry and exit of targets through images captured by cameras in related technologies. By deduplicating the same target for the passenger flow entry and exit statistical results of multiple frames of images, the accuracy of passenger flow entry and exit statistics is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0085] Figure 1 It is a hardware structure block diagram of a mobile terminal of a target traffic statistics method according to an embodiment of the present invention;
[0086] Figure 2 is a flow chart of a target traffic statistics method according to an embodiment of the present invention;
[0087] Figure 3 is a flowchart of real-time passenger flow statistics in a large scene according to an embodiment of the present invention;
[0088] Figure 4 is a schematic diagram of a regular graph of a single camera according to an embodiment of the present invention;
[0089] Figure 5 4 is a block diagram of a target traffic statistics device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0090] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0091] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0092] Example 1
[0093] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal of a target traffic statistics method according to an embodiment of the present invention, such as Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0094] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the target traffic statistics method in the embodiment of the present invention. The processor 102 executes various functional applications and remote login control by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0095] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0096] In this embodiment, a method for counting target traffic running on the above mobile terminal or network architecture is provided. Figure 2is a flow chart of a target traffic statistics method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0097] Step S202, performing target detection on multiple frames of images to obtain detection results;
[0098] In this embodiment, the multiple frames of images may be acquired by one or more image acquisition devices, and the image acquisition devices may specifically be cameras, video recording devices, etc. The above step S202 may specifically include: using a face, head, shoulders, and body detection model to perform face, head, shoulders, and body detection on the multiple frames of video to obtain feature information including multiple targets, and the feature information includes the face, head, shoulders, and body of each target; creating identification ID information for the multiple targets respectively; and recording the detection results including the ID information and feature information. The use of a pedestrian face, head, shoulders, and body association tracking algorithm can solve the tracking effect and accuracy when only the face, head, shoulders, or head and shoulders are partially blocked by the human body, and the human body is more exposed. At the same time, the feature map based on the face or body can greatly improve the accuracy of the pedestrian re-identification model, which is suitable for scenes with different levels of congestion.
[0099] Step S204, performing target tracking on the multiple frames of images according to the detection results to obtain tracking results;
[0100] In this embodiment, the above-mentioned step S204 may specifically include: performing the following operations on each frame image in the multiple frames until the tracking result is obtained, wherein the image on which the operation is being performed is determined to be the current frame image: matching the current frame image with the previous frame image according to the detection result to obtain a first matching result; if the matching result is that there is at least one matching target between the current frame image and the previous frame image, changing the ID information of the target in the current frame image to the ID information of the corresponding successfully matched target in the previous frame image.
[0101] In an optional embodiment, in order to improve the accuracy of target matching, the estimated position of each target in the previous frame image in the current frame image can be determined based on the Kalman filtering algorithm; the current position of each target in the current frame image is obtained; the estimated position is matched with the current position to obtain a second matching result; and the matching target of the current frame image and the previous frame image is determined based on the first matching result and the second matching result, which can further improve the accuracy of target matching.
[0102] Step S206, performing statistics on the target traffic according to the regular map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results;
[0103] The monitoring area in the embodiment of the present invention refers to the area where each frame of image is located, that is, the area that can be monitored by the image acquisition device.
[0104] In this embodiment, the above step S206 may specifically include: judging whether each target in the tracking result enters the second area from the first area of the rule graph, the rule graph includes a rule area and a trip line, and the trip line divides the rule area into a first area and a second area; if the judgment result is that the target enters the second area from the first area of the rule graph, the target is determined to be entering, the trigger entry count is increased by 1, and an entry statistical result is obtained; if the judgment result is that the target enters the first area from the second area, the target is determined to be exiting, the trigger exit count is increased by 1, and an exit statistical result is obtained, wherein the preliminary statistical result includes the entry statistical result and the exit statistical result. By configuring the rule graph, only the target entry and exit statistics of the area of interest can be counted, and some irrelevant data can be removed.
[0105] Step S208, performing deduplication processing on the same target for the preliminary statistical results within a preset time period to obtain target statistical results.
[0106] In this embodiment, the above-mentioned step S208 may specifically include: obtaining the entry statistical results and the exit statistical results within the preset time; updating the statistical results for the same target in the entry statistical results to 1, and obtaining the target entry statistical results; and updating the statistical results for the same target in the exit statistical results to 1, and obtaining the target exit statistical results, so as to obtain the target statistical results including the target entry statistical results and the target exit statistical results.
[0107] Through the above steps S202 to S208, the problem of repeated counting of the same target in counting the entry and exit of targets through images captured by the camera in the related technology can be solved. By deduplicating the same target in the passenger entry and exit statistics results of multiple frames of images, the accuracy of the passenger entry and exit statistics is improved.
[0108] The rule diagram in this embodiment may be automatically set, or the user may draw the rule diagram in the corresponding display interface.
[0109] In one embodiment, a regular map can be automatically set according to the direction of target entry and exit. Specifically, a regular area smaller than the monitoring area is drawn for each image acquisition device according to a preset rule; the center of the regular area is obtained, and the target flow direction is obtained; a trip line is set for the regular area according to the center of the regular area and the target flow direction, wherein the trip line divides the regular area into a first area and a second area, and the trip line is used to count the target inflow and outflow flow. Further, if the target flow direction includes only one flow direction, a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line; if the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, a prompt is given to select the first flow direction or the second flow direction, and the first flow direction or the second flow direction is determined as the target flow direction according to the selection instruction, and a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line.
[0110] In another embodiment, a regular map is generated according to a drawing instruction of the user in a display interface, and the drawing instruction can be triggered by a touch instruction. Specifically, a first drawing instruction is received to draw a regular area smaller than the monitoring area; the regular area is generated according to the first drawing instruction; a second drawing instruction is received to form a trip line that divides the regular area; and the trip line is generated according to the second drawing instruction, wherein the trip line divides the regular area into a first area and a second area, and the trip line is used to count target inflow and outflow traffic.
[0111] The embodiments of the present invention can solve the problem of repeated counting of the same target in multiple cameras. The problem of repeated counting of the same target in different cameras is solved through the target re-identification model, and cross-camera target matching and recognition is realized. Then, duplicates are removed and only the passenger flow in and out of the area of interest is counted through rules. The face, head, shoulder and body association tracking algorithm is adopted, which is suitable for passenger flow in and out statistics under different congestion levels.
[0112] The embodiment of the present invention is described below by taking the case where multiple frames of images are collected by one or more cameras as an example.
[0113] Figure 3 is a flowchart of real-time passenger flow statistics in a large scene according to an embodiment of the present invention, such as Figure 3 As shown, including:
[0114] Step 301, collect video images through one or more cameras, the cameras are installed in a top-mounted or oblique manner, and different installation methods are adopted according to the actual scene. For installation heights greater than H (2.5) meters, it is recommended to install the camera obliquely, and for installation heights less than H (2.5) meters, it is recommended to install the camera top-mounted. Install multiple cameras to ensure that the monitoring range of large scenes can be covered; draw rules for the camera through the web interface;
[0115] Steps 302-S303, perform detection based on the face, head, shoulders and human body detection model to obtain the detection results, and perform pedestrian tracking and ID creation for continuous multi-frame images. Specifically, Yolov5 or CenterNet face, head, shoulders and human body detection models are used to perform face, head, shoulders and human body detection on each frame of the camera captured video. For continuous multi-frame images, a human body multi-part association tracking algorithm is used to perform pedestrian tracking and ID creation. The Hungarian algorithm matches a pedestrian in the current frame with a pedestrian in the previous frame. The Kalman filter can predict the current position based on the pedestrian's position at the previous moment, and more accurately estimate the pedestrian's position.
[0116] Step 304: Perform passenger flow statistics. Figure 4 is a schematic diagram of a regular graph of a single camera according to an embodiment of the present invention, such as Figure 4 As shown, multiple cameras are similar. The solid-line frame represents the monitoring screen, the dotted-line frame represents the rule area, and the mixing line divides the rule area into area A and area B. The dotted-line frame and the mixing line represent a complete rule, and the rule supports polygons; the dotted-line arrow indicates that the pedestrian enters and is counted once, and the solid-line arrow indicates that the pedestrian exits and is counted once. For each pedestrian ID created in step 303, from entering area A, passing the mixing line, arriving at area B, and then exiting area B, it means that the pedestrian enters and is counted once by the mixing line, and vice versa, the pedestrian exits and is counted once. When the pedestrian triggers the rule, the pedestrian's feature map F1 will be saved. The face, head, shoulder and body association tracking algorithm is used, so if the pedestrian face frame, head and shoulder frame and body frame are all available, the corresponding feature map will be saved. The direction of the pedestrian's entry and exit is specified by the direction of the rule line;
[0117] Step 305, obtaining passenger flow statistics results of cameras at different locations in the same scene;
[0118] Steps 306-307, perform deduplication processing based on the pedestrian re-identification model to obtain accurate passenger flow statistics. Specifically, based on steps 304 and 305, obtain the pedestrian entry and exit statistics of N (N>=2) cameras, analyze the pedestrian feature map F1 through the pedestrian re-identification model, and obtain the same target that triggers the entry and exit rules of different cameras. If a pedestrian in one camera triggers the rule to enter the count once, and also triggers the rule to enter the count C times in another or more cameras, it means that the pedestrian repeats the count and enters C times, and the total count will be subtracted from C; if the rule triggered by the target in another camera is to go out and count once, due to the different directions, even if it is the same target, it will not be deduplicated, and so on. The final accurate passenger flow entry and exit statistics of the store or shopping mall are obtained by deduplication.
[0119] Step 305, the actual use is large scenes such as exhibitions, supermarkets, and conference rooms, and a single camera cannot cover the monitoring screen. For example, the scene used is an exhibition, and 10 cameras are installed. In the morning time period (9:00-12:00), the total number of incoming passengers obtained by the 10 cameras is 40,000, and the total number of outgoing passengers is 35,000. Through the pedestrian re-identification model, the same target (actually representing repeated counts of different people) of the 10 cameras is repeatedly counted for 3,000 times, and the repeated outgoing count is 2,000 times. Then, the actual total number of incoming passengers in the exhibition scene is 37,000, and the total number of outgoing passengers is 33,000.
[0120] Example 2
[0121] According to another embodiment of the present invention, a target traffic statistics device is provided. Figure 5 is a block diagram of a target traffic statistics device according to an embodiment of the present invention. Figure 5 As shown, including:
[0122] The detection module 52 is used to perform target detection on multiple frames of images to obtain detection results;
[0123] A tracking module 54, configured to perform target tracking on the multiple frames of images according to the detection results to obtain tracking results;
[0124] A statistics module 56, configured to perform statistics on the target traffic according to the regular map drawn based on the monitoring area and the tracking result to obtain preliminary statistics results;
[0125] The deduplication module 58 is used to perform deduplication processing on the same target of the preliminary statistical results within a preset time period to obtain target statistical results.
[0126] Optionally, the statistics module 56 includes:
[0127] A judgment submodule, used for judging whether each target in the tracking result enters the second area from the first area of the regular graph, the regular graph comprising a regular area and a trip line, the trip line dividing the regular area into the first area and the second area;
[0128] A first determination submodule is used for determining that the target is entering the second area from the first area of the rule graph, and triggering the entry count to increase by 1 to obtain the entry statistics result if the judgment result is that the target enters the second area from the first area of the rule graph;
[0129] The second determination submodule is used to, if the judgment result is that the target enters the first area from the second area, determine that the target is to go out, trigger the number of times of going out to increase by 1, and obtain the statistical result of going out, wherein the preliminary statistical result includes the statistical result of entering and the statistical result of going out.
[0130] Optionally, the deduplication module 58 includes:
[0131] An acquisition submodule, used for acquiring the entry statistics result and the exit statistics result within the preset time period;
[0132] A first updating submodule, used for updating the statistical results for the same target in the entry statistical results to 1, so as to obtain the target entry statistical results;
[0133] The second updating submodule is used to update the statistical results for the same target in the outgoing statistical results to 1, so as to obtain the target outgoing statistical results, wherein the target statistical results include the target ingoing statistical results and the target outgoing statistical results.
[0134] Optionally, the detection module 52 includes:
[0135] A detection submodule, configured to perform face, head, shoulders and body detection on the multiple frames of video using a face, head, shoulders and body detection model to obtain feature information of multiple targets, wherein the feature information includes the face, head, shoulders and body of each target;
[0136] A creation submodule is used to create identification ID information for each of the multiple targets;
[0137] The recording submodule is used to record the detection result including the ID information and feature information.
[0138] Optionally, the tracking module 54 includes:
[0139] The execution submodule is used to perform the following operations on each frame image of the multiple frames until the tracking result is obtained, wherein the image being operated is determined as the current frame image:
[0140] Matching the current frame image with the previous frame image according to the detection result to obtain a first matching result;
[0141] If the matching result is that there is at least one matching target between the current frame image and the previous frame image, the ID information of the target in the current frame image is changed to the ID information of the corresponding successfully matched target in the previous frame image.
[0142] Optionally, the device further comprises:
[0143] A first determination module is used to determine the estimated position of each target in the previous frame image in the current frame image based on a Kalman filter algorithm;
[0144] A first acquisition module, used for acquiring the current position of each target in the current frame image;
[0145] A matching module, used for matching the estimated position with the current position to obtain a second matching result;
[0146] The second determination module is used to determine the matching target between the current frame image and the previous frame image according to the first matching result and the second matching result.
[0147] Optionally, the device further comprises:
[0148] A drawing module, used for drawing a regular area smaller than the monitoring area according to a preset rule;
[0149] A second acquisition module is used to acquire the center of the regular area and acquire the target flow direction;
[0150] A setting module is used to set a mixing line for the regular area according to the center of the regular area and the target flow direction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
[0151] Optionally, the setting module includes:
[0152] A first setting submodule is used for setting a straight line passing through the center of the regular area and perpendicular to the target flow direction as the mixing line if the target flow direction includes only one flow direction;
[0153] The second setting submodule is used to prompt the user to select the first flow direction or the second flow direction if the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, determine the first flow direction or the second flow direction as the target flow direction according to the selection instruction, and set a straight line passing through the center of the regular area and perpendicular to the target flow direction as the mixing line.
[0154] Optionally, the device further comprises:
[0155] A first receiving module, configured to receive a first drawing instruction for drawing a regular area smaller than the monitoring area;
[0156] A first generating module, configured to generate the regular area according to the first drawing instruction;
[0157] A second receiving module is used to receive a second drawing instruction of a mixing line dividing the regular area;
[0158] The second generating submodule is used to generate the mixing line according to the second drawing instruction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
[0159] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0160] Example 3
[0161] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0162] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0163] S1, perform target detection on multiple frames of images to obtain detection results;
[0164] S2, performing target tracking on the multiple frames of images according to the detection results to obtain tracking results;
[0165] S3, performing statistics on the target traffic according to the rule map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results;
[0166] S4, performing deduplication processing on the same target on the preliminary statistical results within a preset time period to obtain target statistical results.
[0167] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0168] Example 4
[0169] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0170] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0171] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0172] S1, perform target detection on multiple frames of images to obtain detection results;
[0173] S2, performing target tracking on the multiple frames of images according to the detection results to obtain tracking results;
[0174] S3, performing statistics on the target traffic according to the rule map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results;
[0175] S4, performing deduplication processing on the same target on the preliminary statistical results within a preset time period to obtain target statistical results.
[0176] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0177] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0178] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A target traffic statistics method, characterized in that: include: Perform target detection on multiple frames of images to obtain detection results; Perform target tracking on the multiple frames of images according to the detection results to obtain tracking results; Counting the target traffic according to the rule map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results; Performing a deduplication process on the same target for the preliminary statistical results within a preset time period to obtain a target statistical result; Before performing target detection on the multiple frames of images to obtain detection results, the method further includes: Drawing a regular area smaller than the monitoring area according to a preset rule; Obtaining the center of the regular area and obtaining the target flow direction; A trip line is set for the regular area according to the center of the regular area and the target flow direction, including: if the target flow direction includes only one flow direction, a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line; if the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, a prompt is given to select the first flow direction or the second flow direction, and the first flow direction or the second flow direction is determined as the target flow direction according to the selection instruction, and a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line; wherein the trip line divides the regular area into a first area and a second area, and the trip line is used to count the target inflow and outflow flow.
2. The method according to claim 1, characterized in that The target traffic is counted according to the rule map drawn based on the monitoring area and the tracking result, and the preliminary statistical results obtained include: Determine whether each target in the tracking result enters a second area from a first area of the regular graph, the regular graph comprising a regular area and a trip line, the trip line dividing the regular area into a first area and a second area; If the judgment result is that the target enters the second area from the first area of the rule graph, the target is determined to have entered, the number of triggered entries is increased by 1, and the entry statistics result is obtained; If the judgment result is that the target enters the first area from the second area, the target is determined to be out, the number of out-tripping triggers is increased by 1, and the out-tripping statistical result is obtained, wherein the preliminary statistical result includes the entry statistical result and the out-tripping statistical result.
3. The method according to claim 2, characterized in that The performing of the same target deduplication processing on the preliminary statistical results within the preset time period to obtain the target statistical results includes: Obtaining the entry statistics result and the exit statistics result within the preset time period; The statistical result for the same target in the entry statistical result is updated to 1 to obtain the target entry statistical result; The statistical results for the same target in the outgoing statistical results are updated to 1 to obtain the target outgoing statistical results, wherein the target statistical results include the target ingoing statistical results and the target outgoing statistical results.
4. The method according to claim 1, characterized in that: The target detection is performed on multiple frames of images to obtain the detection results, including: Using a face, head, shoulders and body detection model to perform face, head, shoulders and body detection on the multiple frames of images to obtain feature information including multiple targets, wherein the feature information includes the face, head, shoulders and body of each target; Create identification ID information for the multiple targets respectively; The detection result including the ID information and feature information is recorded.
5. The method according to claim 1, characterized in that The performing target tracking on the multiple frames of images according to the detection results to obtain tracking results comprises: Perform the following operations on each frame of the multiple frames of images until the tracking result is obtained, wherein the image being operated is determined as the current frame of image: Matching the current frame image with the previous frame image according to the detection result to obtain a first matching result; If the matching result is that there is at least one matching target between the current frame image and the previous frame image, the ID information of the target in the current frame image is changed to the ID information of the corresponding successfully matched target in the previous frame image.
6. The method according to claim 5, characterized in that The method further comprises: Based on the Kalman filter algorithm, the estimated position of each target in the previous frame image in the current frame image is determined; Obtaining the current position of each target in the current frame image; Matching the estimated position with the current position to obtain a second matching result; The matching target between the current frame image and the previous frame image is determined according to the first matching result and the second matching result.
7. The method according to any one of claims 1 to 6, characterized in that Before performing target detection on the multiple frames of images to obtain detection results, the method further includes: receiving a first drawing instruction for drawing a regular area smaller than the monitoring area; generating the regular area according to the first drawing instruction; receiving a second drawing instruction for dividing the regular area into lines; The mixing line is generated according to the second drawing instruction, wherein the mixing line divides the regular area into a first area and a second area, and the mixing line is used to count the target inflow and outflow flow.
8. A target traffic statistics device, characterized in that: include: A detection module is used to perform target detection on multiple frames of images and obtain detection results; A tracking module, used for tracking the target on the multiple frames of images according to the detection result to obtain a tracking result; A statistical module, used to count the target traffic according to the regular map drawn based on the monitoring area and the tracking result to obtain preliminary statistical results; A deduplication module is used to perform deduplication processing on the same target of the preliminary statistical results within a preset time period to obtain a target statistical result; The device also includes: A drawing module, used for performing target detection on multiple frames of images and drawing a regular area smaller than the monitoring area according to a preset rule before obtaining the detection result; A second acquisition module is used to acquire the center of the regular area and acquire the target flow direction; A setting module is used to set a trip line for the regular area according to the center of the regular area and the target flow direction, including: if the target flow direction includes only one flow direction, a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line; if the target flow direction includes a first flow direction and a second flow direction that are perpendicular to each other, a prompt is given to select the first flow direction or the second flow direction, and the first flow direction or the second flow direction is determined as the target flow direction according to the selection instruction, and a straight line passing through the center of the regular area and perpendicular to the target flow direction is set as the trip line; wherein the trip line divides the regular area into a first area and a second area, and the trip line is used to count the target inflow and outflow flow.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for passenger flow statistics based on cameras with intelligent analysis function
CN103986910A
Personnel flow statistics method and device and computer device
CN110263703A
Passenger flow volume analysis method, system and device based on head and shoulder detection
CN112307936A