{'fraction_non_alphanumeric': 0.036937256292095, 'fraction_numerical': 0.018185040765685927, 'mean_word_length': 4.687701612903226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fine-grained Recognition: Accounting for Subtle Differences between Similar Classes

The main requisite for fine-grained recognition task is to focus on subtle discriminative details that make the subordinate classes different from each other. We note that existing methods implicitly address this requirement and leave it to a data-driven pipeline to figure out what makes a subordinate class different from the others. This results in two major limitations: First, the network focuses on the most obvious distinctions between classes and overlooks more subtle inter-class variations. Second, the chance of misclassifying a given sample in any of the negative classes is considered equal, while in fact, confusions generally occur among only the most similar classes. Here, we propose to explicitly force the network to find the subtle differences among closely related classes. In this pursuit, we introduce two key novelties that can be easily plugged into existing end-to-end deep learning pipelines. On one hand, we introduce diversification block which masks the most salient features for an input to force the network to use more subtle cues for its correct classification. Concurrently, we introduce a gradient-boosting loss function that focuses only on the confusing classes for each sample and therefore moves swiftly along the direction on the loss surface that seeks to resolve these ambiguities. The synergy between these two blocks helps the network to learn more effective feature representations. Comprehensive experiments are performed on five challenging datasets. Our approach outperforms existing methods using similar experimental setting on all five datasets.


Introduction
Fine-grained recognition focuses on discriminating between children classes of a main parent category (e.g., cars (Krause et al. 2013), dogs (Khosla et al. 2011), birds (Wah et al. 2011), and aircrafts (Maji et al. 2013)). Deep CNNs have excelled immensely on traditional visual recognition tasks where categories greater differ from each other. However, fine-grained visual categorization (FGVC) poses a significant challenge mainly due to the close resemblance between subcategories e.g., different species of the same bird. The challenge is compounded by the fact that the classifier has to Copyright c 2020, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. Figure 1: Illustration of two novel components of our approach. Left: comparison between class activation maps obtained from the model with our diversification block (DB) and the one without DB. Our DB forces the network to capture more discriminative regions. With DB (below), the network finds beak, tail and feet of the bird as informative regions, while without DB (middle), the network only focuses on beak. Right: visual comparison in terms of 2-d tSNE (Van Der Maaten 2014) plot for features of 24 kinds of Walbler (confusing and difficult classes) in CUB-200-2011 between network trained with cross entropy (CE) (top) and our gradient-boosting loss (below). By focusing on difficult classes, our gradient-boosting loss can distinguish between hard classes which are not well separated by CE. be invariant to intra-class variations, e.g., pose, appearance and lighting changes.
Common deep learning based approaches for FGVC learn a mapping between input images and output labels. While doing so, a natural tendency during learning is to focus on only few distinguishing parts in an object to deal with confusing inter-class similarities and large intra-class variations (see Fig. 1). The analysis of attention based models provides the evidence that attention maps are often densely concentrated on a few parts, thus considering only a limited set of cues. In contrast, here we propose to spread the attention to consolidate a diverse set of relevant cues spread across the activation map. While we diversify attention at the feature level, we do the opposite at the prediction level, i.e., focus on only the most confusing cases to achieve better discriminability. Popular loss functions such as cross entropy, consider all classes to compute the error signal for parameter update. When closely related classes are present in the data, this leads to a weak supervision signal resulting in slower convergence and low recall rates. We show that selectively attending to the hard negative classes helps in achieving much faster convergence and higher accuracy.
Our approach can also be understood as a mechanism to enhance network generalization and avoid overfitting. This consideration is of particular relevance to FGVC, since the datasets are generally smaller due to the high cost of obtaining fine-grained annotations from experts. In effort to minimize loss on training data, a high-capacity network can end up associating unrelated concepts (such as those of background) to the fine-grained object itself. By concentrating on only the closely related classes and diversifying the model's attention, we are in fact regularizing the model to avoid overfitting the training samples. Our approach reduces classifier's confidence on training samples and therefore makes it more generalizable. We note that regularization schemes such as label-smoothing (Szegedy et al. 2016) and maximum prediction entropy (Dubey et al. 2018b) are related to ours, but significantly different as we impose regularization on both features and output predictions.
Our main contributions are as follows: • We introduce a gradient-boosting loss that seeks to resolve ambiguities among closely related classes by appropriately magnifying the gradient updates. • Our diversification block masks out the salient features in order to force the network to look for subtle differences between similar-looking categories. • The proposed method makes the convergence faster while outperforming existing methods on five datasets.

Related Works
Fine-grained classification has attracted much research attention in the recent years. Despite several attempts (Yang et al. 2018;, FGVC is still an active research problem. To deal with the problem of subtle intra-class distance, many approaches focused on obtaining more relevant features (Berg and Belhumeur 2013;Lin, RoyChowdhury, and Maji 2015;Gao et al. 2016;Yang et al. 2018;). One of the earliest but naive strategy was to exploit part annotations (Berg and Belhumeur 2013) to locate the objects so that more informative features were used. Such an approach requires more labeling effort and has therefore limited scalability. Another stream of works (Lin, RoyChowdhury, and Maji 2015;Gao et al. 2016;Li et al. 2018) developed complex pooling methods, so that complex local features can be used for classification. However, one obvious drawback of those methods is the high computation complexity. To deal with the problem of small fine-grained datasets, Cui et al. ) proposed a transfer learning scheme from selected subset of the source domain to target domain. However, it requires to re-train models on a subset of large datasets like ImageNet (Russakovsky et al. 2015) and iNaturalist (Van Horn et al. 2018). Recent efforts (Yang et al. 2018;Chen et al. 2019;Zheng et al. 2019;Ge, Lin, and Yu 2019) used only class labels to automatically locate informative regions. Specifically, Yang et al. (Yang et al. 2018) adapted a Navigator-Teacher-Scrutinizer system under a multi-stage scheme. Sun et al. ) leveraged multiple channel attentions to learn several relevant regions. Wang et al. (Wang, Morariu, and Davis 2018) used a bank of convolutional filters to capture discriminative regions in the feature maps. Chen (Chen et al. 2019) deconstructed and reconstructed input images to find discriminative regions and features. Zheng et al. (Zheng et al. 2019) proposed trilinear attention sampling network to learn features from different details. Despite the fact that the above methods perform well, they generally need to be trained in multiple stages or learn high-dimension features, resulting in increased training times. Another recent work (Ge, Lin, and Yu 2019) developed a computationally complex, three-stage pipeline for fine-grained classification. Their framework requires a weakly supervised object detector, a mask-rcnn (He et al. 2017) based instance segmentation and an LSTM for capturing the context. Moreover, the mask-rcnn needs to be pretrained on an additional dataset: MS-COCO (Lin et al. 2014). Our proposed diversification block adopts a novel way to find more relevant features by suppressing the most prominent discriminative regions in class activation maps (Zhou et al. 2016) and thus forcing the network to find other informative regions. We note that hide-and-seek (Singh and Lee 2017) is related to ours, but largely different since our module works on feature maps and selectively suppresses discriminative regions. Our module is trained end-to-end with a computational cost nearly equal to the backbone.
Lately, FGVC strategies aimed to learn optimal classifiers on top of deep features have been proposed (Dubey et al. 2018a;2018b). Qian et al. (Qian et al. 2015) employed a multi-stage framework which accepted pre-computed feature maps and learned the distance metric for classification. Dubey et al. (Dubey et al. 2018a) adapted the idea from pairwise learning and used Siamese-like neural network. A triplet loss was used in (Wang et al. 2016) to achieve better inter-class separation. The contrastive and triplet losses, however, increase the computational cost of training. (Dubey et al. 2018b) proposed a maximum entropy loss for finegrained classification by using the principle of maximumentropy. All above methods do not specifically focus on differentiating confusing classes. Further, all the negative categories for a given sample are considered as equal. Our proposed gradient-boosting loss solves the problem by explicitly focusing on hard classes, incurs no additional cost and provides faster convergence rates.

Method
In this section, we introduce our method which can be easily plugged into any classification network. As shown in Fig. 2, to deploy our approach, we need to replace global pooling Figure 2: Overview of our overall architecture. Our method contains two novel components: diversification block and gradientboosting loss. The diversification block suppresses the discriminative regions of the class activation maps, and hence the network is forced to find alternative informative features. The gradient-booting loss focuses on difficult (confusing) classes for each image and boosts their gradient. As a result, the network moves swiftly (faster convergence) to discriminate the hard classes.
layer and the last fully connected layer of the backbone network with a 1×1 convolution having output channels equal to the number of classes. Our method includes two novel components: (a) A diversification module which forces the network to capture more subtle features, rather than only the most obvious ones; (b) A gradient boosting loss which trains the network to focus on highly confusing classes. These two components will be addressed in this section.

Diversification Block
Consider the multi-class image classification task with C classes as shown in Fig. 2. Let I be a training image with ground-truth label l ∈ J, where J = {1, 2, ..., C} is the label set containing all labels. The input to our diversification block is the category-specific activation maps M ∈ R C×H×W , which is the output of the modified network. We is the individual activation map corresponding to c th class.
Here, H and W refer to the height and width of the output activation maps.
The basic idea of our diversification block is to suppress the discriminative regions of the activation map M, so that the network is forced to look for other informative regions which is expected to enhance classification performance. In the following, we will target two relevant questions: (1) Where to suppress information? and (2) How to suppress?
Mask Generation Here, we explain the procedure to generate the mask that indicates the locations in M that are sup- denotes the binary suppressing mask for its corresponding activation map M c . Each element in mask B c is in the domain {0, 1}, where 1 indicates the corresponding location will be suppressed while 0 means that no suppression will take place.
Peak suppression: First, we randomly suppress the peak locations of the activation maps because they are the most discriminative regions for the classifier. By suppressing the peaks, the network is forced to find alternative relevant regions in the image. Let P c ∈ R H×W be the peak map derived from c th object category map (M c ) such that: Here, max(M c ) denotes the maximum of matrix M c . We suppress the peaks of different object categories with probability p peak . The masks B c to randomly hide the peaks are generated as follows: where ' * ' denotes element-wise multiplication and r c is a Bernoulli random variable that has p peak probability of being 1.
Patch suppression: Peaks are the most discriminative regions, but there are other discriminative regions as well that encompass more subtle inter-class differences. In the following, we explain how to suppress locations other than peaks in the activation maps. We divide each M c into a grid of patches, where each fixed sized patch M [l,m] c ∈ R G×G is indexed by row l and column m. Lets assume the set of all such patches on the grid is given by: After this operation, the activation map M c will be divided into (W × H)/G 2 patches. Let B c ∈ R H×W be the mask for randomly hiding patches for c th activation map M c . For each patch inside M c , we randomly hide it with probability p patch and set the elements of corresponding locations of B c as 1. Otherwise, the elements of B c are set to 0: where, 0, 1 ∈ R G×G and l, m are in the same range as Eq. 3. To consider only the non-peak locations, we then set the element of B c in the peak location of M c as 0, The final suppressing mask for c th category is obtained as: Activation Suppression Factor Setting values that replace the suppressed features is of much importance to achieve good performance. Let M = {M c : c ∈ [1, C]} represents the category activation maps obtained after our diversification module, which is generated as follows.
where, α denotes the suppressing factor. Basically, we replace the values in the suppressing locations as α times of their initial values. In general, setting α to a low number will lead to good performance. Throughout our experiments, we set α as 0.1. After feature masking, we perform global average pooling to get the confidence scores s ∈ R 1×C as follows: where, AvgPool denotes global average pooling.

Gradient-boosting Cross Entropy Loss
While diversification module aims at finding more subtle variations in the input images, our second contribution is a gradient-boosting loss function that specifically focuses on confusing classes to avoid misclassifications between them. We elaborate the proposed loss function below.
Loss Function The most widely used loss for image classification is cross entropy (CE) loss. For an image I, CE loss can be written as follows: where l is the ground-truth label for image I. Here, the loss considers all negative classes equally. However, in finegrained classification, the ground-truth class is generally much closer to a related subset of classes than others. For example, in CUB-200-2011 (Wah et al. 2011), bird class of Acadian Flycatcher is more closer to categories such as Great Crested Flycatcher, Least Flycatcher, Olive sided Flycatcher and other kinds of Flycatcher, since they all belong to the same species. As a result, the network is prone to making mistakes among these similar (thus confusing) classes and predicting relatively higher confidence scores for them. Based on this observation, we argue that the loss should focus more on the confusing classes, rather than simply considering all negative classes equally for the normalization in Eq. 9. Hence, we propose a novel and simple gradient-boosting cross entropy (GCE) loss which focuses only on k negative classes with top-k highest confidence scores among all negative classes. Here, k simply means the number of negative classes to focus on. We will show in the next section, that the proposed loss basically boosts gradients to more swiftly resolve ambiguities between closely related confusing classes. We define J as the set of all negative classes, where J = {i : i ∈ [1, C] ∧ i = l}. Let s = {s i , i ∈ J } be the set containing confidence scores of all negative classes. We get the k th highest values of s by heap-max algorithm (Chhavi 2018) and denote it as t k . Next, we split J into J > and J < by thresholding s using t k , defined as follows: where, J > contains the negative classes whose confidence scores are within the top-k of all negative classes, and J < is the set of negative classes whose confidence scores rank below the top-k classification scores. Instead of considering all negative classes in Eq. 9, our gradient-boosting cross entropy loss only focuses on confusing classes (J > ). The negative classes in J < do not contribute to the loss since the network can easily distinguish them from the ground-truth class. Our proposed loss is given by: As shown in Eq. 10 and 12, GCE loss focuses only on J > , containing k negative classes with top-k highest confidence scores. Here, k is a hyper-parameter (we found k = 15 works best in our experiments). When k = C, GCE is equivalent to CE.
In the following analysis, we will show how our loss can boost the gradient for both the ground-truth class and confusing negative classes.

Gradient Boosting
We analyze the loss from the perspective of gradient. For the original cross entropy (CE) loss, the gradient for s c is computed as: For our gradient-boosting cross entropy loss, the gradient for s c is computed as: From our definition in Eq. 10 and Eq. 11, the following relation exists between J > and J , As such, we obtain, We can see that for both the ground-truth class and confusing negative classes, the gradient of our proposed loss is larger than the gradient of the original cross entropy loss. With our novel loss, the network can focus on differentiating difficult classes from the ground-truth class and converge faster, which is validated by our experiments.

Training and Inference
Our method is trained end-to-end in a single stage. The diversification block is only used during the training phase. As shown in Fig. 2, during the training phase, class activation maps are passed through our novel diversification block and then to the global average pooling. As a result, discriminative regions are randomly masked and the network is forced to find other relevant areas. During test phase, the whole class activation maps are passed to global average pooling directly, without being suppressed at any region so that all informative regions found during training phase contribute to the final confidence score.

Datasets
We comprehensively evaluate our algorithm on CUB-200-2011 (Wah et al. 2011), Stanford Cars (Krause et al. 2013), FGVC Aircraft (Maji et al. 2013), and Stanford Dogs (Khosla et al. 2011), all of which are widely used for finegrained recognition. Statistics of all datasets are shown in Table 1. We follow the same train/test splits as in the table. For evaluation metric, we use top-1 accuracy following Dubey et al. 2018a;2018b).
Furthermore, we also evaluate on the recent terrain dataset for terrain recognition: GTOS-mobile (Xue, Zhang, and Dana 2018) dataset and GTOS (Ground Terrain in Outdoor Scenes) ) dataset, which have potential use for autonomous agents (automatic car). The datasets are large-scale, containing classes of outdoor ground terrain, i.e. glass, sand, soil, stone-cement, and so on. Since those terrain classes are closely related, visually similar and thus difficult to classify, we use this challenging dataset to evaluate our method. Following (Xue, Zhang, and Dana 2018), we use GTOS as training and GTOS-mobile as test.

Implementation Details
For fair comparisons with other methods (Yang et al. 2018;Wang, Morariu, and Davis 2018), we use an input image resolution of 448×448 in all experiments. We fine-tune pretrained network (ResNet-50 (He et al. 2016)) using our proposed diversification block and gradient-boosting loss due to its popularity in existing works. Momentum SGD optimizer is used with an initial learning rate of 0.001, which decays by 0.1 for every 50 epochs. We set weight decay as 10 −4 . Our algorithm is implemented using Pytorch (Paszke et al. 2017) using two Tesla V100 GPU.

Quantitative Results
Our method does not require any part-annotation and can be trained using only class labels. Moreover, it is parameterfree and does not increase the number of parameters compared to the ResNet-50 backbone. Our results are compared with the most recent and top-performing approaches evaluated under similar experimental setting. Several approaches such as RACNN , RAM (Li et al. 2017), and NTS-net (Yang et al. 2018) extract multiple crops at different scale from an input image. The classification score obtained from these crops are averaged to predict the final class during inference. For fair comparison, we report our 'multi-scale' (five crops) results, in addition to the 'single-scale' using one crop from an image. The comparisons with various methods on four challenging fine-grained datasets, namely CUB-200-2011 (Wah et al. 2011), FGVC Aircraft (Maji et al. 2013), Stanford Cars (Krause et al. 2013), and Stanford Dogs (Khosla et al. 2011), are shown in Table 2. Additionally, results for GTOS-mobile ) are shown in Table 3. Overall, our proposed method outperforms previous methods on all five datasets.
We observe that our method achieves the best accuracy on birds classification task (Table 2). Specifically, our method obtains an accuracy of 88.6% which outperforms TASN (87.6%) (Zheng et al. 2019). TASN (Zheng et al. 2019) performs well because it first uses a small network to find the attentive regions and then distills knowledge from various informational regions to the model. With a low parametric complexity, our method can capture more relevant regions by focusing on hard classes and diversifying informative areas in the class activation maps.
For other four datasets, our method also outperforms the compared methods. In Aircraft, we achieve 93.5% top-1 accuracy, surpassing NTS-net (Yang et al. 2018) (91.4%). In Cars, we obtain 94.9%, outperforming the best performances: 93.8% of TASN (Zheng et al. 2019). In Dogs, we obtain 87.7% top-1 accuracy compared to 87.3% obtained by RACNN approach . Note that RACNN has much more parameters (429M) than our methods (23.9M). In GTOS-mobile, we show our result using ResNet-50 with "single scale", for fair comparison with Deep-TEN  and DEP (Xue, Zhang, and Dana 2018). We get 85.0%, which is 2.8% better than the current state-of-the-art 82.2%.  Table 2: Experimental results on four standard datasets. "-" means the information is not mentioned in the relevant paper. Our method outperforms existing approaches on four commonly used fine-grained datasets, and requires no additional parameters compared to the ResNet-50 backbone. Here, the parameters are computed on CUB-200-2011, having 200 output classes.

Ablation Study
To fully analyze our method, Table 4 provides a detailed ablation analysis on the key components of our method. It basically highlights the importance of diversification block and gradient-boosting loss. We conduct all ablation studies on CUB-200-2011 using the ResNet-50 (He et al. 2016). Diversification block (DB). DB is important because it diversifies the informative regions by forcing the network to find relevant parts other than the most obvious ones. Integrating DB block in the ResNet-50 backbone results in a performance improvement of 0.8% (from 85.5% to 86.3%).
Gradient-boosting loss. Our gradient-boosting loss is another important component that shows significant improvement. Using this loss, we improve the results from 86.3% to 87.7% (an absolute gain of 1.4%).We also compare our loss with other recent losses that aim at achieving better discriminability: Center loss (Wen et al. 2016), LGM loss (Wan et al. 2018), and max entropy loss (Dubey et al. 2018b). The re-α 0 0.1 0.2 1.0 Accuracy 86.2 86.3 85.8 85.5 Table 5: Ablation study on suppressing factor α. Keeping suppressing factor as small leads to good performance. sults show that gradient-boosting loss outperforms all these loss functions. Our loss targets on difficult/confusing classes and selectively boosts the gradients for them, while other losses consider all negative classes as equal.
Suppressing Factor. Here, we show a parameter sensitivity analysis on the suppressing factor α. Top-1 accuracy with respect to different α settings is shown in Table 5. It shows that keeping α as a small value consistently leads to better performance than without using diversification block (α = 1). Specifically, α = 0.1 gives the best performance on CUB-200-2011 dataset.
Choices of k. Here, we show ablation study on k, the number of negative classes to focus on for gradient-boosting loss, in Fig. 3. It shows that by reducing k, our loss focuses on more confusing classes and achieves consistent improvement in top-1 accuracy.
Convergence Analysis. We compare the training curves of our methods and baseline (ResNet-50) in Fig. 5. It shows  that our method converges much faster than the baseline, and also attains a lower error rate on test set. Remarkably, the baseline achieves a lower error rate on training set after 50 epochs, but fails to generalize well to the test set. This shows that the baseline is prone to overfitting on the train set, which our method successfully avoids. Our method uses diversification block which prevents the network to only focus on the most discriminative regions, like the beak or head of a bird. In contrast, using diversification block, the network finds various informative areas, thus reducing overfitting.

Qualitative Results
We qualitatively illustrate the comparison between our approach and the baseline in Fig. 4. We note that the diversification block indeed helps the network to find more discriminative regions in the image. In contrast, the baseline model generally focuses on the most obvious distinguishing patterns and its attention is limited to only a limited set of spatial locations. This explains why our approach generalizes better to test images, attaining a higher accuracy (Fig. 5).

ImageNet Results
To validate the generality of gradient-boosting loss in visual recognition, we apply it to a ResNet-50 backbone on Ima- Figure 6: Training curves of using our loss and Cross Entropy (CE) on ImageNet. Our loss converges considerably faster than CE and also leads to a better performance.
geNet (Russakovsky et al. 2015). Here, we use the input size of 224×224 and follow the same training strategy as used in (He et al. 2016). Since our loss focuses on difficult classes, we apply it only half way (50 epochs) during training when easy categories are already well-classified. The comparison of training curve between using our loss and using cross entropy (CE) is shown in Fig. 6. It shows that the proposed loss converges much faster than the CE loss and achieves a lower error rate on the challenging ImageNet benchmark.

Conclusion
We proposed a novel approach to better discriminate closely related categories in fine-grained classification task. Our method has two novel components: (a) diversification block that forces the network to find subtle distinguishing features between each pair of classes and (b) gradient-boosting loss that specifically focuses on maximally separating the highly similar and confusing classes. Our approach not only outperforms existing methods on all studied fine-grained datasets, but also demonstrates much faster convergence rates. In comparison to previous methods, our solution is both simple and elegant, leads to higher accuracy and demonstrates better computational efficiency.