# A Visual Object Tracking Algorithm Based on Improved TLD
## 3 The Improved TLD Tracking Algorithm
### Implementing the Tracking Module with KCF  
KCF solves the tracking problem by solving a simple grid regression problem [21]. It generates a large number of samples by cyclic shifts and trains the nonlinear prediction model of ridge regression to obtain a filter template. Then, the responses for the filter template are obtained on the current frame. Finally, the location of peak value for the response is regarded as the object's position.  
When implementing the tracking module by the KCF tracker, two adjustments are made. Firstly, KCF posts the estimated object's location to the detection module instead of outputting a bounding box. A serious drawback of the KCF is its use of a fixed object bounding box, the size of which is the same as the extent in the first frame [8]. If the object's scale changes or is occluded partially, KCF is unable to obtain the whole object or is easily influenced by excessive background. In the proposed tracking algorithm, KCF only estimates the object's location and passes it to the detection module of TLD. The detection module generates all possible scales and shifts of the initial bounding box. For each window, the detection module decides the object state (presence or absence), then outputs a most reliable bounding box. The size of the bounding box is determined by the scanning window.  
Secondly, the failure detection is appended before the KCF tracker outputs the location of the peak value in order to determine if the tracking module tracks the object correctly. The response of a location evaluates the similarity with the target. However, KCF cannot be aware of it and keeps tracking the bounding box in which the maximum response value is located. As a result, KCF may track the background, thus losing the target. In the failure detection, a dynamic threshold proposed by [PERSON] [22] is set for the peak value of the response, and the equations are shown in Formula (6):  
\[\left\{\begin{array}{l}u=\sum\limits_{i=1}^{n}V_{i}/n\\ \sigma^{2}=\sum\limits_{i=1}^{n}(V_{i}-u)^{2}\\ \theta=u-\lambda\sigma\end{array}\right. \tag{6}\]  
Figure 7: Histogram of oriented gradient (HOG) features.  
where the collection \(\{V_{i}|i=1,\,2,\,\ldots,\,n\}\) represents the peak values recorded so far, \(u\) stands for the average of \(V_{i}\), \(\sigma\) is the standard deviation of \(V_{i}\), and \(\theta\) is the threshold for the peak value of the current frame. KCF is considered to lose the target if the peak value is smaller than \(\theta\). \(\lambda\) is set empirically. In this study, \(\lambda\) was 4. It was observed that similar performance is achieved in the range (3-4).  
If the peak value of the response is smaller than the threshold, the location of the peak value is marked as not reliable. Therefore, KCF would not update its filter template nor post the location of the peak value to the detection module. Figures 8 and 9 illustrate the function of the failure detection. According to Figure 8, peak values were lower than thresholds from the 460 th frame to around the 490 th frame. As shown in Figure 9, KCF did track the wrong object when thresholds were larger than the peak value. If KCF is judged to track incorrectly, the tracking module will not pass the location of the peak value to the detection module.