[Development of the AI] tracking the target count

Application of structured video-based target after tracking algorithm, will get a unique identification and its corresponding trajectory, the use of these two data we can do some follow-up work: speed (Traffic scenarios), count (traffic class scenarios, security type scenarios) and behavioral detection (traffic scenarios, security type scenarios). I'll write three articles introduced in turn these three themes.

(1) tracking the speed calculating

(2) tracking the count

(3) tracking the behavior detection

Behind will continue to add links.

This article to traffic class application scenario as an example, the vehicle section counting method.

 

Manual counting method

Imagine a scenario where you squatting next to the underground passage, to count through this channel the flow of people in the last five minutes, what your actual practice? Eyes is to stay in one person, from TA into the channel until you leave it? Of course not, because then you do not have so many pairs of eyes. Normal person would imagine somewhere in the channel out an imaginary dividing line, eyes fixed on this line near the area to someone across the line count is incremented. They are not concerned about this line both sides of the target area farther, because what is there, how many goals will not affect the final count results.

As shown above, the inner region B A target range, the observer is not required to consider only after a certain count until the yellow line into the virtual count category. Appearing in the target regions A and B of stay, a U-turn and the like do not affect the final result of the counting.

 

Automatic counting principle

Automatic counting principles are consistent with the manual counting, counting algorithm should also assume that out of a virtual boundary, the target virtual walk across the dividing line, the total count plus one. As mentioned earlier, the target tracking algorithm after treatment, the trajectory will be a unique identifier and corresponding to the target coordinate point set by the two data can quickly determine if a target is crossing a straight line. 2D plane determines a point (X, Y) algorithm (X2, Y2) is simple left or right in a straight line (X1, Y1), a code corresponding to the following:

 1 // check if point at one side of line
 2 bool LeftOfLine(Point p, Point p1, Point p2)
 3 {
 4     if (p1.X == p2.X)
 5     {
 6         return p.X < p1.X;
 7     }
 8 
 9     if (p1.Y == p2.Y)
10     {
11         return p.Y < p1.Y;
12     }
13 
14     if (p2.X < p1.X)
15     {
16         Point tmp = p2;
17         p2 = p1;
18         p1 = tmp;
19     }
20 
21     int ret = (p2.Y - p.Y) * (p2.X - p1.X) - (p2.Y - p1.Y) * (p2.X - p.X);
22     return ret < 0;
23 }    

Analyzing whether the above code can point P P1 and P2 consisting of the left line, a return True, otherwise return False. (Left and right straight lines and not appropriate in the actual use, if P1 and P2 have been determined, the process returns True representative point on one side of the line, returns False representative point on the other side a straight line). When the target first appeared, we judge it by the above method (method returns the result to A) on either side of the line, the goal during the move, the new location will continue to be the point (the point that the latest set of tracks), we still by the above method to determine a target on either side of a straight line (method B returns the result), if a! = B, described straight across the target, then the count should be incremented by one. Setting a target count has been involved in a Flag, count logic behind no longer involved.

Here are five cases described automatic counting logic, counting and goals involved in the rule does not participate in the count:

(1) Ideally, when the target P1 entering from the bottom of the monitor screen, the detection algorithm can be detected, and tracking algorithm to track, after the continuous track, until leaving the monitoring area, it disappears from P2. Virtual cross-domain target count (red dotted line in the drawing), the count effect.

(2) the detection algorithm accuracy is not high, to a specific target position P1 was only detected until leaving the monitoring zone, it disappears from P2. Cross-domain virtual goal line count, count to take effect.

(3) detection algorithm accuracy is not high, the target has not yet counted across the virtual line can not be detected. Count does not take effect.

(4)检测算法准确性不高,或者跟踪算法准确性不高,目标虽然被跟踪到,但是跟踪到的轨迹并不是连续的,并且轨迹刚好在虚拟计数线那里断掉了。计数不生效。

(5)检测算法准确性不高,目标轨迹没有跨域虚拟计数线,这个情况跟(3)一致。

注意,以上举例都是假设目标从监控画面底部进入视野(去向),当目标从监控画面顶部进入视野时(来向),情况类似。

 

影响自动计数准确性的因素

根据前面的讨论,其实影响自动计数准确性的因素很好归纳:

(1)检测算法准确性。目标如果还未跨越虚拟计数线时,检测算法就检测不到该目标了,那么计数肯定丢失;

(2)跟踪算法准确性。跟踪算法效果不好时,目标轨迹不连续,很可能刚好在虚拟计数线那里断掉;

(3)虚拟计数线的位置。虚拟计数线不能太远,很多检测算法对远处的小目标检测效果不理想;当然也不能太近,我们在计数时,为了过滤错误的检测目标,要求必须保证目标轨迹点的数量要大于某个值,比如目标在跨越计数线时,要求目标轨迹点集合中的点数量大于25(必须被连续跟踪超过1秒,假设FPS为25),如果虚拟计数线太近,目标从监控画面下方进入时并且速度很快,那么它不会被连续跟踪超过1秒。

以上是目标跟踪中关于计数的详细说明,有问题留言私信皆可。

Guess you like

Origin www.cnblogs.com/xiaozhi_5638/p/11010749.html