A method, device and electronic equipment for accurate passenger flow statistics

By judging the vertical distance between the detection point and the trigger line and deduplicating the face database, combined with the multi-target tracking of the Anchor-Free neural network, the problem of repeated counting caused by the shaking of target personnel in passenger flow statistics is solved, and accurate and efficient passenger flow is achieved. statistics.

CN113469982BActive Publication Date: 2024-09-06ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110783366.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-12
Publication Date
2024-09-06
Estimated Expiration
2041-07-12

AI Technical Summary

Technical Problem

In the existing technology, in passenger flow statistics, the target person swings back and forth near the trigger line, causing repeated counting, which affects the accuracy of passenger flow statistics.

Method used

By obtaining the detection image, determine the vertical distance between the detection point and the trigger line. If the distance is greater than the preset threshold, the passenger flow will be counted. If it is less than the threshold, the detection point will be updated until it is on both sides of the trigger line, and the face database will be used for deduplication processing. , combined with multi-target tracking based on Anchor-Free neural network, to improve statistical accuracy.

Benefits of technology

It achieves accurate passenger flow statistics when target people are shaking back and forth and entering and exiting repeatedly, improving the accuracy and real-time performance of passenger flow statistics, avoiding repeated counting, and adapting to crowded and crowded scenes at the entrance and exit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113469982B
    Figure CN113469982B
Patent Text Reader

Abstract

The present application discloses a method, device and electronic device for accurate passenger flow counting, the method comprising: when performing passenger flow counting, using the head and shoulder frame of the target person as the detection frame, and using an adaptive dynamic threshold related to the height of the head and shoulder frame as the floating area of ​​the trigger line, when the center point of the head and shoulder frame of the target person crosses the trigger line and passes through the floating area, the target is started to be counted. Based on the above method, the problem of inaccurate passenger flow counting caused by repeated counting in a short period of time due to the target person shaking back and forth near the trigger line can be avoided, and accurate passenger flow counting can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device and electronic equipment for accurate passenger flow counting. Background Art

[0002] Passenger flow is a very important data indicator in the real economy. Accurate passenger flow statistics can help businesses analyze their operating results in a specific period of time, thereby adjusting their own operating methods and improving performance. At the same time, many public places can effectively prevent crowding and trampling incidents by accurately counting passenger flow and adjusting the flow control of entrances and exits at any time, thereby achieving better safety management.

[0003] In order to achieve accurate passenger flow statistics, existing technical solutions usually count the people entering or leaving the area by judging whether the two frames of images captured by the device are on both sides of the trigger line, and combining the movement direction of the target person. The trigger line here is the reference line of the position of the target person entering or leaving the area, which needs to be pre-set in the image acquisition device. However, in actual scenarios, the target person may sway back and forth near the trigger line, resulting in the same person being counted multiple times, thereby affecting the accuracy of passenger flow statistics. Summary of the invention

[0004] The present application provides a method, device and electronic equipment for accurately counting passenger flow, which can realize accurate passenger flow counting in the case of people moving back and forth and repeatedly entering and exiting.

[0005] In a first aspect, the present application provides a method for accurately counting passenger flow, the method comprising:

[0006] Acquire a detection image and determine a detection point in the detection image, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of a trigger line;

[0007] Calculating the vertical distance from the detection point to the trigger line;

[0008] Determining whether the vertical distance is greater than a preset threshold;

[0009] If the vertical distance is greater than a preset threshold, counting the passenger flow of the target object in the detection image;

[0010] If the vertical distance is less than a preset threshold, the detection point is updated until the detection point and the reference point are located on both sides of the trigger line.

[0011] The above statistical method can avoid the problem of inaccurate passenger flow statistics caused by repeated counting when the target person sways back and forth slightly near the trigger line, thereby achieving accurate passenger flow statistics.

[0012] In a possible design, acquiring a detection image and determining a detection point in the detection image includes:

[0013] Determine a target head and shoulder frame of the detection image, and determine a center point of the target head and shoulder frame;

[0014] The central point is used as the detection point.

[0015] Through the above method, the target head and shoulder frame is used as the target frame, and the center point of the head and shoulder frame is used as the detection point, which can reduce the impact of the size difference of the target frame in the distant view and the near view, and improve the detection accuracy.

[0016] In a possible design, the preset threshold is proportional to the target head-shoulder box height.

[0017] Using a parameter proportional to the height of the target head and shoulder frame as the threshold can reduce the size difference of the target frame in the distant view and the near view. When the target frame in the distant view is reduced, the threshold is reduced accordingly, which can improve the counting accuracy.

[0018] In a possible design, counting the number of passengers on the target object in the detection image includes:

[0019] Select the target image;

[0020] Detecting whether there is face data in the target head and shoulder frame of the target image;

[0021] If the face data does not exist in the target head and shoulder frame of the target image, the target object is deleted;

[0022] If the face data exists in the target head and shoulder frame of the target image, the target object is counted.

[0023] Through the above method, the target object without face data is deleted. In this case, it can be ensured that all personnel participating in the counting can participate in the face database comparison each time, thereby improving the accuracy of passenger flow statistics.

[0024] In a possible design, counting the target objects includes:

[0025] Matching the face data of the target object with a preset face database, wherein the preset face database includes a non-customer face database and a customer face database of the day;

[0026] If the target object's facial data successfully matches the preset facial database, the target's in and out counts are both incremented by 0;

[0027] If the target object face data fails to match the preset face database, the target entry or exit count is increased by 1, and the target object face data is stored in the preset face database.

[0028] Based on the above method, the target object's facial data is matched with the preset facial database, which can not only exclude non-customer personnel, but also deduplicate the faces of customers who repeatedly enter and exit the same day, thereby avoiding the problem of inaccurate customer flow statistics caused by counting the same target multiple times.

[0029] In a possible design, before acquiring the detection image, the following steps are further included:

[0030] Input two frames of images continuously acquired by the image acquisition device into the Anchor-Free based neural network respectively, and obtain the coordinates of the head-shoulder frame and ReID features of multiple targets in the two frames of images, wherein the coordinates of the target head-shoulder frame correspond to the ReID features one by one;

[0031] Judging whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features;

[0032] If the head-shoulder frame of any target meets the tracking condition, the head-shoulder frame of the target meeting the tracking condition is tracked, and a frame of image is selected in the tracking trajectory as the detection image;

[0033] If the head-shoulder frame of any target does not meet the tracking condition, and the number of times that the head-shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold, the head-shoulder frame of the target is deleted.

[0034] Based on the above method, multiple targets can be tracked, so that the above method of accurate passenger flow statistics can adapt to the situation where there are many people at the entrance and exit. At the same time, the use of Anchor-Free based neural network can achieve a single network forward reasoning to simultaneously obtain the coordinates of the head and shoulder frames and ReID features of multiple targets in the image, which can reduce time consumption and improve real-time performance.

[0035] In a possible design, it is determined whether the head and shoulder frame of each target meets the tracking conditions, including:

[0036] According to the coordinates of the head-shoulder frames of the multiple targets and the ReID features, a loss matrix of the head-shoulder frames of the multiple targets is calculated, wherein the loss matrix indicates a feature similarity distance between the head-shoulder frame of the target in the first image of the two frames of images and the head-shoulder frame of the target in the second image of the two frames of images;

[0037] Filtering the elements in the loss matrix that are greater than a preset feature similarity threshold, and matching the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity, and determining that the head and shoulder frame of the target with a matching relationship meets the tracking condition;

[0038] For a head-shoulder frame of a target for which a matching relationship cannot be established based on feature similarity, an intersection-and-union ratio is calculated according to the coordinates of the head-shoulder frame of the target in the first image and the coordinates of the head-shoulder frame of the target in the second image to obtain an intersection-and-union ratio matrix, wherein the intersection-and-union ratio matrix indicates a degree of overlap between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image;

[0039] The elements in the IoU matrix that are less than a preset IoU threshold are filtered out, and the head and shoulder frames of the target in the first image corresponding to the remaining elements are matched with the head and shoulder frames of the target in the second image based on the IoU, and it is determined that the head and shoulder frames of the target with a matching relationship meet the tracking conditions; otherwise, the head and shoulder frames of the target do not meet the tracking conditions and the iterative tracking process does not enter.

[0040] In the process of tracking multiple targets, the feature similarity between the head and shoulder frames of the target is first matched to determine whether the head and shoulder frames of the target meet the tracking conditions, which can effectively alleviate the problems of missed tracking and wrong tracking caused by the rapid movement and crowding of target objects. For the remaining targets that cannot meet the tracking conditions, the intersection-over-union ratio between the head and shoulder frames of the target is further matched to determine whether the target meets the tracking conditions. Through two matches, the tracking efficiency of the head and shoulder frames of the targets in the image can be improved, and the accuracy of multi-target tracking can be improved.

[0041] In one possible design, the loss matrix of the head and shoulder boxes of multiple targets is calculated, including:

[0042] According to the head-shoulder frame coordinates of the multiple targets, the Mahalanobis distance between the center point of the head-shoulder frame of the target in the first image and the center point of the head-shoulder frame of the target in the second image is calculated to obtain a first Mahalanobis distance matrix;

[0043] According to the preset parameters, the elements in the first Mahalanobis distance matrix that are greater than or equal to the preset parameters are set to infinity, and the elements that are less than the preset parameters are set to 1, to obtain a second Mahalanobis distance matrix;

[0044] According to the re-identification (ReID) features of the head-shoulder frames of the multiple targets, the feature similarity distance between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image is calculated to obtain a feature similarity distance matrix;

[0045] The loss matrix is ​​obtained by multiplying the second Mahalanobis distance matrix with the corresponding elements of the feature similarity matrix.

[0046] Based on the above method, the generated loss matrix can realize the feature similarity distance between the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image whose spatial distance is greater than a preset parameter becoming infinite.

[0047] In a second aspect, the present application provides a device for accurate passenger flow statistics, the device comprising:

[0048] An acquisition module, used for acquiring a detection image and determining a detection point in the detection image, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of a trigger line;

[0049] A calculation module, used for calculating the vertical distance from the detection point to the trigger line;

[0050] A first determination module, used to determine whether the vertical distance is greater than a preset threshold;

[0051] A counting module, for counting the passenger flow of the target object in the detection image if the vertical distance is greater than a preset threshold;

[0052] The updating module is used to count the passenger flow of the target object in the detection image if the vertical distance is greater than a preset threshold.

[0053] In a possible design, the counting module is specifically used for:

[0054] Select the target image;

[0055] Detecting whether there is face data in the target image;

[0056] If the face data does not exist in the target image, deleting the target object;

[0057] If the face data exists in the target image, the target object is counted.

[0058] In a possible design, the counting module is further used for:

[0059] Matching the face data of the target object with a preset face database, wherein the preset face database includes a non-customer face database and a customer face database of the day;

[0060] If the target object's facial data successfully matches the preset facial database, the target's in and out counts are both incremented by 0;

[0061] If the target object face data fails to match the preset face database, the target entry or exit count is increased by 1, and the target object face data is stored in the preset face database.

[0062] In one possible design, the device further includes:

[0063] An encoding module, used to input two frames of images continuously acquired by an image acquisition device into a neural network based on Anchor-Free, respectively, to obtain the coordinates of the head-shoulder frame and the ReID features of multiple targets in the two frames of images, wherein the coordinates of the head-shoulder frame of the target and the ReID features correspond one to one;

[0064] A second determination module is used to determine whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features;

[0065] A tracking module, if the head-shoulder frame of any target meets the tracking condition, is used to track the head-shoulder frame of the target that meets the tracking condition, and select a frame of image in the tracking trajectory as a detection image;

[0066] The deletion module is used to delete the head and shoulder frame of any target if the head and shoulder frame of the target does not meet the tracking condition and the number of times the head and shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold.

[0067] In a possible design, the second determination module includes:

[0068] A first calculation unit is used to calculate the loss matrix of the head-shoulder frames of the multiple targets according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features, wherein the loss matrix indicates the feature similarity distance between the head-shoulder frame of the target in the first image of the two frames of images and the head-shoulder frame of the target in the second image of the two frames of images;

[0069] A first matching unit is used to filter out the elements in the loss matrix that are greater than a preset feature similarity threshold, and match the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity, to determine that the head and shoulder frame of the target with which the matching relationship is established meets the tracking condition;

[0070] A second calculation unit, for a head-shoulder frame of a target for which a matching relationship cannot be established based on feature similarity, is used to calculate an intersection-and-union ratio according to the coordinates of the head-shoulder frame of the target in the first image and the coordinates of the head-shoulder frame of the target in the second image, to obtain an intersection-and-union ratio matrix, wherein the intersection-and-union ratio matrix indicates a degree of overlap between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image;

[0071] The second matching unit is used to filter out the elements in the IoU matrix that are less than a preset IoU threshold, and match the head and shoulder frame of the target in the first image corresponding to the remaining elements with the head and shoulder frame of the target in the second image based on the IoU, to determine whether the head and shoulder frame of the target with a matching relationship meets the tracking condition; otherwise, the head and shoulder frame of the target does not meet the tracking condition and does not enter the iterative tracking process.

[0072] In a third aspect, the present application provides an electronic device, including:

[0073] Memory, used to store computer programs;

[0074] The processor is used to implement the above-mentioned method steps for accurate passenger flow statistics when executing the computer program stored in the memory.

[0075] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps for implementing the above-mentioned accurate passenger flow statistics are implemented.

[0076] Based on the method provided by the present application, when counting passenger flow, the head and shoulder frame of the tracked target person is used as the detection frame, and the threshold value related to the height of the head and shoulder frame is used as the floating area of ​​the trigger line. When the center point of the head and shoulder frame of the target person crosses the trigger line and passes through the floating area, the target starts to be counted. This method can avoid the problem of inaccurate passenger flow statistics caused by repeated counting caused by the target person shaking back and forth with a small amplitude near the trigger line, and realize accurate passenger flow statistics when the target person shakes back and forth.

[0077] At the same time, when counting the target objects that cross the trigger line and pass through the floating area, the facial data of the target objects are matched with the non-customer facial database and the customer facial database of the day, which can not only exclude non-customer personnel, but also deduplicate the faces of customers who repeatedly enter and exit the day, thereby avoiding the problem of inaccurate customer flow statistics caused by multiple counting of the same target. In addition, the facial data of customers whose storage time in the customer facial database of the day reaches a preset time length is deleted, which can not only realize the regular cleaning of the customer facial database of the day, but also further protect customer privacy.

[0078] In addition, in the process of tracking multiple targets, the target head and shoulder frames in the previous and next two frames of images are first matched based on feature similarity to determine whether the head and shoulder frames of the target meet the tracking conditions. For the remaining targets that do not meet the tracking conditions, the target head and shoulder frames are further matched based on the intersection and union ratio to determine whether the target meets the tracking conditions. Through two matches, the tracking efficiency of the target head and shoulder frames in the image can be improved, and the accuracy of multi-target tracking can be improved. Then the tracked targets are counted, so that the accurate passenger flow statistics method can better adapt to the scenes where the target personnel are crowded, moving quickly, disappearing for a short time, and occluding each other.

[0079] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 A schematic diagram of counting rules for a trigger line non-fluctuation area provided in this application;

[0081] Figure 2 A flowchart of an accurate passenger flow statistics method provided for this application;

[0082] Figure 3 A schematic diagram of a target head and shoulder frame counting rule provided for this application;

[0083] Figure 4 A flow chart of a passenger flow counting method provided for this application;

[0084] Figure 5 A two-stage schematic diagram of detection and identification provided for this application;

[0085] Figure 6 A multi-target tracking flow chart provided for this application;

[0086] Figure 7 A schematic diagram of simultaneous output detection and features provided by this application;

[0087] Figure 8 A flowchart for determining whether the head and shoulder frame of a target meets the tracking conditions provided by this application;

[0088] Fig. 9 A schematic diagram of the structure of a precise passenger flow counting device provided in this application;

[0089] Fig.10 A schematic diagram of the structure of a multi-target tracking module provided in this application;

[0090] Fig.11A schematic diagram of the structure of a module for determining whether a head and shoulder frame of a target meets tracking conditions provided by the present application;

[0091] Fig.12 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0092] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. It should be noted that in the description of the present application, "multiple" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent: A is directly connected to B and A is connected to B through C. In addition, in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0093] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0094] The embodiment of the present application provides a precise passenger flow counting method, which is used to achieve precise passenger flow counting when the target person is swaying back and forth near the trigger line, thereby improving the accuracy of passenger flow counting. The method and device described in the embodiment of the present application are based on the same technical concept. Since the principles of the problems solved by the method and the device are similar, the embodiments of the device and the method can refer to each other, and the repeated parts will not be repeated.

[0095] like Figure 1 As shown, the prior art generally determines whether to count the flow of people on the target person by continuously collecting images of the target person through an image collection device. Specifically, Figure 1 The black dot in the middle represents the center point of the target frame in each frame of the image captured by the device, the thick black line is the trigger line, which is the reference line for the position of the target person entering or leaving the area, and the black curve represents the target person's movement trajectory. By judging whether the center point of the target frame of the previous and next frames is on both sides of the trigger line, and combining the movement direction of the center point of the target frame to count the entry or exit of the target person. According to the statistical method of the prior art, from t1 to t4, the target person was counted twice for entering and leaving the area. However, the target person actually just swayed back and forth near the trigger line, and the number of times counted according to the existing method was inaccurate.

[0096] In order to avoid the problem of inaccurate passenger flow statistics caused by repeated counting of target persons who swing back and forth near the trigger line, an embodiment of the present application provides an accurate passenger flow statistics method to achieve accurate passenger flow statistics when the target persons swing back and forth and repeatedly enter and exit. Specific embodiment one:

[0098] like Figure 2 The figure is a flow chart of a precise passenger flow counting method provided by the present application, the method comprising:

[0099] S21, acquiring a detection image and determining a detection point in the detection image, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of the trigger line;

[0100] In the embodiment of the present application, the method for determining the detection point may be: determining a target head-shoulder frame of the detection image, and taking the center point of the target head-shoulder frame as the detection point, such as Figure 3 As shown, the square box in the figure represents the target head and shoulder box, and the black dot therein represents the center point of the target head and shoulder box.

[0101] In addition, in an embodiment of the present application, a method for determining whether the detection point and the reference point are on both sides of the trigger line may be: if the line between the detection point and the reference point intersects the trigger line, it indicates that the detection point and the reference point are on both sides of the trigger line.

[0102] S22, calculating the vertical distance from the detection point to the trigger line;

[0103] S23, determining whether the vertical distance from the detection point to the trigger line is greater than a preset threshold;

[0104] In the embodiment of the present application, the threshold value may be a parameter related to the target head-shoulder frame height, such as Figure 3 As shown in the figure, the distance from the dotted line to the trigger line is the threshold. Here, the threshold is 1 / 5 of the target head and shoulder box height. Of course, in different application scenarios, the threshold may also be 1 / 4, 1 / 6, 1 / 7 of the target head and shoulder box height according to different situations.

[0105] If the vertical distance from the detection point to the trigger line is greater than the threshold, execute step S24; otherwise, execute step S25.

[0106] Based on the above method, when judging the position of the detection point, a parameter related to the height of the target head and shoulder frame is used as a threshold, and the threshold is used as the floating area on both sides of the trigger line. This method can avoid the problem of inaccurate passenger flow statistics caused by repeated counting when the target person repeatedly shakes near the trigger line.

[0107] S24, if the vertical distance from the detection point to the trigger line is greater than the threshold, counting the passenger flow of the target in the detection image;

[0108] In the embodiment of the present application, in order to improve the accuracy of passenger flow statistics, not only non-customer personnel should be excluded when counting passenger flow, but also the face duplication of customers who repeatedly enter and exit the same day should be removed. The specific passenger flow counting process is as follows: Figure 4 As shown:

[0109] S41, selecting a target image;

[0110] In the motion trajectory of the target object in the detection image, according to a preset image quality scoring rule, an image with the highest quality score is selected as the target image.

[0111] S42, detecting whether there is face data in the target head and shoulder frame of the target image;

[0112] S43, if there is no face data in the target head and shoulder frame of the target image, delete the target object;

[0113] S44, if there is face data in the target head and shoulder frame of the target image, count the target object.

[0114] In the embodiment of the present application, the target object may be counted by updating the counting result.

[0115] Specifically, if the facial data in the target head and shoulder frame of the target image successfully matches the preset face database, the target entry and exit counts are both increased by 0; if the facial data in the target head and shoulder frame of the target image fails to match the preset face database, the target entry or exit counts are both increased by 1, and the facial data of the target head and shoulder frame is stored in the preset face database.

[0116] The preset face database includes a non-customer face database and a customer face database for the day. The non-customer face database stores the face data of staff members, and the customer face database for the day stores the face data of customers who have participated in the counting on the day. For customer face data stored in the customer face database for the day, if the storage time reaches the preset time length, the customer face data will be deleted.

[0117] Based on the above method, the target object's facial data is matched with the preset facial database, which can not only exclude non-customer personnel, but also perform facial deduplication processing on customers who repeatedly enter and exit the same day, thereby avoiding the problem of inaccurate customer flow statistics caused by multiple counting of the same target and improving the statistical accuracy. At the same time, the customer facial data of the customer facial database of the day whose storage time reaches the preset time length is deleted, which can not only realize the regular cleaning of the customer facial database of the day, but also further protect the privacy of customers.

[0118] S25, if the vertical distance is less than a preset threshold, the detection point is updated until the detection point and the reference point are located on both sides of the trigger line.

[0119] When the detection point and the reference point are on both sides of the trigger line, the process returns to step S22; otherwise, the detection point is updated until the detection point and the reference point are on both sides of the trigger line.

[0120] The above steps are executed repeatedly until the target statistics in all images acquired by the device are completed.

[0121] Further, in order to further elaborate on the method provided by the present application, Figure 3 Take the above passenger flow statistics method as an example to illustrate.

[0122] When the reference point is the center of the target head and shoulder frame of the second frame image, and the detection point is the center of the target head and shoulder frame of the third frame image, since the vertical distance from the detection point to the trigger line is less than 1 / 5 of the height of the target head and shoulder frame, the detection point is updated until the detection point is the center of the target head and shoulder frame of the fifth frame image. The detection point and the reference point are located on both sides of the trigger line, and it is calculated that the vertical distance from the detection point to the trigger line is greater than 1 / 5 of the height of the target head and shoulder frame. At this time, the target object can be counted.

[0123] Based on the above method, when counting passenger flow, a parameter related to the height of the target head-shoulder frame is used as a threshold, and the threshold is used as the floating area on both sides of the trigger line. When the center point of the target person's head-shoulder frame crosses the trigger line and enters the floating area and leaves the area in the same direction, the target is counted. This method can avoid the problem of inaccurate passenger flow statistics caused by repeated counting due to repeated shaking of the target person near the trigger line.

[0124] In addition, in order to improve the accuracy of passenger flow statistics, the present application not only matches the target object's facial data with the non-customer facial database to exclude non-customer personnel when counting passenger flow; it also matches it with the customer facial database of the day to deduplicate the faces of customers who repeatedly enter and exit the day, thereby avoiding the problem of inaccurate passenger flow statistics caused by counting the same target multiple times.

[0125] Furthermore, deleting the customer face data whose storage time in the customer face database of the day reaches a preset time length can not only achieve regular cleaning of the customer face database of the day, but also protect customer privacy. Specific embodiment 2:

[0127] Embodiment 1 is a passenger flow counting method based on the case where there is only one target in the image collected by the device. In the actual application scenario of passenger flow counting, the entrance and exit areas are often crowded. In this case, there will be multiple targets in each frame image collected by the device. In order to achieve accurate passenger flow statistics under multiple targets, it is necessary to track multiple targets at the same time, select the detection image in the target tracking trajectory and count the target according to the method described in Embodiment 1.

[0128] To achieve multi-target tracking, it is often necessary to first obtain the target's detection frame and re-identification features. Figure 5 As shown, the prior art generally obtains the target detection frame from the captured image through a detection network, and then inputs the detection frame into a recognition network to extract the target re-identification features. The target recognition network used in this two-stage multi-target tracking method can only extract features for each target separately. When the number of targets in the image is large, the real-time performance of target tracking will be reduced.

[0129] In order to track multiple targets simultaneously, Figure 6 The following is a multi-target tracking method provided by this application. The specific process is as follows:

[0130] S61, inputting two frames of images continuously acquired by the image acquisition device into the Anchor-Free based neural network respectively, obtaining the coordinates of the head and shoulder frames of multiple targets in the two frames of images and ReID features, wherein the coordinates of the head and shoulder frames of the targets correspond one to one with the ReID features;

[0131] like Figure 7 As shown in , for each input image, the use of the Anchor-Free based neural network can achieve a single network forward inference to simultaneously obtain the coordinates of the head and shoulder boxes and ReID features of multiple targets in the image; Figure 5 According to the prior art shown in the figure, if one wants to obtain the coordinates and ReID features of the head and shoulder frame of a target, the head and shoulder frame of the target must first be obtained through a detection network. At this time, the head and shoulder frame of the target is the detection frame of the target. The head and shoulder frame of the target is then input into a recognition network to extract the ReID features of the head and shoulder frame of the target. Moreover, the recognition network can only extract features for each target separately. When the number of targets in the image is large, the real-time performance of target tracking will be reduced.

[0132] Therefore, in the embodiment of the present application, the Figure 7The Anchor-Free based neural network shown in the figure obtains the coordinates of the head and shoulder frame and the ReID features of the target, which has the advantages of reducing time consumption and strong real-time performance.

[0133] Secondly, the neural network uses DLA (Deep Layer Aggregation) as the backbone network, which integrates multi-level and multi-scale network feature layers, can eliminate the impact of target size differences, and at the same time enable the extracted ReID feature information to take into account both the semantic information in the high-level network and the color texture information in the low-level network layer.

[0134] S62, judging whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features;

[0135] Specifically, the process of determining whether the target's head and shoulder frame meets the tracking conditions is as follows: Figure 8 As shown:

[0136] S81, calculating the loss matrix of the head-shoulder boxes of the multiple targets according to the coordinates of the head-shoulder boxes of the multiple targets and the ReID features;

[0137] In the embodiment of the present application, the loss matrix indicates the feature similarity distance between the head and shoulder frame of the target in the first image of the two frames of images and the head and shoulder frame of the target in the second image of the two frames of images. The calculation process of obtaining the loss matrix is ​​as follows:

[0138] According to the head-shoulder frame coordinates of the above-mentioned multiple targets, the Mahalanobis distance between the center point of the head-shoulder frame of the target in the first image and the center point of the head-shoulder frame of the target in the second image is calculated to obtain a first Mahalanobis distance matrix;

[0139] According to the preset parameters, the elements in the first Mahalanobis distance matrix that are greater than or equal to the preset parameters are set to infinity, and the elements that are less than the preset parameters are set to 1, to obtain a second Mahalanobis distance matrix;

[0140] Calculating the feature similarity distance between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image according to the ReID features of the head-shoulder frames of the multiple targets, and obtaining a feature similarity distance matrix;

[0141] The loss matrix is ​​obtained by multiplying the second Mahalanobis distance matrix with the corresponding elements of the feature similarity matrix.

[0142] Based on the above method, the generated loss matrix can realize the feature similarity distance between the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image whose spatial distance is greater than a preset parameter becoming infinite.

[0143] S82, filtering out the elements in the loss matrix that are greater than a preset feature similarity threshold, and matching the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity;

[0144] In the embodiment of the present application, the elements of the loss matrix indicate the feature similarity distance between the head-shoulder frame of a certain target in the first image and the head-shoulder frame of a certain target in the second image. By filtering the elements in the loss matrix that are greater than a preset feature similarity threshold, the head-shoulder frames of targets with a relatively long spatial distance in the two frames of images before and after can be excluded;

[0145] The matching based on feature similarity refers to using a preset algorithm to establish a matching relationship between the head and shoulder frames of the two targets whose ReID features are closest in the first image and the second image. The preset algorithm can be the Hungarian algorithm, and the specific algorithm is not limited in the embodiments of the present application.

[0146] If a matching relationship is established between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image based on feature similarity, it can be determined that the head-shoulder frame of the target is formed by the head-shoulder frame of the same target at different stages. Therefore, it is determined that the head-shoulder frame of the target meets the tracking condition, and step S83 is executed; otherwise, step S84 is executed.

[0147] S83, if a matching relationship is established between the head and shoulder frames of the target based on feature similarity, determining that the head and shoulder frames of the target meet the tracking condition;

[0148] A matching relationship is established between the head and shoulder frames of the target based on feature similarity, which means that the head and shoulder frames of the target in the first image and the head and shoulder frames of the target in the second image are closest in ReID features during the matching process. Therefore, it is determined that the head and shoulder frames of the target in the two frames are generated by the same target at different stages.

[0149] S84, if a matching relationship cannot be established between the head-shoulder frames of the target based on feature similarity, calculating an intersection-over-union ratio according to the coordinates of the head-shoulder frames of the target to obtain an intersection-over-union ratio matrix;

[0150] In the embodiment of the present application, the IOR indicates the degree of overlap between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image.

[0151] S85, filtering out the elements in the IoU matrix that are smaller than a preset IoU threshold, and matching the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image corresponding to the remaining elements based on the IoU;

[0152] In the embodiment of the present application, the elements of the loss matrix indicate the degree of overlap between the head-shoulder frame of a certain target in the first image and the head-shoulder frame of a certain target in the second image. By filtering the elements in the intersection-over-union ratio matrix that are less than a preset intersection-over-union ratio threshold, the target head-shoulder frame whose overlap in the two frames does not meet the requirement can be excluded;

[0153] The matching based on intersection-over-union ratio refers to using a preset algorithm to establish a matching relationship between the head and shoulder frames of the two targets with the highest overlap in the first image and the second image. The preset algorithm can be the Hungarian algorithm, and the specific algorithm is not limited in the embodiments of the present application.

[0154] If the head-shoulder frames of the target are matched based on the intersection-over-union ratio, it can be determined that the head-shoulder frame of the target is formed by the head-shoulder frames of the same target at different stages. Therefore, it is determined that the head-shoulder frame of the target meets the tracking condition, and step S86 is executed; otherwise, step S87 is executed.

[0155] S86, if a matching relationship is established between the head and shoulder frames of the target based on the intersection-over-union ratio, it is determined that the target meets the tracking condition;

[0156] A matching relationship is established between the head and shoulder frames of the target based on the intersection-over-union ratio, which means that the head and shoulder frames of the target in the first image and the head and shoulder frames of the target in the second image have the highest overlap during the matching process. Therefore, it is determined that the head and shoulder frames of the target in the two frames of images are the head and shoulder frames of the same target generated at different stages.

[0157] S87: If a matching relationship cannot be established between the head and shoulder frames of the target based on the intersection-over-union ratio, it is determined that the head and shoulder frames of the target do not meet the tracking condition.

[0158] S63, if the head-shoulder frame of any target meets the tracking condition, the head-shoulder frame of the target meeting the tracking condition is tracked, and a frame of image is selected in the tracking track as a detection image;

[0159] The method for tracking the head and shoulder frame of the target is achieved by creating and updating a tracking body, wherein the tracking body records the head and shoulder frame coordinates, ReID feature information and tracking status of the target.

[0160] Specifically, if the head and shoulder frame of the target does not have a tracking body created, a tracking body is created for the target, and the head and shoulder frame coordinates, head and shoulder frame ReID features and tracking status of the target in the latest frame image are recorded in the tracking body, and the tracking status is set to the creation state;

[0161] If the target's head and shoulder frame has created a tracking volume, the target's head and shoulder frame coordinates, head and shoulder frame ReID features and tracking status in the latest frame image are recorded in the tracking volume, and the tracking status is set to the update status;

[0162] By creating and updating the tracking body information of the target head and shoulder frame, the head and shoulder frame of the target is tracked, and a frame of image is selected as a detection image in the tracking trajectory, and the method steps provided in the first embodiment are executed to realize passenger flow counting.

[0163] S64, if the head-shoulder frame of any target does not meet the tracking condition, and the number of times that the head-shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold, the head-shoulder frame of the target is deleted;

[0164] Specifically, when the head and shoulder frame of the target cannot meet the tracking condition, if the head and shoulder frame of the target has created a tracking body, the tracking body is updated to a lost state. If the tracking body of the head and shoulder frame of the target is in a lost state, it indicates that the tracking track of the head and shoulder frame of the target is disconnected. If the number of times that the tracking body is in a lost state continuously reaches a first threshold, the corresponding target head and shoulder frame is deleted. In the embodiment of the present application, the first threshold can be 15, and can also be adjusted to other parameters according to actual conditions, which is not limited here.

[0165] If the head and shoulder frame of the target does not create a tracking body, the head and shoulder frame of the target is placed in a temporary target library. When the number of times that the head and shoulder frame of the target fails to meet the tracking conditions continuously reaches a second threshold, the head and shoulder frame of the target is deleted from the temporary target library. In this application, the second threshold can be 3, and can also be adjusted to other parameters according to actual conditions, which is not limited here.

[0166] After the above steps are completed, the original second image is updated to the first image, and the next frame image is updated to the second image, and the above steps S61 to S64 are executed in a loop.

[0167] Based on the above steps, this application uses an Anchor-Free based neural network to implement a single network forward reasoning to obtain the coordinates of the head and shoulder frames of multiple targets in the image and the ReID features. The coordinates of the head and shoulder frames of the targets correspond one to one to the ReID features. The number of targets in the image does not affect the reasoning time, so it can reduce time consumption and has strong real-time performance.

[0168] In addition, in the process of tracking multiple targets, the target head and shoulder frames are first matched based on feature similarity to determine whether the target head and shoulder frames meet the tracking conditions, which can alleviate the problem of rapid movement and crowding of target head and shoulder frames. For the remaining targets that cannot meet the tracking conditions, the target head and shoulder frames are further matched based on the intersection-over-union ratio to determine whether the target meets the tracking conditions. Through two matches, the tracking efficiency of the target head and shoulder frames in the image can be improved, and the accuracy of multi-target tracking can be improved.

[0169] Based on the same inventive concept, the present application also provides a device for accurate passenger flow statistics, such as Fig. 9 As shown, it is a structural schematic diagram of a precise passenger flow statistics device in this application, and the device includes:

[0170] An acquisition module 91 is used to acquire a detection image and determine a detection point in the detection image, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of a trigger line;

[0171] A calculation module 92, used for calculating the vertical distance from the detection point to the trigger line;

[0172] A first determination module 93, used to determine whether the vertical distance is greater than a preset threshold;

[0173] A counting module 94, for counting passenger flow of the target object in the detection image if the vertical distance is greater than a preset threshold;

[0174] The updating module 95 is used to count the passenger flow of the target object in the detection image if the vertical distance is greater than a preset threshold.

[0175] In a possible design, the counting module is specifically used for:

[0176] Select the target image;

[0177] Detecting whether there is face data in the target head and shoulder frame of the target image;

[0178] If the face data does not exist in the target head and shoulder frame of the target image, the target object is deleted;

[0179] If the face data exists in the target head and shoulder frame of the target image, the target object is counted.

[0180] In a possible design, the counting module is further used for:

[0181] Matching the face data of the target object with a preset face database, wherein the preset face database includes a non-customer face database and a customer face database of the day;

[0182] If the target object's facial data successfully matches the preset facial database, the target's in and out counts are both incremented by 0;

[0183] If the target object face data fails to match the preset face database, the target entry or exit count is increased by 1, and the target object face data is stored in the preset face database.

[0184] In one possible design, Fig.10 As shown, the device also includes:

[0185] The encoding module 101 is used to input two frames of images continuously acquired by the image acquisition device into the Anchor-Free based neural network respectively to obtain the coordinates of the head and shoulder frames and ReID features of multiple targets in the two frames of images;

[0186] A second determination module 102 is used to determine whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features;

[0187] A tracking module 103, if the head-shoulder frame of any target meets the tracking condition, is used to track the head-shoulder frame of the target that meets the tracking condition, and select a frame of image in the tracking track as a detection image;

[0188] The deleting module 104 is used to delete the head and shoulder frame of any target if the head and shoulder frame of the target meets the tracking condition and the number of times the head and shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold.

[0189] In one possible design, Fig.11 As shown, the second determination module 102 includes:

[0190] A first calculation unit 111 is used to calculate the loss matrix of the head-shoulder frames of the multiple targets according to the coordinates of the head-shoulder frames of the multiple targets and the ReID features, wherein the loss matrix indicates the feature similarity distance between the head-shoulder frame of the target in the first image of the two frames of images and the head-shoulder frame of the target in the second image of the two frames of images;

[0191] A first matching unit 112 is used to filter out the elements in the loss matrix that are greater than a preset feature similarity threshold, and match the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity, to determine that the head and shoulder frame of the target with which the matching relationship is established meets the tracking condition;

[0192] The second calculation unit 113 is used to calculate the intersection-and-union ratio according to the coordinates of the head-and-shoulder frame of the target in the first image and the coordinates of the head-and-shoulder frame of the target in the second image, for the head-and-shoulder frame of the target whose feature similarity cannot establish a matching relationship, to obtain an intersection-and-union ratio matrix, wherein the intersection-and-union ratio matrix indicates the degree of overlap between the head-and-shoulder frame of the target in the first image and the head-and-shoulder frame of the target in the second image;

[0193] The second matching unit 114 is used to filter out the elements in the IoU matrix that are less than a preset IoU threshold, and match the head and shoulder frame of the target in the first image corresponding to the remaining elements with the head and shoulder frame of the target in the second image based on the IoU, to determine whether the head and shoulder frame of the target with a matching relationship meets the tracking condition; otherwise, the head and shoulder frame of the target does not meet the tracking condition and the iterative tracking process does not enter.

[0194] Based on the above-mentioned device for accurate passenger flow counting, when performing passenger flow counting, the head and shoulder frame of the tracked target person is used as the detection frame, and the threshold value related to the height of the head and shoulder frame is used as the floating area of ​​the trigger line. When the center point of the head and shoulder frame of the target person crosses the trigger line and passes through the floating area, the target starts to be counted. This method can avoid the problem of inaccurate passenger flow counting caused by repeated counting caused by the target person swaying back and forth near the trigger line, and realize accurate passenger flow counting when the target person sways back and forth.

[0195] At the same time, when counting the target objects that cross the trigger line and pass through the floating area, the target object's facial data is matched with the non-customer facial database and the customer facial database of the day, which can not only exclude non-customer personnel, but also perform facial deduplication processing on customers who repeatedly enter and exit the day, thereby avoiding the problem of inaccurate customer flow statistics caused by multiple counting of the same target. In addition, the customer facial data of the customer facial database of the day that has been stored for a preset time length is deleted, which can not only realize the regular cleaning of the customer facial database of the day, but also further protect customer privacy.

[0196] In addition, in the process of tracking multiple targets, the target head and shoulder frames in the previous and next two frames of images are first matched based on feature similarity to determine whether the head and shoulder frames of the target meet the tracking conditions. For the remaining targets that do not meet the tracking conditions, the target head and shoulder frames are further matched based on the intersection and union ratio to determine whether the target meets the tracking conditions. Through two matches, the tracking efficiency of the target head and shoulder frames in the image can be improved, and the accuracy of multi-target tracking can be improved. Then the tracked targets are counted, so that the accurate passenger flow statistics method can better adapt to the scenes where the target personnel are crowded, moving quickly, disappearing for a short time, and occluding each other.

[0197] Based on the same inventive concept, an electronic device is also provided in the embodiment of the present application, and the electronic device can realize the functions of the above-mentioned accurate passenger flow counting device, referring to Fig.12 , the electronic device comprises:

[0198] At least one processor 121, and a memory 122 connected to the at least one processor 121. The specific connection medium between the processor 121 and the memory 122 is not limited in the embodiment of the present application. Fig.12 In the example, the processor 121 and the memory 122 are connected via the bus 120. The bus 120 is Fig.12 The connection between other components is shown by bold lines, and is not intended to be limiting. The bus 120 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 121 can also be called a controller, and there is no limitation on the name.

[0199] In the embodiment of the present application, the memory 122 stores instructions that can be executed by at least one processor 121. The at least one processor 121 can execute the method for accurate passenger flow statistics discussed above by executing the instructions stored in the memory 122. The processor 121 can implement Fig. 9 The functions of each module in the device shown.

[0200] Among them, the processor 121 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 122 and calling data stored in the memory 122, the various functions of the device and process data, the device can be monitored as a whole.

[0201] In one possible design, the processor 121 may include one or more processing units, and the processor 121 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 121. In some embodiments, the processor 121 and the memory 122 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0202] The processor 121 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the precise passenger flow counting method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0203] The memory 122 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 122 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 122 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 122 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0204] By programming the processor 121, the code corresponding to the accurate passenger flow counting method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Fig. 9 The steps of the accurate passenger flow counting method of the embodiment shown are as follows: How to design and program the processor 121 is a technique known to those skilled in the art and will not be described in detail here.

[0205] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method for accurate passenger flow statistics discussed above.

[0206] In some possible implementations, various aspects of the method for accurate passenger flow counting provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on a device, the program code is used to enable the control device to execute the steps of the method for accurate passenger flow counting according to various exemplary embodiments of the present application described above in this specification.

[0207] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0208] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0209] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0210] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0211] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for accurately counting passenger flow, characterized in that: The method comprises: Determine a target head and shoulder frame of the detection image, and determine the center point of the target head and shoulder frame; The center point is used as a detection point, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of the trigger line; Calculating the vertical distance from the detection point to the trigger line; Determining whether the vertical distance is greater than a preset threshold, wherein the preset threshold is proportional to the height of the target head-shoulder frame; If the vertical distance is greater than a preset threshold, counting the passenger flow of the target object in the detection image; If the vertical distance is less than a preset threshold, the detection point is updated until the detection point and the reference point are located on both sides of the trigger line.

2. The method according to claim 1, characterized in that Counting the passenger flow of the target object in the detection image includes: Select the target image; Detecting whether there is face data in the target head and shoulder frame of the target image; If the face data does not exist in the target head and shoulder frame of the target image, the target object is deleted; If the face data exists in the target image, the target object is counted.

3. The method according to claim 2, characterized in that Counting the target objects includes: Matching the face data of the target object with a preset face database, wherein the preset face database includes a non-customer face database and a customer face database of the day; If the target object's facial data successfully matches the preset facial database, the target's in and out counts are both incremented by 0; If the target object face data fails to match the preset face database, the target entry or exit count is increased by 1, and the target object face data is stored in the preset face database.

4. The method according to claim 1, characterized in that Before acquiring the detection image, it also includes: Input two frames of images continuously acquired by the image acquisition device into the Anchor-Free based neural network respectively, and obtain the coordinates of the head and shoulder frames and the re-identification ReID features of multiple targets in the two frames of images, wherein the coordinates of the target head and shoulder frames and the re-identification ReID features correspond one to one; Judging whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the re-identification (ReID) features; If the head-shoulder frame of any target meets the tracking condition, the head-shoulder frame of the target meeting the tracking condition is tracked, and a frame of image is selected in the tracking trajectory as the detection image; If the head-shoulder frame of any target does not meet the tracking condition, and the number of times that the head-shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold, the head-shoulder frame of the target is deleted.

5. The method according to claim 4, characterized in that Determine whether the head and shoulder frame of each target meets the tracking conditions, including: According to the coordinates of the head-shoulder frames of the multiple targets and the ReID features, a loss matrix of the head-shoulder frames of the multiple targets is calculated, wherein the loss matrix indicates a feature similarity distance between the head-shoulder frame of the target in the first image of the two frames of images and the head-shoulder frame of the target in the second image of the two frames of images; Filtering the elements in the loss matrix that are greater than a preset feature similarity threshold, and matching the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity, and determining that the head and shoulder frame of the target with a matching relationship meets the tracking condition; For a head-shoulder frame of a target for which a matching relationship cannot be established based on feature similarity, an intersection-and-union ratio is calculated according to the coordinates of the head-shoulder frame of the target in the first image and the coordinates of the head-shoulder frame of the target in the second image to obtain an intersection-and-union ratio matrix, wherein the intersection-and-union ratio matrix indicates a degree of overlap between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image; The elements in the IoU matrix that are less than a preset IoU threshold are filtered out, and the head and shoulder frame of the target in the first image corresponding to the remaining elements are matched with the head and shoulder frame of the target in the second image based on the IoU, and it is determined that the head and shoulder frame of the target with a matching relationship meets the tracking condition; otherwise, the head and shoulder frame of the target does not meet the tracking condition and the iterative tracking process does not enter.

6. The method according to claim 5, characterized in that The loss matrix of the head and shoulder boxes of multiple targets is calculated, including: According to the head-shoulder frame coordinates of the multiple targets, the Mahalanobis distance between the center point of the head-shoulder frame of the target in the first image and the center point of the head-shoulder frame of the target in the second image is calculated to obtain a first Mahalanobis distance matrix; According to the preset parameters, the elements in the first Mahalanobis distance matrix that are greater than or equal to the preset parameters are set to infinity, and the elements that are less than the preset parameters are set to 1, to obtain a second Mahalanobis distance matrix; According to the re-identification (ReID) features of the head-shoulder frames of the multiple targets, the feature similarity distance between the head-shoulder frame of the target in the first image and the head-shoulder frame of the target in the second image is calculated to obtain a feature similarity distance matrix; The loss matrix is ​​obtained by multiplying the second Mahalanobis distance matrix with the corresponding elements of the feature similarity matrix.

7. A precise passenger flow statistics device, characterized in that: The device comprises: An acquisition module is used to determine a target head-shoulder frame of a detection image, determine a center point of the target head-shoulder frame, and use the center point as a detection point, wherein the detection point and a reference point of a previous frame of the detection image are on both sides of a trigger line; A calculation module, used for calculating the vertical distance from the detection point to the trigger line; A first determination module is used to determine whether the vertical distance is greater than a preset threshold, wherein the preset threshold is proportional to the height of the target head-shoulder frame; A counting module, for counting the passenger flow of the target object in the detection image if the vertical distance is greater than a preset threshold; The updating module updates the detection point if the vertical distance is less than a preset threshold value until the detection point and the reference point are located on both sides of the trigger line.

8. The device according to claim 7, characterized in that The counting module is specifically used for: Select the target image; Detecting whether there is face data in the target head and shoulder frame of the target image; If the face data does not exist in the target head and shoulder frame of the target image, the target object is deleted; If the face data exists in the target head and shoulder frame of the target image, the target object is counted.

9. The device according to claim 7, characterized in that The counting module is also used for: Matching the face data of the target object with a preset face database, wherein the preset face database includes a non-customer face database and a customer face database of the day; If the target object's facial data successfully matches the preset facial database, the target's in and out counts are both incremented by 0; If the target object face data fails to match the preset face database, the target entry or exit count is increased by 1, and the target object face data is stored in the preset face database.

10. The device according to claim 7, characterized in that The device also includes: The encoding module is used to input two frames of images continuously acquired by the image acquisition device into the Anchor-Free based neural network respectively, and obtain the coordinates of the head and shoulder frames of multiple targets in the two frames of images and the re-identification ReID features, wherein the coordinates of the target head and shoulder frames and the re-identification ReID features correspond one to one; A second determination module is used to determine whether the head-shoulder frame of each target meets the tracking condition according to the coordinates of the head-shoulder frames of the multiple targets and the re-identification (ReID) features; A tracking module, if the head-shoulder frame of any target meets the tracking condition, is used to track the head-shoulder frame of the target that meets the tracking condition, and select a frame of image in the tracking trajectory as a detection image; The deletion module is used to delete the head and shoulder frame of any target if the head and shoulder frame of the target does not meet the tracking condition and the number of times the head and shoulder frame of the same target is continuously determined to not meet the tracking condition reaches a threshold.

11. The device according to claim 10, characterized in that The second determination module comprises: A first calculation unit is used to calculate the loss matrix of the head-shoulder frames of the multiple targets according to the coordinates of the head-shoulder frames of the multiple targets and the re-identification (ReID) features, wherein the loss matrix indicates the feature similarity distance between the head-shoulder frame of the target in the first image of the two frames of images and the head-shoulder frame of the target in the second image of the two frames of images; A first matching unit is used to filter out the elements in the loss matrix that are greater than a preset feature similarity threshold, and match the head and shoulder frame of the target in the first image and the head and shoulder frame of the target in the second image corresponding to the remaining elements based on feature similarity, and determine that the target head and shoulder frame with a matching relationship meets the tracking condition; a second calculation unit, configured to calculate an intersection-and-union ratio for a head-and-shoulder frame of a target for which a matching relationship cannot be established based on feature similarity, according to the coordinates of the head-and-shoulder frame of the target in the first image and the coordinates of the head-and-shoulder frame of the target in the second image, to obtain an intersection-and-union ratio matrix, wherein the intersection-and-union ratio matrix indicates a degree of overlap between the head-and-shoulder frame of the target in the first image and the head-and-shoulder frame of the target in the second image; The second matching unit is used to filter out the elements in the IoU matrix that are less than a preset IoU threshold, and match the head and shoulder frame of the target in the first image corresponding to the remaining elements with the head and shoulder frame of the target in the second image based on the IoU, to determine whether the head and shoulder frame of the target with a matching relationship meets the tracking condition; otherwise, the head and shoulder frame of the target does not meet the tracking condition and does not enter the iterative tracking process.

12. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 6 when executing the computer program stored in the memory.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 6 are implemented.