{'fraction_non_alphanumeric': 0.036515346640910065, 'fraction_numerical': 0.010248980467911568, 'mean_word_length': 4.699235474006116, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Uncertainty based Class Activation Maps for Visual Question Answering

Understanding and explaining deep learning models is an imperative task. Towards this, we propose a method that obtains gradient-based certainty estimates that also provide visual attention maps. Particularly, we solve for visual question answering task. We incorporate modern probabilistic deep learning methods that we further improve by using the gradients for these estimates. These have two-fold benefits: a) improvement in obtaining the certainty estimates that correlate better with misclassified samples and b) improved attention maps that provide state-of-the-art results in terms of correlation with human attention regions. The improved attention maps result in consistent improvement for various methods for visual question answering. Therefore, the proposed technique can be thought of as a recipe for obtaining improved certainty estimates and explanations for deep learning models. We provide detailed empirical analysis for the visual question answering task on all standard benchmarks and comparison with state of the art methods.


I. INTRODUCTION
To interpret and explain the deep learning models, many approaches have been proposed. One of the approaches uses probabilistic techniques to obtain uncertainty estimates, [1], [2]. Other approaches aim at obtaining visual explanations through methods such as Grad-CAM [3] or by attending to specific regions using hard/soft attention. With the recent probabilistic deep learning techniques by Gal and Ghahramani [1], it became feasible to obtain uncertainty estimates in a computationally efficient manner. This was further extended to data uncertainty and model uncertainty based estimates [4]. Through this work, we focus on using gradients uncertainty losses to improve attention maps while also enhancing the explainability leveraging the Bayesian nature of our approach. The uncertainties that we use are aleatoric and predictive [5]. For the estimated uncertainties, we calculate gradients using the approach similar to gradient-based class activation maps [3]. This provides "certainty maps" which helps in attending to certain regions of the attention maps. Doing this, we report an improvement in attention maps. This is illustrated in the Figure 1.
Our method combines techniques from both the explanation [3] and uncertainty [4] estimation techniques to obtain improved results. We have provided an extensive evaluation. We show that the results obtained for uncertainty estimates show a strong correlation with misclassification, i.e., when the classifier is wrong, the model is usually uncertain. Further, the  [6]) and our models (A-GCA and P-GCA). In the first example, the baseline model had predicted the wrong answer and had high uncertainty in prediction. (σu denotes uncertainty, see Section III). Our model gave a correct answer while also minimizing the uncertainty (thus leading to an improved visual explanation). attention maps provide state of the art correlation with humanannotated attention maps. We also show that on various VQA datasets, our model provides results comparable to the state of the art while significantly improving the performance of baseline methods on which we incorporated our approach. Our method may be seen as a generic way to obtain Bayesian uncertainty estimates, visual explanation, and as a result, improved accuracy for Visual Question Answering (VQA) task.
Our contributions, lie in, a) unifying approaches for understanding deep learning methods using uncertainty estimate and explanation b) obtaining visual attention maps that correlate best with human annotated attention regions and c) showing that the improved attention maps result in consistent improvement in results. This is particularly suited for vision and language-based tasks where we are interested in understanding visual grounding, i.e., for instance, if the answer for a question is 'dog' (Corresponding question: 'Who is on the boat?'), it is important to understand whether the model is certain and whether it is focusing on the correct regions containing a dog. This important requirement is met by the proposed approach.

II. RELATED WORK
The task of Visual question answering [7], [8], [9], [10], [11] is well studied in the vision and language community, but it has been relatively less explored for providing explanation [3] arXiv:2002.10309v1 [cs.CV] 23 Jan 2020 for answer prediction. Recently, lot of works that focus on explanation models, one of that is image captioning for basic explanation of an image [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22]. [23] has proposed an exemplarbased explanation method for generating question based on the image. Similarly, [24] has suggested a discriminator based method to obtain an explanation for paraphrase generation in text. In VQA, [25] [26] have proposed interesting methods for improving attention in the question. Work that explores image and question jointly and is based on hierarchical coattention is [27]. [28], [29], [30], [31] have proposed attention-based methods for the explanation in VQA, which use question to attend over specific regions in an image. [6], [32], [33] have suggested exciting works that advocate multimodal pooling and obtain close to state of the art results in VQA. [31] has proposed an exemplar-based explanation method to improve attention in VQA. We can do systematic comparison of image-based attention while correlating with human annotated attention maps as shown by [34].
Recently a lot of researchers have focused on estimating uncertainty in the predictions using deep learning. [35] has proposed a method to learn uncertainty in the weights of the neural network. Kendall et.al. [36] has proposed method to measure model uncertainty for image segmentation task. They observed that the softmax probability function approximates relative probability between the class labels, but does not provide information about the model's uncertainty. The work by [1], [37] estimates model uncertainty of the deep neural networks (CNNs, RNNs) with the help of dropout [38]. [39] has estimated uncertainty for batch normalized deep networks. [4], [5], [40] have mainly decomposed predictive uncertainty into two major types, namely aleatoric and epistemic uncertainty, which capture uncertainty present in the data and uncertainty about in model respectively. [41] suggested a method to measure predictive uncertainty with the help of model and data uncertainty. Recently, [42] proposed a certainty method to bring two data distributions close for the domain adaption task.
In our previous work [43], our objective is to analyze and minimize the uncertainty in attention masks to predict answers in VQA. To accomplish this, we are proposing gradient-based certainty explanation masks, which minimize the uncertainty in attention regions for improving the correct answer's predicted probability in VQA. Our method also provides a visual explanation based on uncertainty class activation maps, capturing and visualizing the uncertainties present in the attention maps in VQA. We extend our work [43] to generalise uncertainty based class activation map for the VQA system. We start with a simple VQA model without attention, and then we compare with our Gradient based Certainty Attention mask (GCA) method in section-V. We also have analysed the role of data uncertainty in a multimodal setting in section-VI. We conduct an experiment to analyse both epistemic and aleatoric uncertainty in section-VII-B2 and section-VII-B3. In section-VII-B5, we perform Statistical Significance Analysis for variants of our model. Finally, we provide more qualitative results and visualise the attention mask of our model using Monte Carlo Simulation in section-VII-C and our project

III. MODELING UNCERTAINTY
We consider two types of uncertainties to model the uncertainty present in the network, one due to uncertainty present in the data (Aleatoric), and the other due to the model (Epistemic uncertainty).

A. Modeling Aleatoric Uncertainty
Given an input x i the model (G) predicts the logit outputŷ i which is then an input to uncertainty network (U ) for obtaining the variance σ 2 i as shown in Figure-2. To capture Aleatoric uncertainty [4], we learn the observational noise parameter σ i for each input point x i . Then, Aleatoric uncertainty, (σ 2 a ) i is estimated by applying softplus function on the output logit variance. This is given by, For calculating the aleotoric uncertainty loss, we perturb the logit value (y i ) with Gaussian noise of variance (σ 2 a ) i (diagonal matrix with one element corrosponding to each logits value) before the softmax layer. The logits reparameterization trick [5] and [44] combinesŷ i,c and σ i to give N (ŷ i,c , σ 2 i ). We then obtain a loss with respect to ground truth. It is expressed as:ŷ where L a is the aleatoric uncertainty loss (AUL), T is the number of Monte Carlo simulations. c is a class index of the logit vector y i,t , which is defined for all the classes.

B. Modeling Predictive Uncertainty
To obtain the model uncertainty, we measure epistemic uncertainty. However, estimating epistemic uncertainty [41] is computationally expensive, and thus we measure the predictive uncertainty, having both aleatoric and epistemic uncertainties present in it. To estimate it, we sample weights in the Bayesian networks G and then perform Monte Carlo simulations over the model to obtain the predicted class probabilities p(y i,t ).
That is, where c is the answer class, G t ∼ G, U t ∼ U and v a i,t is the aleatoric variance of each logit in the tth MC Simulation. The entropy of the sampled logit's probabilities can be calculated as: The predictive uncertainty contains entropy and aleatoric variance when it's expectation is taken across T number of Monte Carlo simulations: where H(ŷ i ) is the entropy of the probability p(ŷ i ), which depends on the spread of class probabilities while the variance (second term in the above equation) captures both the spread and the magnitude of logit outputs,ŷ i,t . In Equation 2, we can replace σ 2 a with predictive uncertainty σ 2 p (mentioned above in Equation 5) to get the predictive uncertainty loss (PUL).

IV. METHOD
Task: We solve for VQA task. The key difference in our architecture as compared to the existing VQA models is the introduction of gradient-based certainty maps. A detailed figure of the model is given in Figure 3. We keep other aspects of the VQA model unchanged.
In a typical open-ended VQA task, we have a multi-class classification task. A combined (image and question) input embedding is fed to the model. Then, the output logits are fed to a softmax function, giving probabilities of the predictions in the multiple-choice answer space. That is,Â = argmax A∈Ω P (A|I, Q, θ), where Ω is a set of all possible answers, I is the image, Q is the corresponding question, and θ is representing the parameters of the network.

A. U-CAM Approach
The three main parts of our method are Attention Representation, Uncertainties Estimation, and computing gradients of uncertainty losses. In the following sections, we explain them in detail.
1) Attention Representation: We obtain an embedding, g i ∈ R u×v×C where u is width, v is the height of the image, and C represents the number of applied filters on the image X i in the convolution neural network (CNN). The CNN is parameterized by a function G i (X i , θ i ), where θ i represents the weights. Similarly, for the query question X Q , we obtain a question feature embedding g q using a LSTM network. This network is parameterized by a function G q (X q , θ q ), where θ q represents the weights. Both g i and g q are fed to an attention network that combines the image and question embeddings using a weighted softmax function and produces a weighted output attention vector, g f , as illustrated in Figure 3. People have tried with various kinds of attention networks. In this paper, we tried with SAN [29] and MCB [6]. Finally, we obtain attention feature f i using attention extractor network The attended feature f i is passed through a classifier, and the model is trained using the crossentropy loss. Many times, the model is not certain about the answer class to which the input belongs, which sometimes leads to a decrease in accuracy. To tackle this, we have proposed a technique to reduce class uncertainty by increasing the certainty of the attention mask. Additionally, we also incorporate a loss based on the uncertainty which is described next.
2) Estimating Uncertainties: Aleatoric & Predictive: The attention feature, f i obtained from the previous step is fed to the classifier G c . The output of the classifier is fed to G y , which produces class probabilities, y i . G c 's output is also fed to a variance predictor network, G v , which outputs the logits' variance, σ i as mentioned in the Equation 1. For calculating the aleatoric uncertainty loss, we perturb the logit value (y i ) with Gaussian noise of variance (σ 2 a ) i before the softmax layer. The Gaussian likelihood for classification is given by where w represents model's parameters, τ is the precision, f i is the attended fused input, and G y (G c (.)) is the output logit producing network as shown in the Figure 3 . The above setting represents the perturbation of model output with the variance of the observed noise, τ −1 . We make sure that τ (.) is a positive or positive definite matrix (in case of Multivariate) by using the logit reparameterization trick [5] and [44]. Finally, we then obtain an aleatoric loss, L a with respect to ground truth as mentioned in the Equation 3. Our proposed model, which uses this loss as one of the components of its uncertainty loss, is called Aleatoric-GCA (A-GCA). Along with aleatoric loss L a , we combine L V E and L U DL as mentioned in the Equation 10 and 11 respectively to get total uncertainty loss L u . The classifier is trained by jointly minimizing both the classification loss, L y , and the uncertainty loss, L u . In Equation 2, we can replace σ 2 a with predictive uncertainty σ 2 p (mentioned above in Equation 5) to get the predictive uncertainty loss(PUL). Accordingly, the model which uses this loss as one of the constituents of its uncertainty loss is called Predictive-GCA (P-GCA). Next, we compute the gradients of standard classification loss and uncertainty loss with respect to the attended image feature, f i . Besides training, we also use these gradients to obtain visualizations describing important regions responsible for answer prediction, as mentioned in the qualitative analysis section. (Section VII-C) 3) Gradient Certainty Explanation for Attention: Uncertainty present in the attention maps often leads to uncertainty in the predictions and can be attributed to the noise in data and the uncertainty present in the model itself. We improve the certainty in these cases by adding the certainty gradients to the existing Standard Cross-Entropy (SCE) loss gradients for training the model during backpropagation.
Our objective is to improve the model's attention in the regions where the classifier is more certain. The classifier will perform better by focusing more on certain attention regions, as those regions are more suited for the classification task. We can get an explanation for the classifier output as done in the existing Grad-CAM approach ( ∂Ly ∂fi ). But that explanation does not take the model and data uncertainties into the account. We improve this explanation using the certainty gradients (− ∂Lu ∂fi ). If we can minimize uncertainty in the VQA explanation, then uncertainties in the image and question features, and thus uncertainties in the attention regions, would be subsequently reduced. It is the uncertain regions which are a primary source for errors in the prediction, as shown in Figure 1.
In our proposed method, we compute the gradient of the Standard Classification (cross entropy) loss L y with respect to attention feature i.e. ∂Ly ∂fi and and also the gradient of Input: Image X I , Question X Q
The positive sign of gradient ∇ y indicates that the attention certainty is activated on these regions and vice-versa.
We apply a ReLU activation function on the product of gradients of the attention map and the gradients of certainty as we are only interested in attention regions that have a positive influence on interested answer class, i.e., attention regions whose intensity should be increased in order to increase answer class probability y c , whereas negative values are multiplied by γ (large negative number) as the negative attention regions are likely to belong to other categories in image. As expected, without this ReLU, localization maps sometimes highlight more than just the desired class and achieve lower localization performance. Then we normalize ∇ y to get attention regions that are highly activated and giving more weight to certain regions.
Images with higher uncertainty are equivalent to having lower certainty, so the certain regions of these images should have lower attention values. We use residual gradient connection to obtain the final gradient, which is the sum of gradient mask of L y (with respect to attention feature) and the gradient certainty mask ∇ y and is given by: Where ∂Ly ∂fi is the gradient mask of L y when gradients are taken with respect to attention feature. More details are given in the Algorithm 1.

B. Cost Function
We estimate aleatoric uncertainty in logits space by perturbing each logit using the variance obtained from data. The uncertainty present in the logits value can be minimized using cross-entropy loss on Gaussian distorted logits, as shown in the Equation 3. The distorted logit is obtained using a Gaussian multivariate function, having positive diagonal variance. To stabilize the training process [44], we add an additional term to the uncertainty loss, calling it Variance Equalizer(VE) loss, where σ 0 is a constant. The uncertainty distorted loss (UDL) is the difference between the typical cross-entropy loss and the aleatoric/predictive loss estimated in the Equation 3. The scalar difference is passed to an activation function to enhance the difference in either direction and is given by : By putting this constraint, we ensure that the predictive uncertainty loss does not deviate much from the actual cross-entropy loss. The total uncertainty loss is the combination of Aleatoric (or prediction uncertainty loss), Uncertainty Distorted Loss, and Variance equalizer loss.
The final cost function for the network combines the loss obtained through uncertainty (aleatoric or predictive) loss L u for the attention network with the cross-entropy. The cost function used for obtaining the parameters θ f of the attention network, θ c of the classification network, θ y of the prediction network and θ u for uncertainty network is as follows: where n is the number of examples, and η is the hyperparameter which is fine-tuned using validation set, L y is standard cross-entropy loss and L u is the uncertainty loss. We train the model with this cost function until it converges so that the parameters. (θ f ,θ c ,θ y ,θ u ) deliver a saddle point function (θ f ,θ c ,θ y ,θ u ) = arg max θ f ,θc,θy,θu For the first two rows, baseline predicts wrong answers, and it is confusing (the lesser difference between probabilities of Top 2 predicted classes). In the third example, it (our model) correctly predicts the answer, but its output difference of probability between the top two classes is also very high when compared to the baseline model.
V. GENERALISATION OF UNCERTAINTY-CAM FOR VQA SYSTEM We observe that uncertainty in the answer prediction is too high when we have noise in the input data or the model. For example, in the baseline model if you add slight noise in either the input image or question, the baseline VQA model predicts wrong output, that is the answer may change from "Napkin" to "Paper" or "Wii" to "Tennis" as shown in the figure-4. We minimise uncertainty in the answer prediction using the Gradient certainty method as mentioned in section-IV-A and obtain result as shown in the right side of figure-4. As can be observed, the predictions for our model are not only correct, and they are also more robust with the second (wrong) answer having far lesser scores. In table-I, we start with a simple VQA model (LSTM Q+I) [8], in which we obtain image feature using a pretrained CNN model (VGG-16) and a question feature using standard LSTM network. We then use a fused network to bring these two embedding features close to each other and predict the answer. The second method we tried was with a stacked attention network (SAN) [29]. We train our VQA model using uncertainty loss, and we observe that there is an increase in accuracy in VQA. We further improve our model accuracy and attention map using the Gradient certainty based attention map mechanism. The results are shown in the last row of the table-I. So in this work, we thoroughly analyse uncertainty-CAM with attention and without attention for VQA models. The observations that we can draw from our analysis are as follows: a) A  baseline VQA model (without attention) improves marginally (0.4%) by incorporating uncertainty minimization loss. b) The improvement on a VQA model with attention (SAN) by using uncertainty is more significant (0.8%). c) Jointly considering attention and uncertainty through our proposed model on a stacked attention network (SAN) model results in further improvement. The resulting improvement is 1.7%. This analysis suggests that using uncertainty results in a consistent marginal improvement. This is more once we have an attention module. However, using joint attention and uncertainty results in the most improvement in the results. Moreover, through this approach, our interpretability of the model also improves further as the resultant attention map is more appropriate.

VI. DATA UNCERTAINTY IN A MULTI-MODAL SETTING
Uncertainty in the VQA task is two-fold. Consider the example shown in the figure 5. In the example, the question is, "Which kind of animal is it?". When this question is asked (irrespective of image), it may not be concretely answered. Also, seeing the image alone, in the given setting, the animal (especially the one behind) could easily be misclassified as a dog or some other animal. Specifically, when we attend on the image alone, we observe that the attention is only on the animal behind that could be confused with a dog, unlike the animal in the front. These kinds of data uncertainties are tapped & hence minimized best when we consider uncertainties of the fused input (image+question). We tried with minimizing uncertainties of image and question inputs alone. Minimizing the uncertainties in the combined image-question embedding helps in ensuring that more certain regions (and hence better attention maps) are attended to. In Figure 5, we show the resultant attention maps of baseline (when not minimizing uncertainty) & when we tried to minimize onlyimage, only-question & the combined uncertainty, respectively. The architectures used for obtaining these inputs are provided in figure figure-6. The architecture that considers the fused image and question input utilizes all the information and is, therefore, able to obtain the attention map, as shown in the example in figure 5. We can conclude that by considering both image and question as an input to the VQA model, we get better in certainty map and corresponding attention map as compared to the only image or only question as an input.

VII. EXPERIMENTS
We evaluate the proposed GCA methods and have provided both quantitative analysis and qualitative analysis. The former includes: i) Ablation analysis of proposed models (Section-VII-B1), ii) Analysis of uncertainty effect on answer predictions ( Figure-7 (a,b)), iii) Differences of Top-2 softmax scores for answers for some representative questions ( Figure-7 (c,d)) and iv) Comparison of attention map of our proposed uncertainty model against other variants using Rank correlation (RC) and Earth Mover Distance (EMD) [45] as shown in Table-IV for VQA-HAT [34] and in Table-III for VQA-X [46] . Finally, we compare PGCA with state of the art methods, as mentioned in Section-VII-D. The qualitative analysis includes visualization of certainty activation maps for some representative images as we move from our basic model to the P-GCA model. (Section VII-C)

A. Datasets
VQA-v1 [8]: We conduct our experiments on VQA benchmark VQA-v1 [8] dataset, which contains human-annotated questions and answers based on images on MS-COCO dataset. This dataset includes 2,04,721 images in total, out of which 82,783 images are for training, 40,504 images for validation, and 81,434 images for testing. Each image is associated with three questions, and each question has ten possible answers.  VQA-X [46]: We compare our explanation map with human-annotated visual explanation maps provided in VQA-X [46] dataset. We calculate the rank correlation to compare the ground truth explanation map with our explanation, which is present in the main paper in table-2. VQA-X dataset contains 29459 question-answer pairs for the training set, 1459 pairs from validation set, and 1968 for the test set. A humanannotated visual explanation is provided for VQA-v2 only.

B. Ablation Analysis
We do both quantitative and qualitative analysis. The quantitative analysis includes i) Ablation Analysis for Uncertainty Loss, as shown in section VII-B1. ii) Ablation Analysis for     Table-VIII and IX.)  [34] 0.623 -score respectively. Further, we plotted Predictive uncertainty ( Figure-7(a,b)) of some randomly chosen samples against the Classification error (error=log 1 1−p , where p is the probability of misclassification). As seen, when the samples are correct, they are also certain and have less Classification Error (CE). To visualize the direct effect of decreased uncertainty, we plotted ( Figure-7(c,  d)). It can be seen that how similar classes, like (glasses, sunglasses) and (black, gray), etc., thus leading to uncertainty, got separated more in the logit space in the proposed model. Table-VIII and -IX shows list of the questions and its corresponding id's is present in the figure-5.
2) Analysis of Epistemic Uncertainty : We measure the uncertainty(entropy) in terms of mean and variance for all the answer prediction in the validation dataset. We also measure uncertainty for an individual question in the dataset. Here, we split our training data into three parts. In the first part, the model is trained with 50% of the training data. In the second part, the model is trained with 75% of training data, and in the third part, the model is trained with the full dataset as shown in the second block of the table-V. It is observed that the model

Type of Uncertainty
Variance uncertainty(epistemic uncertainty) decreases as training data increases.
3) Analysis of Aleatoric Uncertainty : We analyze the contribution of each term in the uncertainty loss to estimate data uncertainty, as shown in the first block of the table V. From measurements, it can be seen that comparing aleatoric uncertainty of an image with the epistemic uncertainty of another image doesn't make sense because of the significant difference in their values. However, both the uncertainties can be individually compared with the corresponding uncertainties of other images. We capture predictive uncertainty by combining aleatoric uncertainty with the entropy of the prediction (epistemic uncertainty), as mentioned in equation 5 of this paper. Finally, we provide a variation of aleatoric uncertainty and uncertainty distorted loss over a number of epochs, as shown in figure-10.

4) Analysis of Attention Maps:
We compare attention maps produced by our proposed GCA model, and it's variants with the base model and reports them in Table-IV. Rank correlation and EMD scores are calculated for the produced attention map against human-annotated attention (HAT) maps [34]. In the table, as we approach the best-proposed GCA model, Rank correlation (RC) is increasing. EMD is also decreasing (Lower the better) as we move towards GCA. To verify our intuition, that we can learn better attention masks by minimizing the uncertainty present in the attention mask; we start with VE and observe that both rank correlation and answer accuracy increase by 0.42 and 0.3 % from baseline, respectively. We also observe that with UDL, AUL, and PUL based loss minimization technique, both RC and EMD improves, as shown in the Table-IV. Aleatoric-GCA (A-GCA) improves 5.21% in terms of RC and 2.5% in terms of accuracy. Finally, the proposed Predictive-GCA (P-GCA), which is modeled to consider both data and the model uncertainty, improves the RC by 5.51% and accuracy by 2.7% as shown in the Table-IV and  Table-II. Since HAT maps are only available for the VQA-v1 dataset, thus, this ablation analysis has been performed only for VQA-v1. We also providing SOTA results for VQA-v1 and VQA-v2 dataset as shown in Table-VII and Table-VI respectively. Also, we compare with our gradient certainty explanation with human explanation present in the VQA-v2 dataset for the various model, as mentioned in Table-III. This human explanation mask only available for the VQA-v2 dataset. We observe that our attention (P-GCA) mask performs better than others as well.

5) Statistical Significance Analysis: We analyze Statistical
Significance [47] of our GCA model against the variants mentioned in section-5.2 of our method as well as other methods for certainty activation map. The Critical Difference (CD) for Nemenyi [48] test depends on given α (confidence level, which is 0.05 in our case) on average ranks and N (number of tested datasets). The low difference in the ranks for two models implies that they are significantly less different. Otherwise, they are statistically different. Figure 12 visualizes the post hoc analysis using the CD diagram. It is clear that P-GCA works best and is significantly different from other methods.

C. Qualitative Result
We provide attention map visualization of all models for 5 example images, as shown in Figure-8. The first raw, the baseline model misclassifies the answer due to high uncertainty value, that gets resolved by our methods(P-GCA). We can see how attention is improved as we go from our baseline model (MCB) to the proposed Gradient Certainty model (P-GCA). For example, in the first row, MCB is unable to focus on any specific portion of the image, but as we go towards the right, it focuses the cup bottom (indicated by intense orange color in the map). The same can be seen for other images also. We have visualized Grad-CAM maps to support our hypothesis that Grad-CAM is a very good way for visualizing what the network learns as it can focus on the right portions of the image even in the baseline model (MCB), and therefore, can be used as a tutor to improve attention maps. For example, in MCB, it tries to focus on the right portions but with the focus to other points as well. However, in our proposed model, visualization improves as the models focus only on the required portion. More examples for visualization of certainty activation maps for image samples as we move from our baseline model to the P-GCA model in figure-9. We visualise the resulting attention maps of different samples of a particular image-question pair as shown in figure- ( 13,14,15,17,16). The Monte Carlo Simulation was done here, which is refer to Equation 4 of this paper. From these figures, we observe that the uncertainty is low when certainty map point to the right answer and vice versa.

D. Comparison with baseline and state-of-the-art
We obtain the initial comparison with the baselines on the rank correlation on human attention (HAT) dataset [34] that provides human attention while solving for VQA. Between humans, the rank correlation is 62.3%. The comparison of various state-of-the-art methods and baselines are provided in Table IV. We use a variant of MCB [6] model as our baseline method. We obtain an improvement of around 5.2% using the A-GCA model and 5.51% using the P-GCA model in terms of rank correlation with human attention. From this, we justify that our attention map is more similar to the  What color is the road? 9 What color is the boy's hair? 10 human attention map. We also compare with the baselines on the answer accuracy on the VQA-v1 [8] dataset, as shown in Table-VII. We obtain an improvement of around 2.7% over the comparable MCB baseline. Our MCB based model A-GCA and P-GCA improves by 0.9% and 1.1% accuracy as compared to state of the art model DVQA [31] on VQA-v1. However, using a saliency-based method [53] that is trained on eye-tracking data to obtain a measure of where people look in a task-independent manner, results in more correlation with human attention (0.49), as noted by [34]. However, this is explicitly trained using human attention and is not taskdependent. In our approach, we aim to obtain a method that can simulate human cognitive abilities for solving the tasks. We provide state of the art results for VQA-v2 in Table-VI. This table shows that using the GCA method, the VQA result improves. We have provided more results for attention map visualization for both types of uncertainty, training setup, dataset, and evaluation methods here. 2 . Fig. 9. (e stands for Entropy, v stands for aleatoric uncertainty) The first column indicates the given target image and its question and answer. Starting from the second column, it indicates the activation map for baseline (MCB) Attention Network, Aleatoric (AUL), Predictive (PUL), A-GCA, and P-GCA based approach respectively. We observe that both uncertainties decrease as we move from baseline to P-GCA. Also, we observed that uncertainty was high when it predicted incorrectly.   E. Training and Evaluation 1) Model Configuration : We trained the P-GCA model using classification loss and uncertainty loss in an end-toend manner. We have used ADAM optimizer to update the classification model parameter and configured hyper-parameter values using validation dataset as follows: {learning rate = 2) Evaluation Methods : Our evaluation is based on answer accuracy for VQA dataset and rank correlation for HAT dataset. Accuracy: VQA dataset has 3 type of answers: yes/no, number and other. The evaluation is carried out using two test splits, i.e test-dev and test-standard. The question in corresponding test split are of two types: Open-Ended and Multiple-choice. Our model generates a single word answer on the open ended task. For each question there are 10 candidate answer provided with their respective confidence level. This answer can then be evaluated using accuracy metric defined as follows: This answer can be evaluated using accuracy metric provide by Antol et al. [8] as follows.
Where a i the predicted answer and t is the annotated answer 3 annotators agree on the predicted answer. If the predicted answer is not correct, then the accuracy score depends on the evaluate [34] the correlation between human attention map and DAN attention probability. Here we scale down the human attention map to 14x14 in order to make the same size as DAN attention probability. We then compute the rank correlation, as mentioned in [31]. Rank correlation technique is used to obtain the degree of association between the data. The value of rank correlation [54] lies between +1 to -1. When R Cor is close to 1, it indicates a positive correlation between them, When R Cor is close to -1, it indicates a negative correlation between them, and when R Cor is close to 0, it indicates No correlation between them. A higher value of rank correlation is better.
3) Attention Map Visualisation : The size of attention maps is 14 × 14, and the size of the preprocessed image from COCO-QA is 448 × 448. To visualize the attention, we need to make attention probability distribution the same size as given COCO-QA Image. To do this, we first scale the attention probability distribution to 448 × 448 using bi-cubic interpolation and then convolve it with a Gaussian filter of size 31 × 31 with mean 0 and variance 1 to obtain final attention mask. We multiply or mask the obtained attention mask on the original image.

VIII. CONCLUSION
In this paper, we provide a method that uses gradientbased certainty attention regions to obtain improved visual question answering. The proposed method yields improved uncertainty estimates that are correspondingly more certain or uncertain, show consistent correlation with misclassification, and are focused quantitatively on better attention regions as compared to other states of the art methods. The proposed architecture can be easily incorporated in various existing VQA methods, as we show by incorporating the method in SAN [29] and MCB [6] models. The proposed technique could be used as a general means for obtaining improved uncertainty and explanation regions for various vision and language tasks, and in the future, we aim to evaluate this further for other tasks such as 'Visual Dialog' and image captioning tasks.