Senti-Attend: Image Captioning using Sentiment and Attention

Senti-Attend: Image Captioning using Sentiment and Attention

Omid Mohamad Nezami Mark Dras Macquarie University, Sydney, NSW, Australia Stephen Wan CSIRO Data61, Sydney, NSW, Australia Cécile Paris CSIRO Data61, Sydney, NSW, Australia
Abstract

There has been much recent work on image captioning models that describe the factual aspects of an image. Recently, some models have incorporated non-factual aspects into the captions, such as sentiment or style. However, such models typically have difficulty in balancing the semantic aspects of the image and the non-factual dimensions of the caption; in addition, it can be observed that humans may focus on different aspects of an image depending on the chosen sentiment or style of the caption. To address this, we design an attention-based model to better add sentiment to image captions. The model embeds and learns sentiment with respect to image-caption data, and uses both high-level and word-level sentiment information during the learning process. The model outperforms the state-of-the-art work in image captioning with sentiment using standard evaluation metrics. An analysis of generated captions also shows that our model does this by a better selection of the sentiment-bearing adjectives and adjective-noun pairs.

1 Introduction

Image captioning systems aim to describe the content of an image using techniques from both computer vision and Natural Language Processing. The recent progress in designing visual object detection systems and language models together with large annotated datasets has led to a remarkable improvement in the ability to describe objects and their relationship displayed in an image. Generating factual captions is a challenging task as the image captioning systems are required to understand the semantic relation between the image and the caption.

Figure 1: An image with different foci for positive (“a beautiful well-appointed kitchen”) or negative (“ugly mugs”) sentiments.

Moreover, when humans produce descriptions of images, they often go beyond the purely factual, and incorporate some subjective properties like sentiment or stylistic effects, depending on broader context or goals; a recent widely discussed example was the photo of Donald Trump at the 2018 G7 Summit where he is seated with arms crossed in front of Angela Merkel; various commentators have described the photo in negative (“eyes glaring”) or positive (“alpha male”) terms. Researchers in image captioning have similarly proposed models that allow the generation of captions with a particular style [5] or sentiment [15]. This incorporation of sentimental/emotional information has also been applied to text generation [8] and conversation generation [32], and has been found to be an important element in image-grounded conversational agents [9].

In sentiment-bearing image captioning, the focus of the caption could be different depending on the desired sentiment. Figure 1 contains an example image from the dataset of human-authored sentiment-infused captions from [15], where all three negative captions focus on the mugs, and the positive captions focus on the light or the kitchen generally. Previous work in this domain usually does not use attention mechanisms [2, 14, 21, 28]; however, the state-of-the-art image captioning models do, and the above observation suggests it would be useful here. The Senti-Attend model that we propose in this paper, therefore, incorporates attention into the generation of sentiment-bearing captions.

As a second observation, we note that previous work usually injected sentiment using one-hot vectors at each step of the caption generation [15, 29], which can have the effect of forcing sentiment into a generated description of an image that is not semantically suited to the image. The second contribution of Senti-Attend model, then, is to embed the sentiment information in real-valued vectors, allowing the model to learn where sentiment can be applied without changing semantic correlations between the image and the generated caption. The model incorporates two kinds of sentiment embedding, which turn out to be complementary. The high-level embedding captures overall sentiment; it is fed into the long short-term memory (LSTM) network that handles the caption generation. The word-level embedding, in contrast, captures a notion of sentiment linked to the words in the vocabulary. The main contributions of the paper are highlighted as follows:

  • We propose an attention-based image captioning model called Senti-Attend to generate sentiment-bearing descriptions.

  • Our model applies two complementary sentiment information including high-level and word-level. In addition to incorporating sentiments to the generated captions, this mechanism preserves the factual dimensions of the captions.

  • The model outperforms the state-of-the-art models in generating sentimental descriptions.

2 Related Work

In our work we draw on both image captioning and controlled generation.

2.1 Image Captioning

Image captioning systems are usually designed according to a top-down paradigm and include a combination of a Convolutional Neural Network (CNN) and a long short-term memory (LSTM) to encode the visual content and generate the image descriptions, respectively [27], which is inspired from the work of Sutskever et al. [24]. The current state-of-the-art models in image captioning are attention-based systems [2, 14, 21, 28]. The models use visual content, referred to as spatial features, as the input of an attention mechanism to selectively attend to different parts of an image at each time step in generating the image caption.

Yu et al. [31] and You et al. [30] applied a notion of Semantic attention to detected visual attributes, which is learned in an end-to-end fashion. This attention model is used to attend to semantic concepts detected from various parts of a given image. Here, they used the visual content only in the initial time step. In other time steps, Semantic attention was used to select the extracted semantic concepts. That is, Semantic attention differs from spatial attention, which attends to spatial features in every time step, and does not preserve the spatial information of the detected concepts.

To preserve the spatial information, the salient regions are localized using spatial transformer networks [10], which get the spatial features as inputs. This is similar to Faster-RCNN generation of bounding boxes [20], but it is trained in an end-to-end fashion using bilinear interpolation instead of a Region of interest pooling mechanism [11]. Similarly, Anderson et al. [2] applied spatial features, but using a pre-trained Faster-RCNN and an attention mechanism to discriminate among different visual-based concepts regarding the spatial features.

2.2 Controlled Generation

Recently, Hu et al. [8] used variational autoencoders to control a generated sentence in terms of its attributes including sentiment and tense: they conditioned the sentence encoding process on these attributes. In conversation generation, Zhou et al. [32] used emotion categories to control the responses in terms of emotions. As a part of their system, they fed an embedded emotion as an input to their decoder. Ghosh et al. [6] proposed a model conditioning conversational text generation using affect categories. The model can control a generated sentence without previous knowledge about the words in the vocabulary. In our work, in contrast, we feed in embedded sentiments to capture both high-level and word-level sentiment information.

Moreover, image captioning systems control sentiment or other non-factual characteristics of the generated captions [5, 15]. In addition to describing the visual content, these models learn to generate different forms of captions. For instance, Mathews et al. [15] proposed SentiCap system to generate sentimental captions. Here, the notion of sentiment is drawn from Natural Language Processing [17], with sentiment either negative or positive. The SentiCap system of Mathews et al. [15] is a full switching architecture incorporating both factual and sentimental caption paths. It needs two-stage training: training on factual image captions and training on sentimental image captions. Therefore, it does not support end-to-end training.

To address this issue, You et al[29] designed two new schemes, Direct Injection and Sentiment Flow, to better employ sentiment in generating image captions. For Direct Injection, an additional dimension was added to the input of a recurrent neural network (RNN) to express sentiment. A related idea was earlier proposed by Radford et al[19] who discovered a sentiment unit in a RNN-based system. In the Direct Injection model, the sentiment unit is injected at every time step of the generation process. The Sentiment Flow approach of You et al[29] injects the sentiment unit only at the initial time step of a designated sentiment cell trained in a similar learning fashion to the memory cell in a long short-term memory (LSTM) network. Similar to the work of You et al[29], we have a single phase optimization for our image captioning model. In contrast, SentiCap, Direct Injection and Sentiment Flow models apply visual features only in the initial time step of the LSTM.

However, recent state-of-the-art image captioning models usually apply visual features, which are spatial ones, at each time step of the LSTM [2, 14, 21, 28]. Nezami et al. [16] also used spatial features at every step to generate more human-like captions, but for injecting facial expressions. In this work, therefore, we use an attention-based model to generate sentimental captions. In addition to this, we design a new injecting mechanism for sentiments to learn both high-level and word-level information. The high-level one involves injecting a sentiment vector to the LSTM. The fine-grained one involves using another sentiment vector to learn sentiment values appropriate at the word level.

3 Approach

Our image captioning model adapts a conventional attention-based encoder-decoder mechanism [2, 14, 21, 28] to generate sentiment-bearing captions; we call our adapted model Senti-Attend. Our model takes as the first input an image encoded into image feature sets, . Each set has dimensions to represent a region of the image, termed spatial features, . is usually generated using a convolutional layer of a convolutional neural network (CNN). As the second input, we have the targeted sentiment category () to generate the image description with specific sentiment. The model takes these inputs and generates a caption encoded as a sequence of 1-of- encoded words.

(1)

where is the size of the vocabulary and is the length of the caption.

3.1 Spatial Features

ResNet-152 [7] is used as the CNN model. It has been pretrained on the ImageNet dataset [22]. For use in our image captioning model, we use features from the Res5c layer of the CNN model. Then, we reshape the features into dimensions.

3.2 Targeted Sentiment Category

Our model aims to achieve an image description that is relevant to the targeted sentiment category. The sentiment categories are Positive, Negative , as per the SentiCap work [15]. We have the further sentiment category Neutral , which is for generating captions without dominant sentiment values. In our problem statement, we assume that the sentiment category is already specified, as previous work does. Because our model uses the targeted sentiment to describe an image, we can change the sentiment category to generate a different caption with a new sentiment value.

We embed the sentiment categories to give real value vectors, which are randomly initialized. Then, our model learns a sentiment category’s vector during training time. Using this mechanism, we allow our system to learn the sentiment information in an adaptive way with respect to visual and text data. Specifically, we use one sentiment embedding vector () as an additional input to a long short-term memory (LSTM) network. In addition, we use another embedding vector () as a supplementary energy term to predict the next word’s probability. , the embedding vector of the sentiment category, has dimensions, . is to model the high-level representation of the sentiment concept in the generated caption. represents desired word-level sentiment.

3.3 Captioning Model

In common with the architectures in [2, 14, 21, 28], but with a sentiment term added, Senti-Attend aims to minimize the following cross entropy loss (the first loss):

(2)
(3)

where , as the categorical probability distribution across all words in the vocabulary, is from the output of a multilayer perceptron; is the next targeted word, is from the ground truth caption; is the second embedded vector of sentiment; is the attention-based features, calculated using a conventional soft attention mechanism; is the hidden state of the LSTM, estimated using Equation 6; and and are our trained weights and bias, respectively. Similar to the previous work, the loss function contains a regularization term, to encourage the system to take equal notice to different parts of the image by the end of a caption generation process.

Senti-Attend also includes the following sentiment-specific cross entropy loss that we call the second loss:

(4)
(5)

where is the categorical probability distribution of the current state () across three sentiment classes Positive, Neutral, Negative , obtained from a multilayer perceptron; is the targeted sentiment class; and and are our trained weights and bias. Using this loss function, Senti-Attend model can learn the targeted sentiment class at the end of each time step. The model architecture is shown in Figure 2.111We also tried optimizing the CIDEr metric [26] similar to Rennie et al[21]; however, we could not achieve a better result. It is likely because we have a small number of captions with sentiment in our training set and optimizing the CIDEr metric leads to ignoring the sentiment-bearing parts of the captions.

Our LSTM decoder is defined by equations

(6)

where , , , and are input gate, input modulation gate, output gate, forget gate and memory cell respectively. Here, is a real value vector with dimensions to represent the previous word, , embedded using our model. is the first embedded vector of sentiment. It is used to condition the caption generation process using the targeted sentiment, which we refer as high-level sentiment. , and are trained weights and biases and is the logistic sigmoid activation function.

Figure 2: The framework of the Senti-Attend model. Spatial image features are attended using a conventional soft attention method. They are the outputs of our ResNet-152 network.
Senti Model B-1 B-2 B-3 B-4 ROUGE-L METEOR CIDEr SPICE
Pos Attend 57.1 33.8 20.6 13.1 45.3 17.8 69.2 17.2
Senti-Attend 56.0 32.3 18.7 11.1 43.6 18.7 60.8 15.9
Senti-Attend 57.1 34.1 21.0 13.2 45.5 18.1 69.9 16.8
Senti-Attend 56.4 33.2 19.7 12.3 44.2 18.0 65.0 16.1
Senti-Attend 57.6 34.2 20.5 12.7 45.1 18.9 68.6 16.7
Neg Attend 56.5 33.5 20.2 12.5 45.0 17.7 67.7 16.3
Senti-Attend 55.8 32.5 19.5 11.9 43.7 18.1 62.3 16.5
Senti-Attend 56.6 34.0 21.1 13.6 45.2 18.1 69.9 16.4
Senti-Attend 56.6 34.2 21.5 14.1 45.4 18.0 71.3 16.8
Senti-Attend 58.6 35.4 22.3 14.7 45.7 19.0 71.9 17.4
Avg Attend 56.80 33.65 20.40 12.80 45.15 17.75 68.45 16.75
Senti-Attend 55.90 32.40 19.10 11.50 43.65 18.40 61.55 16.20
Senti-Attend 56.85 34.05 21.05 13.40 45.35 18.10 69.90 16.60
Senti-Attend 56.50 33.70 20.60 13.20 44.80 18.00 68.15 16.45
Senti-Attend 58.10 34.80 21.40 13.70 45.40 18.95 70.25 17.05
Table 1: The image captioning results (%) of our models on the SentiCap test split. Pos, Neg, and Avg show the results on the positive test set, the negative test set and their average (the best performances are bold). B-N is BLEU-N metric.
Senti Model B-1 B-2 B-3 B-4 ROUGE-L METEOR CIDEr SPICE
Pos SentiCap 49.1 29.1 17.5 10.8 36.5 16.8 54.4 _
Direct Injection 51.2 30.6 18.8 11.6 38.4 17.2 61.1 _
Sentiment Flow 51.1 31.4 19.4 12.3 38.6 16.9 60.8 _
Ours: Attend 57.1 33.8 20.6 13.1 45.3 17.8 69.2 17.2
Ours: Senti-Attend 57.6 34.2 20.5 12.7 45.1 18.9 68.6 16.7
Neg SentiCap 50.0 31.2 20.3 13.1 37.9 16.8 61.8 _
Direct Injection 52.2 33.6 22.2 14.6 39.8 17.1 68.4 _
Sentiment Flow 51.0 33.0 21.9 14.8 39.4 17.0 70.1 _
Ours: Attend 56.5 33.5 20.2 12.5 45.0 17.7 67.7 16.3
Ours: Senti-Attend 58.6 35.4 22.3 14.7 45.7 19.0 71.9 17.4
Avg SentiCap 49.55 30.15 18.90 11.95 37.20 16.80 58.10 _
Direct Injection 51.70 32.10 20.50 13.10 39.10 17.15 64.75 _
Sentiment Flow 51.05 32.20 20.65 13.55 39.00 16.95 65.49 _
Ours: Attend 56.80 33.65 20.40 12.80 45.15 17.75 68.45 16.75
Ours: Senti-Attend 58.10 34.80 21.40 13.70 45.40 18.95 70.25 17.05
: Ours - Best Previous +6.40 +2.60 +0.75 +0.15 +6.30 +1.80 +4.76
Table 2: Our image captioning results (%) compared to the state-of-the-art models on the SentiCap test split.

4 Experimental Setup

4.1 Datasets

Microsoft COCO dataset

This dataset [3], which is the largest image captioning dataset, is used to train the Senti-Attend model. We use the specified training portion of the dataset which includes 413K+ captions for 82K+ images. This dataset can help our model to generate generic image captions.

SentiCap dataset

This dataset [15] is used to train our model to generate captions with sentiment. It includes manually generated captions with positive and negative sentiments. The training portion of the dataset consists of 2,380 positive captions for 824 images and 2,039 negative ones for 823 images.

For training our model, we combine the training sets of the Microsoft COCO and the SentiCap datasets similar to You et al[29], where all captions in the Microsoft COCO dataset are assigned the neutral label in terms of sentiment values. The validation set of the SentiCap dataset includes 409 positive captions for 174 images and 429 negative ones for 174 images. We use this set for model selection. Then the selected model is evaluated on the test set of the SentiCap dataset included 2,019 positive sentences for 673 images and 1,509 negative ones for 503 images. We separately report our results on the negative and positive parts of the test set similar to other work in this domain [15, 29].

4.2 Evaluation Metrics

We evaluate Senti-Attend model using SPICE [1], CIDEr [26], METEOR [4], ROUGE-L [13], and BLEU [18], which are standard evaluation metrics. Larger values are better for all metrics. Recently, the SPICE metric has shown a close correlation with human judgments. We have reported our results using SPICE for future comparisons, even though the previous work in this domain has not reported SPICE.

Moreover, to analyze the sentiment value of the generated captions using our model, all generated adjectives are tagged using the Stanford part-of-speech tagger software [25]. We apply the adjectives with strong sentiment values which are found in the list of the adjective-noun pairs (ANPs) of the SentiCap dataset (for example, cuddly, sunny, shy and dirty). Using Equation 7, we calculate Entropy. The variability of lexical selection can be indicated using Entropy (more variations corresponds to higher scores).

(7)

where is an adjective and is the probability of the adjective. is the number of unique generated adjectives.

We also calculate how often a model’s chosen nouns correspond to the constituent nouns of the ANPs in the reference captions. To do this we implement a simplified version of SPICE that only considers noun matches, ; this includes the SPICE functionality of matching WordNet synonyms [1] (for example, street and road). is an indication of how well the model’s captions attend to objects chosen by humans to add a particular sentiment to.

4.3 Models for Comparison

To evaluate our model’s performance in generating sentiment-bearing captions, we compare it with the state-of-the-art approaches in this domain. Mathews et al. [15] introduced a joint-training model, which is trained on the Microsoft COCO dataset and then on the SentiCap dataset; this is the SentiCap model. Subsequently, You et al[29] proposed two models for incorporating sentiment information into image captioning tasks, and they reported enhanced performance on the SentiCap dataset. The first of the two models, Direct Injection, adds a new dimension to the input of their caption generator to express sentiment. In the second model, Sentiment Flow, they developed a new architecture to flow the sentiment information in different caption generation steps.

For model-internal comparisons, we use our attention-based image captioning model without sentiment inputs (the Attend model); this allows us to assess the model’s performance without sentiment. We further define three variants of our general Senti-Attend system (Figure 2). First, we use one-hot embedding representations for the ternary sentiment instead of the two embedding vectors ( and ). We also do not use the second loss function. We call this model Senti-Attend. We speculate that the distributed representation of sentiment, analogous to those used in [32, 6], will allow a model to be more selective about where to apply sentiment, where this one-hot variant in contrast might force sentiment inappropriately. Second, we only use the first embedding vector () instead of both embedding vectors. Again, we do not use the second loss function. We call this approach the Senti-Attend model. Third, we only leave out the second loss function, giving the Senti-Attend model. We name our full approach, which uses both embedding vectors and the second loss function, the Senti-Attend model. All Senti-Attend models have a similar architecture applying high-level and word-level sentiment information.

4.4 Implementation Details

In this work, we set the size of the memory cell and the hidden state of the LSTM to 2048 dimensions for all models except the Attend model. The model has the memory cell and the hidden state with size of 1024 dimensions. The word embedding and the sentiment embedding vectors have 512 and 256 dimensions, respectively. The Adam optimization function with a learning rate of is applied to optimize our network [12]. We set the size of mini-batches to 180 for all models except the Attend model, which has mini-batches of size 100. Since we have a small number of sentiment-bearing captions in our training set, we use dropout [23] on and to prevent overfitting. The size of our vocabulary is fixed to 9703 for all models. Since METEOR is more closely correlated with human judgments and is calculated more quickly than SPICE (METEOR does not need dependency parsing) [1], it is used to select the best model on the validation set.

5 Results

5.1 Overall Metrics

Table 1 shows the comparison between our models. The Senti-Attend model has achieved the best performances for all evaluation metrics across positive, negative and average test sets. The Senti-Attend and Senti-Attend models have comparable performance (although we observe in Section 5.2 below that Senti-Attend produces better sentimental captions by those criteria). These two models, which are using the sentiment embedding vectors, outperform Senti-Attend for all evaluation metrics except METEOR, showing the effectiveness of our embedding approach. Here, we report the results of the Attend model to show the performance of our attention-based system without sentiment; however, the model is not effective in terms of sentimental captions (Table 3).

In Table 2, we report the results of Senti-Attend compared to the state-of-the-art approaches on the SentiCap dataset. For a fair comparison, our model is trained using a similar portion of Microsoft COCO and SentiCap datasets. We also use similar validation and test sets to evaluate our model. The model achieved better results compared to the previous state-of-the-art approaches by all standard evaluation metrics except Blue-4 for the negative test set, where the model is very marginally () lower than the Sentiment Flow model. However, the average results show that our model outperforms all state-of-the-art approaches on the SentiCap dataset. For example, our model achieved , , and improvements using Blue-1, ROUGE-L, and CIDEr metrics in comparison with the best previous state-of-the-art approaches, respectively. Using METEOR, the model achieved better performance compared to the approaches, which is showing closer correlation with human judgments. We also have , , and improvements using Blue-2 to Blue-4, respectively.

Senti Model
Pos Attend 2.2042 15.8 3 / 5
Senti-Attend 3.2840 13.7 169 / 432
Senti-Attend 3.2795 15.3 8 / 25
Senti-Attend 3.2691 14.4 60 / 171
Senti-Attend 3.2040 15.0 140 / 356
Neg Attend 2.1513 15.5 2 / 5
Senti-Attend 3.5681 18.1 141 / 305
Senti-Attend 3.5895 16.7 11 / 29
Senti-Attend 3.5396 17.7 35 / 76
Senti-Attend 3.7954 17.7 132 / 257
Avg Attend 2.17775 15.65 2.5 / 5.0
Senti-Attend 3.42605 15.90 155.0 / 368.5
Senti-Attend 3.43450 16.00 9.5 / 27.0
Senti-Attend 3.40435 16.05 47.5 / 123.5
Senti-Attend 3.49970 16.35 136.0 / 306.5
Table 3: The Entropy of the generated adjectives () and the SPICE of the generated nouns () using our models on the SentiCap test split. We also calculated the number of the generated ANPs, both overall and only those that are in the reference captions ().
Senti Model Top 10 Adjective
Pos Attend white, black, small, blue, little, tall, different, _, _, _
Senti-Attend nice, beautiful, great, happy, good, busy, white, sunny, blue, black
Senti-Attend white, black, blue, small, nice, little, beautiful, tall, sunny, happy
Senti-Attend great, nice, beautiful, white, black, blue, busy, right, healthy, happy
Senti-Attend beautiful, nice, sunny, great, busy, white, blue, good, happy, calm
Neg Attend white, black, small, blue, little, tall, different, busy, _, _
Senti-Attend dirty, stupid, lonely, bad, broken, cold, dead, little, crazy, white
Senti-Attend white, black, blue, small, little, dead, tall, busy, lonely, dirty
Senti-Attend dirty, white, black, dead, lonely, stupid, little, blue, broken, cold
Senti-Attend lonely, stupid, dead, dirty, broken, white, cold, black, bad, weird
Table 4: Top-10 generated adjectives using our models.
Figure 3: Examples of generated captions using our models. The top row contains positive generated captions and the bottom row contains negative ones (A for Attend, SA-2EL for Senti-Attend, SA-EL for Senti-Attend, SA-L for Senti-Attend, and SA for Senti-Attend). The last column includes some captions with some inconsistent parts.

5.2 Qualitative Results

In addition to calculating Entropy and explained in Section 4.2, we calculate the number of ANPs generated by our models, both overall and only ANPs which are found in the (sentiment-appropriate) reference captions (). From Table 3, the Attend model, which does not have sentiment inputs, achieves the lowest Entropy and ; moreover, in absolute numbers, it can only generate a few ANPs. The Senti-Attend model gives the highest Entropy and , and so has both the highest variability in adjective choice for describing sentiment, and also attends best to the objects (represented by nouns) that human annotators choose to apply sentiment to in captions; in addition, it is not only accurate, it generates a large number of relevant ANPs.

Although Senti-Attend can generate more ANPs, shows that Senti-Attend has better precision (measured by the ratio of the two terms) in generating ANPs which are compatible with the reference captions. further shows that Senti-Attend is less effective than other Senti-Attend models at choosing appropriate nouns. This accords with our intuition that the one-hot sentiment encoding do indeed force sentiment into captions in ways that are not optimal. Of the remaining models, Senti-Attend can generate more ANPs. It also has the best after Senti-Attend. Senti-Attend has the best Entropy after Senti-Attend and a good value of ; however, it does not generate many ANPs at all, indicating that having separate word-level sentiment is useful. As noted in the previous section, it achieved comparable performance to Senti-Attend for all overall evaluation metrics. This shows that generating both good performances for evaluation metrics (i.e. producing good captions in general), producing captions that have a high variety of sentiment terms and good alignment with objects chosen to apply sentiment to is a challenging issue in this domain. Nevertheless, the full Senti-Attend model is able to do well on all these competing objectives .

By way of examples, Table 4 shows the top-10 generated adjectives using our models. We observe that colours are repeated for both positive and negative generated captions (as they are in both positive and negative ground-truth captions): these commonly appear in non-sentiment-based captioning system outputs. Among our sentiment models, Senti-Attend ranks them high, whereas the others have sentiment-appropriate adjectives ranked higher. busy is seen in positive generated captions more than the negative ones. It also has a higher rank in the positive ground-truth captions compared to the negative ones. Attend has similar generated adjectives for both positive and negative ones because it does not use any sentiment signal.

Figure 3 shows a number of the example generated captions using our models. The first two columns include positive and negative captions for different images. For example, in the first column, Senti-Attend generates the caption “a dirty toilet in a dirty bathroom with a broken window”. The caption is compatible with the negative sentiment of the corresponding image. Other Senti-Attend models are also successful in generating negative captions for the image, but with less variability of expression. For instance, Senti-Attend generates “a dirty bathroom with a dirty toilet and a broken toilet”. Senti-Attend can generate “a kitchen with a nice table and a stove” caption, which positively describes its corresponding image. Senti-Attend and Senti-Attend can also generate positive captions. Here, Attend cannot generate sentiment-bearing captions. In the second column, we have similar generated captions. Columns three and four includes positive and negative captions for similar images. The captions show that Senti-Attend can manipulate and control the sentiment value of the captions using the targeted sentiment. For example, in the third column, Senti-Attend generates “a black bear is walking through a beautiful river” and “a black bear is walking through a muddy river” for the positive and negative sentiments, respectively. Senti-Attend can generate both types of sentiments, as well. Senti-Attend can generate a negative caption properly. In the forth column, all Senti-Attend models are successful in generating positive captions. The Attend model also generates a positive caption properly. Here, generating negative captions for the image is even challenging for humans. However, Senti-Attend and Senti-Attend models can effectively generate positive (“nice day” and “beautiful day”) and negative (“damaged building” and “lonely clock”) ANPs for the image. They choose different nouns for different sentiments which are compatible with the corresponding image. The last column shows some captions with some errors. For example, Senti-Attend generates “a beautiful woman in a green shirt standing next to a soccer ball”, which is not even semantically compatible with the image. In addition to generating sentimental captions, the captions should be compatible with their corresponding images. Senti-Attend can handle both topics properly although it has some errors in the generated captions (see supplementary material for more examples showing the effectiveness of the Senti-Attend model in comparison with other models to generate sentiment-bearing image captions).

6 Conclusion

In this work, we propose an attention-based image captioning model with sentiment, called the Senti-Attend model. One novel feature of this model is applying the attention-based features to effectively generate sentimental image captions. We also design a mechanism to incorporate embedded sentiments in generating image captions. The mechanism learns both high-level, which is conditioning our caption generator in general, and word-level, which is impacting on the word prediction process, sentiment information. We implement the mechanism with one-hot sentiment representation instead of sentiment embedding which results in less effective captions showing the effectiveness of our embedding approach. The Senti-Attend model significantly outperforms state-of-the-art work in this domain using all standard image captioning evaluation metrics. The qualitative results demonstrate that the improved performance is due to selecting sentimental adjectives and adjective-noun pairs in the generated captions.

References

  • [1] P. Anderson, B. Fernando, M. Johnson, and S. Gould. Spice: Semantic propositional image caption evaluation. In ECCV, pages 382–398. Springer, 2016.
  • [2] P. Anderson, X. He, C. Buehler, D. Teney, M. Johnson, S. Gould, and L. Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In CVPR, volume 3, page 6, 2018.
  • [3] X. Chen, H. Fang, T.-Y. Lin, R. Vedantam, S. Gupta, P. Dollár, and C. L. Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
  • [4] M. Denkowski and A. Lavie. Meteor universal: Language specific translation evaluation for any target language. In WMT, pages 376–380, 2014.
  • [5] C. Gan, Z. Gan, X. He, J. Gao, and L. Deng. Stylenet: Generating attractive visual captions with styles. In CVPR. IEEE, 2017.
  • [6] S. Ghosh, M. Chollet, E. Laksana, L.-P. Morency, and S. Scherer. Affect-lm: A neural language model for customizable affective text generation. arXiv preprint arXiv:1704.06851, 2017.
  • [7] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016.
  • [8] Z. Hu, Z. Yang, X. Liang, R. Salakhutdinov, and E. P. Xing. Toward controlled generation of text. arXiv preprint arXiv:1703.00955, 2017.
  • [9] B. Huber, D. McDuff, C. Brockett, M. Galley, and B. Dolan. Emotional dialogue generation using image-grounded language models. In Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems, page 277. ACM, 2018.
  • [10] M. Jaderberg, K. Simonyan, A. Zisserman, et al. Spatial transformer networks. In Advances in neural information processing systems, pages 2017–2025, 2015.
  • [11] J. Johnson, A. Karpathy, and L. Fei-Fei. Densecap: Fully convolutional localization networks for dense captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4565–4574, 2016.
  • [12] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
  • [13] C.-Y. Lin. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out, 2004.
  • [14] J. Lu, C. Xiong, D. Parikh, and R. Socher. Knowing when to look: Adaptive attention via a visual sentinel for image captioning. In CVPR, volume 6, page 2, 2017.
  • [15] A. P. Mathews, L. Xie, and X. He. Senticap: Generating image descriptions with sentiments. In AAAI, pages 3574–3580, 2016.
  • [16] O. M. Nezami, M. Dras, P. Anderson, and L. Hamey. Face-cap: Image captioning using facial expression analysis. arXiv preprint arXiv:1807.02250, 2018.
  • [17] B. Pang and L. Lee. Opinion mining and sentiment analysis. Found. Trends Inf. Retr., 2(1-2):1–135, Jan. 2008.
  • [18] K. Papineni, S. Roukos, T. Ward, and W.-J. Zhu. Bleu: a method for automatic evaluation of machine translation. In ACL, pages 311–318. Association for Computational Linguistics, 2002.
  • [19] A. Radford, R. Jozefowicz, and I. Sutskever. Learning to generate reviews and discovering sentiment. arXiv preprint arXiv:1704.01444, 2017.
  • [20] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis & Machine Intelligence, (6):1137–1149, 2017.
  • [21] S. J. Rennie, E. Marcheret, Y. Mroueh, J. Ross, and V. Goel. Self-critical sequence training for image captioning. In CVPR, volume 1, page 3, 2017.
  • [22] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
  • [23] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
  • [24] I. Sutskever, O. Vinyals, and Q. V. Le. Sequence to sequence learning with neural networks. In NIPS, pages 3104–3112, 2014.
  • [25] K. Toutanova, D. Klein, C. D. Manning, and Y. Singer. Feature-rich part-of-speech tagging with a cyclic dependency network. In NAACL HLT, pages 173–180. Association for Computational Linguistics, 2003.
  • [26] R. Vedantam, C. Lawrence Zitnick, and D. Parikh. Cider: Consensus-based image description evaluation. In CVPR, pages 4566–4575. IEEE, 2015.
  • [27] O. Vinyals, A. Toshev, S. Bengio, and D. Erhan. Show and tell: A neural image caption generator. In CVPR, pages 3156–3164. IEEE, 2015.
  • [28] K. Xu, J. Ba, R. Kiros, K. Cho, A. Courville, R. Salakhudinov, R. Zemel, and Y. Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, pages 2048–2057, 2015.
  • [29] Q. You, H. Jin, and J. Luo. Image captioning at will: A versatile scheme for effectively injecting sentiments into image descriptions. arXiv preprint arXiv:1801.10121, 2018.
  • [30] Q. You, H. Jin, Z. Wang, C. Fang, and J. Luo. Image captioning with semantic attention. In CVPR, pages 4651–4659. IEEE, 2016.
  • [31] Y. Yu, H. Ko, J. Choi, and G. Kim. End-to-end concept word detection for video captioning, retrieval, and question answering. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3261–3269. IEEE, 2017.
  • [32] H. Zhou, M. Huang, T. Zhang, X. Zhu, and B. Liu. Emotional chatting machine: Emotional conversation generation with internal and external memory. arXiv preprint arXiv:1704.01074, 2017.
Figure 4: Examples of positive generated captions with their corresponding images using the Senti-Attend model. The captions show the effectiveness of the model to generate positive captions which are compatible with the content of the images. For example, the model generates the relevant adjective-noun pairs (ANPs) including “nice bus”, “great sign”, “happy man”, and “pretty flowers” in the first row, which are positively describing the images.
Figure 5: Examples of positive generated captions using the Attend (A), Senti-Attend (SA-2EL), Senti-Attend (SA-EL), Senti-Attend (SA-L), and Senti-Attend (SA) models with their corresponding ground truth (Ref) descriptions. The SA model is the only approach which can add sentiment to the nouns having sentiment in the Ref descriptions. For instance, the model generates “beautiful building” in the first row where the Ref descriptions add “amazing” and “beautiful” to “building”. It can also generate “a great group of people” in the first row. Here, in the Ref descriptions, we have “a group of young beautiful people” and “a group of young amazing people” which similarly add the positive sentiment to “people”.
Figure 6: Sample positive generated captions using all models with their Ref descriptions. Here, the models can add sentiment to the nouns having sentiment in the Ref descriptions; however, the SA model is the most successful one. For example, in the first row, it can generate “tall tower” where we have “great tower” in the Ref descriptions. Here, the SA-EL model also generates “beautiful building” where we have “nice building” in the Ref descriptions.
Figure 7: Examples of negative generated captions using the Senti-Attend model, which are showing the effectiveness of the model to generate negative captions which are compatible with the visual content. For instance, the model properly generates the negative ANPs such as “cold air”, “broken umbrella”, “crazy face”, “dirty bed”, and “dead grass” in the first row.
Figure 8: Examples of negative generated captions using all models with their Ref descriptions. Only the SA model can add sentiment to its generated captions similar to the Ref descriptions. For example, it can generate “shy boy”. Here, we have “lazy guy”, “annoying guy”, and “poor guy” in the Ref descriptions which are negatively describing the boy in the image. The SA-EL model can generate “young boy”; however, “young” is not an adjective with a strong sentiment value in the SentiCap dataset.
Figure 9: Sample negative generated captions using the models with their corresponding Ref descriptions. Mostly, the SA model is successful to add sentiment to its generated captions which are similar to the Ref descriptions. For instance, in the first row, it can generate “damaged building” where we have “ugly building” and “abandoned building” in the Ref descriptions. “building”, which is chosen by the SA model to add sentiment to, is a part of the Ref ANPs. In the first row, the SA model also generates “weird flower” where we have “little flower”, “dead flowers” and “fragile flower” in the Ref descriptions. Here, the SA-L model correctly generates “dead flower”.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
""
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
   
Add comment
Cancel
Loading ...
320306
This is a comment super asjknd jkasnjk adsnkj
Upvote
Downvote
""
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters
Submit
Cancel

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test
Test description