How Do Generative Image AIs Work? Searching Query Using Scene Graph Part 2.

Published in AGEDB , 3 min read, Oct 4

Computing Image Similarity with Graph Database

The computation for searching images that are similar to a given image via the graph database takes the similarity measure processes.

Figure1. Similarity Calculation with Graph Model

Measure image similarity where a specific image overlaps with a specific SPO

  • If there is a specific SPO associated with the Image, set the similarity to high, for example, set the weight to 3 for the SPO with Noun 2 followed by Noun 3.

  • 'Img 1' and 'Img 2' have one SPO in common (weight 3): Similarity 3

  • 'Img 1' and 'Img 3' have two SPOs in common: Similarity 2

By default, the more overlaps there are between the SPOs of the image and the SPOs of the other image, the higher the similarity. You can set a higher similarity for certain SPOs that seems particularly important.

How do AIs process searching for similar images using Scene Graph?

Let's take a look at an example that uses the graph model above, where a similar photo of a man playing tennis would have a weight of 3 for the SPO ['man' 'playing' 'tennis'] using the similarity measure.

Figure 2. Original Image
Figure3. Operation by Similar measure types

Similar image 1 is a photo of a man playing tennis, just like the original, and similar image 2 is a photo of two men in front of a motorcycle.

There are more SPOs that overlap with the original image in Image 2, however, since the SPO 3 on image 1, "man playing tennis" has a higher weight set for the specific action, Image 1 results to have more similarity to the original image.

What are the other advantages offered by Scene Graphs?

Scene Graph presents results in a graph, you can natively load the results into graph visualization for intuitive searching. While basic SPO search queries via images or images via SPOs follow straightforward logic, it's with more complex queries that the performance divergence between relational and graph databases becomes apparent. When comparing image similarity based on common SPOs, the graph database excels in terms of speed and efficiency. In contrast, relational databases, burdened by numerous JOIN clauses, struggle with complex queries like “show me pictures of a man wearing Nike shoes playing tennis.” The graph database's swift search capabilities translate into lower costs, making it a superior choice in such scenarios.

Furthermore, the significance of graph databases becomes even more pronounced when dealing with videos rather than static images. Videos inherently introduce a temporal dimension, resulting in the continuous creation of objects and their evolving relationships over time. This temporal context eliminates the 'ambiguity' often encountered in plain text and facilitates the efficient categorization of objects within videos. Consider a scenario where two men appear in the same video, both identified as 'man' by an image detection algorithm. In textual representation, distinguishing them as separate entities can be challenging. However, Scene Graph excels in making this distinction, enabling precise categorization. Managing the ambiguity inherent in detected objects and their dynamic behaviors becomes notably more efficient when leveraging Scene Graph, reducing storage inefficiencies stemming from redundant instances

Presently, research and practical applications for maintaining and harnessing Scene Graph data are in a relatively early stage. However, as the demand for complex queries within images and videos continues to grow, the importance of effectively managing and utilizing Scene Graphs is poised to increase. In such a landscape, graph databases stand as invaluable tools for enhancing the analytical potential unlocked by Scene Graphs, paving the way for more advanced and insightful analyses in the future.

To get started on integrating Scene graph technology, wait no more and contact us today!


Chang, Xiaojun, et al. "Scene graphs: A survey of generations and applications." arXiv preprint arXiv:2104.01111 (2021).

We're Here to Offer Our Expertise

Ask us your questions now or get in touch with our Sales and Support Team.