{'fraction_non_alphanumeric': 0.03648928209868392, 'fraction_numerical': 0.014393239139046613, 'mean_word_length': 4.876875323331609, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
PARTICUL: Part Identification with Confidence measure using Unsupervised Learning

In this paper, we present PARTICUL, a novel algorithm for unsupervised learning of part detectors from datasets used in fine-grained recognition. It exploits the macro-similarities of all images in the training set in order to mine for recurring patterns in the feature space of a pre-trained convolutional neural network. We propose new objective functions enforcing the locality and unicity of the detected parts. Additionally, we embed our detectors with a confidence measure based on correlation scores, allowing the system to estimate the visibility of each part. We apply our method on two public fine-grained datasets (Caltech-UCSD Bird 200 and Stanford Cars) and show that our detectors can consistently highlight parts of the object while providing a good measure of the confidence in their prediction. We also demonstrate that these detectors can be directly used to build part-based fine-grained classifiers that provide a good compromise between the transparency of prototype-based approaches and the performance of non-interpretable methods.


Introduction
With the development of deep learning in recent years, convolutional neural networks (CNNs) have quickly become the backbone of all state-of-the-art visual recognition systems. CNNs are highly efficient but also highly complex systems manipulating abstract (and often opaque) representations of the image -also called feature vectors -to achieve high accuracy, at the cost of transparency and interpretability of the decision-making process. In order to overcome these issues, a solution, explored in [1, 3, 6, 7, 10-12, 17, 19, 22, 27, 34, 41, 44], consists in building an intermediate representation associating each input image with a set of semantic attributes. These attributes, usually representing an association between a part of an object (e.g., head of a bird) and a property (e.g., shape, color), can be either used by interpretable methods [3,22,27] to produce the decision, as post-hoc explanation [11,12] of a particular decision, or as supplementary arXiv:2206.13304v1 [cs.CV] 27 Jun 2022 information in order to discriminate similar categories in the case of fine-grained visual classification (FGVC) [7,10,19,41,44]. In practice, attributes are learned through fully supervised algorithms [1,6,7,10,19,34,41,44], using datasets with hand-crafted annotations. Such datasets are expensive to produce -using expert knowledge or online crowd-sourcing platforms -and prone to errors [13,23]. Therefore, a lot of effort [3,5,8,9,14,18,25,29,38,39,42,43] has been recently put into the development of more scalable techniques using less training information. In particular, the task of localizing different parts of an object, a prerequisite to attribute detection, can be performed in a weakly supervised (using the category of each image) or unsupervised manner. By focusing on general features of the objects rather than discriminative details, part detection represents an easier task than attribute detection. However, it must offer strong evidence of accuracy and reliability in order to constitute a solid basis for a trustworthy decision.
In this paper, we present PARTICUL 3 (Part Identification with Confidence measure using Unsupervised Learning), a plug-in module that uses an unsupervised algorithm in order to learn part detectors from FGVC datasets. It exploits the macro-similarities of all images in the training set in order to mine for recurring patterns in the feature space of a pre-trained CNN. We propose new objective functions enforcing the locality and unicity of the detected parts. Our detectors also provide a confidence measure based on correlation scores, allowing the system to estimate the visibility of each part. We apply our method on two public datasets, Caltech-UCSD Bird 200 (CUB-200) [35] and Stanford Cars [37], and show that our detectors can consistently highlight parts of the object while providing a good measure of the confidence in their prediction. Additionally, we provide classification results in order to showcase that classifiers based only on part detection can constitute a compromise between accuracy and transparency. This paper is organized as follows: Section 2 presents the related work on part detection; Section 3 describes our PARTICUL model and Section 4 presents our results on two FGVC datasets. Finally, Section 5 concludes this paper and proposes several lines of research aiming at improving our approach.

Related work
Part detection (and more generally attribute detection) is a problem which has been extensively studied in recent years, especially for FGVC which is a notoriously hard computer vision task. Learning how to detect object parts in this context can be done either in a fully supervised (using ground-truth part locations), weakly supervised (using image labels only) or unsupervised manner.
Weakly supervised approaches [3,5,8,14,16,18,21,25,30,36,38,42,43] produce part detectors as by-products of image classification i.e., object parts are jointly learned with categories in an end-to-end manner to help distinguish very similar categories. In particular, the OPAM approach presented in [25] obtains parts from candidate image patches that are generated by Selective Search [33], filtered through a dedicated pre-trained network, selected using an object-part spatial constraint model taking into account a coarse segmentation of the object at the image level, and finally semantically realigned by applying spectral clustering on their corresponding convolutional features.
Recently, unsupervised part detection methods have greatly benefited from the expressiveness and robustness of features extracted from images using deep CNNs. Modern approaches [15,29,39,40,42] mainly focus on applying clustering techniques in the feature space and/or identifying convolutional channels with consistent behaviors. More precisely, [15] produces part detectors through the sampling and clustering of keypoints within an estimation of the object segmentation produced by a method similar to GrabCut [26]. For a given image, [39] uses itemset mining to regroup convolutional channels based on their activation patterns, producing parts per image instead of globally (as in [25]) and thus requiring an additional semantic realignment -through clustering -for part-based classification. Rather than working on the full images, [40] and [29] use convolutional features of region proposals produced by Selective search [28]. [29] then learns the relation between regions and parts using clustering and soft assignment algorithms, while [40] builds part detectors from the top-k most activated filters across all regions of the training set. Due to the independent training of each detector, the latter approach produces tens of redundant part detectors which must be filtered out in a weakly unsupervised manner.
This issue is partially addressed in the MA-CNN approach [42], where part detectors are learned by performing a soft assignment of the convolutional channels of a pretrained CNN into groups that consistently have a peak response in the same neighborhood, then regressing the weight (importance) of each channel in each group through a fully convolutional layer applied on the feature map. Each part detector produces an activation map, normalized using a sigmoid function, corresponding to the probability of presence of the part at each location. By picking the location with the highest activation value for each detector, MA-CNN generates part-level images patches that are fed into a Part-CNN [2] architecture for classification. In practice, part detectors are initialized by channel grouping (using k-means clustering) and pre-trained in an unsupervised manner using dedicated loss functions enforcing the locality and unicity of each detector attention region. Finally, these detectors are fine-tuned during end-to-end learning of the image category. As such, this method falls into the category of unsupervised part learning with weakly supervised fine-tuning. More recently, the P-CNN approach [9] implements the part detection learning algorithm of MA-CNN, replacing the fully connected layer in charge of channel grouping by a convolution layer. Its classification pipeline uses Region-of-Interest (ROI) pooling layer around the location of maximum activation to directly extract part features and global features from the part detection backbone. In both cases, the channel grouping initialization requires first to process all images of the training set in order to cluster channels according to the location of their highest response. Moreover, for a given detector, only the area immediately surrounding the location of highest activation is taken into account (either to extract an image patch in [42] or a vector through ROI-pooling in [9]), thus reducing the ability to detect the same part at different scales.
Contributions Our PARTICUL approach builds part detectors as weighted sums of convolutional channels extracted from a pre-trained CNN backbone. Our detectors are trained globally across the training set, instead of locally, contrary to [39] and [25] which require an additional semantic alignment phase. We develop objective functions that are specially crafted to ensure the compactness of the distribution of activation values for each part detector and the diversity of attention locations. Unlike [42] and [9], which propose similar functions, our approach does not require any fine-tuning of the backbone or an initial channel grouping phase. This induces a fast convergence during training and enables our module to be used with black-box backbones, in a plug-in fashion. Moreover, our detectors use a softmax normalization function, instead of sigmoid function, that simplifies the process of locating the part and enables us to detect parts at different scales. Finally, our detectors supply a measure of confidence in their decision based on the distribution of correlation scores across the training set. Importantly, this measure can also predict the visibility of a given part, a subject which is, to our knowledge, not tackled in any of the related work.

Proposed model
In this section, we present PARTICUL, our proposal for unsupervised part learning from FGVC datasets. In practice, each part detector can be seen as a function highlighting dedicated attention regions on the input image, in accordance with the constraints detailed in this section.
Notations For a tensor T inside a model M, we denote T (x) the value of T given an input x of M. If T has H rows, W columns and C channels, we denote T [h,w] (x) ∈ R C the vector (or single feature) located at the h th row, w th column. We denote * the convolution operation between tensors, σ the softmax normalization function. e define I as the set of all input images of a given dimension H I × W I and I C ⊆ I as the subset of images in I containing an object of the macro-category C. In our experiments, we denote X train = x i ∈ I C i ∈ [1 . . n] the training set of size n. Although I C cannot usually be formally specified, we assume that X train is representative of this set.

Part detectors
As illustrated in Fig. 1, we first use a pre-trained CNN F to extract a H ×W ×D feature map. Then, we build each of the p part detectors as a convolution with a 1 × 1 × D kernel k (i) (no bias is added), followed by a 2D spatial softmax layer, each part detector producing a H × W activation map We denote the set of all part detector kernels as K = [k (1) , k (2) , . . . , k (p) ].

Objective functions
Locality: For each part detector i, we force the network to learn a convolutional kernel k (i) which maximizes one region of the activation map for any training image x. In order to allow activations to be localized into a given neighborhood rather than in a single location in the H × W activation map, we first apply a 3 × 3 uniform filter u on P (k (i) , x). Let Learning all convolutional kernels K in order to enforce locality can be translated as the optimization of the objective function Intuitively, solving the optimization problem in Eq. 3 using G(k (i) , x) rather than P (k (i) , x) relaxes the learning constraint and prevents the detectors from focusing on discriminative details between two adjacent feature vectors that would represent the same part.
Unicity In order to prevent the system from learning only a handful of easy parts, we wish to ensure that each feature vector F [h,w] (x) is not simultaneously correlated with multiple convolutional kernels k (i) . Let S(K, x) ∈ R H×W s.t.: Ensuring unicity can be translated as the following objective function, i.e., making sure that no location (h, w) contains a cumulative activation higher than 1: The final objective function for the unsupervised learning of part detectors is a weighted composition of the functions described above: where λ controls the relative importance of each objective function.

Confidence measure and visibility
Visibility is related to a measure of confidence in the decision provided by each of our detectors and based on the distribution of correlation scores across the training set. After fitting our detectors to Eq. 6, we employ the function returning the maximum correlation score of detector i for image x (before softmax normalization). The distribution of values taken by H i across I C is modeled as a random variable following a normal distribution N (µ i , σ 2 i ) estimated over X train . We define the confidence measure of part detector i on image x as where Φ(z, µ, σ 2 ) is the cumulative distribution function of N (µ i , σ 2 i ).

Experiments
In order to showcase the effectiveness of our approach, we apply our algorithm on two public FGVC datasets -the Caltech-UCSD Birds 200 (CUB-200) [ . In addition to the object subcategory labels (bird species, car model), both datasets also provide additional information in the form of annotations (object bounding box, part locations in [35]). However, when learning and calibrating our part detectors, and unless specified otherwise, we do not use any information other than the images themselves and work in a fully unsupervised setting.

Unsupervised learning of part detectors
In this section, we illustrate our unsupervised part detection algorithm using VGG19 [31] (with batch normalization) pretrained on the Imagenet dataset [4] as our extractor F (.) (Eq. 1). For part visualization, we use SmoothGrad [32], filtering out small gradients using the method described in [24]. We train our detectors during 30 epochs, using RMSprop with a learning rate of 5×10 −4 and a decay of 10 −5 . These training parameters are chosen using crossvalidation on the training set, with the goal of minimizing the objective function (Eq. 6). Since we do not need to fine-tune the extractor, only p×D convolutional weights are learned during training, which drastically reduces the computation time. Finally, for a given number of parts p, we supervise the importance λ of the unicity constraint (Eq. 6) by measuring the overall attention across the feature map after training. More precisely, we compute the value  detectors systematically converge towards the same location inside of the feature map (E(X train , K) ≈ 1/p) corresponding to the head of the bird; in the case of Stanford Cars, where images contain more varied distinctive patterns, the number of unique detectors depends on the random initialization of their convolutional weights, but the average contribution per detector quickly drops with p. For both datasets, we choose λ = 0.2 which maximizes E(X train , K) for all values of p. As a comparison, we also train our detectors after fine-tuning the extractor on each dataset (in this case, the learning process can be considered weakly supervised), leading to only marginally better results. This supports our claim that, in practice, our detectors do not require a fine-tuned extractor and can work as a plug-in module to a black-box extractor. Using this visualizations, we can manually re-attach a semantic value to each detector, e.g., the second part detector trained on CUB-200 is probably a "leg" detector. Best viewed in color.
As illustrated in Fig. 3, our detectors consistently highlight recurring parts of the objects and are relatively insensitive to the scale of the part. Although we notice some apparent redundancy of the detected parts (e.g., around the head of the bird), the relatively high corresponding value for E(X train , K) (0.87 for λ = 0.2 and p = 6, see Fig. 2a) indicates that each detector actually focus on a different location of the feature map, leading to a richer representation of the object. Note that when training our detectors, we do not know beforehand towards which part each detector will converge. However, using part visualization, we can re-attach a semantic value to each detector after training.

Confidence measure
After training our detectors, we perform a calibration of their confidence measure using the method presented in Sec. 3.3. In order to illustrate the soundness of our approach, we exploit the annotations provided by the CUB-200 dataset to extract a subset of images where the legs of the bird are non-visible (2080 images from both the training and test set, where the annotations indicate that the color of the legs is not visible). As shown on Fig. 4a, there is a clear difference in  the distributions of maximum correlation scores between images with and without visible legs. This also confirms that images not containing the part tend to produce lower correlation scores, and by consequence our proposal for a confidence measure based on a cumulative distribution function (Eq. 8). In practice (Fig. 4b), a calibrated detector can detect the same part at different scales while ignoring images where the confidence measure is below a given threshold (2% in the example). It is interesting to note that for all images in the middle row, the annotations actually indicate that the legs are not visible, i.e., our detectors can also be employed as a fast tool to verify manual annotations.

Classification
In all related works closest to ours, the performance of part detectors is never evaluated independently but rather w.r.t. to the classification task, a method which is highly dependent on the architecture chosen for the decision-making process: e.g., SVMs in [15] and [29], Part-CNN [2] in [42], Spatially Weighted Fisher Vector CNN (SWFV) in [40], multi-stream architecture in [39]. Nevertheless, in order to provide a basis of comparison with state-of-art techniques, we also provide classification results based on the extraction of part feature vectors. As illustrated in Fig. 5, we use a method similar to [41], where the feature map F (X) is multiplied element-wise with the activation map produced by each detector to compute a set of part feature vectors that are used as inputs of p independent classifiers (each containing 2 intermediate layers -with 4096 neurons, ReLU activation and dropout -before the classification layer). As such, our detectors operate a form of semantic realignment and extraction of relevant feature vectors from the image. Note that, contrary to the fixed size ROI pooling used in [9], this method has the advantage of dynamically adjusting the number of feature vectors taken into account depending on the scale of the part. For the final decision, we sum up the logits of all part-based classifiers to produce prediction scores for each category. Therefore, the final decision can be directly traced back to the individual result of each part-based classifier. This approach does not provide the transparency [20] of prototype-based methods [3,22], but constitutes a good compromise to non interpretable approaches using global features.  Table 1 summarizes the results obtained when using our part-based classifier, along with the results obtained on a fine-tuned VGG-19 (acting as a baseline) and other state-of-the-art methods. With 8 detectors, we outperform the prototype-based approach [22] -which uses a more efficient extractor (Resnet50) -on Stanford Cars and obtain similar results on CUB-200. When compared with other methods using only part-level features, our PARTICUL model outperforms the OPAM [25] approach on both datasets. We also obtain comparable results to other methods requiring either the object bounding box [15] or to preselect detectors (in a weakly supervised manner) based on their classification accuracy [40]. When compared with less transparent methods using image-level (global) features in addition to part-level features -a method which usually has a significant impact on accuracy (e.g., from 80.7% to 85.8% on CUB-200 using OPAM [25]) -again we achieve comparable results and even outperform the UPM [39] approach on CUB-200. Finally, it is also interesting to note that for both datasets, our classification results obtained by picking 10 feature vectors out of the 14×14 = 196 possible vectors of the extractor feature map correspond to a drop of less then 1% in accuracy when compared with the baseline, indicating that we are indeed selecting the most relevant vectors for the classification. Moreover, in 80% (resp. 77%) of these cases where only the baseline provides a correct prediction on the CUB-200 (resp. Stanford Cars) dataset, at least one of our individual part-based classifier does provide a correct prediction (see Fig. 6). Thus, our proposed model could be further improved by fine-tuning the relative importance of part logits (e.g., using the confidence measure).

Conclusion and future work
In this paper, we presented our algorithm for unsupervised part learning using datasets for FGVC. We showed that our detectors can consistently highlight parts of an object while providing a confidence measure associated with the detection. To our knowledge, our method is the first to take the visibility of parts into account, paving the road for a solid attribute learning and ultimately for interpretable visual recognition. In the particular context of FGVC, our detectors can be integrated in a part-based classification architecture which constitutes a good compromise between the transparency of prototype-based approaches and the performance of non-interpretable methods. As a future work, we will study the integration of our detectors into a prototype-based architecture, learning prototypes from part feature vectors rather than from the entire image feature map. We will also study the impact of weighting part logits by the confidence score associated with the detected part on the overall accuracy of the system.