A SSOCIATIVE C ONVERSATION M ODEL : G ENERATING V ISUAL I NFORMATION FROM T EXTUAL I NFORMATION
Anonymous authors
Paper under double-blind review
A BSTRACT
In this paper, we propose the Associative Conversation Model that generates visual information from textual information and uses it for generating sentences in order to utilize visual information in a dialogue system without image input.
In research on Neural Machine Translation, there are studies that generate translated sentences using both images and sentences, and these studies show that visual information improves translation performance.
However, it is not possible to use sentence generation algorithms using images for the dialogue systems since many text-based dialogue systems only accept text input.
Our approach generates (associates) visual information from input text and generates response text using context vector fusing associative visual information and sentence textual information.
A comparative experiment between our proposed model and a model without association showed that our proposed model is generating useful sentences by associating visual information related to sentences.
Furthermore, analysis experiment of visual association showed that our proposed model generates (associates) visual information effective for sentence generation.
I NTRODUCTION
In human conversation, communication is carried out on the premise that each other has common knowledge.
This is also true when humans use the dialogue system, and we conduct dialogue on the premise that the system has common sense.
Therefore, it is essential that the dialogue system has common sense.
However, it is nearly impossible for humans to organize and describe a huge amount of common sense, when the necessary time and cost are considered.
In the case of a human being, it is possible to acquire the knowledge through conversation with a person.
Hence, it is desirable for dialogue systems to acquire knowledge through conversation as well.
This has the advantage that human beings need not explicitly give knowledge to the system.
As a model that can extract knowledge from conversations, the encoder-decoder model has been proposed (Sutskever et al., 2014) (Vinyals & Le, 2015).
It consists of an encoder that encodes the input information into a context vector and a decoder that generates sentences using the context.
Vinyals & Le (2015) showed that it is possible to extract commonsense knowledge and to conduct conversation by learning pairs of dialogues with the model.
For example, Vinyals & Le (2015) reported that when asked who is skywalker, NCM responded “ he is a hero. ” .
Their conversation model (NCM) has a problem that it is not possible to respond properly to the input texts that require visual information.
For example, Vinyals & Le (2015) reported that when asked how many legs a spider have, NCM responded “ three, i think. ” .
Further, the image or video may contain more detailed information than texts.
Consider, for example, a scene in a news program including a closed caption “one player won the ﬁgure skating match” and showing images with skating players with gold medals.
Here, in the video, more detailed information such as a gold medal that does not exist directly in the text is presented.
We thought that if such detailed visual information could be extracted from the image, more speciﬁc and useful texts could be generated, including “ gold medals ” which can not be obtained with text alone.
In recent years, studies have been reported in which translated sentences are generated by adding image features to the context vector encoded by the encoder-decoder model (Calixto et al., 2017)
(Elliott & K´ad´ar, 2017)
(Nakayama & Nishida,
[Figure]
(Saha et al., 2016)
(Toyama et al., 2016).
These studies showed that visual information works effectively for generating translation.
Meanwhile, visual information is not considered in many text-based dialogue systems, because what is given to the input is only the utterance text.
How can the visual information be used without accepting visual information as the input to the dialogue system?
Based on the discussion above, we propose an Associative Conversation Model that associates the input text with the visual information and generates the response using both the text and the associated visual information.
In our proposed method, we attempted to generate response texts using visual information without inputting images.
The contribution of this research is as follows:
(cid:15)
We made it possible to generate visual information related to sentence textual information through end-to-end learning of dialogue.
(cid:15)
We made it possible to generate sentences using visual information without directly inputting visual information by association.
(cid:15)
Our proposed model can generate response texts including useful information compared with a model without association by associating visual information related to input text.
This is a useful method for constructing the text-based
dialogue
systems that automatically
extract information from the text and the video data (e.g. TV news) to generate sentences.
A SSOCIATIVE C ONVERSATION M ODEL 2. O VERVIEW OF ARCHITECTURE
Figure 1 shows our overall model.
The objective of this model is to enable for the decoder to generate a more appropriate response text which cannot be obtained only by textual information, by adaptively referring to the context vector based on visual information.
However, in this task, only the textual description is given as input.
Therefore, we adopted the following approach so that visual information can be utilized from the textual information.
(cid:15) First, visual association is performed from the input text, and the visual information corresponding to the text is generated.
(For example, ﬁgure 1 shows that the input text “ Today is Skating Championships ” is used to generate the visual information corresponding to a scene where a player in Skating Championships won the gold medal.)
(cid:15)
Next, by fusing the textual information and the associated visual information is obtained the information reﬂecting either or both as necessary.
[Figure]
(Figure 1 shows that the fused information is generated from the textual information “ Skating Championships ” and the visual information “ gold medal, skater ”.)
(cid:15) Finally, a response text is generated based on the fused information.
(Figure 1 shows that the fused information was used to decode the ﬁnal response “ Japanese female skater won the gold medal ”.)
Our approach is simple.
When generating sentences from the input texts and videos, an encoder for text and another for video can be used to acquire context vectors for text and for video, respectively.
In our task, however, the videos cannot be directly obtained from the input because only the textual information is given as input.
Therefore, our idea is to replace the encoder for video with a mechanism for generating the visual context vectors from texts.
The conﬁguration of this associative conversation model is simple, and is composed of the encoder for text and the decoder equipped with attention mechanism, as well as the visual association encoder from texts.
Associative encoder is an
RNN which generates visual context vectors from textual context vectors (see Sec 2.2.2).
We used
LSTMs for encoder, decoder, and the associative encoder, respectively (Hochreiter & Schmidhuber, 1997).
The input to the associative conversation model is textual descriptions only, and the output is a response text to the input.
This model generates the response text by inputting to the decoder the fused context vector obtained by fusing the textual context vector and the visual context vector generated from the input text.
The associative conversation model is able to learn the pairs of dialogue texts by end-to-end, like a normal encoder-decoder model.
Actually, however, two prior learnings are performed before training the associative conversation model.
One is the training of multimodal encoder-decoder model which generates a response text from the video and text.
The other is the training of the associative encoder which predicts the visual context vector from the textual context vector obtained by the multimodal encoder-decoder model.
2. L EARNING M ETHOD
Learning consists of the following three steps.
In order to learn the Associative Conversation Model in the ﬁnal step3, it is necessary to learn two models in step1 and step2.
Step 1 : Extraction of context vectors between textual and visual information
Figure 2a shows a network model used in step1.
End-to-end learning is performed on the model that inputs the utterance text X txt and the video X vis corresponding to the utterance and outputs the response sentence Y .
In this learning, the following four components are trained simultaneously.
(cid:15)
Textual encoder inputting X txt and outputting C txt which is the textual context vector (cid:15) Visual encoder inputting X vis and outputting C vis which is the visual context vector
(cid:15) Fusion layer inputting C txt and C vis and outputting the fused context vector C (cid:15) Decoder with attention mechanism, inputting C and outputting the response text Y
The trained model is used to extract the correspondence between the textual and visual information (see Fig. 2a).
Step 2 : Learning association
In this step, the associative encoder is trained, which inputs the textual context vector C txt extracted in step1 and outputs the visual context vector C vis corresponding to the input utterance text.
Step 3 : Generating responses using association
In step3, learning is performed in the network where the visual encoder in step1 is replaced with the associative encoder trained in step2.
This model is a generation-based model which inputs X txt , and outputs a response text Y , by using the fused context vector C obtained from C txt and C vis in the fusion layer.
That is, the structure of the Associative
Conversation Model is the same as the network of step1, except that it uses an associative encoder instead of the visual encoder.
In the fusion layer, the decoder with attention, the weights learned in step1 are initialized and and trained again.
In textual and video encoders, the weights trained in step1 are left unchanged, and are not updated.
It should be noted that what is trained in this model are only the decoder, the attention, and the fusion layer.
2.2. S TEP 1 : E XTRACTION OF CONTEXT VECTORS THE CORRESPONDENCE BETWEEN THE TEXTUAL AND VISUAL INFORMATION
The training data used in this step are the utterance text, the video corresponding to the utterance text, and the response text for the utterance.
We used videos rather than images because the texts often include the expression of actions.
We created the dataset based on TV programs as they contain the utterance texts, their corresponding videos, and their response texts.
First, the closed caption texts were extracted from TV news programs as the utterance texts X txt .
Also, the scenes corresponding the temporal intervals where the utterances occurred were extracted as the sequence of images X vis from the TV news programs.
For more information on the dataset, see Sec 3.
Here, the utterance
X txt is represented by the sequence of the corresponding word x txt .
Similarly, the video X vis corresponding to the utterance text is represented by the sequence of image features x vis .
In this work, the image features acquired by the already learned CNN were used instead of learning the image features directly from the input video.
Therefore, the input to the prior learning models are the sequence of word vectors X txt =
( x txt 1 ; :::::; x txtL ) and the sequence of image feature vectors
X vis = ( x vis 1 ; :::::; x visF ) .
Also, the output is the sequence of words vectors Y =
( y 1 ; :::::; y T ) .
Here,
L , F , and T represent the length of each input text, the number of the input images, and the length of the output text, respectively.
The model used in step1 is the multimodal encoder-decoder model consisting of a textual encoder, a visual encoder, and a decoder with attention (Bahdanau et al., 2014) .
In step1, the textual and visual encoders encode the input text and video, respectively, to obtain the context vectors C txtt and C vist .
Then, C t which is the fused context vector is input to the decoder to generate a response text.
For extracting context vector C t , the attention mechanism was used.
[Equation]
Attention mechanism can extract a context vector that strongly reﬂects some parts of the sequence corresponding to the words of the response text.
For example, when the word “ spider ” of the text and the image of the spider were paid attention to, the textual and visual context vectors of the spider are generated, respectively.
In this case, there is a correspondence relations between the textual and visual context vectors.
So, in step2, the associative encoder which predicts the visual context vectors from the textual context vectors is trained.
The purpose of step1 is to extract the textual and visual context vectors having correspondence relations to be used for learning in step2.
The usual attention-based encoder-decoder model calculates the context vectors by Eq.
(3), (4), and (5).
h i is the intermediate vector of the bidirectional LSTM computed from the input sequence h
i
=
[ (cid:0)!
h i ; (cid:0) h i ] (Schuster & Paliwal, 1997).
[Equation] [Equation]
Meanwhile, the multimodal encoder-decoder model acquires two context vectors C txtt and C vist .
Thus, the multimodal encoder-decoder model uses the following equations instead of Eq. (3) (4) and (5).
[Equation]
Also, there are some responses that do not always require visual information in the dialogue.
Therefore, the decoder needs to be able to measure which of the textual and visual information should be paid attention to and how strongly it should be focused.
The degree to which the textual and visual context vectors C txtt and C vist should be referred to can be learnt by introducing the weight matrices and by multiplying them to C txtt and C vist , respectively.
Therefore, the context vector eventually passed to the decoder is the fused context vector having how strongly the textual and visual information should be referred to. [Equation]
[Equation]
This fused context vector C t is used to predict the next word in the decoder.
We call this layer the fusion layer.
We learn the parameters W txt , W vis , and the biases b c .
After training the multi-modal encoder-decoder model, the training data is again input to the model to save the textual and visual context vectors.
2.2. S TEP 2 : L EARNING FOR VISUAL ASSOCIATION
In step2, the visual associative encoder is trained.
The associative encoder is trained so that it can predict the visual context vector from the textual context vector.
In addition, the associative encoder decides the next visual context vector by referring to the past textual context vectors.
Let us consider the following example.
The visual information (visual context vector) associated with the word “ squeeze ” is diverse.
For example, the phrases “ squeeze a lemon ”, “ squeeze a person’s hand ”, and “ squeeze toothpaste out ” would make us imagine the different visual situations representing “ squeeze ”.
In this example, the phrases “ lemon ”, “ person’s hand ”, and “ toothpaste ” make the situation of “ squeeze ” more concrete.
In this work, the association is to generate the corresponding visual information from the textual information.
Namely, there is a demand that the model can imagine what to “ squeeze ”.
Here, suppose that a context vector “ squeeze ” is obtained by the attention mechanism.
If the context vector “ lemon ” was obtained before this point, it will be possible to generate the visual information of “ squeeze a lemon ” from the context vectors of “ lemon ” and “ squeeze ”.
This indicates the utilization of temporal features.
Therefore, RNN is used for the associative encoder.
Accordingly, the associative encoder can be seen as a regression model with the input sequence of context vectors of words C txt =
( C txt 1 ; :::; C txtt ; :::; C txtT ) and the output sequence of context vectors of images C vis = ( C vis 1 ; :::::; C vist ; :::::; C visT ) (Eq.
Here, T is the length of the output text.
We used LSTM which is capable of learning long-term dependence.
[Equation]
2.2. S TEP 3 : G ENERATING RESPONSES WITH VISUAL ASSOCIATION
In step3, the associative conversation model learns response texts using the associative visual information instead of visual information directly obtained from video (see Fig. 2b).
The input to the associative conversation model is the sequence of words X txt =
( x txt 1 ; :::; x txtL ) .
The output is also the sequence of words Y =
( y 1 ; :::::; y T ) .
In the associative conversation model, the visual encoder obtained in the prior learning of step is replaced with the associative encoder.
Therefore, the architecture of the associative conversation model can be obtained by replacing Eq. (7) in step1 with Eq.
In other words, the mechanism of blending the textual and visual information trained in step1 is left unchanged, and the visual context vector is predicted from the textual context vector by the associative encoder.
The visual context vectors as well as the textual context vectors are given to the decoder, and the decoder, the attention, and the fusion layer (Eq. (12)) are trained.
The weights of the decoder, the attention and the fusion layer are initialized, and the weights obtained by prior learning of step1 is not used.
The weights in the textual and associative encoders are not updated, and the same parameters used in the prior learning of step1 are given.
The reason for re-training the decoder, the attention and the fusion layer is because the associative visual representation has different property from the visual context vector generated in step1.
The associative visual representation is different from the visual context vector obtained in step1.
We thought that re-training parts other than encoding of semantic representation enables to generate response texts using the associative visual elements in common knowledge.
D ATASET
The model was learned using the following data collected independently: subtitles in TV news and the corresponding video where the subtitles were displayed.
The visual encoder of the model of step1 encodes a sequence of images (video).
Note that the subtitles were delimited by “ ! ” , “ ? ”, or Japanese period to acquire sentences, and a pair of one sentence and the following sentence was regarded as one dialogue.
Therefore, the response text of a certain utterance becomes the next input utterance.
Also, the video was cut out as a frame sequence with a frame rate of 5 fps.
Each frame was input to the prior learned convolutional neural network, and the output of the last pooling layer was used as the image features.
VGG was used for the convolutional neural network (Simonyan & Zisserman, 2014).
The recorded programs were 163 Japanese TV news broadcast in from December, 2016 to March, 2017, having 38K dialogues and 19K vocabulary words.
Data was divided into 34K dialogue for training data and 4K dialogue for test data.
E XPERIMENTS
In this section, we describe the result of comparison between an Associative Conversation Model and a model without association.
We used a encoder-decoder model with attention that caused the pair of dialogue sentences for the baseline model.
The baseline model generate a sentence Y as utterance text X txt .
Both the proposed model and the baseline model was trained with the same dialogue sentences, and we investigated the effect of association.
In addition, we visualized the associated objects, and investigated whether associative conversation model acquired effective visual information for response generation.
As a result of the experiments, we found that the association works effectively to generate sentences with useful information.
We also found that our proposed model associates visual information related to input texts.
4. M ODEL C ONFIGURATION
In the step1, we used single layer LSTMs as both the encoders and the decoder.
The hidden layer dimension of the textual encoder was set to 512, the hidden layer dimension of the visual encoder to 512, the dimension of the fused context vector to 1024, and the hidden layer dimension of the decoder to 1024, the dimensionality word embeddings was set to 512, the dimensionality image feature was set to 512, the batch size was set to 64.
Adagrad was used for optimization (Duchi et al., 2011).
Associated image
Input
The University Entrance exam will be held on 14th and 15th.
Well, today is All Japan Figure Skating
Championships.
Output (ACM)
It is highly expected to be snowy and windy.
A player who has won the gold medal in women's singles.
Output (Baseline)
There will be a large-scale ﬁre that is also in western Japan and eastern Japan.
Aiming for four consecutive championships in the women's singles, athletes of the
Japanese championships participated in the tournament.
Generated
[Figure]
Snowy [Figure] In the step2, the associative encoder is composed of 4-layer LSTM with the hidden layers dimension being 1024, the batch size was 64.
Adam was used for optimization (Kingma & Ba, 2014).
In the step3, the model is composed of a textual encoder, decoder, and a associative encoder instead of visual encoder. The hidden layer dimension of the textual encoder was set to 512, the dimension of the fused context vector to 1024, and the hidden layer dimension of the decoder to 1024, the dimensionality word embeddings was set to 512, the batch size was set to 64.
Adagrad was used for optimization
Also, in the step3, weights and biases of the decoder and attention were used the weights in step and not updated.
The weights of associative encoder were not updated either.
The weights of the decoder are initialized in the step3 (See Eq. (1), (2), (10), (11), and (12)) .
The baseline model is composed of single layer LSTMs as the encoder and the decoder.
The hidden layer dimension of the textual encoder was set to 512, the dimension of the fused context vector to 1024, and the hidden layer dimension of the decoder to 1024, the dimensionality word embeddings was set to 512, the batch size was set to 64.
Adagrad was used for optimization.
4. R ESULTS
Figure 3 shows the texts generated from the test data by our model or by the baseline , and the images that are similar to the associated visual information. We faithfully translated the Japanese sentences which the models generated into English. This results show that our model generated texts with more useful information than the baseline.
For example, in the example on the left of the ﬁgure 3, the proposed model generated a speciﬁc weather forecast with the word “ snowy ” for the input sentence “ The University Entrance exam will be held on 14th and 15th. ”. Note that it is a fact that the snow actually fell on the day of the exam, and that the images showing that it was snowing at the venue of the exam were included in the training data. The important point here is that the word “ snowy ” cannot be easily generated from the input sentences alone, but is a word that can be generated for the ﬁrst time in association with the image of snow. On the other hand, the result generated by the baseline is “ There will be a large-scale ﬁre that is also in western Japan and eastern Japan ” and contains erroneous information such as “ ﬁre ”.
In the example on the right of the ﬁgure 3), the proposed model generated the text including the word “ gold medal ” for the input sentence “ Well, today is All Japan Figure Skating Championships. ”. In addition to this example, it was conﬁrmed that the proposed model with the associative function generated useful sentences with more speciﬁc information than the baseline without it. These results suggest that association works effectively to generate sentences with more speciﬁc information.
In order to verify this, we analyzed what kind of visual information was generated by the associative encoder. 4. A NALYSIS OF VISUAL ASSOCIATION Figure 3 shows the analysis result of the association. These results show that our model successfully associated visual information related to the input sentence.
The upper image in Fig. 3 is “ the image with the highest similarity to the associative representation generated by association from the input sentence by the proposed model ”. We calculated the cosine similarity between the semantic representation C vis obtained in step1 and the semantic representation C ′ vis generated by the associative encoder. Also, we assumed that the images that were paid attention to at the time indicated by the value of (cid:11) vis which is derived when the most similar semantic representation C vis was generated, are associative images.
In other words, the image in Fig. 3 was obtained by visualizing the associative visual information from texts using images in the training data.
From the result of Fig. 3, it is conﬁrmed that the visual information matching the contents of the sentence can be associated.
For example, the example to the right of Fig. 3 shows that a scene where a skating player acquired a gold medal was obtained by visual association on the topic of “ skating championship ”, although it misunderstood ﬁgure skating as speed skating. Also, the word “ gold medal ” was generated from its association result. The associated image includes a player holding the gold medal and other players skating behind her.
Multiple examples were found, in which the images matching the input sentence were successfully associated like this. Some of these examples are found in the appendix.
Also, these examples show that useful words were generated which are difﬁcult to generate easily without any association. For example, it is difﬁcult to generate the word ”snow” from the sentence ”the University Entrance exam will be held on 14th and 15th”, without the visual association that it actually snowed around the venue at that time.
However, there remain several problems.
In some examples, it was conﬁrmed that the visual information was associated with a topic different from the input sentence.
For example, in the example above, a scene where a speed skating player won the gold medal was associated with the topic about ﬁgure skating.
It is expected that this can be improved by increasing the amount of the training data.
Also, the proposed model could not generate a good reply to the utterances in a colloquial tone, because the learning was performed using the training data composed of sentences of news programs.
A solution to this is to learn by training data composed of general dialogue sentences instead of news sentences when re-learning the model using the fused context vectors in step 3.
That is, using the knowledge extracted by the encoders in steps 1 and 2, relearning is performed in step 3 using general dialogue sentences.
Once the knowledge can be extracted, the model can be trained more efﬁciently by performing only step 3 according to the task (e.g. general conversation).
R ELATED W ORK
In studies about conversation model based on maltimedia data, Mostafazadeh et al.
(2017) used deep neural network models trained on social media data (pair of image and text), and show their approach improves the quality of response generation.
Although they assumed Image-Grounded Conversations, we developed their idea and assumed the case of not using the images during the conversation.
In recent years, studies have been reported in which translated sentences are generated by adding image features to the context vector encoded by the encoder-decoder model (Calixto et al., 2017) (Elliott & K´ad´ar, 2017) (Nakayama & Nishida, 2017)
(Saha et al., 2016)
(Toyama et al., 2016).
These studies showed that visual information works effectively for generating translation.
The approaches that use images only when training such as our approach are Toyama et al.
(2016) and
Elliott & K´ad´ar (2017).
(Toyama et al., 2016) proposed a neural machine translation model that introduces a continuous latent variable containing an underlying semantic extracted from texts and images.
Their model is the encoder-decoder with attention, but there is a mechanism to generate the latent variables.
When for predicting a translation in decoder inputting the sentence to encoder, decoder generate a target word using a latent variable generated from the source text, target text, and an image.
(Elliott & K´ad´ar, 2017) show their approach using multitask learning model, inputting the text and outputting the text and the image feature, improves translation performance.
The network of structure is attention-based encoder-decoder, but has two decoders outputting text or image feature vector ^ v .
This decoder outputting image feature vector is trained to predict the true image vector v .
There are important differences between our approach and their approaches.
First, although their approach has given the image as a visual information when training, our approach has given the video (sequence of image features) to expand their approach.
By this extension, we think our model is able to learn words expressing motion effectively.
Secondly, we are dealing the dialogue task, not the translation task.
Thirdly, we challenged our model extract knowledge from the noisy data that the visual information at that time and the sentence does not necessarily correspond (News of the video and subtitle).
Therefore, our model includes a fusion layer learning to use the measure of visual information and textual information (Eq.
The difference between Elliott & K´ad´ar (2017) and our approach is our approach is not multitask learning model, thus out model receives input of visual information.
Hence it is possible to perform attention to visual information during training can be extracted visual information according to the response word.
C ONCLUSIONS
In a study applying a sentence generation algorithm of translation sentence to a conversation model, there was a problem that it was not possible to respond well to an input text which requires visual information.
However, it is not possible to use sentence generation algorithms using images for the dialogue systems since many text-based dialogue systems only accept text input.
Based on the discussion above, we propose an Associative Conversation Model that associates the input text with the visual information and generates the response using both the text and the associated visual information.
Comparative experiments with models that do not use association show that association of visual information related to input texts produces response texts that contain valuable information compared to models without association.
Analysis of association also showed that our proposed method can generate visual information related to sentence textual information through end-to-end learning of dialogue.
Our approach is a useful for constructing the text-based dialogue systems that automatically extract information from the text and the video data (e.g. TV news) to generate sentences.  A PPENDIX Associated image Input
The Grand Sumo Tournament is in the second day.
In the pitchers, three people including Otani has been selected from the Nippon Ham pitchers.
Output (ACM)
Today, Yokozuna Hakuho will aim for the ﬁrst victory.
This is an athlete .
Output (Baseline)
No. 1 is No. 1 in 1 meter.
Baseball is out in the professional this season.
Generated word
Yokozuna (The highest rank in sumo)
Athlete (a) Topic : Sports
Associated image
Input
The vicinity of Honshu is expected to be covered widely by mobile high pressure.
In the morning of tomorrow, it is affected by the developing low pressure mainly in the western Japan and East Japan Sea side.
Output (ACM)
Tomorrow morning, it will be sunny in many places from western Japan to eastern Japan, and western Japan side of the Sea side.
Please also note the inﬂuence on the trafﬁc caused by windstorms , heavy blizzards, and snowdrift.
Output (Baseline)
Then, the weather in various places of tomorrow.
Vigilance is necessary for windstorms and high waves.
Generated word
Sunny
Trafﬁc, Windstorms (b)
[Figure]
: Weather