# TF-YOLO: An Improved Incremental Network for Real-Time Object Detection
## 3 Proposed TF-YOLO Network
### K-means++ Clustering in Pre-Processing  
Clustering algorithms is generally viewed as an unsupervised method for data analysis [28]. K-means++ clustering is an approach commonly used to adaptively partition a dataset into groups. It is necessary to specify the number of cluster centers in advance, since \(k\) clustering centers are simultaneously initialized. The way to choose the cluster center is to select the maximum or minimum  
Figure 5: Feature extraction diagram of the proposed TF-YOLO network. value randomly in the dataset as the initial cluster center. Therefore, the better the cluster centers are selected, the more effective the algorithm would be obtained. As mentioned above, K-means++ algorithm is used to conduct latitude clustering at first. It randomly selects a sample point in the dataset as the first initialized cluster center, and it calculates the rest for each cluster center [29]. After the sample points are initialized, the distances between the cluster centers are calculated, then the shortest distance from its own cluster center is chosen. On the other hand, the sample with the greatest distance is selected as the new cluster center. The above process is repeated until there is no further change in the assignment of distances to clusters. Thus, the algorithm converges. Eventually, the final cluster center is calculated using the k-means++ algorithm to determine the specific parameters of the anchor. The k-means++ algorithm generally uses the Euclidean distance to measure the distance between two points. Nevertheless, there are the following three scale targets in the dataset: large-scale targets, moderate-scale targets, and small-scale targets [30]. The main steps of the K-means++ method are as follows:  
* Step 1: Choose an initial center \(t_{1}\) uniformly at random from the dataset \(X\). * Step 2: Choose the next center \(t_{i}\), selecting \(t_{i}=x^{\prime}\in X\) with probability \(\frac{D(x^{\prime})^{2}}{\sum_{x\in X}D(x)^{2}}\), where D(x) is the distance from a data point \(x\) to the closest center. * Step 3: Repeat Step 2, until \(D(x)\) is the shortest distance. After which, \(k\) center is chosen. * Step 4: Define center \(T=\{t_{1},t_{2},\cdots,t_{k}\}\). * Step 5: For \(i\in\{1,2,\cdots,k\}\), set the cluster \(T_{i}\) to be the set of points in \(X\) that are closer to \(t_{i}\) than they are to \(t_{j}\) for all \(j\
eq i\). * Step 6: For \(i\in\{1,2,\cdots,k\}\), set \(t_{i}\) to be the center of mass of all points in \(T_{i}\): \(t_{i}=\frac{1}{|T_{i}|}\sum_{x\in T_{i}}x\). * Step 7: Repeat Step 5 and Step 6 until \(T\) converges. The definition of the three sizes of targets here refers to the proportion that they are in the entire image. Furthermore, in terms of the Euclidean distance, more errors would occur in the larger bounding boxes rather than in smaller bounding boxes. Since the goal is to get better IOU through anchor boxes, [PERSON]'s distance is a better choice. [PERSON]'s distance is adapted to the variable box size, which is a good solution to resolve the error caused by Euclidean distance. The distance formula is defined as:  
\[d(box,centroid)=1-\text{IOU}(box,centroid) \tag{2}\]  
where \(box\) represents the sample, and \(centroid\) represents the center of the cluster, and \(\text{IOU}(box,centroid)\) represents the intersection of the cluster's center box and the cluster box [31]. The intersection ratio IOU can indicate the accuracy of the prediction box by Equation (3). \[\text{IOU}(bb_{gt},bb_{dt})=\frac{bb_{gt}\cap bb_{dt}}{bb_{gt}\cup bb_{dt}} \tag{3}\]  
where \(bb_{gt}\) represents the real box, and \(bb_{dt}\) represents the prediction box. Combining the above two equations, the final distance can be calculated as  
\[d(box,centroid)=\frac{bb_{gt}\cup bb_{dt}-bb_{gt}\cap bb_{dt}}{bb_{gt}\cup bb _{dt}} \tag{4}\]  
As mentioned above, YOLOv3 algorithm has achieved end-to-end training and high-speed target detection. However, some problems still exist.