Pitfalls of Conditional Batch Normalization for Contextual Multi-Modal Learning
Abstract
Humans have perfected the art of learning from multiple modalities through sensory organs.
Despite their impressive predictive performance on a single modality, neural networks cannot reach human level accuracy with respect to multiple modalities.
This is a particularly challenging task due to variations in the structure of respective modalities.
Conditional Batch Normalization (CBN) is a popular method that was proposed to learn contextual features to aid deep learning tasks.
This technique uses auxiliary data to improve representational power by learning affine transformations for convolutional neural networks.
Despite the boost in performance observed by using CBN layers, our work reveals that the visual features learned by introducing auxiliary data via CBN deteriorates.
We perform comprehensive experiments to evaluate the brittleness of CBN networks to various datasets, suggesting that learning from visual features alone could often be superior for generalization.
We evaluate CBN models on natural images for bird classification and histology images for cancer type classification.
We observe that the CBN network learns close to no visual features on the bird classification dataset and partial visual features on the histology dataset.
Our extensive experiments reveal that CBN may encourage shortcut learning between the auxiliary data and labels.
Introduction
Learning about complex relationships between real-world variables has been the key to progression of human kind [12].
While some of these relationships are now intuitive to us, some are more complex mathematical relationships.
With advancement of deep learning in the field of computer vision [14], natural language processing [30] and speech recognition [2], learning complex relationships across modalities is still an open research question.
Most of the current state-of-the-art algorithms, learn from single modality [8, 23] which might limit the representation learnt by the model.
Processing data from multiple modalities can provide richer context to the respective modality[32].
For examples, video action recognition [5, 10, 28] can be benefited by learning from the audio along with the visual features[29].
Such factors motivate context-based learning , where auxiliary features are used to enhance the primary feature representation.
To learn such contextual information, designing of methods that can learn from each individual modality along with their fusion is critical but a challenging task.
In computer vision, Conditional Batch Normalization (CBN) based models that perform feature-wise affine transformations have shown to achieve strong visual reasoning[22].
CBN[7] relies on modulating the visual feature stream with auxiliary features in the intermediary layers of a CNN.
The normalized activations produced by auxiliary network has been considered as a popular method to compute contextual information.
Recent works have shown unreliability of batch normalization during distributional shifts, adversarial attacks and dependency on the dataset[15, 11].
Lack of robustness of BN poses an immediate challenge for its conditional version, CBN.
With adoption of CBN in various applications[1, 4, 22], it is important to study the quality of visual features learnt in presence of auxiliary data.
In this work, we empirically and visually show that while CBN network which learns auxiliary data may surpass the performance of standard Batch Normalization(BN) network, they often fail to learn visual features altogether or partially.
We devise a set of experiments to perform surgery into the
CBN network.
We observe that the CBN network is brittle to the type and quality of the contextual information and fails to generalize realistic scenarios by learning shortcuts.
Background
Since the introduction of Batch Normalization[16], they have become an integral part of CNNs for faster convergence.
The intermediary convolutional layers stabilise the variation of activations by normalising the input, x i characterised by the following equation:
[Equation]
Batch normalization introduces learnable parameters, β i and γ i for each normalised layer L Ni :
[Equation]
Conditional batch normalization[7], aims to learn the learnable parameters from meta-data to "ground" visual features.
It directly predicts affine scaling parameter of the affine transformation from meta-data.
A shallow multi-layer perceptron, we call it auxiliary network, allows the meta-data to predict the β ′ and γ ′ that shifts and scales the normalised batch features.
Formally, for meta-data a i and auxiliary network for H and O respectively for affine parameter prediction, H ( a i ) =
β ′
and O ( a i )
=
γ ′ .
[Equation]
These updated ˆ β i and ˆ γ i are used as parameters for batch normalization.
Modulation of a neural network activations using conditional information through CBN has been proven successful in multimodal setting [22].
While CBN is a computationally efficient method to fuse different modalities, the robustness of this affine layer is unexplored.
The addition of β ′ and γ ′ , might seemingly be small yet showing a boost in performance of the task, we observe that it degrades in the quality of visual features learnt.
Related Works
Batch normalization[16] layers were introduced to alleviate the problem of internal covariate shift, also leading to faster model convergence.
However, [26] have argued that BN might not alleviate the internal covariate shift.
Recent studies [6, 34] have shown standard BN training is detrimental to performance in domain shift task.
CBN layer was introduced to provide contextual information through affine transformation.
[22] uses CBN layer to modulate visual features to answer compositional questions on CLEVR dataset[17].
Conditional Instance Normalization [9] was introduced in the context of style transfer.
In reinforcement learning, [3] used CBN layer to condition NMN and LSTM to follow compositionality in a 2D grid world.
In generative modeling, [4, 35] uses condition biasing through image description.
[21] used CBN layer to make input distribution features robust to variations in few shot setting.
While CBN has proved it efficacy through its acceptance in different applications but a thorough analysis of its potency is yet to be learnt[20].
We make the first attempt to uncover the potential risk of using CBN via a series of experiments.
Experiments
CBN is widely used for various applications such as multi-modal language acoustic learning[1], metalearning[24, 36] and image generation[4].
Due to its varied applications, we design our methodology for a supervised image classification task with visual and auxiliary features allowing for an easier surgery of the neural network.
The aim of these experiments is to expose the potential pitfalls and impacts of fusing meta-data with images using CBN.
4.1 Experimental Setup
We design our experiments to answer some fundamental questions posed by fusing of differently structured auxiliary data via CBN.
We design a small experiment for each question posed although the major question, we aim to ask is - Does the addition of auxiliary data improve visual feature representation?
CBN training - Baseline
In this setting, auxiliary data is passed as the input to the shallow auxiliary network that predicts the affine CBN parameters.
This baseline experiment is mainly performed to establish effectiveness of CBN for classification.
Effect on CBN in absence of test-time auxiliary data The additional features passing through auxiliary network and its fusion with spatial features[22] has been reported to improve accuracy across tasks.
We aim to look at the neural network beyond final predictive accuracy with this experiment.
In medical applications, the meta-data collection differs across hospitals, and often among different medical practitioners.
We simulate this scenario by masking the attributes at test-time.
Due to masking, the auxiliary network is switched off and the network only relies on its own affine transformation parameters.
By reducing the dependence of network on auxiliary data, it is easier to establish its independence from visual features during test-time.
We eventually completely switch off the auxiliary data stream and notice the difference in reliance of this auxiliary stream versus the spatial stream.
Effect on CBN with masked train-time auxiliary data While in previous experiment, we attempted to establish the independence of the visual stream, in this experiment, we aim to understand the quality of visual features learnt in absence of meta-data.
We mask the attributes randomly to aid the network to learn and utilize visual features more.
During masking, we essentially pass a flag that prevents the addition of H ( a i ) and O ( a i ) to ˆ β i and ˆ γ i respectively.
Introduction of Supplementary network We hypothesize that the presence of auxiliary data challenges the learning of visual features.
Therefore we introduce a supplementary network to ground and assist with the optimization of CBN network to learn visual features.
The supplementary network has same network architecture as the CBN network but uses standard batch normalization.
We optimize a loss consists of: cross-entropy loss of the CBN network, and distance between CBN network and supplementary network distribution.
More formally, let F represent the CBN network that maps input x
i to its label y
i using subsidiary features, a i and G represent the BN network that maps input x i to its label y
i .
Let the cross entropy loss of CBN network be represented by L CBN .
We define the total sum as follows:
[Equation]
where m is a hyperparameter.
It is important to note that the aim of supplementary network is to simply assist in optimization and grounding the CBN network, therefore the weighting over the distance between supplementary and CBN network is very small.
Removing data from the CBN network Datasets such as CUB-200-211[31] and Animals with
Attributes[33] 2, which are popular in few-shot classification problem, have attributes which are highly correlated with the images and label.
We use these datasets to better study the learning capability of visual features in isolation from auxiliary data.
4.2 Dataset
We use natural images and medical images to test the effectiveness of CBN using our proposed training loss.
We use [31] dataset for the task of bird identification.
It contains 11,788 images taken from 200 different species of bird.
Every image of the dataset contains 312 binary and continuous concept labels.
This dataset has been widely used in Few-Shot Classification and Conditional Image
Generation, making it suitable for our analysis.
The auxiliary data comes from the attributes.
In our experiments we use binary attributes.
For medical images, Whole Slide Pathology images were used.
The tumor-infiltrating lymphocytes (TILs) [25] contains histological mappings based on each type of cancer.
We use all 13 subsets of
TCGA dataset, therefore constituting 13 cancer types.
Although the popular task for such a dataset is necrosis classification [19] but since it is a binary classification task and is prone to overfitting without truly emphasising the effectiveness of our analysis, we modify the task to be a classification of different (here, thirteen) tumor types.
The advantage of medical images is that their meta-data is readily available from diagnosis.
A doctor uses whole slide images along with the meta-data for diagnostics indicating importance of fusion of different modalities.
The meta-data includes information such as origin of tumor, age, gender, and size of tumor cells.
4.3 Results and Analysis
In this section we evaluate the performance of networks that perform affine transformations using
CBN and standard Batch Normalization.
Due to BN’s sensitivity to the batch size [18], we perform all our experiments on batch size of 64.
We perform our experiments on ResNet-18 [13] backbone.
For CBN network, we modify the ResNet-18 architecture to replace batch normalization layers with CBN layers.
The auxiliary network that uses auxiliary data is a two layer MLP network to predict the affine parameters for CBN networks.
The experiments in this paper were carried out using the V100SXM2 GPU.
The results reported are averaged over 10 runs.
Table 1 summarises the results on test set and we breakdown the analysis according to the set of different experiments below.
CBN Baseline We train both CBN network and BN network to perform classification on the CUB and TIL dataset.
In principle we expect the CBN network to learn from the spatial feature along with the features learnt from the other auxiliary modality.
This suggests that, ideally, the representative power of this baseline model is greater than the representation from the standard vision only model.
One may suspect that this should in turn lead to better generalization.
From, Figure1 we observe that the validation accuracy of the CBN model is greater than the BN model by a great margin of 6 . 9% in CUB and over 10% in TIL dataset.
This proves the effectiveness of modulating visual features by the auxiliary data.
We interestingly also notice that the CBN network achieves convergence much faster than the BN network.
Although convergence is a desired property, it is worrisome if the network converges in just 4 epochs achieving 100% accuracy in the case of CUB dataset!
Although, the same is not observed in TIL dataset, suggesting the difference in dataset and/or auxiliary data type.
This particularly motivates the upcoming experiments to make an attempt at uncovering the black-box of conditional learning from auxiliary information stream.
Models with CBN layer perform better
Dependence of CBN on test-time auxiliary data In a realistic scenario, due to data privacy and differences in data acquisition, meta-data collected for each patient maybe varied.
If we were to leverage the CBN model in such a setting, it is likely that some of the auxiliary information is missing.
To test this we limit the auxiliary information during validation and test-time in increments from 0 to 1 (full CBN network) of 10% supplementary data.
From {+Figure
+} we observe that in the case of CUB, with less than 20% of auxiliary data, the network performs as well as in the presence of all of the auxiliary data.
While in the case of TIL dataset, there is a sharp increase in the accuracy with greater fraction of meta-data.
We hypothesize that this is due to the difference in structure and diversity of meta-data.
Naturally histopathology data is very diverse suggestive of its difficulty in learning.
In addition it must be noted that in complete absence of auxiliary information during testing time, the CBN network has very low accuracy, 0 .
5% in the case of CUB and 22 .
3% for TIL.
This is suggestive of the network not learning visual feature in the case of CUB dataset.
While, simultaneously the
CBN network does achieve greater than random accuracy in TIL dataset, its performance deteriorates highly in absence of the meta-data.
Masking of train-time auxiliary data From Figure 3, the dependence of accuracy on the auxiliary features is apparent.
We therefore attempt to establish the relationship between model’s performance and the auxiliary data during training phase.
In this experiment, we incrementally increase the fraction of auxiliary data fed in to the CBN model.
With no auxiliary data at train-time, the network behaves similar to a BN model since auxiliary affine predictions are turned off, where as with all of the meta-data at train-time, the network behaves and performs similar to the baseline CBN model.
In Figure 3, we observe the general trend of achieving higher accuracy in presence of higher auxiliary data, although in the experiment with CUB dataset, the model converges much earlier with TIL data.
Intuitively Figure 3 also signifies the inverse change in dependency of visual feature representation with increase in auxiliary data.
It is observed that, with affine parameter prediction switches on, the neural network attempts to use the auxiliary data for label prediction.
Introduction of supplementary network We hypothesized that supplementary network may help to ground and bring the CBN network closer to BN network, implying learning of visual features.
Hyperparamaters m equals 0 .
We observe that the hypothesis is proven incorrect and supplementary network is not able to reduce the dependence of auxiliary data on CBN network.
In Figure6 we observe that the accuracy curves for both CUB and TIL datasets are very similar to CBN curve, although more stable.
Due to ineffectiveness of the supplementary network on baseline experiment, we perform all our experiments with CBN network.
[Figure]
Removing spatial data Table 1 present that even in the absence of image data, the network is able to perform as well as the baseline CBN network for CUB dataset.
This is highly suggestive of presence of shortcuts in data and the visual features not contributing to the CBN model’s predictive performance.
On the contrary, CBN network on the TIL dataset learns some feature in absence of visual features, therefore indicating partial learning of vision features.
Discussion From an exhaustive set of experiments, we observe that although the attenuating the affine batch normalization parameter via a second modality leads is higher predictive performance as compared to standard batch normalization training of vision modality, it leads to deterioration of visual features.
In the case of both TIL and CUB, there is an increased dependency on the auxiliary data.
This suggests that the affine parameters of CBN network allow for a shortcut learning of auxiliary data leading to poor generalization.
Visually we compare the features learnt by CBN network with all attributes, CBN network with no attributes and BN network for both CUB and TIL dataset.
We observe that the features learnt in each of the cases are very different signifying the potential difference in their respective minima.
It is particularly interesting to note that in the absence of visual features in CUB, the network has random predictive performance signified by 4b.
We observe that the visual features presented in 4a is less explanatory of the bird features as compared to 4b.
[Figure]
Ablation study - Continuous vs Discrete attributes in CUB
The CUB dataset contains continuous attribute values between 0 and 1.
We threshold the values greater than 50 to 1 and rest to 0 .
Although in the case of continuous attributes, we observe from Figure 7 that the neural network converges within 2 epochs which suggests that the continuous attributes leads to memorization, highly undesirable for generalization.
Therefore we use binary attributes in all of our experiments.
Conclusion
In this work, we explored the efficacy of Conditional Batch Normalization to fuse an auxiliary network with a vision only model.
We observe that the CBN network motivates learning of highly undesirable shortcuts learning between the auxiliary data and the label.
This leads to a boost in performance but a drop in visual features.
We observed that the effectiveness of CBN is dependent on the dataset.
We hope that this work inspires research in the direction of learning generalizable visual features while conditioning in presence of differently structured modality.
Acknowledgements
Authors would like to thank Vincent Michalski for fruitful discussions.
We would like to thank the
Digital Research Alliance of Canada for compute resources, Google and CIFAR for research funding.
IS acknowledges funding from Mitacs and Imagia Canexia Health.
AAR acknowledges funding from
FRQS.
Appendix Training Model
[Table]