# A Self-Supervised Tree-Structured Framework for Fine-Grained Classification
## 3 Proposed Tree-Structured Framework for Fine-Grained Classification
### Initial Classification Tree Construction  
The initial classification tree constructed based on a clustering algorithm has several advantages. First, the clusters are constructed based on the similarity of subclasses, meaning that all subclasses in each cluster share certain common properties, which is an important factor that can help the machine-learning matcher to accurately predict the belonging cluster. Furthermore, the size of the output space in cluster \(i\) is \(n_{i}\), which is much smaller than the size of the overall output space \(o\) (\(n_{i}<<o\)) [20]. This greatly reduces the cost of computation and improves the efficiency of the classification process. This section introduces the process of constructing a well-structured initial classification tree. As the basis of initial classification tree construction, features of images can be extracted with pre-trained models [24], fine-tuned models [25], and so on. Furthermore, CNNs, e.g., ResNet [26], are one of the mainstream tools for extracting image features. In this paper, a fine-tuned CNN model is utilized to extract features to represent the images. Once the image features are extracted, an initial classification tree can be constructed through a clustering algorithm such as K-means++ [27]. The purpose of the clustering algorithm is to classify features into the belonging cluster at each level. Given the set of image features \(F_{i}^{n-1}=\{x_{i}^{n-1,\,1},x_{i}^{n-1,\,2},\dots,x_{i}^{n-1,\,n_{i}}\}\) belonging to a cluster \(i\) at level \(n-1\) (\(C_{i,n-1}\)), we aim to determine the belonging cluster \(C=\{C_{1}^{n},C_{2}^{n},\dots,C_{k}^{n}\}\) at Level \(n\) for \(F_{i}^{n-1}\). Below, an objective function of the clustering algorithm is shown. \[\{C_{l}^{n}\mid l=1,2,\dots,k\} \tag{1}\] \[\text{s.t. }\quad\left\{ \begin{array}{l}C_{l}^{n}\bigcap_{l^{ \prime}\
eq l}C_{l}^{n}=\varnothing\\ F_{i}^{n-1}=\bigcup_{l=1}^{k}C_{l}^{n}\end{array} \right.\]  
Figure 4 illustrates an example of constructing one part of the initial classification tree, where Feature \(F_{i}^{n-1}\) is assigned to Cluster \(C_{i}^{n-1}\). Subsequently, the structure of Level \(n\) is constructed by applying the clustering algorithm. Now, the belonging cluster for each image feature has been obtained. However, usually, each subclass contains various images in the data. Hence, it is necessary to determine the belonging cluster for each subclass. Algorithm 1 introduces the process of determining the belonging classes through the voting strategy. Figure 4: A part of the initial classification tree constructed with the clustering algorithm. ```
0: Extracted features from each image in the training set (denoted as \(F\)); Number of the subclasses (denoted as \(n_{sub}\)); Number of clusters split from the cluster in the previous level (denoted as \(n_{chd}\))
0: belonging cluster for each subclass
1: clustering algorithm applied to segment \(F\) in \(n_{chd}\) clusters
2:for\(i=1\) to \(n_{sub}\)
3:for\(j=1\) to \(n_{chd}\)
4: count the number of image features in each cluster \(C_{k}\), where \(k\in[1,n_{chd}]\) (voting)
5: the highest number of votes is selected as the belonging cluster
6:endfor
7:endfor
```  
**Algorithm 1** Determining the belonging classes for the subclasses. Algorithm 1 determines the belonging clusters for subclasses according to image features. First, the inputs are specified as the extracted features from each image, the total number of the subclasses, and desired number of clusters split from the cluster in the previous level. Then, a clustering algorithm is applied to classify the image features (Line 1). The number of image features in each cluster is calculated for each subclass (Line 4). Following the principle of majority rule, the belonging cluster for each subclass is determined based on the highest number of votes (Line 5). The algorithm stops until it determines the belonging cluster for all subclasses.