# Fast Visual Object Tracking with Rotated Bounding Boxes

**Introduction**

Visual object tracking is an important element of many applications such as person-following robots, self-driving cars, or surveillance cameras, etc. The performance of such systems critically depends on a reliable and efficient object tracking algorithm. It is especially important to track an object online and in real-time when the camera is running under challenging situations: illumination, changing pose, motion blurring, partial and full occlusion, etc. These two fundamental features are the core requirements for human-robot interactions (e.g., person-following robots).

To address the visual object tracking problems, many benchmarks have been developed, such as Object Track- ing Benchmark (OTB50 and OTB100), and Visual Object Tracking Challenges (VOT2016, VOT2018, VOT2019). In OTB datasets, ground truth was labeled by axis aligned bounding boxes and while in VOT datasets rotated bounding boxes were used. Comparing between axis-aligned bounding boxes and rotated bounding boxes, rotated bounding boxes contain a minimal amount of background pixels. Thus, the datasets with rotated bounding boxes have the tighter enclosed boxes than the axis-aligned bounding boxes. As well as, the rotated bounding boxes provide the object orientation in the image plane. The orientation information can be further used to solve many computer vision problems (e.g., action classification).

Despite the advantage of rotated bounding boxes, it is very computationally intensive to estimate the rotation angle and scale of the bounding boxes. Many researchers have developed novel algorithms to settle the problem. But most of them have limitations in terms of tracking speed or accuracy. In the meantime, fully convolutional Siamese networks had become popular in the field of object tracking. However, the original Siamese networks did not solve the rotation problem. Wang *et al. *(SiamMask) have been inspired by the advanced version of Siamese network (SiamRPN, SiamRPN++) and wide range of image datasets (Youtube-VOS, COCO, Ima- geNet, etc.). SiamMask is able to predict a segmentation mask on the target for tracking and fits a minimum area rotated bounding box in real-time (87 fps).

In this paper, we propose a novel efficient rotated bounding box estimation algorithm when a segmentation/mask of an object is given. Particularly, the masks are generated by SiamMask. The key problem is to predict the rotation angle of the bounding boxes. Inspired by the conic fitting problem described by Fitzgibbon, we try to fit an ellipse on the mask to compute the rotation angle. Once the rotation angle is known, then we could fit a rotated rectangle on the mask. Our algorithm consists of two parts: (1) rotation angle estimation, and (2) scale calculation. Details will be provided in Section 3.

The contribution of this paper can be summarized in the following three aspects:

- a new real-time state-of-the-art object tracking algorithm on the datasets that are labeled with rotated bounding boxes, e.g., VOT challenge series (2015- 2019).
- a fast novel rotated bounding box estimation algorithm when a segmentation/mask is given. This algorithm can be used to generate rotated bounding box ground truth from any segmentation datasets to train a rotation angle regression model. This is the main contribution of the paper.
- the source code 2 will be released as an additional package to PySOT 3 which is written by SenseTime Video Intelligence Research team.

The paper is structured as follows. The most relevant work will be briefly summarized in Section 2. Then, we will describe our approach in detail in Section 3. The evaluation of the algorithm is in Section 4. Finally, Section 5 concludes the paper and discusses future work.

**2. Related Work**

In this section, we discuss the history of the Siamese network based tracking algorithms and several trackers that yield rotated bounding boxes.

**2.1. Siamese network based Trackers**

The first Siamese network based object tracking algorithm (SiamFC) was introduced by Bertinetto in 2016. The Siamese network is trained offline on a dataset for object detection in videos. The input to the network are two images, one is an exemplar image z, the other one is the search image x. Then, a dense response map is generated from the output of the network. SiamFC learns and predicts the similarity between the regions in x and the exemplar image z. In order to handle the object scale variantion, SiamFC searches for objects at five scales 1.025{2,1,0,1,2} near the target’s previous location. As a result, there will be 5 forward passes on each frame. SiamFC runs at about 58 fps, which is the fastest fully convolutional network (CNN) based tracker comparing to online training and updating networks in 2016. However, SiamFC is an axis-aligned bounding box tracker. It couldn’t outperform the online training and updating deep CNN tracker MDNet (1 fps) in terms of average overlap accuracy.

He combines two branches (Semantic net and Appearance net) of Siamese network (SA-Siam) to improve the generalization capability of SiamFC. Two branches are individually trained, and then the two branches are com- bined to output the similarity score at testing. S-Net is an AlexNet pretrained on an image classification dataset. A-Net is a SiamFC pretrained on an object detection from video dataset. S-Net improves the discrimination power of the SA-Siam tracker because different objects activate different sets of feature channels in the Semantic branch. Due to the complexity of the two branches, SA-Siam runs at 50 fps when tracking with pretrained model.

By modifying the original Siamese net with a Region Proposal Network(RPN), Li *et al.* proposed a Siamese Region Proposal Network (SiamRPN) to estimate the target location with the variable bounding boxes. The output of SiamRPN contains a set of anchor boxes with corresponding scores. So, the bounding box with the best score is considered as the target location. The benefit of RPN is to reduce the multi-scale testing complexity in the traditional Siamese networks (SiamFC, SA-Siam). An updated version SiamRPN++ has released in 2019. In terms of process- ing speed, SiamRPN is 160 fps and SiamRPN++ is about 35 fps.

Unlike SiamFC, SA-Siam, and SiamRPN yielding axis-aligned bounding boxes, SiamMask uses the advantage from a video object segmentation dataset and trained a Siamese net to predict a set of masks and bounding boxes on the target. The bounding boxes are estimated based on the masks using rotated minimum bounding rect- angle (MBR) at the speed of 87 fps. However, the MBR does not always predict the bounding boxes that perfectly align with the ground truth bounding boxes (see Figure 1). Although the same bounding boxes prediction algorithm used in VOT2016 for generating the ground truth can im- prove the average overlap accuracy dramatically, the run- ning speed decreases to 5 fps. To address this problem, we present a new method in Section 3 that can process frames in real-time and achieves a better result.

**2.2. Rotated bounding boxes**

Beside the Siamese network trackers, Nebehay (CMT) use a key-point matching approach to scale and ro- tate the bounding boxes. But, this tracker cannot handle deformable objects is an update of CMT, and the processing speed dropped to 11 fps.

Hua suggest a proposal selection method (optical flow and Hough transform) to filter out a group of locations and orientations that very likely contains the object. Then, they use three cues (detection confidence, objectness measures from object edges and motion boundaries) to determine which location has the highest likelihood. But, this approach also couldn’t run in real-time (0.3 fps).

Zhang propose a rotation estimation method using Log-Polar transformation. In Log-Polar coordinate, a set of 36 rotation sample are chosen on every ∆ = 2π , R where R = 36. But, the rotation sample set also increases the rum-time of KCF tracker by 36 times.

Guo build a structure-regularized compressive tracking (SCT) with online update. During the detection stage, SCT samples several candidates with different rotation angles based on integral image and quadtree segmentation. SCT runs on a computer system without GPU at 15 fps.

Recently, a rotation adaptive tracking approach was introduced by Rout. The authors assume that the rotation angle is limited within a range (e.g., ±10◦). However, this assumption doesn’t always hold. He built on top of SA-Siam with angle estimation strategy. Although the method could reduce the processing time, it still limits the rotation angle to some degrees (e.g., −π/8, π/8). In order to find an arbitrary rotation angle, we present our approach in the next section.

**3. Approach**

In the original SiamMask tracker, Wang compared three different bounding boxes estimation algorithms: min-max axis-aligned rectangle (*Min-max*), minimum area rectangle (*MBR*), and optimal bounding box (*Opt*). Due to the computational burden, *Opt *could not perform in real-time (5fps). SiamMask with *MBR *is the real-time (87 fps) state-of-the-art tracker in terms of average overlap Accuracy. Although *MBR *performs better than the other bounding box estimation algorithms, it has a weakness such that minimum area rectangle could not represent the geometric shape and point distribution of the masks (see Figure 2). As a result, most of the estimated bounding boxes are not in the correct orientation. In the following subsections, we will discuss an alternate solution to generate bounding boxes with correct rotation angle and tighter size by post-processing on the output mask from SiamMask. Our method consists of the steps in Figure 3.

**3.1. Rotation angle estimation**

To estimate the rotation angle, we adopted the fitEllipse API provided by OpenCV3 4 which use a least-squares scheme to solved the ellipse fitting problem. This algorithm (B2AC) Algebraic distance with quadratic constraint was first introduced by Fitzgibbon.

An ellipse can be formulated using a conic equation with a constraint:

*F(x,y)=ax ^{2} +bxy+cy^{2} +dx+ey+f =0 where, b^{2} − 4ac < 0 [1]*

In Equation [1], a, b, c, d, e, f are the coefficients of the ellipse and x, y are the points on the ellipse. By grouping the coefficients into a vector, we have the following two vectors:

*a = [a,b,c,d,e,f] ^{T}*

*x = [x2,xy,y2,x,y,1] [2]*

So, the conic can be written as:*F (x) = x · a = 0 [3]*

To fit an ellipse on a set of points A = {(x1, y1), ..., (xN , yN )}, where|A| = N, we need to find the coefficient vector **a**. Halīr introduced an improved least squares method to minimize the sum of squared error of the following equation:

min_{a} _{i=1}𝛴^{N} F(x_{i},y_{i})^{2} = min_{a} _{i=1}𝛴^{N} F(x_{i})^{2}

where, x_{i} =[x_{i}^{2},x_{i}y_{i},y_{i}^{2},x_{i},y_{i},1], and A_{i} =(x_{i},y_{i}) [4]

Let us denote the following terms for the fitted ellipse (also see Figure 4):

*m* semi-major axis*n* semi-minor axis

(x_{o},y_{o}) center coordinate of the ellipse*θ* rotation angle

Be aware that, when the ellipse is near-circular (rotational symmetric shapes), θ is not stable. A solution for this case is to force θ = 90^{o}. However, it did not increase the performance of the VOT datasets empirically.

**3.2. SiamMask E**

Since we need to rotate the image with respect to the ellipse center, an affine transformation (Translation and Rotation for our case) will be used here to compute the transformed coordinates. After the estimation of rotation angle θ and the center point (x_{o} , y_{o}), then we need to compute the 2D affine transformation matrix M:

Once the affine transformation matrix is computed, then we apply the rotation on the segmentation/mask about the ellipse’s center (x_{o} , y_{o}): Let’s denote the mask as a set of points Mask(magenta color in Figure 3(a)), and the transformed mask as Mask′ (magenta color in Figure 3(d)).

After this step, our aim is to output the intersection (red in Figure 3(f)) between the min-max axis-aligned bounding box (blue in Figure 3(e)) and the ellipse bounding box (green in Figure 3(e)). The advantage of using the ellipse bounding box is to cut out the unexpected portion of the shape (e.g., protruding limbs). Thus, the output bounding box would be able to focus on the trunk of the human body. After the affine transformation, the ellipse bounding box is trivial, and we denote it as G:

The min-max axis-aligned bounding box denote as B:

The intersection bounding box R (red in Figure 3(f)) can be calculated using the following equation:

then, convert R to a polygon

The last step is to convert the transformed coordinate back to the image coordinate using the inverse of the affine transformation matrix M. We denote the output bounding box as R′ (red color in Figure 3(g)):

**3.3. Refinement step (Ref)**

As you can see from Figure 1 at row 3 column 2, our bounding box (green) is not as tight as the ground truth (blue). This problem because the *Mask *generated by SiamMask includes the limbs of the dancer. To manage this problem, we implement a refinement procedure to slim the size of the bounding box by evaluating the amount of *Mask *that an edge is crossing. Let’s denote the length of an edge as α, and the portion of the edge intersecting the *Mask *is β. We set a constraint such that, β > α∗*factor*; otherwise, the edge will gradually move toward the bounding box center (see Figure 5). Here, we choose *factor *= 0.258 empirically on dataset VOT2018.

**4. Experiments**

In this section, we evaluate our proposed methods on the datasets that labeled with rotated bounding boxes: VOT2016, VOT2018, and VOT2019.

**4.1. Environment setup**

In order to provide a fair comparison, we test our algorithm using the same pretrained Siamese network model and the same parameters. The reported data is evaluated on a desktop computer with the following hardware:

• GPU: GeForce GTX 1080 Ti

• CPU: Intel Core i5-8400 CPU @ 2.80GHz × 6

• Memory: 32 GB

**4.2. Evaluation metrics**

We only evaluation on the VOT challenge series (VOT2015-2019 short term), where VOT2015 has the same data sequences as VOT2016, and VOT2017 has the same sequences as VOT2018. These three datasets contain 60 sequences with different challenging situations (e.g., motion blur, size change, occlusion, illumination change, etc). To the best of our knowledge, VOT2015-2019 are the only object tracking datasets that labeled with rotated bounding boxes. We also adopt the supervised tracking evaluation methods that are used in VOT2016 [21]: Accuracy (A), Ro- bustness (R), and Expected Average Overlap (EAO). The Accuracy is the average overlap between the estimated and the ground truth bounding boxes when the target is successfully being tracked. The Robustness measures the ratio between the number of times the tracker loses the target (fails) and the number of resumed trackings. The Expected Average Overlap (EAO) is considered as the primary measurement in the VOT challenge. According to the official toolkit, the tracker will be reinitialized when the estimated bounding box has no intersection with the ground truth. After five frames, the tracker will restart with the ground truth bounding box.

**4.3. Overall results**

Table 1 presents the result comparison between the state-of-the-art Siamese based tracking algorithms on VOT2016, VOT2018, and VOT2019 datasets. Our tracker SiamMask E with Ref has the 0.655 Accuracy and 0.446 EAO on VOT2018 dataset which it a new state-of-the-art comparing the other Siamese trackers and the VOT2018 short term challenge winners. Although SiamMask- Opt has the similar performance as ours, due to the computation complexity, SiamMask-Opt can only run at 5 frames per second. However, our tracker is able to process in real- time with the speed of more than 80 frames per second. Similarly, our tracker also forms a new state-of-the-art re- sult on VOT2019.

**4.4. Ablation studies**

The ablation test results are shown in Table 2. In the table, SiamMask E is our baseline model without the refinement step.

We exchange the bounding box orientation between SiamMask E and SiamMask, where SiamMask E with Minimum Area Bounding Box angle (SiamMask E + minABoxAngle) performs weaker than our baseline SiamMask E. Similarly, SiamMask with ellipse angle (SiamMask + ellipseAngle) is preferable over the original SiamMask. By adding the refinement step (Ref) to both SiamMask and SiamMask E, the average overlap Ac- curacy increase dramatically. Furthermore, we modify the bounding box rotation of SiamMask E + Ref with the original Minimum Area Bounding Box angle ( SiamMask E + Ref + minABoxAngle) which results in slightly decreasing on the primary measurement EAO. It proves that using the ellipse’s angle could improve the tracking performance on the VOT datasets. On the other hand, we also test SiamMask + Ref with changing the angle of the Minimum Area Bounding Box to the ellipse’s angle (SiamMask + ellipseAngle + Ref). The result shows that SiamMask + ellipseAngle + Ref also has some degree of improvement on both VOT2018 and VOT2019 on the primary measurement EAO. Overall, SiamMask E, which improves the bounding box orientation and scale using ellipse fitting on top of SiamMask, has a similar performance as the original Sima- Mask with the refinement step (SiamMask + Ref). And, SiamMask E with the refinement step (SiamMask E + Ref) outperforms any other combinations on the ablation study table.

**4.5. Qualitative results**

To analysis the improvement, we show several results computed on VOT2019 dataset. We compare the state- of-the-art algorithms SiamMask and SiamRPN++ along with our approach SiamMask E in Figure 6.

**5. Conclusion**

In this paper, we updated the SiamMask tracker to achieve the next level of state-of-the-art performance. Our new tracker SiamMask E retains real-time processing speed at 80 fps. We show that the bounding box using ellipse fitting outperforms the minimum area rectangle bounding box in terms of better rotation angle and tighter bounding box scale. Our results show the strength of SiamMask network tracking model such that it can out- perform the other state-of-the-art trackers.

**Future work:** Our approach focused on an efficient bounding box refinement algorithm. On a different aspect, if a proper motion model is employed, we believe the result could move to the next level. To attain this, a real-time algorithm is needed to differentiate the camera the target motion in order to estimate the real target motion. As well as, we need to beware the other dynamic distractors in the scene.

**Authors**

Bao Xin Chen

John K. Tsotsos