Dynamic Graph Generation Network: Generating Relational Knowledge from Diagrams

11/27/2017 ∙ by Daesik Kim, et al. ∙ 0

In this work, we introduce a new algorithm for analyzing a diagram, which contains visual and textual information in an abstract and integrated way. Whereas diagrams contain richer information compared with individual image-based or language-based data, proper solutions for automatically understanding them have not been proposed due to their innate characteristics of multi-modality and arbitrariness of layouts. To tackle this problem, we propose a unified diagram-parsing network for generating knowledge from diagrams based on an object detector and a recurrent neural network designed for a graphical structure. Specifically, we propose a dynamic graph-generation network that is based on dynamic memory and graph theory. We explore the dynamics of information in a diagram with activation of gates in gated recurrent unit (GRU) cells. On publicly available diagram datasets, our model demonstrates a state-of-the-art result that outperforms other baselines. Moreover, further experiments on question answering shows potentials of the proposed method for various applications.



There are no comments yet.


page 6

page 12

page 13

page 14

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Within a decade, performances on classical vision problems such as image classification [6], object detection [4, 15], and segmentation [16]

have been largely improved by the use of deep learning frameworks. Based on the great successes of deep learning for such low-level vision problems, a next step could be deriving semantics from images such as relations between objects. For example, to understand a given soccer scene more deeply, it would be very important not only to detect the objects in the image, such as players and a ball but also to figure out the relationships between the objects.

Figure 1: Examples of how relational knowledge can be generated from a diagram. In the first row, inputs are only diagrams which have various types of topics, illustrations, texts and layouts. Our model can infer a graphical structure in a diagram as in the second row. In the end, we can extract relational knowledge in the form of sentence from the generated graphs.

In this work, among various vision problems, we aim to understand diagram images, which have played a major role in classical knowledge representation and education. Previously, most machine learning algorithms have focused on extracting knowledge from the information described by natural languages or structured databases (e.g. Freebase

[2], Wordnet [19]). In contrast to language-based knowledge, a diagram contains rich illustrations including text, visual information and their relationships, which can depict human’s perception of objects more succinctly. As shown in Figure 1, some complicated concepts such as “food web in a jungle” and “life cycle of a moth” can be easily described as a diagram. On the other hand, a single natural image or a single sentence may not be sufficient to deliver the same amount of information to the readers.

Whereas the diagram has good characteristics of knowledge abstraction, it requires composite solutions to properly analyze and extract the contained knowledge. Since diagrams in a science textbook employ a wide variety of methods for explaining concepts in their layout and composition, understanding a diagram can be a challenging problem of inferring human’s general perception of structured knowledge. Unlike conventional vision problems, this task must involve inference models for vision, language and particularly relations among objects which can be a novel point. Despite the noted arbitrariness, we believe that a simple method generally exists to analyze and interpret the knowledge conveyed in a diagram.

There have not been many studies on diagram analysis yet, but Kembhavi et al[8] recently proposed a pioneering work analyzing the diagram’s structure. The main flow of the algorithm is twofold: 1) Object detection: Objects in the diagram are detected and segmented individually by conventional methods such as those in [1, 10]. 2) Relation inference: The relations among detected objects are inferred by a recurrent neural network (RNN) to transmit contexts sequentially. However, this approach has several limitations. First, concatenating separated methods results in a long pipeline from input to output, which can cause accumulated errors and lose contexts on a diagram. Second, and more importantly, the vanilla RNN is not fully capable of dealing with the information formed as a graph structure.

Figure 2: Overview of the unified diagram parsing network (UDPnet). In (a) the detection branch, an object detector can extract objects of 4 different types. Then in order to exploit pairs of objects, we produce relationship candidates with duplicated objects. (b) In the graph generation branch, we pass local features from candidates to the dynamic graph generation network (DGGN) with a global feature . In the final step, each relationship candidate can be determined whether it is valid or not. At last, we can establish a relationship graph with nodes and edges.

In this paper, we propose a novel method to solve the aforementioned issues. Our contributions are twofold. First, using a robust object detection model and a novel graph-based method, a unified diagram parsing network (UDPnet) is proposed to understand a diagram by jointly solving the two tasks of object detection and relation matching, which tackles the first limitation of the existing work. Second, we propose a RNN-based dynamic graph generation network

(DGGN) to fully exploit the diagram information by describing with a graph structure. To solve the problem, we propose a dynamic adjacency tensor memory (DATM) for the DGGN to store information about the relationships among the elements in a diagram. The DATM has features of both an adjacency matrix in graph theory and a dynamic memory in recent deep learning. With this new type of memory, the DGGN suggests a novel way to propagate information through the structure of a graph. In order to demonstrate the effectiveness of the proposed DGGN, we evaluated our model on a couple of diagram datasets. We also analyzed the inside of GRU

[3] cells to observe the dynamics of information in the DGGN.

2 Related Works

Visual relationships:

Studies on visual relationships have been emerging in the field of computer vision. This line of research includes detection of visual relationships

[17, 13] and generation of a scene graph [7]. Most of these approaches are based on algorithms for grouping elements by relationships, and aiming to find relationships among the elements. Recently, this research field has focused on the scene graph analysis algorithm, which tackles the problem of understanding general scenes in natural images. Lu et al. [17] incorporated language prior to reasoning over a pair of objects and Xu et al. [23] solved scene graph inference using GRUs via iterative message passing. Whereas most of the previous studies dealt with natural images, we aim to infer visual relationships and generate a graph based on these relationships. Moreover, our method extracts knowledge from an abstracted diagram by inferring human’s general perception.

Neural networks on a graph: Generalization of neural networks for arbitrarily structured graphs has drawn attention in the last few years. Graph neural networks (GNNs) [20] were introduced as an RNN-based model that iteratively propagates nodes in the graph until the nodes reach a stable fixed point. Later, Li et al. [14] proposed gated graph neural networks (GG-NNs), which apply GRU as an RNN model for the task. In contrast to the RNN-based models, Marino et al. [18] proposed graph search neural network

(GSNN) to build knowledge graphs for multi-label classification problems. GSNN iteratively predicts nodes based on current knowledge by a way of pre-trained ‘importance network’. The main difference between previous methods and ours is that our model can generate a graph structure based on relationships between nodes. Since generating a graph should involve in dynamic establishment or removal of edges between nodes, we also adopt RNN for DGGN as most neural-network-based methods for a graph. The proposed DGGN not only works by message-passing between nodes, but also builds the edges of a graph online, which provides great potential for graph generation and solution of inference problems.

Memory augmented neural network: Since Weston et al. [21]

proposed a memory network for the question answering problem, a memory augmented network became popular in natural language processing. This memory component has shown great potential to tackle many problems of neural networks such as catastrophic forgetting. In particular, Graves

et al

. applied the memory component in Neural Turing machine

[5], and showed that the neural network can update and retrieve memory dynamically. Using this concept, a number of dynamic memory models have been proposed to solve multi-modal problems such as visual question answering [12, 22]. In this paper, we incorporate the scheme of the dynamic memory in DGGN to easily capture and store the graph structure.

3 Proposed Method

Figure 2 shows a overall framework of the proposed UDPnet. The proposed network consists of two branches: 1) an object detection network, and 2) a graph generation network handling the relations among the detected objects. In the first branch, a set of objects in a diagram image is detected. In the second branch, the relations among the objects are generated. We define an object as , and a relation in the form of . Both branches can be optimized simultaneously by a multi-task learning method in an end-to-end manner. After the optimization process, we can use the generated relational information to solve language-based problems such as question-answering.

3.1 Detecting Constituents in a Diagram

As seen in the Figure 1

, various kinds of objects can be included in a diagram depending on the information being conveyed. Those objects are usually described in a simplified manner and the number of object classes is huge, which makes detecting and classifying objects more difficult. In our work, instead of detecting classical object types such as cats and dogs, we define objects in four categorical classes which are adequate for diagrams: blob (individual object), text, arrow head and arrow tail. As a detector, we used SSD

[15] which has been reported to have a robust performance.

3.2 Generating a Graph of relationships

3.2.1 Overall Procedure of Graph Generation

In our method, the relation matching for objects in a diagram is conducted by predicting the presence of an edge between a pair of vertices using graph inference. The nodes and edges of a graph match to the objects and the relations of paired objects, respectively. Therefore, the graph is described as a bipartite graph,


where represents the set of paired disjoint vertices and , and denotes edges of the graph each of which connects a pair of nodes and . To construct a bipartite graph, we duplicate the detected objects as and and assume that those two sets are disjoint. Then we predict whether an edge between the nodes and exists.

The connection between nodes is determined by their spatial relationship and the confidence score for each object class which is provided by the object detector. Note that we do not use convolution features from ROI pooling because there can be various kinds of objects in a diagram, whose shape and texture are hard to be generalized. Instead, we define a feature for the object including location (xmin, ymin, xmax, ymax), center point (xcenter, ycenter), width, height and confidence scores. Thus, the relationship between two objects and is described as local feature

, and the feature vector

acts as an input to a RNN layer. To prevent the order of local features in a sequence from affecting the performance, we randomly shuffle the order of the features before training in every iteration.

Furthermore, to extract the layout of a diagram and spatial information of all objects, a global feature is utilized as an input to the RNN. The global feature is constructed by the sum of the convolution feature of conv-7 layer () of backbone network in the first branch and the binary mask feature of a diagram (). To match the dimension of conv-7 feature as that of hidden units, we use a fully connected layer in the last step. For the mask feature, we pass the

dimensional binary mask map to the 4 layered convolution and max pooling to match the dimension to the hidden unit, where

and are the width and height of an image, and is the number of object classes.

3.2.2 Dynamic Graph Generation Network

Figure 3: Comparison of the vanilla GRU and the proposed DGGN. (a) In vanilla RNN, information is sequentially transmitted only to a randomly selected next cell. (b) In DGGN, past hidden states are calculated with the dynamic adjacency memory, and the information on the entire graph is propagated in both the update and the retrieval processes simultaneously.

In our problem, the local feature vector contains the connection information between the nodes and . For simplicity, instead of two indices and , we will use one index to denote the local feature, i.e. . In the previous work [8], vanilla RNN was used and the connection vector was inputted sequentially to train the RNN. The problem is that there is no guarantee that the input will be associated with the because the vector is randomly shuffled in stochastic gradient training. Besides, while we define this problem as the bipartite graph inference, vanilla RNN could not capture the graph structure and propagate it into the next unit.

To solve the aforementioned problem, we propose the DGGN method which incorporates GRU as a base model. As shown in Figure 3, the proposed method of propagating previous states to the next step is completely different from that of the vanilla GRU. In order to exploit the graph structure, instead of just sequentially transferring features as in vanilla GRU (Figure 3(a)), we aggregate messages from adjacent edges (Figure 3(b)). To pass the messages from adjacent edges, the proposed DGGN requires a dynamic programming scheme which can build the graph structure in an online manner.

Figure 4: Specific explanations of update and retrieve steps with the DATM in DGGN. (a) In the retrieve step, past messages are transmitted from adjacent edges (a-1). Specifically, to obtain previous hidden state, we conduct weighted mean pool with extracted matrix at indexes of objects. (b) In the update step, model can store the inferred information into the DATM with a concatenated vector at indexes of input objects.

In this paper, we incorporate the adjacency matrix in the graph theory which has been mainly used to propagate message through known structure of the graph  [20]

. However, in our problem, the adjacency matrix is unknown, which has to be estimated. Therefore, we propose a dynamic memory component into this problem which holds the connection information among nodes. In this work, we expand

-dimensional adjacency matrix to -dimensional memory. The dynamic adjacency tensor memory(DATM) is defined as a concatenation of the adjacency matrix and the corresponding hidden unit whose () element is an dimensional hidden vector of the GRU which is related to the connection between the nodes and . The adjacency matrix represents the connection status between each of nodes in the directed graph. Each cell in the adjacency matrix only indicates whether the corresponding pair of nodes has a directed arc or not. Then both retrieve and update steps with tensor are implemented to aggregate messages from adjacent edges and to build up graph simultaneously.

Retrieve Step: Figure 4(a) shows the retrieve step of DGGN. We can get the previous hidden state which collects messages propagated through adjacent edges (Figure 4 (a-1)). In doing so, as shown in Figure 4(a-2) and equation (2), we take average of the adjacent vectors of and

weighted by the probability of the existence of an edge. Formally, we extract an adequate hidden unit

for the input vector representing the connection with node and , as in


Here, represents the element of the matrix , and is the hidden unit stored in the location of the tensor . In this step, the probability works as weights for aggregating messages which represents the philosophy that more credible adjacent edges should give more credible messages. Before transmitted to GRU layer, the global feature is added to reflect the global shape of the diagram.

Update Step: In the update step shown in Figure 4(b) , we update the cell with an length vector that concatenates the output and the hidden state from a GRU cell (8).



is a sigmoid function. To obtain the hidden state

, the vectors and are used as previous hidden state and input vectors of the standard GRU, respectively. Update gate has a role to adjust influx of previous information in the GRU cell (6). The binary output is obtained after fully connected layer (7).

3.3 Multi-task Training and Cascaded Inference

In this work, the proposed UDPnet shown in Figure 2 is trained in an end-to-end manner. Because the UDPnet consists of two branches (object detection by SSD and graph generation by DGGN), by nature, the problem is a multi-task learning problem. Thus, different losses for each branches are combined into the overall loss as follows:


The overall loss is a weighted sum of the classification loss and the location regression loss for the object detection branch, and the relation classification loss for the graph generation network.

As defined in original SSD, the classification loss is the softmax loss over confidences of multiple classes and the location regression loss is a smooth L1 loss [4] between the predicted box and the ground truth box. The relation classification loss is the softmax loss over two classes, adjacent or not. For a faster convergence, we first pre-trained object detection branch alone, then fine-tuned both branches jointly with the overall loss.

During training, matching strategy between the candidates and the ground truths is important for both box detection and relationship inference. To solve the issue, we set our own strategy for matching candidate pairs and the ground truth. First, given objects detected at the first branch of object detection, we generate pairs of relation candidates. For each relation candidate, the two intersection over unions (IOUs), each of which is computed between one of the detected objects and the closest ground truth object, are averaged. Then, each ground truth relationship is matched with the best overlapped relation candidate. To consider the imbalance in the number of detected objects among different diagrams, we should sample the same number of relation candidates from each training diagram.

At inference, we first detect objects in a diagram. Then we apply non maximum suppression (NMS) with an IoU threshold of 0.45 on boxes with scores higher than 0.01. Unlike in training, we should use all boxes that were detected to generate candidate pairs for next branch. Next, we apply graph generation branch to all relation candidates to infer relationship to each other. Finally, we can obtain a diagram graph composed of adjacent edges between nodes with confidence scores higher than 0.1.

After graph inference, we can post-process the generated relational information to further generate knowledge sentences which can be inputs of question answering models. Thus, our methods can make a bridge between visual inference and linguistic reasoning. Actually, we applied proposed pipeline in this paper to Textbook Question Answering competition [9] and the details on the post-processing can be found in the supplementary material.

Figure 5: Qualitative results of diagram graph generation and a pipeline to solve question answering problem. (a) Each row shows an example of various kinds of diagram. From the left, original diagrams and diagrams with detected constituents are presented. In last two columns, comparison between the DGGN and the Vanilla GRU with final results is shown. (b) From a diagram graph, we extract knowledge sentences, then solve multi-choice problems.

4 Evaluation

In this section, we validate the performance of the proposed algorithm for the two sub-problems: graph generating and question answering.

Datasets. We performed experiments on two different datasets: AI2D [8] and FOODWEBS [11]. AI2D contains approximately 5,000 diagrams representing scientific topics at an elementary school level. Overall, the AI2D dataset contains class-annotation for more than 118K constituents and 53K relationships among them, including segmentation mask for each of the elements. AI2D also contains more than 15,000 multiple choice questions about diagrams. The polygons for segmentation provided with the AI2D dataset were reshaped into rectangles for simplicity and efficiency. FOODWEBS consists of 490 food web diagrams and 5,208 questions encountered on eighth grade science exams. FOODWEBS focuses on question answering using questions about environmental problems. Unlike AI2D, the diagrams in FOODWEBS do not have annotations for relations among objects, and we used this dataset only as a benchmark of question answering.

Baseline. we used the following ablation models to compare with our method:

  • Fully connected layer - only incorporating the object detection branch in our model and replacing the graph generation branch with fully connected layers.

  • Vanilla GRU - similar to the previous baseline but using a vanilla GRU instead of the graph generation branch.

  • DGGN w/o global feature - exploiting the same structure as our model but excluding the global feature from inputs in the second branch.

  • DGGN w/o weighted mean pool - averaging hidden vectors of adjacent edges without multiplying weights which represent the strength of each adjacency.

  • DGGN w/ ROI-pooled feature - concatenating a ROI-pooled feature in the local feature , expanding it into a 34 dimensional vector.

Metrics. We propose to measure mean Average Precision (AP) for edge evaluation and IoU for graph completion. First, AP can measure both the recall and precision of a model in predicting the existence of edges. Since our relation candidate should have two boxes, we use average IoUs of those boxes with ground truth boxes as IoU for a relation. We used IoU thresholds for experiments and report the mean AP by averaging the results of all the thresholds.

Additionally, we adopt an IoU metric to measure completion of entire graph. For both of nodes and edges, we define IoU of node and edge as the number of the intersection divided by the number of the union. Note that we only use the number of overlapped nodes or edges instead of using overlapped area in the original IoU metric.

Fully connected layer 8.87 9.22 8.92 8.24
Vanilla GRU 39.28 39.89 43.11 31.54
  w/o global feature 39.34 40.51 43.03 31.11
  w/o weighted mean pool 42.15 44.22 44.99 34.37
  w/ ROI-pooled feature 39.73 43.09 42.19 31.38
DGGN 44.08 44.23 47.13 38.97
Table 1: Comparison results of AP on the AI2D test set.

Implementation Details.

We implemented the first branch based on SSDv2 modified from the original SSD. For the second branch, we use 1 layer GRU with 128 hidden states. During training, we sample 160 positive and negative relationship candidates at a ratio of 1 to 7. The training and testing codes are built on Pytorch. Additional experiments about QA on diagrams utilized the implementation

111https://github.com/allenai/dqa-net under the same conditions of previous work [8].

Vanilla GRU 70.06 15.58
  w/o global feature 70.95 14.44
  w/o weighted mean pool 69.48 24.84
  w/ ROI-pooled feature 69.24 23.00
DGGN 69.77 25.86
Table 2: Comparison results of IoU on the AI2D test set.
Method AI2D [8] FOODWEBS [11]
Dqa-Net(GT) 41.55 -
VQA 32.90 56.50
Dqa-Net(Dsdp) 38.47 59.30
Dqa-Net(Ours) 39.73 58.22
Table 3: Accuracy of Question Answering on AI2D and FOODWEBS. The results of VQA and DQA-Net(Dsdp) on AI2D and FOODWEBS are refer to [8] and [11], respectively.

4.1 Quantitative Results

Table 1 shows comparisons DGGN with baselines on the AI2D dataset. Our results demonstrate that the DGGN outperforms baselines. In the second row of the table 1, the Fully connected layer model shows 8.87 mAP, which is extremely low. This is because the relational information among the nodes (elements) is not reflected to fully connected layer. The vanilla GRU shows 39.28 mAP, which is lower than those of any variants of DGGN. This implies that the vanllia GRU model was not successful for embedding the relational information among the nodes, because the GRU model can only learn the sequential order of the input. In this problem, however, the shuffled order of the relation candidates does not have meaningful sequential knowledge of the relationship.

Next, we performed ablation studies with variants of DGGN as presented in the middle of Table 1. In the table, we can see that DGGN w/o global feature achieved the largest margin to the best model, and this indicates that the global feature can significantly enhance the performance. On the other hand, the result of DGGN w/o weighted mean pool is slightly lower than the best model which shows that weights might not be meaningful to the performance. Interestingly, DGGN w/ ROI-pooled feature scored a lower mAP in spite of the additional information. One possible reason is that ROI-pooled feature can cause overfit without a sufficient amount of training data, since objects in diagrams are hard to be generalized.

Table 2 shows comparisons of the modified metric for measuring completion of a graph. In the case of the edge inference, we set 0.5 as the threshold of mean IoU of each predicted box intersecting with a ground truth box and set 0.01 as the threshold of confidence for the adjacency of edges. Since all models use the same SSD model at the object detection branch, results of the are similar to each other. They have slight different performance because of the end-to-end fine-tuning process. For , the DGGN shows a better performance than other baselines. Like the results of mAP in Table 1, the usage of global feature has a significant impact on the performance.

Table 3 shows the results of the question answering experiments conducted on AI2D and FOODWEBS. For AI2D, we first evaluated Dqa-net with ground truth annotations of diagrams as our upper bound. Our model shows an accuracy of 39.73% which outperforms previous work and approaches upper bound by 2 % margin. On FOODWEBS, we only deploy on trained model with AI2D and extract diagram graphs from entire data. The results show our model demonstrates comparative results. Overall, our model performs better when compared with the VQA method, which estimates the answer directly from a diagram image. These question answering tests reveal a potential for expansion to the linguistic field. Also, this result is meaningful in that our model is not directly designed to solve the QA problem.

4.2 Qualitative Results

In this section, we analyze qualitative results as shown in Figure 5. Three diagrams which have different layouts and topics are presented to compare qualitatively in Figure 5(a). For example, diagrams for the same topic “life cycle of a ladybug” in the second and third row have different layouts. Nevertheless, our model can understand different layouts and generate graphs according to the intentions of the diagrams. In the second column, the detection results of the object detection branch, finding four kinds of objects (blob, text, arrow and arrow head) in the diagram, are presented. In the third column, we present the results of graph generation on various diagrams. Then we compare our results to those of the baseline (vanilla GRU) as shown in the last column. As seen in the results, we confirmed that our model correctly connected the links between the objects according to their intended relation, in most case.

Figure 5(b) shows a sample describing a pipeline of solving question-answering from a diagram graph. After the diagram of “life cycle of a frog” is converted to a relation graph, we can generate knowledge sentences such as “Adult Frog links to Young Frog” with three categories : “relation”, “entity” and “count”. Using those sentences, we solved the multi-choice QA problems. For instance, the second question asks for the relationship among the objects in the diagram. We have already generated a knowledge sentence “Egg Mass links to Tadpole”, so the QA model can easily respond “b) tadpole” with a confidence of 0.82. This process can contribute to the solution of various problems related to knowledge of relationships.

Figure 6:

Three statistics of activation value of update gate on AI2D test sets. (a) Mean of activation values. (b) The first quartile statistics of activation values. (c) The third quartile statistics of activation values.

5 Discussion

In this section, we discuss the effectiveness of DGGN by investigating the GRU cells, and we analyzed the dependency of candidate order of DGGN to compare the results between our model and baseline (vanilla GRU).

Activation of gates. To understand the DGGN better, we analyze information dynamics in DGGN. For this, we extracted the activation values of the update gate. In equation (6), update gate obtained from equation (4) determines the amount of the received information of the cell from the previous . By investigating the graph of the update gate’s activation, we can observe that this model meaningfully exploits messages from the past. Obviously, the more update gates activate, the richer the transmitted information becomes.

We plot three statistics of activation values of update gates using 920 test samples. In Figure 6(a), we presented the mean of activation values which shows the significant margin between our model (red solid line) and the baseline (blue dotted line), and this shows that our model can generally activate update gates more effectively than the baseline does. While the first quartile statistics in Figure 6(b) show a larger margin than the an aforementioned result, the third quartile statistics do not show meaningful differences between our model and the baseline in Figure 6(c). Those two results show that our model encouraged activation in relatively inactive update gates. Overall, we can conclude that DGGN delivers more informative messages based on the graphical structure to GRU cells and induces more influx of information from the past which can lead to better results.

For a study in terms of time steps, we extract activation values of update gates in GRU cells from the second diagram in Figure 5(a). Then we average this quantity over hidden cells with respect to time steps. As shown in Figure 7, our model performs higher than the baseline over almost all the steps. Specifically, almost all the yellow dots in the graph, depicting the candidates of the connected edge, show that the activation values of our model are higher than baseline. Therefore, as we discussed in the previous chapter, the cells of our model successfully infer the relationships by accepting more adjacent information with respect to time steps.

Order of relation candidates. To explore a mechanism of aggregating messages in DGGN, we verified the effect of the order of relation candidates. We evaluated 50 results (

) repeatedly with randomly ordered candidates for the baseline and our model on the AI2D. Then we extracted variation statistics from the results. For the baseline, variance and standard deviation of results are

and , respectively. Our model shows a variance and a standard deviation of results of and , respectively. The result shows that the variance and the standard deviation of our model are much lower (around 13 times smaller standard deviation) than those of the baseline.

During the training process, we shuffled the order of candidates before transmitted into GRU cells for both models, to avoid order dependency. However, the statistics show that our model is more robust against the order of relation candidates compared to the baseline. We can confirm that the proposed model successfully extracts the graph structure regardless of the order of the input sequence, due to the proposed method’s ability to aggregate messages from the past.

Figure 7: Mean of activation values of update gate on second diagram of Figure 5.

6 Conclusion

In this work, we proposed UDPnet and DGGN to tackle the problem of understanding a diagram and generating a graph by the neural network. For diagram understanding, we combine an object detector and a network that generates relations among detected objects. A multi-task learning scheme is used to train the UDPnet in an end-to-end manner. Moreover, we propose a novel RNN module to propagate message based on graph structure and generate a graph simultaneously. Then, we demonstrated that the proposed UDPnet provides state-of-the-art quantitative and qualitative results on problems of generating relation for a given diagram. We also analyzed how our model works better than strong baselines. Our work can be a meaningful step in diagram understanding and reasoning problem beyond natural image understanding. Moreover, we believe that the proposed DGGN could benefit other tasks related to graph structure.


7 Appendix

7.1 Results of Recall@K

While we measured AP for evaluation in this paper, we additionally utilized recall metric for measuring retrieval power of relationships due to the sparsity of the relationship. Table 4 shows results of Recall@k metric (R@k) on AI2D test dataset. The R@k measures the fraction of ground-truth relationship that appears among the top-k most confident predictions. The results of R@5, R@10 and R@20 demonstrate similar trend of results compared to those of mAPs.

Vanilla GRU 21.79 33.97 48.87
  w/o global feature 21.44 33.63 49.18
  w/o weighted mean pool 22.62 35.75 51.60
  w/ ROI-pooled feature 21.45 34.21 49.87
DGGN 22.66 35.93 51.73
Table 4: Comparison results of Recall@K on the AI2D test set.

7.2 Training Details

For training, We jointly optimized the overall loss of the proposed algorithm with ADAM optimizer with default parameters (). For the three losses in overall loss (10), we set , and . The initial learning rate is set to and is multiplied by 0.09 in every 1000 iterations. The batch size is set to 32 and we evaluated our model after 15000 iteration (

150 epochs).


7.3 Details of Post-processing

1:Relation set generated by the proposed DGGN
2:Generated sentences set
7:     if  ’  then
8:         Continue
9:     else if  ’ then
10:         if  ’ & ’ then
11:              Generate sentence
13:         else if  ’ & ’ then
14:              Find satisfying {’ & ’ }
15:              Generate sentence
17:         end if
18:     end if
19:until all elements in are visited
Algorithm 1 Post processing algorithm

In this section, we explain a detailed post-processing procedure of the proposed method. Once relationships are determined among objects, we can additionally make new relationship between objects sharing the same intermediate node. For example, given two text objects sharing the same blob object, we can say that one text is linked to another one. Also, given two text objects connected by two intermediate blob objects, we can say equivalently to the previous case. In most case, the text object represents the name or explanation of the connected blob object. Consequently, making further connections by this rule-based algorithm, we can generate sentences using given texts. Using extensively connected texts, we just put an additional phrase of “links to” such as “Lavar links to Fly”. Note that localized text boxes are recognized using Tesseract222https://github.com/tesseract-ocr/tesseract. Algorithm 1 shows details of post processing.

After generating sentences about relationship, we added sentences about facts of detected elements in a diagram. As shown in Figure 11, counts of objects and stages, and names of elements are added to help richer descriptions about a diagram.

7.4 Additional Qualitative Results

In next pages, we present additional qualitative results on diagram graph generation and question answering. We provide results of diagram graph generation of various layouts and topics as depicted from Figure 8 to Figure 10. The results of DGGN are compared with those of those of vanilla GRU. Ground truths are also shown. In Figure 11, we also show pipelines from diagram graph to question answering with post-processing described in the previous section. For two different types of questions, relationship and count, related sentences are highlighted.

Figure 8: Additional qualitative results on diagram graph generation: (a) original diagram (b) diagram with detected constituents (c) generated graph results of DGGN (d) ground truth (e) results of baseline (vanilla GRU)
Figure 9: Additional qualitative results on diagram graph generation: (a) original diagram (b) diagram with detected constituents (c) generated graph results of DGGN (d) ground truth (e) results of baseline (vanilla GRU)
Figure 10: Additional qualitative results on diagram graph generation: (a) original diagram (b) diagram with detected constituents (c) generated graph results of DGGN (d) ground truth (e) results of baseline (vanilla GRU)
Figure 11: Additional qualitative results on question answering: (a) a question about relationship. (b) a question about the count of stages