\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{comment}
\usepackage{amsmath,amssymb} %
\usepackage{color}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage[export]{adjustbox}
\usepackage{cellspace, tabularx}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{caption}

\usepackage{siunitx}

\setlength{\belowcaptionskip}{-2ex} 

\usepackage{floatrow}
\newfloatcommand{capbtabbox}{table}[][\FBwidth]
\usepackage{blindtext}
\usepackage{subcaption} 
\captionsetup{compatibility=false}

\newcommand{\etal}{\textit{et al.}}
\newcommand{\eg}{\textit{e.g.}}
\newcommand{\ie}{\textit{i.e.}}

\usepackage{color, colortbl}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\definecolor{Gray}{gray}{0.9}
\usepackage{cleveref}
\usepackage{bm}
\newcommand{\bv}{\bm{v}}
\newcommand{\bx}{\bm{x}}
\newcommand{\by}{\bm{y}}
\newcommand{\bz}{\bm{z}}
\newcommand{\bc}{\bm{c}}
\newcommand{\bh}{\bm{h}}
\newcommand{\softatt}{{\textbf{Soft-Att}}}
\newcommand{\mimlOneTwoEight}{{\textbf{Two-Stream Att(128)}}}
\newcommand{\firstIC}{{\textbf{Vanilla-$\Theta_D(\bh^{\text{first}})$}}}
\newcommand{\lastIC}{{\textbf{Denoising-$\Theta_D(\bh^{\text{last}})$}}}
\newcommand{\lastSAE}{{\textbf{Denoising SAE-Decoder}}}

\newcommand{\base}{\footnotesize{\textbf{Baseline}}}
\newcommand{\cla}{\footnotesize{\textbf{+Conditional Latent Attn.}}}
\newcommand{\sae}{\footnotesize{\textbf{+SAE-Regularizer}}}
\newcommand{\gtone}{\footnotesize{\textbf{GT1}}}
\newcommand{\gttwo}{\footnotesize{\textbf{GT2}}}

\usepackage{soul}
\newcommand{\hbnote}[1]{\textbf{\color{red}HB\@:~#1}}

\begin{document}
\pagestyle{headings}
\mainmatter
\def\ECCVSubNumber{8}  %

\title{Injecting Prior Knowledge into Image Caption Generation}
\titlerunning{Injecting Prior Knowledge into Image Caption Generation}

\author{Arushi Goel\inst{1}\and
Basura Fernando\inst{2} \and
Thanh-Son Nguyen\inst{2} \and
Hakan Bilen\inst{1}}
\authorrunning{A. Goel et al.}
\institute{School of Informatics, University of Edinburgh, Scotland \and
AI3, Institute of High Performance Computing, A*STAR, Singapore
}
\maketitle

\begin{abstract}
Automatically generating natural language descriptions from an image is a challenging problem in artificial intelligence that requires a good understanding of the visual and textual signals and the correlations between them.
The state-of-the-art methods in image captioning struggles to approach human level performance, especially when data is limited.
In this paper, we propose to improve the performance of the state-of-the-art image captioning models by incorporating two sources of prior knowledge: (i) a conditional latent topic attention, that uses a set of latent variables (topics) as an anchor to generate highly probable words and,
(ii) a regularization technique that exploits the inductive biases in syntactic and semantic structure of captions and improves the generalization of image captioning models.
Our experiments validate that our method produces more human interpretable captions and also leads to significant improvements on the MSCOCO dataset in both the full and low data regimes.
\end{abstract}

\section{Introduction}
\label{sec.intro}

In recent years there has been a growing interest to develop end-to-end learning algorithms in computer vision tasks.
Despite the success in many problems such as image classification~\cite{he2016deep} and person recognition~\cite{joon2015person}, the state-of-the-art methods struggle to reach human-level performance in solving more challenging tasks such as image captioning within limited time and data  which involves understanding the visual scenes and describing them in a natural language.
This is in contrast to humans who are effortlessly successful in understanding the scenes which they have never seen before and  communicating them in a language.
It is likely that this efficiency is due to the strong prior knowledge of structure in the visual world and language~\cite{chomsky2014aspects}.

Motivated by this observation, in this paper we ask ``How can such prior knowledge be represented and utilized to learn better image captioning models with deep neural networks?''.
To this end, we look at the state-of-the-art encoder-decoder image captioning methods~\cite{vinyals2015show,xu2015show,Anderson2018}
where a Convolutional Neural Network (CNN) encoder extracts an embedding from the image, a Recurrent Neural Network (RNN) decoder generates the text based on the embedding.
This framework typically contains two \emph{dynamic} mechanisms to model the sequential output: i) an attention module \cite{bahdanau2014neural,xu2015show} that identifies the relevant parts of the image embedding  based on the previous word and visual features and ii) the RNN decoder that predicts the next words based on the its previous state and attended visual features.
While these two components are very powerful to model complex relations between the visual and language cues, we hypothesize that they are also capable of and at the same time prone to overfitting to wrong correlations, thus leading to poor generalization performance when the data is limited.
Hence, we propose to regulate these modules with two sources of prior knowledge.
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.82\linewidth]{highlevel_introfig.pdf}

\end{center}
\caption{Our Final Model with Conditional Latent Topic Attention (CLTA) and Sentence Prior (Sentence Auto-Encoder (SAE) regularizer) both rely on prior knowledge to find relevant words and generate non-template like and generalized captions compared to the same Baseline caption for both images - \emph{A man hitting a tennis ball with a racket.}} 
\label{fig:introfig}
\end{figure}
First, we propose an attention mechanism that accurately attends to relevant image regions and better cope with complex associations between words and image regions.
For instance, in the example of a ``man playing tennis'', the input visual attention encoder might only look at the local features (\emph{tennis ball}) leaving out the global visual information (\emph{tennis court}). Hence, it generates a trivial caption as ``A man is hitting a tennis ball'', which is not the full description of the image in context (as shown in \cref{fig:introfig}).
We solve this ambiguity by incorporating prior knowledge of context via latent topic models~\cite{blei2003latent}, which are known to identify semantically meaningful topics~\cite{chang2009reading}, into our attention module.
In particular we introduce a Conditional Latent Topic Attention (CLTA) module that models relationship between a word and image regions through a latent shared space \ie~latent topics to find salient regions in an image. \emph{Tennis ball} steers the model to associate this word with the latent topic, ``tennis'', which further is responsible for localizing \emph{tennis court} in the image. If a region-word pair has a higher probability with respect to a latent topic and if the same topic has a higher probability with respect to some other regions, then it is also a salient region and will be highly weighted. Therefore, we compute two sets of probabilities conditioned on the current word of the captioning model.
We use conditional-marginalized probability where marginalization is done over latent topics to find salient image regions to generate the next word.
Our CLTA is modeled as a neural network where marginalized probability is used to weight the image region features to obtain a context vector that is passed to a image captioning decoder to generate the next word.

Second, the complexity in the structure of natural language makes it harder to generate fluent sentences while preserving a higher amount of encoded information (high Bleu-4 scores). 
Although current image captioning models are able to model this linguistic structure, the generated captions follow a more template-like form, for instance, ``A \ul{man} \ul{hitting} a \ul{tennis ball} with a \ul{racket}.'' As shown in \cref{fig:introfig}, visually similar images have template-like captions from the baseline model.
Inspired from sequence-to-sequence (seq2seq) machine translation \cite{sutskever2014sequence,luong2015multi,wiseman2016sequence,gehring2017convolutional}, we introduce a new regularization technique for captioning models coined SAE Regularizer.  
In particular, we design and train an additional seq2seq sentence auto-encoder model (``SAE'') that first reads in a whole sentence as input, generates a fixed dimensional vector, then the vector is further used to reconstruct the input sentence.
Human languages are highly structured and follows immense amount of regularity.
Certain words are more likely to co-appear and certain word patterns can be observed more often.
Our SAE is trained to learn the structure of the input (sentence) space in an offline manner by exploiting the regularity of the sentence space.
The continuous latent space learned by SAE blends together both the syntactic and semantic information from the input sentence space and generates high quality sentences during the reconstruction via the SAE decoder.
This suggests that the continuous latent space of SAE contains sufficient information regarding the syntactic and semantic structure of input sentences.
Specifically, we use SAE-Dec as an auxiliary decoder branch (see \cref{fig:sae}). Adding this regularizer forces the representation from the image encoder and language decoder to be more representative of the visual content and less likely to overfit. 
SAE-Dec is employed along with the original image captioning decoder (``IC-Dec'') to output the target sentence during training, however, we do not use SAE regularizer at test time reducing additional computations.

Both of the proposed improvements also help to overcome the problem of training on large image-caption paired data \cite{lin2014microsoft,liu2004conceptnet} by incorporating prior knowledge which is learned from unstructured data in the form of latent topics and SAE. These priors -- also known as ``inductive biases'' -- help the models make inferences that go beyond the observed training data.   
Through an extensive set of experiments, we demonstrate that our proposed CLTA module and SAE-Dec regularizer improves the image captioning performance both in the limited data and full data training regimes on the MSCOCO dataset \cite{lin2014microsoft}. 


\section{Related Work}
\label{sec.rel}
Here, we first discuss related attention mechanisms and then the use of knowledge transfer in image captioning models.
\noindent
\textbf{Attention mechanisms in image captioning. }
The pioneering work in neural machine translation \cite{bahdanau2014neural,luong2015effective,cho2014properties} has shown that attention in encoder-decoder architectures can significantly boost the performance in sequential generation tasks.
Visual attention is one of the biggest contributor in image captioning \cite{fang2015captions,xu2015show,Anderson2018,Huang_2019_ICCV}. Soft attention and hard attention variants for image captioning were introduced in~\cite{xu2015show}. Bottom-Up and Top-Down self attention is effectively used in~\cite{Anderson2018}. Attention on attention is used in recent work~\cite{Huang_2019_ICCV}. Interestingly, they use attention at both encoder and the decoder step of the captioning process.
Our proposed attention significantly differs in comparison to these attention mechanisms. 
First, the traditional attention methods, soft-attention \cite{bahdanau2014neural} and scaled dot product attention \cite{vaswani2017attention} aims to find features or regions in an image that highly correlates with a word representation~\cite{Anderson2018,bahdanau2014neural,sharma2018conceptual}.
In contrast, our \emph{conditional-latent topic attention} uses latent variables \ie topics as anchors to find relationship between word representations and image regions (features). 
Some image regions and word representations may project to the same set of latent topics more than the others and therefore more likely to co-occur. 
Our method learns to model these relationships between word-representations and image region features using our latent space.
We allow competition among regions and latent topics to compute two sets of probabilities to find salient regions.
This competing strategy and our latent topics guided by pre-trained LDA topics \cite{blei2003latent} allow us to better model relationships between visual features and word representations.
Hence, the neural structure and our attention mechanism is quite different from all prior work~\cite{xu2015show,Anderson2018,Huang_2019_ICCV,bahdanau2014neural}.
\noindent
\textbf{Knowledge transfer in image captioning. } 
It is well known that 
language consists of semantic and syntactic biases \cite{bao2019generating,marcheggiani2018exploiting}. We exploit these biases by first training a recurrent caption auto-encoder to capture this useful information using \cite{sutskever2014sequence}. Our captioning auto-encoder is trained to reconstruct the input sentence and hence, this decoder encapsulates the structural, syntactic and semantic information of input captions. During captioning process we regularize the captioning RNN with this pretrained caption-decoder to exploit biases in the language domain and transfer them to the visual-language domain. To the best of our knowledge, 
no prior work has attempted such knowledge transfer in image captioning. Zhou \etal \cite{zhou2019improving} encode external knowledge in the form of knowledge graphs using Concept-Net \cite{liu2004conceptnet} to improve image captioning. The closest to ours is the work of \cite{yang2019auto} where they propose to generate scene graphs from both sentences and images and then encode the scene graphs to a common dictionary before decoding them back to sentences. However, generation of scene graphs from images itself is an extremely challenging task. 
Finally, we propose to transfer syntactic and semantic information as a regularization technique during the image captioning process as an auxiliary loss. 
Our experiments suggest that this leads to considerable improvements, specially in more structured measures such as CIDEr \cite{vedantam2015cider}. 


\section{Method}
\label{sec.method}

In this section, we first review image captioning with attention, introduce our CLTA mechanism, and then our sentence auto-encoder (SAE) regularizer.

\subsection{Image Captioning with Attention}
\label{sec.overview}
Image captioning models are based on encoder-decoder architecture \cite{xu2015show} that use a CNN as image encoder and a Long Short-Term Memory (LSTM)~\cite{hochreiter1997long} as the decoder -- see~Fig.\ref{fig:introfig}.
The encoder takes an image as input and extracts a feature set $v=\{\bv_1,\ldots,\bv_R\}$ corresponding to $R$ regions of the image, where $\bv_i \in \mathbb{R}^D$ is the $D$-dimensional feature vector for the $i^{th}$ region. 
The decoder outputs a caption $y$ by generating one word at each time step. At time step $t$, the feature set $v$ is  combined into a single vector $\bv^t_a$ by taking weighted sum as follows:
\begin{equation}
    \bv^t_a = \sum_{i=1}^R \alpha_{i}^{t} \bv_{i}
    \label{eq.ct}
\end{equation}
where $\alpha^t_i$ is the CLTA weight for region $i$ at time $t$, that is explained in the next section.
The decoder LSTM $\phi$ then takes a concatenated vector $[\bv^t_a|\by_{t-1}]$ and the previous hidden state $\mathbf{h_{t-1}}$ as input and generates the next hidden state $\mathbf{h_t}$: 

\begin{align}
\mathbf{h_t} &= \phi([\bv^t_a|E \by_{t-1}], \mathbf{h_{t-1}},\Theta_{\phi})
\label{eq.lstm.hil}
\end{align}
where, $|$ denotes concatenation, $\by_{t-1}\in \mathbb{R}^K$ is the one-hot vector of the word generated at time $t-1$, $K$ is the vocabulary size, $\bh^t \in \mathbb{R}^{n}$ is the hidden state of the LSTM at time $t$, $n$ is the LSTM dimensionality, and $\Theta_{\phi}$ are trainable parameters of the LSTM. Finally, the decoder predicts the output word by applying a linear mapping $\psi$ on the hidden state and $\bv^t_a$ as follows: 
\begin{align}
\by_{t} &= \psi([\mathbf{h_t}|\bv^t_a],\Theta_{\psi})
\end{align}
where $\Theta_{\psi}$ are trainable parameters. Our LSTM implementation closely follows the formulation in \cite{zaremba2014recurrent}. 
The word embedding matrix $E \in \mathbb{R}^{m\times K}$ is trained to translate one-hot vectors to word embeddings as in \cite{xu2015show}, where $m$ is the word embedding dimension. In the next section, we describe our proposed CLTA mechanism. 
\subsection{CLTA: Conditional Latent Topic Attention}
\label{sec.method.att}

At time step $t$, our CLTA module takes the previous LSTM hidden state ($\bh^{t-1}$) and image features to output the attention weights $\alpha^t$. 
Specifically, we use a set of latent topics to model the associations between textual ($\bh^{t-1}$) and visual features ($\bv$) to compute the attention weights.
The attention weight for region $i$ is obtained by taking the conditional-marginalization over the latent topic $l$ as follows:
\begin{align}
\alpha^t_i & = P(\text{region}=i|h^{t-1}, \bv) = \sum_{l=1}^C P(\text{region}=i|h^{t-1}, \bv, l) P(l|h^{t-1}, \bv_{i})
\end{align}
where $l$ is a topic variable in the $C$-dimensional latent space. 
To compute $P(l|h^{t-1}, \bv_i)$, we first project both textual and visual features to a common $C$-dimensional shared latent space, and obtain the associations by summing the projected features as follows:

\begin{equation}
    \bm{q}^t_{i}= W_{sc} \bv_i + W_{hc} \bh^{t-1}
\end{equation}
where $W_{sc}\in \mathbb{R}^{C\times D}$ and $W_{hc}\in \mathbb{R}^{C\times n}$ are the trainable projection matrices for visual and textual features, respectively. 
Then the latent topic probability is given by:
\begin{equation}
P_L = 
P(l|\bh^{t-1}, \bv_{i}) = \frac{\exp({\bm{q}^t_{il}})}{\sum_{k=1}^{C}\exp({\bm{q}^t_{ik}})}
\label{eq.ltopic}
\end{equation}

Afterwards, we compute the probability of a region given the textual, vision features and latent topic variable as follows:
\begin{equation}
    \bm{r}^t_{i} = W_{sr} \bv_i + W_{hr} \bh^{t-1}
\end{equation}
\begin{align}
    P(\text{region}=i|\bh^{t-1}, v, l) &= \frac{\exp({\bm{r}^t_{il}})}{\sum_{k=1}^{R}\exp({\bm{r}^t_{kl}})}
\end{align}
where $W_{sr}\in \mathbb{R}^{C\times D}$ and $W_{hr}\in \mathbb{R}^{C\times n}$ are the trainable projection matrices for visual and textual features, respectively.

The latent topic posterior in \cref{eq.ltopic} is pushed to the pre-trained LDA topic prior by adding a KL-divergence term to the image captioning objective. We apply Latent Dirichlet Allocation (LDA) \cite{blei2003latent} on the caption data. Then, each caption has an inferred topic distribution $Q_T$ from the LDA model which acts as a prior on the latent topic distribution, $P_L$. For doing this, we take the average of the C-dimensional latent topics at all time steps from $0,\ldots,t-1$ as: 
\begin{equation}
P_{L_{avg}} = \frac{1}{t}\sum_{k=0}^{t-1} P(l|\bh^{k}, \bv_{i}) 
\end{equation}
Hence, the KL-divergence objective is defined as: 

\begin{equation}
D_{KL}(P_{L_{avg}}||Q_T) = \sum_{c \in C} P_{L_{avg}}(c) \times log(\frac{P_{L_{avg}}(c)}{Q_T(c)})
\label{eq.kl}
\end{equation}
\begin{figure}[t]
  \centering
\includegraphics[width=0.9\linewidth]{latent-topics.pdf}
\caption{Image-Caption pairs generated from our CLTA module with $128$ dimensions and visualization of Top-20 words from the latent topics.}
\label{fig:latentcategory}
\end{figure}
This learnt latent topic distribution captures the semantic relations between the visual and textual features in the form of visual topics, and therefore we also use this latent posterior, $P_L$ as a source of meaningful information during generation of the next hidden state. The modified hidden state $\mathbf{h_t}$ in \cref{eq.lstm.hil} is now given by:

\begin{align}
\mathbf{h_t} &= \phi([\bv^t_a|E \by_{t-1}|P_L], \mathbf{h_{t-1}},\Theta_{\phi})
\label{eq.lstm.hil.new}
\end{align}

We visualize the distribution of latent topics in \Cref{fig:latentcategory}.
While traditional ``soft-max" attention exploit simple correlation among textual and visual information, we make use of latent topics to model associations between them.
\subsection{SAE Regularizer} 
\label{sec.method.sae}
Encoder-decoder methods are widely used for translating one language to another \cite{cho2014learning,sutskever2014sequence,bahdanau2014neural}.
When the input and target sentences are the same, these models function as auto-encoders by
first encoding an entire sentence into a fixed-(low) dimensional vector in a latent space, and then reconstructing it.
Autoencoders are commonly employed for unsupervised training in text classification \cite{dai2015semi} and machine translation \cite{luong2015multi}.

In this paper, our SAE regularizer has two advantages: i) acts as a soft constraint on the image captioning model to regularize the syntactic and semantic space of the captions for better generalization and, ii) encourages the image captioning model to extract more context information for better modelling long-term memory. 
These two properties of the SAE regularizer generates semantically meaningful captions for an image with syntactic generalizations and prevents generation of naive and template-like captions.  
Our SAE model uses network architecture of \cite{sutskever2014sequence} with Gated Recurrent Units (GRU) \cite{chung2014empirical}.
Let us denote the parameter of the decoder GRU by $\Theta_{\text{D}}$. 
A stochastic variation of the vanilla sentence auto-encoders is de-noising auto-encoders~\cite{vincent2008extracting} which are trained to ``de-noise'' corrupted versions of their inputs.
To inject such input noise, we drop each word in the input sentence with a probability of 50\% to reduce the contribution of a single word on the semantics of a sentence.
We train the SAE model in an offline stage on training set of the captioning dataset.
After the SAE model is trained, we discard its encoder and integrate only its decoder to regularize the captioning model.

As depicted in \Cref{fig:sae}, the pretrained SAE decoder takes the last hidden state vector of captioning LSTM $\bh$ as input and generates an extra caption (denoted as $y_{\text{sae}}$) in addition to the output of the captioning model (denoted as $y_{\text{lstm}}$). 
We use output of the SAE decoder only in train time to regulate the captioning model $\phi$ by implicitly transferring the previously learned latent structure with SAE decoder.
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.9\linewidth]{SAEReg.pdf}
\end{center}
\caption{Illustration of our proposed Sentence Auto-Encoder (SAE) regularizer with the image captioning decoder. The captioning model is trained by adding the SAE decoder as an auxiliary branch and thus acting as a regularizer.}
\label{fig:sae}
\end{figure}
Our integrated model is optimized to generate two accurate captions (\ie $y_{\text{sae}}$ and $y_{\text{lstm}}$) by minimizing a weighted average of two loss values:
\begin{equation}
\arg \min_{\Omega}~~~\lambda L(y^*,y_{\text{lstm}}) + (1-\lambda)  L(y^*,y_{\text{sae}})
\label{eq.loss}
\end{equation} 
where $L$ is the cross-entropy loss computed for each caption, word by word against the ground truth caption $y^*$, $\lambda$ is the trade-off parameter, and $\Omega$ are the parameters of our model. 
We consider two scenarios that we use during our experimentation.
\begin{itemize}
    \item First, we set the parameters of the SAE decoder $\Theta_D$ to be the weights of the pre-trained SAE decoder and freeze them while optimizing \Cref{eq.loss} in terms of $\Omega=\{ \Theta_{\phi},\Theta_{\psi},E \}$.
    \item Second, we initialize $\Theta_D$ with the weights of the pre-trained SAE decoder and fine-tune them along with the LSTM parameters, \ie $\Omega=\{\Theta_{\phi},\Theta_{\psi},E,\Theta_{\text{D}}\}$.
\end{itemize}
As discussed in \cref{sec.method.att}, we also minimize the KL divergence in \cref{eq.kl} along with the final regularized objective in \cref{eq.loss} as:

\begin{equation}
\arg \min_{\Omega}~~~\lambda L(y^*,y_{\text{lstm}}) + (1-\lambda)  L(y^*,y_{\text{sae}}) + \gamma D_{KL}(P_{L_{avg}}||Q_T)
\label{eq.totalloss}
\end{equation} 

where, $\gamma$ is the weight for the KL divergence loss.

\paragraph{Discussion. } An alternative way of exploiting the information from the pre-trained SAE model is to bring the representations from the captioning decoder closer to the encodings of the SAE encoder by minimizing the Euclidean distance between the hidden state from the SAE encoder and the hidden state from the captioning decoder at each time-step. 
However, we found this setting is too restrictive on the learned hidden state of the LSTM.
 

\section{Experiments}
\label{sec.exp}


    
\noindent
\textbf{Dataset. } 
Our models are evaluated on the standard MSCOCO 2014 image captioning dataset~\cite{lin2014microsoft}. For fair comparisons, we use the same data splits for training, validation and testing as in \cite{karpathy2015deep} which have been used extensively in prior works. This split has 113,287 images for training, 5k images for validation and testing respectively with 5 captions for each image. 
We perform evaluation on all relevant metrics for generated sentence evaluation - CIDEr \cite{vedantam2015cider}, Bleu \cite{papineni2002bleu}, METEOR \cite{denkowski2014meteor}, ROUGE-L \cite{lin2004automatic} and, SPICE \cite{anderson2016spice}.
\hfill

\noindent
\textbf{Implementation Details. }
For training our image captioning model, we compute the image features based on the Bottom-Up architecture proposed by \cite{Anderson2018}, where the model is trained using a Faster-RCNN model \cite{ren2015faster} on the Visual-Genome Dataset \cite{krishna2017visual} with object and attribute information. 
These features are extracted from $R$ regions and each region feature has $D$ dimensions, where $R$ and $D$ is 36 and 2048 respectively as proposed in \cite{Anderson2018}. 
We use these $36\times 2048$ image features in all our experiments.

\subsection{Experimental Setup}
\label{sec.expsetup}
\paragraph{LDA Topic Models.} The LDA \cite{blei2003latent} model is learned in an offline manner to generate a $C$ dimensional topic distribution for each caption. Briefly, the LDA model treats the captions as word-documents and group these words to form $C$ topics (cluster of words), learns the word distribution for each topic $(C \times V)$ where $V$ is the vocabulary size and also generates a topic distribution for each input caption, $Q_T$ where each $C^{th}$ dimension denotes the probability for that topic.

\paragraph{Sentence Auto-Encoder.} The Sentence Auto-encoder is trained offline on the MSCOCO 2014 captioning dataset \cite{lin2014microsoft} with the same splits as discussed above. For the architecture, we have a single layer GRU for both the encoder and the decoder. The word embeddings are learned with the network using an embedding layer and the dimension of both the hidden state and the word embeddings is 1024. During training, the decoder is trained with teacher-forcing \cite{bengio2015scheduled} with a probability of 0.5. For inference, the decoder decodes till it reaches the end of caption token. The learning rate for this network is 2e-3 and it is trained using the ADAM \cite{kingma2014adam} optimizer.
\paragraph{Image Captioning Decoder with SAE Regularizer.} 
The architecture of our image captioning decoder is same as the Up-Down model \cite{Anderson2018} with their ``soft-attention'' replaced by our CLTA module and trained with the SAE regularizer. We also retrain the AoANet model proposed by Huang \etal \cite{Huang_2019_ICCV} by incorporating our CLTA module and the SAE regularizer. In the results section, we show improvements over the Up-Down and AoANet models using our proposed approaches. 
Note, the parameters for training Up-Down and AoANet baselines are same as the original setting.
While training the captioning models together with the SAE-decoder, we jointly learn an affine embedding layer (dimension 1024) by combining the embeddings from the image captioning decoder and the SAE-decoder. 
During inference, we use beam search to generate captions from the captioning decoder using a beam size of 5 for Up-Down and a beam-size of 2 for AoANet. 
For training the overall objective function as given in Equation \ref{eq.totalloss}, the value of $\lambda$ is initialized by 0.7 and increased by a rate of 1.1 every 5 epochs until it reaches a value of 0.9 and $\gamma$ is fixed to 0.1. We use the ADAM optimizer with a learning rate of 2e-4.
Our code is implemented using PyTorch \cite{pytorch} and will be made publicly available. 

\section{Results and Analysis}
\label{sec.results}

First, we study the caption reconstruction performance of vanilla and denoising SAE, then report our model's image captioning performance on MS-COCO dataset with full and limited data, investigate multiple design decisions and analyze our results qualitatively.

\subsection{Sentence Auto-Encoder Results}
\label{sec.quantresults}
An ideal SAE must learn mapping its input to a fixed low dimensional space such that a whole sentence can be summarized and reconstructed accurately.
To this end, we experiment with two SAEs, Vanilla-SAE and Denoising-SAE and report their reconstruction performances in terms of Bleu4 and cross-entropy (CE) loss in fig.\ref{fig:sea_loss}.

\newsavebox{\testbox}%
\newlength{\testheight}%
\savebox{\testbox}{%
       
        \centering
        \begin{tabular}{c|c|c}
        \hline
        Models & Bleu-4 $\uparrow$ & CE-Loss $\downarrow$\\
        \hline\hline
        Vanilla SAE & \textbf{96.33}  & \textbf{0.12} \\
        Denoising SAE & 89.79 & 0.23\\
        \hline
        \end{tabular}
        }%
\settoheight{\testheight}{\usebox{\testbox}}
\begin{figure}
\begin{floatrow}
\ffigbox{
\includegraphics[width=\linewidth,height=3.0\testheight]{SAE_plot_v2.pdf}
}
{
\caption{Error Curve for the Sentence Auto-Encoder on the Karpathy test split. The error starts increasing approximately after 20 epochs.} 
\label{fig:sea_loss}
}
\capbtabbox{
\usebox{\testbox}
}
{
\caption{Bleu-4 Evaluation and Reconstruction Cross-Entropy Loss for the Sentence Auto-Encoder on the Karpathy test split of MSCOCO 2014 caption dataset \cite{lin2014microsoft}.}
\label{table:sea_results}
}
\end{floatrow}
\end{figure}
The vanilla model, when the inputs words are not corrupted, outperforms the denoising one in both metrics.
This is expected as the denoising model is only trained with corrupted input sequences.
The loss for both the Vanilla and Denoising SAE start from a relatively high value of approximately 0.8 and 0.4 respectively, and converge to a significantly low error of 0.1 and 0.2.  
For a better analysis, we also compute the Bleu-4 metrics on our decoded caption against the 5 ground-truth captions. 
As reported in fig.\ref{table:sea_results}, both models obtain
significantly high Bleu-4 scores.
This indicates that an entire caption can be compressed in a low dimensional vector ($1024$) and can be successfully reconstructed.
\begin{table*}[t]
\renewcommand*{\arraystretch}{1.13}
\resizebox{0.98\textwidth}{!}{
\begin{tabular}{|l|c  c  c  c  c  c|c  c  c  c  c  c|}
\hline
\multirow{2}{*}{Models} & \multicolumn{6}{c|}{cross-entropy loss} & \multicolumn{6}{c|}{cider optimization}\\
 & B-1  & B-4 & M & R &C & S & B-1  & B-4 & M & R &C & S \\
\hline\hline 
LSTM-A \cite{yao2017boosting} & 75.4 & 35.2 & 26.9 & 55.8 & 108.8 & 20.0 &  78.6 & 35.5& 27.3& 56.8& 118.3 & 20.8 \\ 
RFNet \cite{jiang2018recurrent} & 76.4 & 35.8 & 27.4 & 56.8  &112.5& 20.5 & 79.1& 36.5& 27.7& 57.3 &121.9& 21.2 \\ 
Up-Down \cite{Anderson2018} & 77.2 & 36.2 & 27.0 & 56.4 & 113.5 & 20.3 & 79.8& 36.3& 27.7& 56.9 &120.1& 21.4 \\ 
GCN-LSTM \cite{yao2018exploring}  & 77.3 & 36.8 & 27.9 & 57.0 &116.3& 20.9 &  80.5 & 38.2& 28.5& 58.3 &127.6& 22.0 \\ 
AoANet \cite{Huang_2019_ICCV} & 77.4 & 37.2 & 28.4 & 57.5 & 119.8 & 21.3 & 80.2& 38.9& 29.2& 58.8 &129.8 & 22.4 \\  
\hline \hline
Up-Down$^{\dagger}$ & 75.9 & 36.0 & 27.3 & 56.1 & 113.3 & 20.1 & 79.2 & 36.3 & 27.7 & 57.3 & 120.8 & 21.2 \\
Up-Down$^{\dagger}$ + CLTA + SAE-Reg &\textbf{ 76.7} &\textbf{37.1} & \textbf{28.1} & \textbf{57.1} & \textbf{116.2}&  \textbf{21.0} & \textbf{80.2} &\textbf{37.4} &\textbf{ 28.4} & \textbf{58.1} & \textbf{127.4} &\textbf{22.0} \\
\rowcolor{LightCyan}
Relative Improvement & +0.8 & +1.1 & +0.8 & +1.0 & +2.9 & +0.9  & +1.0 & +1.1 & +0.7 & +0.8 & +6.6 & +0.8\\
\hline
AoANet$^{*}$ & 77.3 & 36.9 & \textbf{28.5} & 57.3 & 118.4 & 21.6  & 80.5 & 39.1 & 29.0 & 58.9 & 128.9 & 22.7 \\
AoANet$^{\dagger}$ + CLTA + SAE-Reg & \textbf{78.1} & \textbf{37.9} & 28.4 & \textbf{57.5} & \textbf{119.9} & \textbf{21.7} & \textbf{80.8} & \textbf{39.3} & \textbf{29.1} & \textbf{59.1} & \textbf{130.1} & \textbf{22.9}\\
\rowcolor{LightCyan}
Relative Improvement & +0.8 & +1.0 & -0.1 & +0.2 & +1.5 & +0.1 & +0.3 & +0.2 & +0.1 & +0.2 & +1.2 & +0.2  \\
\hline

\end{tabular}}
\caption{Image captioning performance on the ``Karpathy'' test split of the MSCOCO 2014 caption dataset \cite{lin2014microsoft} from other state-of-the-art methods and our models. Our Conditional Latent Topic Attention with the SAE regularizer significantly improves across all the metrics using both \textit{cross-entropy loss} and \textit{cider optimization}. \small{$\dagger$ denotes our trained models} and * indicates the results obtained from the publicly available pre-trained model. }
\label{table:celoss}
\end{table*}
 
              
                
\subsection{Image Captioning Results}
\label{sec.ic.results}
Here we incorporate the proposed CLTA and SAE regularizer to recent image-captioning models including Up-Down~\cite{Anderson2018} and AoANet~\cite{Huang_2019_ICCV} and report their performance on MS-COCO dataset in multiple metrics (see \Cref{table:celoss}).
The tables report the original results of these methods from their publications in the top block and the rows in cyan show relative improvement of our models when compared to the baselines.

The baseline models are trained for two settings - 1)Up-Down$^{\dagger}$, is the model re-trained on the architecture of Anderson \etal \cite{Anderson2018} and, 2) AoANet$^{\dagger}$, is the Attention-on-Attention model re-trained as in Huang \etal \cite{Huang_2019_ICCV}. 
Note that for both Up-Down and AoANet, we use the original source code to train them in our own hardware.
We replace the ``soft-attention" module in our Up-Down baseline by CLTA directly.
The AoANet model is based on the powerful Transformer \cite{vaswani2017attention} architecture with the multi-head dot attention in both encoder and decoder. 
For AoANet, we replace the dot attention in the decoder of AoANet at each head by the CLTA which results in multi-head CLTA. 
The SAE-decoder is added as a regularizer on top of these models as also discussed in \cref{sec.expsetup}.
As discussed later in \cref{sec.ablation}, we train all our models with $128$ dimensions for the CLTA and with the Denoising SAE decoder (initialized with $\bh^{last}$). 

We evaluate our models with the cross-entropy loss training and also by using the CIDEr score oprimization \cite{rennie2017self} after the cross-entropy pre-training stage (\cref{table:celoss}).
For the cross-entropy one, our combined approach consistently improves over the baseline performances across all metrics. It is clear from the results that improvements in CIDEr and Bleu-4 are quite significant which shows that our approach generates more human-like and accurate sentences. 
It is interesting to note that AoANet with CLTA and SAE-regularizer also gives consistent improvements despite having a strong transformer language model. We show in \cref{sec.qualitative} the differences between our captions and the captions generated from Up-Down and AoANet. 
Our method is modular and improves on state-of-the-art models despite the architectural differences. 
Moreover, the SAE decoder is discarded after training and hence it brings no additional computational load during test-time but with significant performance boost.
For CIDEr optimization, our models based on Up-Down and AoANet also show significant improvements in all metrics for our proposed approach.

\begin{table}[t]
\renewcommand*{\arraystretch}{1.1}
  \begin{center}
    \resizebox{0.8\textwidth}{!}{
    \begin{tabular}{|l|c|c|c|c|c|c|}
     
      \hline
      Models & \multicolumn{2}{c|}{50\% data}
      & \multicolumn{2}{c|}{75\% data}
      & \multicolumn{2}{c|}{100\% data} \\ %
      \hline
       & Bleu-4  & CIDEr &  Bleu-4  & CIDEr &  Bleu-4  & CIDEr  \\ 
       \hline
      Up-Down & 35.4 & 112.0 & 35.8 & 112.7 & 36.0 &  113.3  \\
      \hline
      Up-Down+CLTA& 36.3 & 113.7 & 36.3 & 114.5 & 36.5 & 115.0  \\
      \hline
      Up-Down+CLTA+SAE-Reg & \textbf{36.6}  & \textbf{114.8}& \textbf{36.8} &\textbf{115.6} & \textbf{37.1}  &\textbf{116.2}  \\

      \hline
      \hline
      AoANet & 36.6 & 116.1 & 36.8 & 118.1 & 36.9 &  118.4  \\
      \hline
      AoANet+CLTA& 36.9 & 116.7 & 37.1 & 118.4 & 37.4 & 119.1  \\
      \hline
      AoANet+CLTA+SAE-Reg & \textbf{37.2}  & \textbf{117.5}& \textbf{37.6} &\textbf{118.9} & \textbf{37.9}  &\textbf{119.9}  \\
      
      \hline
    \end{tabular}}
  \end{center}
   \caption{Evaluation of our CLTA and SAE-Regularizer methods by training on a subset of the MSCOCO ``Karpathy'' Training split.}
\label{table:lowdata}
\end{table}
\subsection{Learning to Caption with Less Data}
\label{sec.lessdata}
Table \ref{table:lowdata} evaluates the performance of our proposed models for a subset of the training data, where $x$\% is the percentage of the total data that is used for training. All these subsets of the training samples are chosen randomly. Our CLTA module is trained with $128$ dimensions for the latent topics along with the Denoising SAE Regularizer initialized with the last hidden state of the LSTM (Up-Down+CLTA+SAE-Reg). 
Despite the number of training samples, our average improvement with CLTA and SAE-Regularizer is around 1\% in Bleu-4 and 2.9\% in CIDEr for the Up-Down model and 0.8\% in Bleu-4 and 1.2\% in CIDEr for the AoANet model. The significant improvements in Bleu-4 and CIDEr scores with only 50\% and 75\% of the data compared to the baseline validates our proposed methods as a form of rich prior.
 
 
 
\subsection{Qualitative Results}
\label{sec.qualitative}

In \cref{fig:qualitative}, we show examples of images and captions generated by the baselines Up-Down and AoANet along with our proposed methods, CLTA and SAE-Regularizer. The baseline models have repetitive words and errors while generating captions (\textit{in front of a mirror}, \textit{a dog in the rear view mirror}). 
Our models corrects these mistakes by finding relevant words according to the context and putting them together in a human-like caption format (\textit{a rear view mirror shows a dog} has the same meaning as \textit{a rear view mirror shows a dog in the rear view mirror} which is efficiently corrected by our models by bringing in the correct meaning). 
From all the examples shown, we can see that our model overcomes the limitation of overfitting in current methods by completing a caption with more semantic and syntactic generalization (\eg: \textit{different flavoured donuts} and \textit{several trains on the tracks}). 
\begin{figure}[t]
  \centering
\includegraphics[width=\linewidth]{qualitative_new.pdf}
\caption{Example of generated captions from the baseline Up-Down, AoANet, our proposed CLTA and, our final models with both CLTA and SAE Regularizer.}
\label{fig:qualitative}
\end{figure}
\subsection{Ablation Study}

\label{sec.ablation}
\textbf{Conditional Latent Topic Attention (CLTA).}
Table \ref{table:mil_ablation} depicts the results for the CLTA module that is described in \cref{sec.method.att}.
Soft-attention is used as a baseline and corresponds to the attention mechanism in \cite{xu2015show} which is the main attention module in Up-Down image captioning model by Anderson \etal \cite{Anderson2018}.
We replace this attention with the CLTA and evaluate its performance for different number of latent dimensions, \ie~topics ($C$).
The models trained with latent topic dimensions of $128$, $256$ and $512$ all outperform the baseline significantly. 
The higher CIDEr and Bleu-4 scores for these latent topics show the model's capability to generate more descriptive and accurate human-like sentences.
As we increase the dimensions of latent topics from $128$ to $512$, we predict more relevant keywords as new topics learnt by the CLTA module with $512$ dimensions are useful in encoding more information and hence generating meaningful captions.
\begin{table}[t]
\centering
\begin{subtable}{.49\textwidth}
\centering%
    \raggedright
 
    \begin{tabular}{|c|c|c|c|c|c|}
     
      \hline
      Models & Baseline & \multicolumn{3}{c|}{CLTA}\\ %
      \hline
      & Soft-Attention  & 128 & 256 & 512 \\ 
      \hline
      Bleu-4 & 36.0  & 36.5 & 36.6 & \textbf{36.7} \\
      \hline
      CIDEr & 113.3 & 115.0 &  115.2 & \textbf{115.3} \\
      
      \hline
    \end{tabular}

\caption{Evaluation scores for the Up-Down model with soft-attention and ablations of our CLTA module.}\label{table:mil_ablation}

\end{subtable}\hfill
\begin{subtable}{.49\textwidth}
\centering%
\renewcommand*{\arraystretch}{1.1}
\resizebox{0.95\textwidth}{!}{
\begin{tabular}{|l|l|c|c|c|}
\hline
Models  & SAE-Decoder & $\bh$ & Bleu-4 &CIDEr  \\
\hline\hline 
Baseline& No & - & 36.0 & 113.3 \\
\hline
\multirow{4}{*}{CLTA-128}
&\multirow{2}{*}{Vanilla} & First & 36.9 & 115.8  \\ 
& & Last  & 36.8 & 115.3 \\
\cline{2-5} 
&\multirow{2}{*}{Denoising} & First & 36.8 & 116.1  \\ 
& & Last  & 37.1 & \textbf{116.2} \\
\hline
                CLTA-512& Denoising & Last & \textbf{37.2} & 115.9 \\
\hline
\end{tabular}}

\caption{Additional quantitative evaluation results from different settings of the SAE decoder when trained with image captioning decoder. $\bh$ denotes the hidden state.} 
\label{table:sae_ablation}

\end{subtable}
\caption{Ablative Analysis for different settings on our (a) CLTA module and, (b) SAE regularizer training.}
\end{table}
     
      

\noindent
\textbf{Image Captioning Decoder with SAE Regularizer. }
\Cref{table:sae_ablation} reports ablations for our full image captioning model (Up-Down with CLTA) and the SAE regularizer.
As discussed in \cref{sec.method.sae}, SAE decoder (parameters defined by $\Theta_D$) is initialized with the hidden state of the image captioning decoder. 
During training, we test different settings of how the SAE decoder is trained with the image captioning decoder:
(1) Vanilla vs Denoising SAE and,
(2) $\bh^{\text{first}}$ vs $\bh^{\text{last}}$, whether the SAE decoder is initialized with the first or last hidden state of the LSTM decoder.
For all the settings, we fine-tune the parameters of GRU$_\text{D}$ ($\Theta_D$) when trained with the image captioning model (the parameters are initialized with the weights of the pre-trained Vanilla or Denoising SAE decoder). 

The results in Table \ref{table:sae_ablation} are reported on different combinations from the settings described above, with the CLTA having $128$ and $512$ dimensions in the image captioning decoder. 
Adding the auxiliary branch of SAE decoder significantly improves over the baseline model with CLTA and in the best setting, Denoising SAE with  $\bh^{\text{last}}$ improves the CIDEr and Bleu-4 scores by 1.2 and 0.6 respectively. 
As the SAE decoder is trained for the task of reconstruction, fine-tuning it to the task of captioning improves the image captioning decoder. 

Initializing the Vanilla SAE decoder with $\bh^{\text{last}}$ does not provide enough gradient during training and quickly converges to a lower error, hence this brings lower generalization capacity to the image captioning decoder. As $\bh^{\text{first}}$ is less representative of an entire caption compared to $\bh^{\text{last}}$, vanilla SAE with $\bh^{\text{first}}$ is more helpful to improve the captioning decoder training. 
On the other hand, the Denoising SAE being robust to noisy summary vectors provide enough training signal to improve the image captioning decoder when initialized with either $\bh^{\text{first}}$ or $\bh^{\text{last}}$ but slightly better performance with $\bh^{\text{last}}$ for Bleu-4 and CIDEr as it forces $\bh^{\text{last}}$ to have an accurate lower-dim representation for the SAE and hence better generalization. 
It is clear from the results in \cref{table:sae_ablation}, that Denoising SAE with $\bh^{\text{last}}$ helps to generate accurate and generalizable captions. From our experiments, we found that CLTA with $128$ topics and Denoising SAE (with $\bh^{\text{last}}$) has better performance than even it's counterpart with $512$ topics. Hence, for all our experiments in \cref{sec.ic.results} and \cref{sec.lessdata} our topic dimension is $128$ with Denoising SAE initialized with $\bh^{\text{last}}$.


\section{Conclusion}
\label{sec.conclusion}
In this paper, we have introduced two novel methods for image captioning that exploit prior knowledge and hence help to improve state-of-the-art models even when the data is limited.
The first method exploits association between visual and textual features by learning latent topics via an LDA topic prior and obtains robust attention weights for each image region.
The second one is an SAE regularizer that is pre-trained in an autoencoder framework to learn the structure of the captions and is plugged into the image captioning model to regulate its training.
Using these modules, we obtain consistent improvements on two investigate models, bottom-up top-down and the AoANet image captioning model, indicating the usefulness of our two modules as a strong prior.  
In future work, we plan to further investigate potential use of label space structure learning for other challenging vision tasks with limited data and to improve generalization. 


\bibliographystyle{splncs04}
\bibliography{egbib}
\end{document}


Peer reviews:

content: confidence: 4: The reviewer is confident but not absolutely certain that the evaluation is correct
rating: 9: Top 15% of accepted papers, strong accept
review: 1. [Summary] In 2-3 sentences, describe the key ideas, experiments, and their significance.

 The paper tries to mitigate overfitting and generating easy captions by introducing prior knowledge from the dataset during training. To this end, authors propose to add visual-semantic relation prior knowledge by defining a series of Latent Topics, and semantic prior knowledge by training a Seq2seq module with the text. While the former is introduced in the training procedure as a self-attention with image region features, the latter is utilized to remove visual biased on semantic structures. Apart from increasing results of state-of-the-art approaches, they demonstrate that with their approach, image captioning models can rely on less data when training.

2. [Strengths] What are the strengths of the paper? Clearly explain why these aspects of the paper are valuable.

 -	The paper is easy to read. Ideas are easy to follow.
 -	It is very well motivated.
 -	Benefits of both modules (CLTA and SAE Regularizer) are clearly demonstrated in the experiments.
 -	The implementation is very well explained in detail.
 -	The benefits of adding prior knowledge (visual and semantic) is showed.
 -	Additionally, authors demonstrate the relevance of prior knowledge as it allows to train models with less data.

3. [Weaknesses] What are the weaknesses of the paper? Clearly explain why these aspects of the paper are weak.

 -	Although the improvement exists, in some situations it is marginal.

4. [Overall rating] Paper rating.

 9

5. [Justification of rating] Please explain how the strengths and weaknesses aforementioned were weighed in for the rating.

 Good paper. Well written, well motivated, simple method and positive results. On top of that, very much in line with the workshop.

6. [Detailed comments] Additional comments regarding the paper (e.g. typos or other possible improvements you would like to see for the camera-ready version of the paper, if any.)

title: Injecting Prior Knowledge into Image Caption Generation

content: confidence: 3: The reviewer is fairly confident that the evaluation is correct
rating: 9: Top 15% of accepted papers, strong accept
review: [Summary] In 2-3 sentences, describe the key ideas, experiments, and their significance.

The authors propose two adding to prior knowledge based modules to image captioning models. One module uses prior knowledge on the association of keywords to image regions. The other module regularizes generated captions to be more realistic.

[Strengths] What are the strengths of the paper? Clearly explain why these aspects of the paper are valuable.

Simple but powerful ideas; clear methods; topical submission; excellent writing.

[Weaknesses] What are the weaknesses of the paper? Clearly explain why these aspects of the paper are weak.

By nature of the method experimental settings are complex; 

[Overall rating] Paper rating: Strong accept

[Confidence] 4/5

[Detailed comments] Additional comments regarding the paper (e.g. typos or other possible improvements you would like to see for the camera-ready version of the paper, if any.)

- Grammar: lines 40, 189
- Formatting: line 221
title: Powerful implementation of prior knowledge into image captioning models