Finding similar photos by comparing the meaning graphs of their captions
Many photos on the web come with a short caption. If a caption captures what a picture is about, we can look for similar pictures by looking for similar captions. We turned captions into graphs of objects, their properties and the relations between them, and used those graphs to retrieve photos. The program never looks at the pictures themselves.
The idea
A picture is more than a list of objects. It also has properties, such as a little red bird and a dry branch, and relations, such as the bird sitting on the branch. So the representation has to keep the properties of objects and the relations between them, not just the nouns.
We read each caption with the C&C parser and Boxer, which write out a discourse representation structure: the things mentioned and the facts that connect them. Unlike in our earlier work on text classification, we kept only nouns, adjectives, verbs and the relations between them, because we found the rest of the grammatical information valueless for captions.
From caption to graph
Each noun becomes a node. Adjectives become attributes of the noun they describe. Each verb becomes its own node, joined to nouns by agent and patient edges, and adverbs become attributes of the verb. Words like "on" or "under" become edges between noun nodes. We kept the graph as close to a simple chain as possible, since that makes comparing graphs faster.

Comparing two captions
To compare two graphs, we again look for the largest shared part, the maximum common subgraph, with a faster approximate version. We score pairs of nodes by how similar their words are, using WordNet, a dictionary that arranges words in a tree of concepts. We add credit for shared attributes and for similar neighbours. The best non-overlapping pairs are kept, and the average of their scores is the similarity of the two captions.
The score for a pair of nodes combines three things: how close the two words are in WordNet, how many attributes the nodes share (relative to the larger number of attributes on either node), and how similar their neighbours are. The neighbours count only when the edges between them are the same in both graphs.

We worked with a subset of the SBU Captioned Photo Dataset, limited to 12 objects (bag, ball, castle, chicken, computer, duck, elephant, laptop, keyboard, monitor, plate and shirt) because of limited computing resources. It held 6000 training captions and 900 test captions. For a test caption, the system returns the pictures whose captions are the most similar.
What human judges said
We asked 25 people to judge the results. Each saw 20 sets of pictures: a query picture and the top five pictures returned for it. They scored each returned picture from 0 (no similarity at all) to 4 (nearly the same objects and concept), looking at both the objects and the overall idea.
The scores fell steadily down the ranking, with average medians of 2.95, 2.55, 2.3, 1.95 and 1.55 for positions one to five, and 2.26 ± 0.748 over all five (Table I). We read this as ranking that goes along with human judgement. Two examples show what the system does well and badly. A duck query returned other ducks. A query showing fruit bats in a tree returned plastic bags in trees. The paper notes that the system favours concept over content here, and that negation needs better handling, and the bats caption itself begins "Not plastic bags".

Results in more detail
The judges were told to compare each returned picture with the query picture on the objects present and on the overall concept. Each judge scored 100 pictures, five for each of the 20 sets. The scale was:
- 4: both pictures have almost the same objects and show a very similar concept
- 3: the pictures share common objects, and may share some concepts as well
- 2: the concepts are quite different, though some objects are related in some way
- 1: almost no similarity in concept, and the objects are not very related
- 0: absolutely no similarity in any respect
Table I gives the median score of the judges for every picture. The first table below is its AVERAGE row, which averages over the 20 sets, with the standard deviations.
| Position in the ranking | Average of median scores | Standard deviation |
|---|---|---|
| 1 | 2.95 | 0.707 |
| 2 | 2.55 | 0.760 |
| 3 | 2.3 | 0.779 |
| 4 | 1.95 | 0.784 |
| 5 | 1.55 | 0.710 |
| All five (set average) | 2.26 | 0.748 |
Going by what the points on the scale mean, an average of 2.26 says that most returned pictures shared some kinds of objects or relations with the query. The picture the system ranks first, with 2.95 ± 0.707, showed a great deal of conceptual similarity.
Table I also gives the numbers for each of the 20 sets, and the spread between sets is wide. The set averages run from 1.4 (set 16) to 3.8 (set 3) (Table I). The ranking is not always in order: in set 4 the first and fifth pictures got a median of 0 and the third and fourth got 4 (Table I). The second table below shows the four sets with the highest averages and the three with the lowest.
| Set | Image 1 | Image 2 | Image 3 | Image 4 | Image 5 | Set average |
|---|---|---|---|---|---|---|
| Set 3 | 4 | 3 | 4 | 4 | 4 | 3.8 |
| Set 20 | 4 | 3 | 3 | 3 | 4 | 3.4 |
| Set 5 | 4 | 4 | 4 | 2 | 2 | 3.2 |
| Set 13 | 4 | 4 | 4 | 3 | 1 | 3.2 |
| Set 16 | 4 | 1 | 0 | 1 | 1 | 1.4 |
| Set 6 | 2 | 0 | 2 | 2 | 2 | 1.6 |
| Set 18 | 4 | 3 | 0 | 0 | 1 | 1.6 |
Figure 5 of the paper looks at the scores from the judges' side. For each position in the ranking it shows one bar per judge, with the bar giving that judge's median over the 20 sets, and a thick line for the average trend. The pictures come back in order of conceptual similarity, and the judges gave higher scores to the first pictures than to the later ones, which we read as the similarity analysis agreeing with human perception of similarity.

Discussion
Our aim was modest. We wanted to show that a graph of a caption makes sense to people, and the ratings point that way. The first picture returned got an average median of 2.95 out of 4, and the scores fell down the ranking in step with the order the system returned the pictures in. We conclude that the approach works fairly well for captions of complicated images and picks up both the objects and their context.
The bats example shows what that costs. The system prefers concept over content, so plastic bags hanging in trees come back for bats hanging in trees, and the paper says that negation needs better handling. We also state that further studies are needed before the model can compete with other contemporary techniques.
For future work we plan to add features taken from the images themselves, to try homomorphism instead of subgraph isomorphism, and to try dependency-based graph models for faster results. One proposed way to speed the system up is a lookup table that lists, for each object, the training captions that contain it. A test caption would then be compared only with captions that share at least one of its objects.
Retrieval was only the test. The main goal was a graph model of what a caption means.
Sources
The figures and tables listed here are taken from the paper cited at the top of this page; the numbers quoted in the text come from it too.
- Figures: Fig. 3, Fig. 2, Fig. 4, Fig. 5
- Tables: Table I: median score and standard deviation from the 25 judges for each of the five retrieved images in the 20 sets
Cite the paper
Swarnendu Ghosh, N Das, T Gonçalves, P Quaresma (2016). Representing image captions as concept graphs using semantic information. International Conference on Advances in Computing, Communications and Informatics (ICACCI), pp. 162–167 · IEEE.
@inproceedings{ghosh2016representing,
author = {Ghosh, Swarnendu and Das, N and Gon{\c c}alves, T and Quaresma, P},
title = {Representing image captions as concept graphs using semantic information},
booktitle = {International Conference on Advances in Computing, Communications and Informatics (ICACCI)},
pages = {162--167},
publisher = {IEEE},
year = {2016},
doi = {10.1109/icacci.2016.7732041}
}