W EAKLY S UPERVISED C LUSTERING BY E XPLOITING U NIQUE C LASS C OUNT
Anonymous authors
Paper under double-blind review
A BSTRACT
A weakly supervised learning based clustering framework is proposed in this paper.
As the core of this framework, we introduce a novel multiple instance learning task based on a bag level label called unique class count ( ucc ), which is the number of unique classes among all instances inside the bag.
In this task, no annotations on individual instances inside the bag are needed during training of the models.
We mathematically prove that with a perfect ucc classiﬁer, perfect clustering of individual instances inside the bags is possible even when no annotations on individual instances are given during training.
We have constructed a neural network based ucc classiﬁer and experimentally shown that the clustering performance of our framework with our weakly supervised ucc classiﬁer is comparable to that of fully supervised learning models where labels for all instances are known.
Furthermore, we have tested the applicability of our framework to a real world task of semantic segmentation of breast cancer metastases in histological lymph node sections and shown that the performance of our weakly supervised framework is comparable to the performance of a fully supervised Unet model.
I NTRODUCTION
In machine learning, there are two main learning tasks on two ends of scale bar: unsupervised learning and supervised learning.
Generally, performance of supervised models is better than that of unsupervised models since the mapping between data and associated labels is provided explicitly in supervised learning.
This performance advantage of supervised learning requires a lot of labelled data, which is expensive.
Any other learning tasks reside in between these two tasks, so are their performances.
Weakly supervised learning is an example of such tasks.
There are three types of supervision in weakly supervised learning: incomplete , inexact and inaccurate supervision.
Multiple instance learning (MIL) is a special type of weakly supervised learning and a typical example of inexact supervision (Zhou, 2017).
In MIL, data consists of bags of instances and their corresponding bag level labels.
Although the labels are somehow related to instances inside the bags, the instances are not explicitly labeled.
In traditional MIL, given the bags and corresponding bag level labels, task is to learn the mapping between bags and labels while the goal is to predict labels of unseen bags (Dietterich et al., 1997; Foulds & Frank, 2010).
In this paper, we explore the feasibility of ﬁnding out labels of individual instances inside the bags only given the bag level labels, i.e. there is no individual instance level labels.
One important application of this task is semantic segmentation of breast cancer metastases in histological lymph node sections, which is a crucial step in staging of breast cancer (Brierley et al., 2016).
In this task, each pathology image of a lymph node section is a bag and each pixel inside that image is an instance.
Then, given the bag level label that whether the image contains metastases or not, the task is to label each pixel as either metastases or normal.
This task can be achieved by asking experts to exhaustively annotate each metastases region in each image.
However, this exhaustive annotation process is tedious, time consuming and more importantly not a part of clinical workﬂow.
In many complex systems, such as in many types of cancers, measurements can only be obtained at coarse level (bag level), but information at ﬁne level (individual instance level) is of paramount importance.
To achieve this, we propose a weakly supervised learning based clustering framework.
Given a dataset consisting of instances with unknown labels, our ultimate objective is to cluster the instances in this dataset.
To achieve this objective, we introduce a novel MIL task based on a new kind of bag level label called unique class count ( ucc ), which is the number of unique classes or the number of clusters among all the instances inside the bag.
We organize the dataset into non-empty bags, where each bag is a subset of individual instances from this dataset.
Each bag is associated with a bag level ucc label.
Then, our MIL task is to learn mapping between the bags and their associated bag level ucc labels and then to predict the ucc labels of unseen bags.
We mathematically show that a ucc classiﬁer trained on this task can be used to perform unsupervised clustering on individual instances in the dataset.
Intuitively, for a ucc classiﬁer to count the number of unique classes in a bag, it has to ﬁrst learn discriminant features for underlying classes.
Then, it can group the features obtained from the bag and count the number of groups, so the number of unique classes.
Our weakly supervised clustering framework is illustrated in Figure 1.
It consists of a neural network based ucc classiﬁer, which is called as Unique Class Count ( UCC ) model, and an unsupervised clustering branch.
The UCC model accepts any bag of instances as input and uses ucc labels for supervised training.
Then, the trained UCC model is used as a feature extractor and unsupervised clustering is performed on the extracted features of individual instances inside the bags in the clustering branch.
Semantic segmentation of breast cancer metastases in lymph node sections, for example, can be formulated in this framework as follows: each image (bag) has a label of ucc(image is fully normal or fully metastases) or ucc 2 (image is a mixture of normal and metastases).
A UCC model can be trained on ucc labels and the trained model can be used to extract features of intances (pixels) inside the bags (images).
Then, semantic segmentation masks can be obtained by clustering the extracted features (so the pixels) into two clusters (metastases or normal).
Note that ucc does not directly provide an exact label for each individual instance.
Therefore, our framework is a weakly supervised clustering framework.
Moreover, while UCC model is trained in a fully supervised fashion on ucc labels, clustering is performed completely in an unsupervised fashion.
Finally, we have constructed ucc classiﬁers and experimentally shown that clustering performance of our framework with our ucc classiﬁers is better than the performance of unsupervised models and comparable to performance of fully supervised learning models.
We have also tested the performance of our model on the real world task of semantic segmentation of breast cancer metastases in lymph node sections.
We have compared the performance of our model with the performance of popular medical image segmentation architecture of Unet (Ronneberger et al., 2015) and shown that our weakly supervised model approximates the performance of fully supervised Unet model 1 .
Hence, there are three main contributions of this paper:
We have deﬁned unique class count as a bag level label in MIL setup and mathematically proved that a perfect ucc classiﬁer, in principle, can be used to perfectly cluster the individual instances inside the bags.
We have constructed a neural network based ucc classiﬁer by incorporating kernel density estimation (KDE) (Parzen, 1962) as a layer into our model architecture, which provided us with end-to-end training capability.
We have experimentally shown that clustering performance of our framework is better than the performance of unsupervised models and comparable to performance of fully supervised learning models.
The rest of the paper is organized such that related work is in Section 2, details of our weakly supervised clustering framework are in Section 3, results of the experiments on MNIST, CIFAR and CIFAR100 datasets are in Section 4, the results of the experiments in semantic segmentation of breast cancer metastases are in Section 5, and Section 6 concludes the paper.
R ELATED W ORK
This work is partly related to MIL which was ﬁrst introduced in (Dietterich et al., 1997) for drug activity prediction.
Different types of MIL were derived with different assumptions (G¨artner et al., 2002; Zhang & Goldman, 2002; Chen et al., 2006; Foulds, 2008; Zhang & Zhou, 2009;
Zhou et al., 2009), which are reviewed in detail in (Foulds & Frank, 2010), and they were used for many different applications such as, image annotation/categorization/retrieval (Chen & Wang, 2004; Zhang et al., 2002; Tang et al., 2010), text categorization (Andrews et al., 2003; Settles et al., 2008), spam detection (Jorgensen et al., 2008), medical diagnosis (Dundar et al., 2007), face/object detection (Zhang et al., 2006; Felzenszwalb et al., 2010) and object tracking (Babenko et al., 2011).
In MIL, different types of pooling layers are used to combine extracted features of instances inside the bags, such as max-pooling and log-sum-exp pooling (Ramon & De Raedt, 2000; Zhou & Zhang, 2002; Wu et al., 2015; Wang et al., 2018).
On the other hand, our UCC model uses KDE layer in order to estimate the distribution of extracted features.
The advantage of KDE over pooling layers is that it embeds the instance level features into distribution space rather than summarizing them.
There are also methods modeling cardinality and set distributions (Liu et al., 2015; Brukhim &
Globerson, 2018; Kipf et al., 2018).
However, cardinality of a set and ucc are completely different from each other.
It is also important to state that ucc is obviously different from object/crowd counting (Idrees et al., 2013;
Arteta et al., 2014; Zhang et al., 2015; 2016) since the task in object/crowd counting is to count the instances of the same type of object or people.
Lastly, we compare clustering accuracies of our models with clustering accuracies of unsupervised baseline models: K-means (Wang et al., 2015) and Spectral Clustering (Zelnik-Manor & Perona, 2005); state of the art unsupervised models: JULE (Yang et al., 2016), GMVAE (Dilokthanakul et al., 2016), DAC (Chang et al., 2017), DEPICT (Ghasedi Dizaji et al., 2017) and DEC (Xie et al., 2016); and state of the art semi-supervised models: AAE (Makhzani et al., 2015), CatGAN (Springenberg, 2015), LN (Rasmus et al., 2015) and ADGM (Maaløe et al., 2016).
W EAKLY S UPERVISED C LUSTERING F RAMEWORK
In this section, we state our machine learning objective and formally deﬁne our novel MIL task, which is the core of our weakly supervised clustering framework.
Finally, we explain details of the two main components of our framework, namely UCC model and unsupervised clustering branch.
Objective: Let X = { x 1 , x 2 , · · · , x n } be a dataset such that each instance x i ∈ X belongs to a class, but its label is unknown.
In this paper, we assume that total number of classes K is known.
Hence, each instance x i is endowed with an underlying, but unkown, label L ( x i ) =
l i ∈ { 1 , 2 , · · · , K } .
Further assume that for each class k ∈ { 1 , 2 , · · · K } , there exist at least one element x i ∈
X such that L ( x i ) =
l i = k .
Our eventual objective is to derive a predicted class label ˆ l i for each instance x i that tends towards underlying truth class l i , i.e. ˆ l i → L ( x i ) =
l i .
3. A N OVEL MIL T ASK
In this novel MIL task, unique class count is used as an inexact, weak, bag level label and is deﬁned in Deﬁnition 1.
Assume that we are given subsets σ ζ ⊂ X , ζ = 1 , 2 , · · · , N and unique class counts η σ ζ ∀ σ ζ .
Hence, MIL dataset is D = { ( σ 1 , η σ 1 ) , · · · , ( σ N , η σ N ) } .
Then, our MIL task is to learn the mapping between the bags and their associated bag level ucc labels while the goal is to predict the ucc labels of unseen bags.
Deﬁnition
Given a subset σ ζ ⊂ X , unique class count, η σ ζ , is deﬁned as the number of unique classes that all instances in the subset σ ζ belong to, i.e. η σ ζ = |{L ( x i ) | x i ∈
σ ζ }| .
Recall that each instance belongs to an underlying unknown class.
Given a dataset D , our eventual objective is to assign a label to each instance x i ∈
X such that assigned labels and underlying unknown classes are consistent.
To achieve this eventual objective, a deep learning model is designed such that the following intermediate objectives can be achieved while it is being trained on our MIL task:
Unique class count : Given an unseen set σ ζ , the deep learning model, which is trained on D , can predict its unique class count η σ ζ correctly.
Labels on sets : Let σ pureζ and σ pureξ be two disjoint pure sets (Deﬁnition 2) such that while all instances in σ pureζ belong to one underlying class, all instances in σ pureξ belong to another class.
Given σ pureζ and σ pureξ , the deep learning model should enable us to develop an unsupervised learning model to label instances in σ pureζ and σ pureξ as belonging to different classes.
Note that the underlying classes for instances in the sets are unknown.
Labels on instances : Given individual instances x i ∈ X , the deep learning model should enable us to assign a label to each individual instance x i such that all instances with different/same underlying unknown classes are assigned different/same labels.
This is the eventual unsupervised learning objective.
Deﬁnition
A set σ is called a pure set if its unique class count equals one.
All pure sets is denoted by the symbol σ pure in this paper.
3. U NIQUE C LASS C OUNT M ODEL
In order to achieve the stated objectives, we have designed a deep learning based Unique Class Count ( UCC ) model.
Our UCC model consists of three neural network modules ( θ feature , θ drn , θ decoder ) and can be trained end-to-end.
The ﬁrst module θ feature extracts features from individual instances; then distributions of features are constructed from extracted features.
The second module θ drn is used to predict ucc label from these distributions.
The last module θ decoder is used to construct an autoencoder together with θ feature so as to improve the extracted features by ensuring that extracted features contain semantic information for reconstruction.
Formally, for x i ∈ σ ζ , i = { 1 , 2 , · · · , | σ ζ |} , feature extractor module θ feature extracts J features { f 1 ,iσ ζ , f 2 ,iσ ζ , · · · , f J,iσ ζ } = θ feature ( x i ) for each instance x i ∈ σ ζ .
As a short hand, we write the operator θ feature as operating element wise on the set to generate a feature matrix θ feature ( σ ζ ) =
f σ ζ with matrix elements f j,iσ ζ ∈ R , representing the j th feature of the i th instance.
After obtaining features for all instances in σ ζ , a kernel density estimation (KDE) module is used to accumulate feature distributions h σ ζ =
( h 1 σ ζ ( v ) , h 2 σ ζ ( v ) , · · · , h J σ ζ ( v )) .
Then, h σ ζ is used as input to distribution regression module θ drn to predict the ucc label, ˜ η
σ ζ = θ drn ( h σ ζ ) as a softmax vector (˜ η 1 σ ζ , ˜ η
2 σ ζ , · · · , ˜ η Kσ ζ ) .
Concurrently, decoder module θ decoder in autoencoder branch is used to reconstruct the input images from the extracted features in an unsupervised fashion, ˜ x i = θ decoder ( θ feature ( x i )) .
Hence, UCC model, main modules of which are illustrated in Figure 2(a), optimizes two losses concurrently: ‘ucc loss’ and ‘autoencoder loss’.
While ‘ucc loss’ is cross-entropy loss, ‘autoencoder loss’ is mean square error loss.
Loss for one bag is given in Equation 1.
[Equation]
where α ∈ [0 , 1] (1)
3.2. K ERNEL D ENSITY E STIMATION M ODULE
In UCC model, input is a set σ ζ and output is corresponding ucc label ˜
η σ ζ , which does not depend on permutation of the instances in σ ζ .
KDE module provides UCC model with permutation- invariant property.
Moreover, KDE module uses the Gaussian kernel and it is differentiable, so our model can be trained end-to-end (Appendix A).
KDE module also enables our theoretical analysis thanks to its decomposability property (Appendix B).
Lastly, KDE module estimates the probability distribution of extracted features and enables θ drn to fully utilize the information in the shape of the distribution rather than looking at point estimates of distribution obtained by other types of pooling layers (Ramon & De Raedt, 2000; Zhou & Zhang, 2002;
Wang et al., 2018)
(Appendix C.6).
3.2. P ROPERTIES OF U NIQUE C LASS C OUNT M ODEL
This section mathematically proves that the UCC model guarantees, in principle, to achieve the stated intermediate objectives in Section 3.1.
Proof of propositions are given in Appendix B.
Proposition 1 Let σ ζ , σ ξ be disjoint subsets of X with predicted unique class counts ˜ η
σ ζ = ˜ η σ ξ = 1 .
If the predicted unique class count of σ ν = σ ζ ∪ σ ξ is ˜ η σ ν = 2 , then h σ ζ (cid:54) = h σ ξ .
Deﬁnition
A perfect unique class count classiﬁer takes in any set σ and output the correct predicted unique class count ˜ η σ = η σ .
Proposition 2 Given a perfect unique class count classiﬁer.
The dataset X can be perfectly clustered into K subsets σ pureξ , ξ = 1 , 2 , · · · , K , such that X = (cid:83)
Kξ =
σ pureξ and σ pureξ = { x i | x i ∈
X , L ( x i ) = ξ } .
Proposition 3 Given a perfect unique class count classiﬁer.
Decompose the dataset X into K subsets σ pureξ , ξ = 1 , · · · K , such that σ pureξ = { x i | x i ∈ X , L ( x i ) = ξ } .
Then, h σ pureξ (cid:54) =
h σ pureζ for ξ (cid:54) = ζ .
Suppose we have a perfect ucc classiﬁer.
For any two pure sets σ pureζ and σ pureξ , which consist of instances of two different underlying classes, ucc labels must be predicted correctly by the perfect ucc classiﬁer.
Hence, the conditions of Proposition 1 are satisﬁed, so we have h σ pureζ (cid:54) =
h σ pureξ .
Therefore, we can, in principle, perform an unsupervised clustering on the distributions of the sets without knowing the underlying truth classes of the instances.
Hence, the perfect ucc classiﬁer enables us to achieve our intermediate objective of “Labels on sets” .
Furthermore, given a perfect ucc classiﬁer, Proposition 2 states that by performing predictions of ucc labels alone, without any knowledge of underlying truth classes for instances, one can in principle perform perfect clustering for individual instances.
Hence, a perfect ucc classiﬁer enables us to achieve our intermediate objective of “Labels on instances” .
3. U NSUPERVISED I NSTANCE C LUSTERING
In order to achieve our ultimate objective of developing an unsupervised learning model for clustering all the instances in dataset X , we add this unsupervised clustering branch into our framework.
Theoreticallly, we have shown in Proposition 3 that given a perfect ucc classiﬁer, distributions of pure subsets of instances coming from different underlying classes are different.
In practice, it may not be always possible (probably most of the times) to train a perfect ucc classiﬁer, so we try to approximate it.
First of all, we train our ucc classiﬁer on our novel MIL task and save our trained model (¯ θ feature , ¯ θ drn , ¯ θ decoder ) .
Then, we use trained feature extractor ¯ θ feature to obtain feature matrix f X
= ¯ θ feature ( X ) .
Finally, extracted features are clustered in an unsupervised fashion, by using simple k-means and spectral clustering methods.
Figure 2(b) illustrates the unsupervised clustering process in our framework.
A good feature extractor ¯ θ feature is of paramount importance in this task.
Relatively poor ¯ θ feature may result in a poor unsupervised clustering performance in practice even if we have a strong ¯ θ drn .
To obtain a strong ¯ θ feature , we employ an autoencoder branch, so as to achieve high clustering performance in our unsupervised instance clustering task.
The autoencoder branch ensures that features extracted by ¯ θ feature contain semantic information for reconstruction.
E XPERIMENTS ON MNIST AND CIFAR D ATASETS
This section analyzes the performances of our UCC models and fully supervised models in terms of our eventual objective of unsupervised instance clustering on MNIST (10 clusters)
(LeCun et al., 1998), CIFAR10 (10 clusters) and CIFAR100 (20 clusters) datasets (Krizhevsky & Hinton, 2009).
4. M ODEL A RCHITECTURES AND D ATASETS
To analyze different characteristics of our framework, different kinds of unique class count models were trained during our experiments: UCC , UCC 2+ , UCC α =1 and UCC 2+ α =1 .
These unique class count models took sets of instances as inputs and were trained on ucc labels.
While UCC and
UCC 2+ models had autoencoder branch in their architecture and they were optimized jointly over both autoencoder loss and ucc loss , UCC α
=1 and UCC 2+ α =1 models did not have autoencoder branch in their architecture and they were optimized over ucc loss only (i.e. α = 1 in Equation 1).
The aim of training unique class count models with and without autoencoder branch was to show the effect of autoencoder branch in the robustness of clustering performance with respect to ucc classiﬁcation performance.
UCC and UCC α =1 models were trained on bags with labels of ucc 1 to ucc 4 .
On the other hand, UCC 2+ and UCC 2+ α =1 models were trained on bags with labels ucc 2 to ucc 4 .
Our models were trained on ucc labels up to ucc 4 instead of ucc 10 ( ucc 20 in CIFAR100) since the performance was almost the same for both cases and training with ucc 1 to ucc 4 was much faster (Appendix C.2).
Please note that for perfect clustering of instances inside the bags, it is enough to have a perfect ucc classiﬁer that can perfectly discriminate ucc 1 and ucc 2 bags from Proposition 2.
The aim of traininig UCC 2+ and UCC 2+ α =1 models was to experimentally check whether these models can perform as good as UCC and UCC α =1 models even if there is no pure subsets during training.
In addition to our unique class count models, for benchmarking purposes, we also trained fully supervised models, FullySupervised , and unsupervised autoencoder models, Autoencoder .
FullySupervised models took individual instances as inputs and used instance level ground truths as labels during training.
On the other hand, Autoencoder models were trained in an unsupervised manner by optimizing autoencoder loss (i.e. α = 0 in Equation 1).
It is important to note that all models for a dataset shared the same architecture for feature extractor module and all the modules in our models are ﬁne tuned for optimum performance and training time as explained in Appendix C.1.
We trained and tested our models on MNIST, CIFAR10 and CIFAR100 datasets.
We have X mnist,tr ,
X mnist,val and X mnist,test for MNIST; X cifar 10 ,tr , X cifar 10 ,val and X cifar 10 ,test for CIFAR10; and X cifar 100 ,tr , X cifar 100 ,val and X cifar 100 ,test for CIFAR100.
Note that tr , val and test subscripts stand for ‘training’, ‘validation’ and ‘test’ sets, respectively.
All the results presented in this paper were obtained on hold-out test sets X mnist,test , X cifar 10 ,test and X cifar 100 ,test .
FullySupervised models took individual instances as inputs and were trained on instance level ground truths.
Unique class count models took sets of instances as inputs, which were sampled from the power sets 2 X mnist,tr , 2 X cifar 10 ,tr and 2 X cifar 100 ,tr , and were trained on ucc labels (Appendix C.2).
While all
[Table]
∗ Models do not separate training and testing data, i.e. their results are not on hold-out test sets.
the models were trained in a supervised setup, either on ucc labels or instance level ground truths, all of them were used to extract features for unsupervised clustering of individual instances.
4. U NIQUE C LASS C OUNT P REDICTION
Preceeding sections showed, in theory, that a perfect ucc classiﬁer can perform ‘weakly’ supervised clustering perfectly.
We evaluate ucc prediction accuracy of our unique class count models in accordance with our ﬁrst intermediate objective that unique class count models should predict ucc labels of unseen subsets correctly.
We randomly sampled subsets for each ucc label from the power sets of test sets and predicted the ucc labels by using trained models.
Then, we calculated the ucc prediction accuracies by using predicted and truth ucc labels, which are summarized in Table(Appendix C.3).
We observed that as the task becomes harder (from MNIST to CIFAR100), it also becomes harder to approximate the perfect ucc classiﬁer.
Moreover, UCC and UCC α =1 models, in general, have higher scores than their counterpart models of UCC 2+ and UCC 2+ α =1 , which is expected since the ucc prediction task becomes easier at the absence of pure sets and models reach to early stopping condition (Appendix C.1) more easily.
This is also supported by annother interesting, yet reasonable, observation that UCC 2+ models have higher ucc accuracies than UCC 2+ α =1 models thanks to the autoencoder branch which makes UCC 2+ harder to reach to early stopping condition.
4. L ABELS ON S ETS
Jensen-Shannon (JS) divergence (Lin, 1991) value between feature distributions of two pure sets consisting of instances of two different underlying classes is deﬁned as inter-class JS divergence in this paper and used for comparison on ‘Labels on sets’ objective of assigning labels to pure sets.
Higher values of inter-class JS divergence are desired since it means that feature distributions of pure sets of underlying classes are far apart from each other.
The features of all the instances in a particular class are extracted by using a trained model and feature distributions associated to that class obtained by performing kernel density estimation on these extracted features.
Then, for each pair of classes, inter-class JS divergence values are calculated (Appendix C.4).
For a particular model, which is used in feature extraction, the minimum of these pairwise inter-class JS divergence values is used as a metric in the comparison of models.
We have observed that as the task gets more challenging and the number of clusters increases, there is a drop in minimum inter-class JS divergence values, which is summarized in Table 1.
4. L ABELS ON I NSTANCES
For our eventual objective of ‘Labels on instances’, we have used ‘clustering accuracy’ as a comparison metric, which is calculated similar to Ghasedi Dizaji et al.
By using our trained models, we extracted features of individual instances of all classes in test sets.
Then, we performed unsupervised clustering over these features by using k-means and spectral clustering.
We used number of classes in ground truth as number of clusters (MNIST: 10, CIFAR10: 10, CIFAR100: 20 clusters) during clustering and gave the best clustering accuracy for each model in Table 1 (Appendix C.5).
In Table 1, we compare clustering accuracies of our models together with baseline and state of the art models in the literature: baseline unsupervised (K-means (Wang et al., 2015), Spectral Clustering (Zelnik-Manor & Perona, 2005)); state of the art unsupervised (JULE (Yang et al., 2016),
GMVAE (Dilokthanakul et al., 2016), DAC (Chang et al., 2017), DEPICT (Ghasedi Dizaji et al., 2017), DEC (Xie et al., 2016)) and state of the art semi-supervised (AAE (Makhzani et al., 2015),
CatGAN (Springenberg, 2015), LN (Rasmus et al., 2015), ADGM (Maaløe et al., 2016)).
Clustering performance of our unique class count models is better than the performance of unsupervised models in all datasets and comparable to performance of fully supervised learning models in MNIST and CIFAR10 datasets.
The performance gap gets larger in CIFAR100 dataset as the task becomes harder.
Although semi-supervised methods use some part of the dataset with ‘exact’ labels during training, our models perform on par with AAE and CatGAN models and comparable to LN and ADGM models on MNIST dataset.
ADGM and LN even reach to the performance of the FullySupervised model since they exploit training with ‘exact’ labeled data.
On CIFAR10 dataset, LN and CatGAN models are slightly better than our unique class count models; however, they use 10% of instances with ‘exact’ labels, which is not a small portion.
In general, our UCC and UCC α =1 models have similar performance, and they are better than their counterpart models of UCC 2+ and UCC
+ α =1 due to the absence of pure sets during training.
However, in the real world tasks, the absence of pure sets heavily depends on the nature of the problem.
In our task of semantic segmentation of breast cancer metastases in histological lymph node sections, for example, there are many pure sets.
Furthermore, we observed that there is a performance gap between UCC 2+ and UCC
+ α =1 models: UCC 2+ models perform better than UCC 2+ α =1 models thanks to the autoencoder branch.
The effect of autoencoder branch is also apparent in Figure 3, which shows clustering accuracy vs ucc accuracy curves for different datasets.
For MNIST dataset, while UCC model gives clustering accuracy values proportional to ucc accuracy, UCC α =1 model cannot reach to high clustering accuracy values until it reaches to high ucc accuracies.
The reason is that autoencoder branch in UCC helps θ feature module to extract better features during the initial phases of the training process, where the ucc classiﬁcation accuracy is low.
Compared to other datasets, this effect is more signiﬁcant in MNIST dataset since itself is clusterable.
Although autoencoder branch helps in CIFAR10 and CIFAR100 datasets as well, improvements in clustering accuracy coming from autoencoder branch seems to be limited, so two models UCC and UCC α =  follow nearly the same trend in the plots.
The reason is that CIFAR10 and CIFAR100 datasets are more complex than MNIST dataset, so autoencoder is not powerful enough to contribute to extract discrimant features, which is also conﬁrmed by the limited improvements of Autoencoder models over baseline performance in these datasets.
S EMANTIC S EGMENTATION OF B REAST C ANCER M ETASTASES
Semantic segmentation of breast cancer metastases in histological lymph node sections is a crucial step in staging of breast cancer, which is the major determinant of the treatment and prognosis (Brierley et al., 2016).
Given the images of lymph node sections, the task is to detect and locate, i.e. semantically segment out, metastases regions in the images.
We have formulated this task in our novel MIL framework such that each image is treated as a bag and corresponding ucc label is obtained based on whether the image is from fully normal or metastases region, which is labeled by ucc 1 , or from boundary region (i.e. image with both normal and metastases regions), which is labeled by ucc 2 .
We have shown that this segmentation task can be achieved by using our weakly supervised clustering framework without knowing the ground truth metastases region masks of images, which require experts to exhaustively annotate each metastases region in each image.
This annotation process is tedious, time consuming and more importantly not a part of clinical workﬂow.
We have used 512 × 512 image crops from publicly available CAMELYON dataset (Litjens et al., 2018) and constructed our bags by using 32 × 32 patches over these images.
We trained our unique class count model UCC segment on ucc labels.
Then, we used the trained model as a feature extractor and conducted unsupervised clustering over the patches of the images in the hold-out test
[Table]
K
[Table]
dataset to obtain semantic segmentation masks.
For benchmarking purposes, we have also trained a fully supervised Unet model (Ronneberger et al., 2015), which is a well-known biomedical image segmentation architecture, by using the ground truth masks and predicted the segmentation maps in the test set.
The aim of this comparison was to show that at the absence of ground truth masks, our model can approximate the performance of a fully supervised model.
Moreover, we have obtained semantic segmentation maps in the test dataset by using k-means clustering as a baseline study.
Example images from test dataset with corresponding ground truth masks, ucc labels and predicted masks by different models are shown in Figure 4.
(Please see Appendix D.1 for more details.)
Furthermore, we have calculated pixel level gross statistics of TPR (True Positive Rate), FPR (False
Positive Rate), TNR (True Negative Rate), FNR (False Negative Rate) and PA (Pixel Accuracy) over the images of hold-out test dataset and declared the mean values in Table 2 (Appendix D.2).
When we look at the performance of unsupervised baseline method of K-means clustering, it is obvious that semantic segmentation of metastases regions in lymph node sections is not an easy task.
Baseline method achieves a very low TPR value of 0.370 and almost random score of 0.
in PA.
On the other hand, both our weakly supervised model UCC segment and fully supervised model Unet outperform the baseline method.
When we compare our model UCC segment with
Unet model, we see that both models behave similarly.
They have reasonably high TPR and TNR scores, and low FPR and FNR scores.
Moreover, they have lower FPR values than FNR values, which is more favorable than vice-versa since pathologists opt to use immunohistochemistry (IHC) to conﬁrm negative cases (Bejnordi et al., 2017).
However, there is a performance gap between two models, which is mainly due to the fact that Unet model is a fully supervised model and it is trained on ground truth masks, which requires exhaustive annotations by experts.
On the contrary,
UCC segment model is trained on ucc labels and approximates to the performance of the Unet model.
ucc label is obtained based on whether the image is metastatic, non-metastatic or mixture, which is much cheaper and easier to obtain compared to exhaustive mask annotations.
Another factor affecting the performance of UCC segment model is that ucc 1 labels can sometimes be noisy.
It is possible to have some small portion of normal cells in cancer regions and vice-versa due to the nature of the cancer.
However, our UCC segment is robust to this noise and gives reasonably good results, which approximates the performance of Unet model.
C ONCLUSION
In this paper, we proposed a weakly supervised learning based clustering framework and introduce a novel MIL task as the core of this framework.
We deﬁned ucc as a bag level label in MIL setup and mathematically proved that a perfect ucc classiﬁer can be used to perfectly cluster individual instances inside the bags.
We designed a neural network based ucc classifer and experimentally showed that clustering performance of our framework with our ucc classiﬁers are better than the performance of unsupervised models and comparable to performance of fully supervised learning models.
Finally, we showed that our weakly supervised unique class count model, UCC segment , can be used for semantic segmentation of breast cancer metastases in histological lymph node sections.
We compared the performance of our model UCC segment with the performance of a Unet model and showed that our weakly supervised model approximates the performance of fully supervised
Unet model.
In the future, we want to check the performance of our UCC segment model with other medical image datasets and use it to discover new morphological patterns in cancer that had been overlooked in traditional pathology workﬂow.
A K ERNEL D ENSITY E STIMATION
Kernel density estimation is a statistical method to estimate underlying unknown probability distribution in data (Parzen, 1962).
It works based on ﬁtting kernels at sample points of an unknown distribution and adding them up to construct the estimated probability distribution.
Kernel density estimation process is illustrated in Figure 5.
A. KDE MODULE IS DIFFERENTIABLE
The distribution of the feature h jσ ζ ( v ) is obtained by applying kernel density estimation on the extracted features f j,iσ ζ as in Equation 2.
In order to be able to train our unique class count model end-to-end, we need to show that KDE module is differentiable, so that we can pass the gradients from θ drn to θ feature during back-propagation.
Derivative of h jσ ζ ( v ) with respect to input of KDE module, f j,iσ ζ , can be obtained as in Equation 3.
[Equation]
After showing that KDE module is differentiable, we can show the weight update process for θ feature module in our model.
Feature extractor module θ feature is shared by both autoencoder branch and ucc branch in our model.
During back-propagation phase of the end-to-end training process, the weight updates of θ feature comprise the gradients coming from both branches (Equation 5).
Gradients coming from autoencoder branch follow the traditional neural network back-propagation ﬂow through the convolutional and fully connected layers.
Different than that, gradients coming from ucc branch (Equation 6) also back-propagate through the custom KDE layer according to Equation 3.
[Equation]
autoencoderloss where α ∈ [0 , 1] (4)
[Equation]
B P ROOFS OF P ROPOSITIONS
Before proceeding to the formal proofs, it is helpful to emphasize the decomposability property of kernel density estimation here.
For any set, σ ζ , one could partition it into a set of M disjoint subsets σ ζ = σ (cid:48) 1 ∪ σ (cid:48) 2 ∪· · ·∪ σ (cid:48)
M where σ (cid:48) λ
∩ σ (cid:48) ψ = ∅ for λ (cid:54) =
ψ .
It is trivial to show that distribution h j σ ζ ( v ) is simply a linear combination of distributions h jσ (cid:48)
λ ( v ) , λ = 1 , 2 , · · · , M (Equation 7).
As a direct consequence, one could decompose any set into its pure subsets.
This is an important decomposition which will be used in the proofs of propositions later.
[Equation]
Now, we can proceed to formally state our propositions.
Deﬁnition
Given a subset σ ζ ⊂ X , unique class count, η σ ζ , is deﬁned as the number of unique classes that all instances in the subset σ ζ belong to, i.e. η σ ζ = |{L ( x i ) | x i ∈
σ ζ }| .
Recall that each instance belongs to an underlying unknown class.
Deﬁnition
A set σ is called a pure set if its unique class count equals one.
All pure sets are denoted by the symbol σ pure in this paper.
Proposition B. 1 For any set σ ζ ⊂ X , the unique class count η σ ζ of σ ζ does not depend on the number of instances in σ ζ belonging to a certain class.
Proof: This conclusion is obvious from the deﬁnition of unique class count in Deﬁnition 1.
Proposition B. 2 θ drn is non-linear.
Proof: We give a proof by contradiction using Proposition B.1.
Suppose θ drn is linear, then
[Equation]
Hence, θ drn is linear only when Equation 8 holds.
However, by Proposition B.1, ( θ feature , θ drn ) should count correctly regardless of the proportion of the size of the sets | σ ζ | and | σ ξ | .
Hence, Equationcannot hold true and θ drn by contradiction cannot be linear.
Proposition B. 3 Let σ ζ , σ ξ be disjoint subsets of X with predicted unique class counts ˜ η
σ ζ and ˜ η σ ξ , respectively.
Let ˜ η σ ν be the predicted unique class count of σ ν = σ ζ ∪ σ ξ .
If h σ ζ = h σ ξ , then ˜ η σ ν = ˜
η σ ζ = ˜ η σ ξ .
Proof: The distribution of set σ ν can be decomposed into distribution of subsets,
[Equation]
ξ where w ζ + w ξ =(9)
[Equation]
Hence, ˜ η σ ν = ˜
η σ ζ = ˜ η σ ξ .
Proposition 1 Let σ ζ , σ ξ be disjoint subsets of X with predicted unique class counts ˜ η
σ ζ = ˜ η σ ξ = 1 .
If the predicted unique class count of σ ν = σ ζ ∪ σ ξ is ˜ η σ ν = 2 , then h σ ζ (cid:54) = h σ ξ .
Proof: Proof of this proposition follows immediately from the contra-positive of Proposition B.3.
Deﬁnition
A perfect unique class count classiﬁer takes in any set σ and output the correct predicted unique class count ˜ η σ = η σ .
Proposition 2 Given a perfect unique class count classiﬁer.
The dataset X can be perfectly clustered into K subsets σ pureξ , ξ = 1 , 2 , · · · , K , such that X = (cid:83)
Kξ =
σ pureξ and σ pureξ = { x i | x i ∈
X , L ( x i ) = ξ } .
Proof: First note that this proposition holds because the “perfect unique class count classiﬁer” is a very strong condition.
Decompose X into subsets with single instance and then apply the unique class count on each subset, by deﬁnition, unique class counts of all subsets are one.
Randomly pair up the subsets and merge them if their union still yield unique class count of one.
Recursively apply merging on this condition until no subsets can be merged.
Proposition 3 Given a perfect unique class count classiﬁer.
Decompose the dataset X into K subsets σ pureξ , ξ = 1 , · · · K , such that σ pureξ = { x i | x i ∈ X , L ( x i ) = ξ } .
Then, h σ pureξ (cid:54) =
h σ pureζ for ξ (cid:54) = ζ .
Proof: Since in Proposition 1, the subsets are arbitrary, it holds for any two subsets with unique class count of one.
By pairing up all combinations, one arrives at this proposition.
Note that for a perfect unique class count classiﬁer, η = ˜
η .
C D ETAILS ON E XPERIMENTS WITH MNIST AND CIFAR D ATASETS C. D ETAILS OF M ODEL A RCHITECTURES
Feature extractor module θ feature has convolutional blocks similar to the wide residual blocks in Zagoruyko & Komodakis (2016).
However, the parameters of architectures, number of convolutional and fully connected layers, number of ﬁlters in convolutional layers, number of nodes in fully-connected layers, number of bins and σ value in KDE module, were decided based on models’ performance and training times.
While increasing number of convolutional layers or ﬁlters were not improving performance of the models substantialy, they were putting a heavy computation burden.
For determining the architecture of θ drn , we checked the performances of different number of fully connected layers.
As the number of layers increased, the ucc classiﬁcation performance of the models increased.
However, we want θ feature to be powerful, so we stopped to increase number of layers as soon as we got good results.
For KDE module, we have tried parameters of 11 bins, 21 bins, σ = 0 .
1 and σ = 0 .
Best results were obtained with 11 bins and σ = 0 . 1 .
Similarly, we have tested different number of features at the output of θ feature module and we decided to use 10 features for MNIST and CIFAR10 datasets and 16 features for CIFAR100 dataset based on the clustering performance and computation burden.
During training, loss value of validation sets was observed as early stopping criteria.
Training of the models was stopped if the validation loss didn’t drop for some certain amount of training iterations.
For the ﬁnal set of hyperparameters and details of architectures, please see the code for our experiments: http://bit.ly/uniqueclasscount
C. D ETAILS OF D ATASETS
We trained and tested our models on MNIST, CIFAR10 and CIFAR100 datasets.
While MNIST and
CIFAR10 datasets have 10 classes, CIFAR100 dataset has 20 classes.
For MNIST, we randomly splitted 10,000 images from training set as validation set, so we had 50,000, 10,000 and 10, images in our training X mnist,tr , validation X mnist,val and test sets X mnist,test , respectively.
In CIFAR10 dataset, there are 50,000 and 10,000 images with equal number of instances from each class in training and testing sets, respectively.
Similar to MNIST dataset, we randomly splitted 10, images from the training set as validation set.
Hence, we had 40,000, 10,000 and 10,000 images in our training X cifar 10 ,tr , validation X cifar 10 ,val and testing X cifar 10 ,test sets for CIFAR10, respectively.
In CIFAR100 dataset, there are 50,000 and 10,000 images with equal number of instances from each class in training and testing sets, respectively.
Similar to other datasets, we randomly splitted 10,000 images from the training set as validation set.
Hence, we had 40,000, 10,000 and 10,000 images in our training X cifar 100 ,tr , validation X cifar 100 ,val and testing X cifar 100 ,test sets for CIFAR10, respectively.
FullySupervised models took individual instances as inputs and were trained on instance level ground truths.
X mnist,tr , X cifar 10 ,tr and X cifar 100 ,tr were used for training of FullySupervised models.
Unique class count models took sets of instances as inputs and were trained on ucc labels.
Inputs to unique class count models were sampled from the power sets of MNIST, CIFAR10 and
CIFAR100 datasets, i.e. 2 X mnist,tr , 2 X cifar 10 ,tr and 2 X cifar 100 ,tr .
For MNIST and CIFAR10 datasets, the subsets (bags) with 32 instances and for CIFAR100 dataset, the subsets (bags) with 128 instances are used in our experiments.
While UCC and UCC α =1 models are trained on ucc 1 to ucc 4 labels,
UCC 2+ and UCC 2+ α =1 models are trained on ucc 2 to ucc 4 labels.
Our models were trained on ucc labels up to ucc 4 instead of ucc 10 ( ucc 20 in CIFAR100) since the performance was almost the same for both cases in our experiment with MNIST dataset, results of which are shown in Table 3.
On the other hand, training with ucc 1 to ucc 4 was much faster than ucc 1 to ucc 10 because as the ucc label gets larger, the number of instances in a bag is required to be larger in order to represent each class and number of elements in powerset also grows exponentially.
Please note that for perfect clustering of instances, it is enough to have a perfect ucc classiﬁer that can discriminate ucc 1 and ucc 2 from Proposition 2.
All the results presented in this paper were obtained on hold-out test sets X mnist,test , X cifar 10 ,test and X cifar 100 ,test .
[Table]
[Figure]
[Figure]
C ONFUSION M ATRICES FOR ucc P REDICTIONS
We randomly sampled subsets for each ucc label from the power sets of test sets and predicted the ucc labels by using trained models.
Then, we calculated the ucc prediction accuracies by using predicted and truth ucc labels, which are summarized in Table 1.
Here, we show confusion matrices of our UCC and UCC 2+ models on MNIST, CIFAR10 and CIFAR100 datasets as examples in
Figure 6, 7 and 8, respectively.
[Figure]
[Figure] [Figure]
C. F EATURE D ISTRIBUTIONS AND I NTER - CLASS JS D IVERGENCE M ATRICES
The features of all the instances in a particular class are extracted by using a trained model and feature distributions associated to that class obtained by performing kernel density estimation on these extracted features.
Then, for each pair of classes, inter-class JS divergence values are calculated.
We show inter-class JS divergence matrices for our FullySupervised and UCC models on
MNIST test dataset in Figure 9.
We also show the underlying distributions for FullySupervised and UCC models in Figure 10 and 11, respectively.
[Figure]
F i gu r e 10 :
D i s t
r
i bu ti on s o f e x t r ac t
e
d f ea t u r e s by ou r
F u ll y S
u p e
r
v i s e d m od e l on
M N I
S T t e s t d a t a s e t .
E ac h c
o l u m n c o rr e s pond s t o a f ea t u r e l ea r n e d by m od e l a nd eac h r o w c
o rr e s pond s t o a n und e r l y
i ng c l a ss i n t h e t e s t d a t a s e t .
F i gu r e 11 :
D i s t
r
i bu ti on s o f e x t r ac t
e
d f ea t u r e s b y ou r
U
CC m od e l on
M N I
S T t e s t d a t a s e t .
E ac h c
o l u m n c o rr e s pond s t o a f ea t u r e l ea r n e d by m od e l a nd eac h r o w c
o rr e s pond s t o a n und e r l y
i ng c l a ss i n t h e t e s t d a t a s e t .
C. K- MEANS AND S PECTRAL C LUSTERING A CCURACIES OF O UR M ODELS
We performed unsupervised clustering by using k-means and spectral clustering and gave the best clustering accuracy for each model on each dataset in Table 1 in the main text.
Here, we present all the clustering accuracies for our models in Table
[Table] [Table]
C. UCC M ODELS WITH A VERAGING L AYER AND KDE L AYER
KDE layer is chosen as MIL pooling layer in UCC model because of its four main properties, ﬁrst three of which are essential for the proper operation of proposed framework and validity of the propositions in the paper:
KDE layer is permutation-invariant, i.e. the output of KDE layer does not depend on the permutation of its inputs, which is important for the stability of θ drn module.
KDE layer is differentiable, so UCC model can be trained end-to-end.
KDE layer has decomposability property which enables our theoretical analysis (Appendix B).
KDE layer enables θ drn to fully utilize the information in the shape of the distribution rather than looking at point estimates of distribution.
Averaging layer (Wang et al., 2018) as an MIL pooling layer, which also has the ﬁrst three properties, can be an alternative to KDE layer in UCC model.
We have conducted additional experiments by replacing KDE layer with ’averaging layer’ and compare the clustering accuracy values of the models with averaging layer and the models with KDE layer in Table
[Table]
[Table]
D D ETAILS ON S EMANTIC S EGMENTATION T ASK D. D ETAILS OF M ODEL AND D ATASET
Our model UCC segment has the same architecture with the UCC model in CIFAR10 dataset, but this time we have used 16 features.
We have also constructed the Unet model with the same blocks used in UCC segment model in order to ensure a fair comparison.
The details of the models can be seen in our code: http://bit.ly/uniqueclasscount
We have used 512 × 512 image crops from publicly available CAMELYON dataset (Litjens et al., 2018).
CAMELYON dataset is a public Whole Slide Image (WSI) dataset of histological lymph node sections.
It also provides the exhaustive annotations for metastases regions inside the slides which enables us to train fully supervised models for benchmarking of our weakly supervised unique class count model .
We randomly crop 512 × 512 images over the WSIs of CAMELYON dataset and associate a ucc label to each image based on whether it is fully metastases/normal ( ucc 1 ) or mixture ( ucc 2 ).
We assigned ucc labels based on provided ground truths since they are readily available.
However, please note that in case no annotations provided, obtaining ucc labels is much cheaper and easier compared to tedious and time consuming exhaustive metastases region annotations.
We assigned ucc 1 label to an image if the metastases region in the corresponding ground truth mask is either less than 20% (i.e. normal) or more than 80% (i.e metastases).
On the other hand, we assigned ucc 2 label to an image if the metastases region in the corresponding ground truth mask is more than 30% and less than 70% (i.e. mixture).
Actually, this labeling scheme imitates the noise that would have been introduced if ucc labeling had been done directly by the user instead of using ground truth masks.
Beyond that, ucc 1 labels in this task can naturally be noisy since it is possible to have some small portion of normal cells in cancer regions and
vice-versa due to the nature of the cancer.
In this way, we have constructed our segmentation dataset consisting of training, validation and testing sets.
The images in training and validation sets are cropped randomly over the WSIs in training set of CAMELYON dataset and the images in testing set are cropped randomly over the test set of CAMELYON dataset.
Then, the bags in our MIL dataset to train UCC segment model are constructed by using 32 ×patches over these images.
Each bag contains 32 instances, where each instance is a 32 × 32 patch.
The details of our segmentation dataset are shown in Table 6.
We have provided the segmentation dataset under “./data/camelyon/” folder inside our code folder.
If you want to use this dataset for benchmarking purposes please cite our paper (referenced later) together with the original CAMELYON dataset paper of Litjens et al.
[Table]
We have given confusion matrix for ucc predictions of our UCC segment model in Figure 12.
For
Unet model, we have shown loss curves of traininig and validation sets during training in Figure 13.
D. D EFINITIONS OF E VEALUTION M ETRICS
In this section, we have deﬁned our pixel level evaluation metrics used for performance comparison of our weakly supervised UCC segment model, fully supervised Unet model and unsupervised baseline K − means model.
Table 7 shows the structure of pixel level confusion matrix together with basic statistical terms.
Then, our pixel level evaluation metrics TPR (True Positive Rate), FPR (False
Positive Rate), TNR (True Negative Rate), FNR (False Negative Rate) and PA (Pixel Accuracy) are deﬁned in Equation 11, 12, 13, 14 and 15, respectively.
[Table]
[Equation]
TP
[Equation]
[Equation]