The second major phase of TCD3 is to process the detected coordinates and use machine-learning algorithms to detect anomalies in paths.
The first step is to run an algorithm to cluster multiple points to average the different guesses of the position of the car by each of the different Computer Vision algorithms. Although using the K-Means algorithm was initially investigated, a custom averaging algorithm using distance thresholds was used, as K-Means requires knowledge on the number of clusters in the frame. This method is able to get a good approximation of every cars center point, which is then passed
into the learning phase.
The next phase of TCD3 is to learn the normal movement of cars on the roads. There are two primary methods that are used to learn the movement, first a general model is created for the entire road, and then a specific model is created for each of the different areas and sectors on the road.
A matching algorithm connects the coordinates detected frame over frame, and then calculates the X and Y displacement for each car frame over frame. From this metric, the angle of motion of the car is measured, the deviance from the normal of the road is calculated, and the acceleration & speed are calculated.
Two methods are used to detect an anomaly from the motion characteristics, first a hard threshold is set, using data hand picked by the user, and if any of the metrics exceed the threshold, a car is considered anomalous. The second method uses machine-learning algorithms to determine what the normal movement is, and then the deviance from the learned is checked. The deviance is determined using proportion of current movement characteristic to the learned, and by checking how large the difference is, and checking it against another threshold.
The more effective model, called the Learning Area Sector Model (LASM), is an infrastructure created to store the learned movement characteristics for each area in the frame. The sectors are split between each of the lanes and are 7 pixels wide. This model is setup so that all the learned data can be stored, and therefore all cars are compared to cars that have passed through the same place. This system allows analysis to be performed in all scenes effectively.
These two models, used in conjunction, are used to detect anomalies for every frame. After this, TCD3 analyzes the number of anomalies detected for each car, and if a car is anomalous for at least 10 frames, then a car is considered anomalous. This ensures that small deviances are not caught, and only concrete anomalous behaviors are caught.
Using the number of methods reporting anomalous behavior, as well as the amplitude with which the car exceed safe limits, the confidence of an anomaly detection can be ascertained.