# Siamese Tracking with Adaptive Template-Updating Strategy
## 3 Our Approach
### Adaptive Template-Updating Strategy
#### 3.2.1 Contour-Detection Network  
The VGG-16 network has high depth and density (16 convolution layers and stead-1 convolution kernels), and it is widely used in classification tasks because of its easy training and fast convergence. Therefore, we used the VGG-16 network structure to extract contour features. In order to detect edges, we made some modifications to our contour-detection network. First, we removed all fully connected layers. Next, we deleted the last max pool layer. Third, the output terminal was connected with a refinement module. In detail, conv1-conv5 with max pooling in the VGG-16 network were taken as our front end, which is good at extracting features; then, we modified the back end to enable our network to extract contour information. This idea was generated from the five side-output layers of a normal holistically nested edge-detection (HED) network: the lower layer captures more spatial details, but lacks sufficient semantic information; on the contrary, the deeper layer encodes more abundant semantic information but lacks spatial details. In our task, we needed to reduce the interference of useless background information and abstract target contours. Therefore, we employed the deeper-layer features to formulate our template. However, especially in the deeper layers, side outputs suffer more from the problem of thick boundaries in HED networks. Consequently, output boundaries require refinement in order to generate clear and accurate object contours. In addition, the final outputs need to be resized to their original size by up-pooling and deconvolution. To get the best performance in convolution process, we chose the smallest convolution filter (\(3\times 3\)) with the stride of one pixel that can capture left/right, up/down, and central motion; max pooling was performed with stride 2 over a \(2\times 2\) pixel window. The configuration of each convolutional layer and the max pooling layer in our contour-detection network is summarized in Table 1.  
The output of our contour-detection network was a binary image with edge information. We first used the flooding-filling method in OpenCV to generate a connected region to represent the location of the target we chose from the contour map. Next, we could further generate object masks on the basis of the previous stage. The mask set background information to zero, and the selected object was segmented from the original image. Its feature could be extracted as the target template without background information. Finally, the drift problem of the bounding box in complex or deceptive backgrounds was successfully solved. The benefits of using shape-adaptive templates instead of conventional bounding-box region templates were discussed in Section 2.2, and the shape-adaptive template-generating process is illustrated in Figure 5.  
\begin{table}
\begin{tabular}{l c c c c c c c c c} \hline \hline
**Layer** & **C1** & **P1** & **C2** & **P2** & **C3** & **P3** & **C4** & **P4** & **C5** \\ \hline RF size & 5 & 6 & 14 & 16 & 40 & 44 & 92 & 100 & 196 \\ Stride & 1 & 2 & 2 & 4 & 4 & 8 & 8 & 16 & 16 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Receptive field and stride size of each layer. RF, receptive field; C, convolution; P, pooling.