DPPnet: Image Question Answering using Convolutional Neural Network with Dynamic Parameter Prediction
We tackle image question answering (ImageQA) problem by learning a convolutional neural network (CNN) with a dynamic parameter layer whose weights are determined adaptively based on questions. For the adaptive parameter prediction, we employ a separate parameter prediction network, which consists of gated recurrent unit (GRU) taking a question as its input and a fully-connected layer generating a set of candidate weights as its output. However, it is challenging to construct a parameter prediction network for a large number of parameters in the fully-connected dynamic parameter layer of the CNN. We reduce the complexity of this problem by incorporating a hashing technique, where the candidate weights given by the parameter prediction network are selected using a predefined hash function to determine individual weights in the dynamic parameter layer. The proposed network---joint network with the CNN for ImageQA and the parameter prediction network---is trained end-to-end through back-propagation, where its weights are initialized using a pre-trained CNN and GRU. The proposed algorithm illustrates the state-of-the-art performance on all available public ImageQA benchmarks.READ FULL TEXT VIEW PDF
In this paper, we propose to employ the convolutional neural network (CN...
In this work we describe a Convolutional Neural Network (CNN) to accurat...
The design, analysis and application of a volumetric convolutional neura...
We present a skin condition classification methodology based on a sequen...
In this paper we consider the problem of continuously discovering image
In this paper, we aim to provide elements to contribute to the discussio...
Syndrome differentiation in Traditional Chinese Medicine (TCM) is the pr...
DPPnet: Image Question Answering using Convolutional Neural Network with Dynamic Parameter Prediction
Image question answering (ImageQA) [1, 17, 23] aims to solve the holistic scene understanding problem by proposing a task unifying various recognition problems. ImageQA is a task automatically answering the questions about an input image as illustrated in Figure 1. The critical challenge of this problem is that different questions require different types and levels of understanding of an image to find correct answers. For example, to answer the question like “how is the weather?” we need to perform classification on multiple choices related to weather, while we should decide between yes and no for the question like “is this picture taken during the day?” For this reason, not only the performance on a single recognition task but also the capability to select a proper task is important to solve ImageQA problem.
ImageQA problem has a short history in computer vision and machine learning community, but there already exist several approaches[10, 16, 17, 18, 23]
. Among these methods, simple deep learning based approaches that perform classification on a combination of features extracted from image and question currently demonstrate the state-of-the-art accuracy on public benchmarks[23, 16]; these approaches extract image features using a convolutional neural network (CNN), and use CNN or bag-of-words to obtain feature descriptors from question. They can be interpreted as a method that the answer is given by the co-occurrence of a particular combination of features extracted from an image and a question.
Contrary to the existing approaches, we define a different recognition task depending on a question. To realize this idea, we propose a deep CNN with a dynamic parameter layer whose weights are determined adaptively based on questions. We claim that a single deep CNN architecture can take care of various tasks by allowing adaptive weight assignment in the dynamic parameter layer. For the adaptive parameter prediction, we employ a parameter prediction network, which consists of gated recurrent units (GRU) taking a question as its input and a fully-connected layer generating a set of candidate weights for the dynamic parameter layer. The entire network including the CNN for ImageQA and the parameter prediction network is trained end-to-end through back-propagation, where its weights are initialized using pre-trained CNN and GRU. Our main contributions in this work are summarized below:
We successfully adopt a deep CNN with a dynamic parameter layer for ImageQA, which is a fully-connected layer whose parameters are determined dynamically based on a given question.
To predict a large number of weights in the dynamic parameter layer effectively and efficiently, we apply hashing trick , which reduces the number of parameters significantly with little impact on network capacity.
We fine-tune GRU pre-trained on a large-scale text corpus  to improve generalization performance of our network. Pre-training GRU on a large corpus is natural way to deal with a small number of training data, but no one has attempted it yet to our knowledge.
This is the first work to report the results on all currently available benchmark datasets such as DAQUAR, COCO-QA and VQA. Our algorithm achieves the state-of-the-art performance on all the three datasets.
The rest of this paper is organized as follows. We first review related work in Section 2. Section 3 and 4 describe the overview of our algorithm and the architecture of our network, respectively. We discuss the detailed procedure to train the proposed network in Section 5. Experimental results are demonstrated in Section 6.
propose a Bayesian framework, which exploits recent advances in computer vision and natural language processing. Specifically, it employs semantic image segmentation and symbolic question reasoning to solve ImageQA problem. However, this method depends on a pre-defined set of predicates, which makes it difficult to represent complex models required to understand input images.
Deep learning based approaches demonstrate competitive performances in ImageQA [18, 10, 23, 16, 1]. Most approaches based on deep learning commonly use CNNs to extract features from image while they use different strategies to handle question sentences. Some algorithms employ embedding of joint features based on image and question [1, 10, 18]
. However, learning a softmax classifier on the simple joint features—concatenation of CNN-based image features and continuous bag-of-words representation of a question—performs better than LSTM-based embedding on COCO-QA dataset. Another line of research is to utilize CNNs for feature extraction from both image and question and combine the two features ; this approach demonstrates impressive performance enhancement on DAQUAR  dataset by allowing fine-tuning the whole parameters.
The prediction of the weight parameters in deep neural networks has been explored in 
in the context of zero-shot learning. To perform classification of unseen classes, it trains a multi-layer perceptron to predict a binary classifier for class-specific description in text. However, this method is not directly applicable to ImageQA since finding solutions based on the combination of question and answer is a more complex problem than the one discussed in, and ImageQA involves a significantly larger set of candidate answers, which requires much more parameters than the binary classification case. Recently, a parameter reduction technique based on a hashing trick is proposed by Chen et al.  to fit a large neural network in a limited memory budget. However, applying this technique to the dynamic prediction of parameters in deep neural networks is not attempted yet to our knowledge.
We briefly describe the motivation and formulation of our approach in this section.
Although ImageQA requires different types and levels of image understanding, existing approaches [1, 10, 18] pose the problem as a flat classification task. However, we believe that it is difficult to solve ImageQA using a single deep neural network with fixed parameters. In many CNN-based recognition problems, it is well-known to fine-tune a few layers for the adaptation to new tasks. In addition, some networks are designed to solve two or more tasks jointly by constructing multiple branches connected to a common CNN architecture. In this work, we hope to solve the heterogeneous recognition tasks using a single CNN by adapting the weights in the dynamic parameter layer. Since the task is defined by the question in ImageQA, the weights in the layer are determined depending on the question sentence. In addition, a hashing trick is employed to predict a large number of weights in the dynamic parameter layer and avoid parameter explosion.
typically construct a joint feature vector based on two inputsand and solve a classification problem for ImageQA using the following equation:
where is a set of all possible answers and is a vector for the parameters in the network. On the contrary, we use the question to predict weights in the classifier and solve the problem. We find the solution by
where and denote static and dynamic parameters, respectively. Note that the values of are determined by the question .
illustrates the overall architecture of the proposed algorithm. The network is composed of two sub-networks: classification network and parameter prediction network. The classification network is a CNN. One of the fully-connected layers in the CNN is the dynamic parameter layer, and the weights in the layer are determined adaptively by the parameter prediction network. The parameter prediction network has GRU cells and a fully-connected layer. It takes a question as its input, and generates a real-valued vector, which corresponds to candidate weights for the dynamic parameter layer in the classification network. Given an image and a question, our algorithm estimates the weights in the dynamic parameter layer through hashing with the candidate weights obtained from the parameter prediction network. Then, it feeds the input image to the classification network to obtain the final answer. More details of the proposed network are discussed in the following subsections.
The classification network is constructed based on VGG 16-layer net 
, which is pre-trained on ImageNet
. We remove the last layer in the network and attach three fully-connected layers. The second last fully-connected layer of the network is the dynamic parameter layer whose weights are determined by the parameter prediction network, and the last fully-connected layer is the classification layer whose output dimensionality is equal to the number of possible answers. The probability for each answer is computed by applying a softmax function to the output vector of the final layer.
We put the dynamic parameter layer in the second last fully-connected layer instead of the classification layer because it involves the smallest number of parameters. As the number of parameters in the classification layer increases in proportion to the number of possible answers, predicting the weights for the classification layer may not be a good option to general ImageQA problems in terms of scalability. Our choice for the dynamic parameter layer can be interpreted as follows. By fixing the classification layer while adapting the immediately preceding layer, we obtain the task-independent semantic embedding of all possible answers and use the representation of an input embedded in the answer space to solve an ImageQA problem. Therefore, the relationships of the answers globally learned from all recognition tasks can help solve new ones involving unseen classes, especially in multiple choice questions. For example, when not the exact ground-truth word (e.g., kitten) but similar words (e.g., cat and kitty) are shown at training time, the network can still predict the close answers (e.g
., kitten) based on the globally learned answer embedding. Even though we could also exploit the benefit of answer embedding based on the relations among answers to define a loss function, we leave it as our future work.
As mentioned earlier, our classification network has a dynamic parameter layer. That is, for an input vector of the dynamic parameter layer , its output vector denoted by is given by
where denotes a bias and denotes the matrix constructed dynamically using the parameter prediction network given the input question. In other words, the weight matrix corresponding to the layer is parametrized by a function of the input question .
The parameter prediction network is composed of GRU cells  followed by a fully-connected layer, which produces the candidate weights to be used for the construction of weight matrix in the dynamic parameter layer within the classification network. GRU, which is similar to LSTM, is designed to model dependency in multiple time scales. As illustrated in Figure 3, such dependency is captured by adaptively updating its hidden states with gate units. However, contrary to LSTM, which maintains a separate memory cell explicitly, GRU directly updates its hidden states with a reset gate and an update gate. The detailed procedure of the update is described below.
Let be the words in a question , where is the number of words in the question. In each time step , given the embedded vector for a word , the GRU encoder updates its hidden state at time , denoted by , using the following equations:
where and respectively denote the reset and update gates at time , and is candidate activation at time . In addition, indicates element-wise multiplication operator and
is a sigmoid function. Note that the coefficient matrices related to GRU such as, , , , , and are learned by our training algorithm. By applying this encoder to a question sentence through a series of GRU cells, we obtain the final embedding vector of the question sentence.
Once the question embedding is obtained by GRU, the candidate weight vector, , is given by applying a fully-connected layer to the embedded question as
where is the output of the parameter prediction network, and is the weight matrix of the fully-connected layer in the parameter prediction network. Note that even though we employ GRU for a parameter prediction network since the pre-trained network for sentence embedding—skip-thought vector model —is based on GRU, any form of neural networks, e.g., fully-connected and convolutional neural network, can be used to construct the parameter prediction network.
The weights in the dynamic parameter layers are determined based on the learned model in the parameter prediction network given a question. The most straightforward approach to obtain the weights is to generate the whole matrix using the parameter prediction network. However, the size of the matrix is very large, and the network may be overfitted easily given the limited number of training examples. In addition, since we need quadratically more parameters between GRU and the fully-connected layer in the parameter prediction network to increase the dimensionality of its output, it is not desirable to predict full weight matrix using the network. Therefore, it is preferable to construct based on a small number of candidate weights using a hashing trick.
We employ the recently proposed random weight sharing technique based on hashing  to construct the weights in the dynamic parameter layer. Specifically, a single parameter in the candidate weight vector is shared by multiple elements of , which is done by applying a predefined hash function that converts the 2D location in to the 1D index in . By this simple hashing trick, we can reduce the number of parameters in while maintaining the accuracy of the network .
Let be the element at in , which corresponds to the weight between output and
input neuron. Denote bya hash function mapping a key to a natural number in , where is the dimensionality of . The final hash function is given by
where is another hash function independent of . This function is useful to remove the bias of hashed inner product . In our implementation of the hash function, we adopt an open-source implementation of xxHash111https://code.google.com/p/xxhash/.
We believe that it is reasonable to reduce the number of free parameters based on the hashing technique as there are many redundant parameters in deep neural networks  and the network can be parametrized using a smaller set of candidate weights. Instead of training a huge number of parameters without any constraint, it would be advantageous practically to allow multiple elements in the weight matrix to share the same value. It is also demonstrated that the number of free parameter can be reduced substantially with little loss of network performance .
This section discusses the error back-propagation algorithm in the proposed network and introduces the techniques adopted to enhance performance of the network.
The proposed network is trained end-to-end to minimize the error between the ground-truths and the estimated answers. The error is back-propagated by chain rule through both the classification network and the parameter prediction network and they are jointly trained by a first-order optimization method.
Let denote the loss function. The partial derivatives of with respect to the element in the input and output of the dynamic parameter layer are given respectively by
The two derivatives have the following relation:
Likewise, the derivative with respect to the assigned weights in the dynamic parameter layer is given by
As a single output value of the parameter prediction network is shared by multiple connections in the dynamic parameter layer, the derivatives with respect to all shared weights need to be accumulated to compute the derivative with respect to an element in the output of the parameter prediction network as follows:
where denotes the indicator function. The gradients of all the preceding layers in the classification and parameter prediction networks are computed by the standard back-propagation algorithm.
Although encoders based on recurrent neural networks (RNNs) such as LSTM and GRU  demonstrate impressive performance on sentence embedding [19, 25], their benefits in the ImageQA task are marginal in comparison to bag-of-words model . One of the reasons for this fact is the lack of language data in ImageQA dataset. Contrary to the tasks that have large-scale training corpora, even the largest ImageQA dataset contains relatively small amount of language data; for example,  contains 750K questions in total. Note that the model in  is trained using a corpus with more than 12M sentences.
To deal with the deficiency of linguistic information in ImageQA problem, we transfer the information acquired from a large language corpus by fine-tuning the pre-trained embedding network. We initialize the GRU with the skip-thought vector model trained on a book-collection corpus containing more than 74M sentences . Note that the GRU of the skip-thought vector model is trained in an unsupervised manner by predicting the surrounding sentences from the embedded sentences. As this task requires to understand context, the pre-trained model produces a generic sentence embedding, which is difficult to be trained with a limited number of training examples. By fine-tuning our GRU initialized with a generic sentence embedding model for ImageQA, we obtain the representations for questions that are generalized better.
It is very common to transfer CNNs for new tasks in classification problems, but it is not trivial to fine-tune the CNN in our problem. We observe that the gradients below the dynamic parameter layer in the CNN are noisy since the weights are predicted by the parameter prediction network. Hence, a straightforward approach to fine-tune the CNN typically fails to improve performance, and we employ a slightly different technique for CNN fine-tuning to sidestep the observed problem. We update the parameters of the network using new datasets except the part transferred from VGG 16-layer net at the beginning, and start to update the weights in the subnetwork if the validation accuracy is saturated.
Before training, question sentences are normalized to lower cases and preprocessed by a simple tokenization technique as in . We normalize the answers to lower cases and regard a whole answer in a single or multiple words as a separate class.
The network is trained end-to-end by back-propagation. Adam  is used for optimization with initial learning rate 0.01. We clip the gradient to 0.1 to handle the gradient explosion from the recurrent structure of GRU 
. Training is terminated when there is no progress on validation accuracy for 5 epochs.
Optimizing the dynamic parameter layer is not straightforward since the distribution of the outputs in the dynamic parameter layer is likely to change significantly in each batch. Therefore, we apply batch-normalization to the output activations of the layer to alleviate this problem. In addition, we observe that GRU tends to converge fast and overfit data easily if training continues without any restriction. We stop fine-tuning GRU when the network start to overfit and continue to train the other parts of the network; this strategy improves performance in practice.
We now describe the details of our implementation and evaluate the proposed method in various aspects.
We evaluate the proposed network on all public ImageQA benchmark datasets such as DAQUAR , COCO-QA  and VQA . They collected question-answer pairs from existing image datasets and most of the answers are single words or short phrases.
DAQUAR is based on NYUDv2  dataset, which is originally designed for indoor segmentation using RGBD images. DAQUAR provides two benchmarks, which are distinguished by the number of classes and the amount of data; DAQUAR-all consists of 6,795 and 5,673 questions for training and testing respectively, and includes 894 categories in answer. DAQUAR-reduced includes only 37 answer categories for 3,876 training and 297 testing questions. Some questions in this dataset are associated with a set of multiple answers instead of a single one.
The questions in COCO-QA are automatically generated from the image descriptions in MS COCO dataset  using the constituency parser with simple question-answer generation rules. The questions in this dataset are typically long and explicitly classified into 4 types depending on the generation rules: object questions, number questions, color questions and location questions. All answers are with one-words and there are 78,736 questions for training and 38,948 questions for testing.
Similar to COCO-QA, VQA is also constructed on MS COCO  but each question is associated with multiple answers annotated by different people. This dataset contains the largest number of questions: 248,349 for training, 121,512 for validation, and 244,302 for testing, where the testing data is splited into test-dev, test-standard, test-challenge and test-reserve as in . Each question is provided with 10 answers to take the consensus of annotators into account. About 90% of answers have single words and 98% of answers do not exceed three words.
DAQUAR and COCO-QA employ both classification accuracy and its relaxed version based on word similarity, WUPS . It uses thresholded Wu-Palmer similarity  based on WordNet  taxonomy to compute the similarity between words. For predicted answer set and ground-truth answer set of the example, WUPS is given by
where denotes the thresholded Wu-Palmer similarity between prediction and ground-truth. We use two threshold values ( and ) in our evaluation.
VQA dataset provides open-ended task and multiple-choice task for evaluation. For open-ended task, the answer can be any word or phrase while an answer should be chosen out of 18 candidate answers in the multiple-choice task. In both cases, answers are evaluated by accuracy reflecting human consensus. For predicted answer and target answer set of the example, the accuracy is given by
where denotes an indicator function. In other words, a predicted answer is regarded as a correct one if at least three annotators agree, and the score depends on the number of agreements if the predicted answer is not correct.
We test three independent datasets, VQA, COCO-QA, and DAQUAR, and first present the results for VQA dataset in Table 1. The proposed Dynamic Parameter Prediction network (DPPnet) outperforms all existing methods nontrivially. We performed controlled experiments to analyze the contribution of individual components in the proposed algorithm—dynamic parameter prediction, use of pre-trained GRU and CNN fine-tuning, and trained 3 additional models, CONCAT, RAND-GRU, and CNN-FIXED. CNN-FIXED is useful to see the impact of CNN fine-tuning since it is identical to DPPnet except that the weights in CNN are fixed. RAND-GRU is the model without GRU pre-training, where the weights of GRU and word embedding model are initialized randomly. It does not fine-tune CNN either. CONCAT is the most basic model, which predicts answers using the two fully-connected layers for a combination of CNN and GRU features. Obviously, it does not employ any of new components such as parameter prediction, pre-trained GRU and CNN fine-tuning.
|LSTM Q ||48.76||78.20||35.68||26.59||54.75||78.22||36.82||38.78|
|LSTM Q+I ||53.74||78.94||35.24||36.42||57.17||78.95||35.80||43.41|
|LSTM Q+I ||54.06||-||-||-||-||-||-||-|
The results of the controlled experiment are also illustrated in Table 1. CONCAT already outperforms LSTM Q+I by integrating GRU instead of LSTM  and batch normalization. RAND-GRU achieves better accuracy by employing dynamic parameter prediction additionally. It is interesting that most of the improvement comes from yes/no questions, which may involve various kinds of tasks since it is easy to ask many different aspects in an input image for binary classification. CNN-FIXED improves accuracy further by adding GRU pre-training, and our final model DPPnet achieves the state-of-the-art performance on VQA dataset with large margins as illustrated in Table 1 and 2.
|Acc||WUPS 0.9||WUPS 0.0|
|Single answer||Multiple answers|
|Single answer||Multiple answers|
Table 3, 4, and 5 illustrate the results by all algorithms including ours that have reported performance on COCO-QA, DAQUAR-reduced, DAQUAR-all datasets. The proposed algorithm outperforms all existing approaches consistently in all benchmarks. In Table 4 and 5, single answer and multiple answers denote the two subsets of questions divided by the number of ground-truth answers. Also, the numbers (0.9 and 0.0) in the second rows are WUPS thresholds.
To understand how the parameter prediction network understand questions, we present several representative questions before and after fine-tuning GRU in a descending order based on their cosine similarities to the query question in Table6. The retrieved sentences are frequently determined by common subjective or objective words before fine-tuning while they rely more on the tasks to be solved after fine-tuning.
|Query question||What body part has most recently contacted the ball?||Is the person feeding the birds?|
|Before fine-tuning||What shape is the ball?||Is he feeding the birds?|
|What colors are the ball?||Is the reptile fighting the birds?|
|What team has the ball?||Does the elephant want to play with the birds?|
|How many times has the girl hit the ball?||What is the fence made of behind the birds?|
|What number is on the women’s Jersey closest to the ball?||Where are the majority of the birds?|
|What is unusual about the ball?||What colors are the birds?|
|What is the speed of the ball?||Is this man feeding the pigeons?|
|After fine-tuning||What body part is the boy holding the bear by?||Is he feeding the birds?|
|What body part is on the right side of this picture?||Is the person feeding the sheep?|
|What human body part is on the table?||Is the man feeding the pigeons?|
|What body parts appear to be touching?||Is she feeding the pigeons?|
|What partial body parts are in the foreground?||Is that the zookeeper feeding the giraffes?|
|What part of the body does the woman on the left have on the ramp?||Is the reptile fighting the birds?|
|Name a body part that would not be visible if the woman’s mouth was closed?||Does the elephant want to play with the birds?|
The qualitative results of the proposed algorithm are presented in Figure 4. In general, the proposed network is successful to handle various types of questions that need different levels of semantic understanding. Figure 4(a) shows that the network is able to adapt recognition tasks depending on questions. However, it often fails in the questions asking the number of occurrences since these questions involve the difficult tasks (e.g., object detection) to learn only with image level annotations. On the other hand, the proposed network is effective to find the answers for the same question on different images fairly well as illustrated in Figure 4(b). Refer to our project website222http://cvlab.postech.ac.kr/research/dppnet/ for more comprehensive qualitative results.
We proposed a novel architecture for image question answering based on two subnetworks—classification network and parameter prediction network. The classification network has a dynamic parameter layer, which enables the classification network to adaptively determine its weights through the parameter prediction network. While predicting all entries of the weight matrix is infeasible due to its large dimensionality, we relieved this limitation using parameter hashing and weight sharing. The effectiveness of the proposed architecture is supported by experimental results showing the state-of-the-art performances on three different datasets. Note that the proposed method achieved outstanding performance even without more complex recognition processes such as referencing objects. We believe that the proposed algorithm can be extended further by integrating attention model to solve such difficult problems.
Learning deep features for scene recognition using places database.In NIPS, 2014.