Ultralytics YOLO27:
License YOLO
Back to Ultralytics Glossary

Scene Graph

Scene graph is a visual representation of objects, attributes, and relationships that supports reasoning, image search, and robotics.

A scene graph is a structured representation of a visual scene in which nodes represent objects, attributes describe their properties, and labeled edges describe relationships between them. It turns an image into connected facts: which objects appear, what they are like, and how they interact. In computer vision, this structure supports reasoning about a scene beyond recognizing individual objects.

Justin Johnson, Ranjay Krishna, and colleagues introduced the modern image-grounded formulation in their 2015 work on image retrieval using scene graphs. Their representation included objects such as a man and a boat, the boat's white color, and the relationship "man standing on boat," enabling searches that specify relationships as well as object categories.

Objects, Attributes, and Relationships#

Each node identifies an object instance. Two horses in one image receive separate identities even though their category labels match. A bounding box locates each instance, providing grounding: a connection between a symbolic object and its image region. Attributes attach properties such as color or material to that instance. Relationships connect two instances through a predicate, the label describing their connection. The resulting subject–predicate–object triple expresses one relational fact.

The Visual Genome dataset, developed by Ranjay Krishna and collaborators, contains 108,077 images with structured visual annotations. Scene graphs are image-specific forms of a knowledge graph. Their semantic relationships permit multiple connections between objects and disconnected components, so an image scene graph has no required root node.

The Visual Genome Python driver's scene graph example includes "horse is wearing bridle" and "window is next to door." These annotations can be represented with a directed graph using NetworkX, installed with pip install networkx:

import networkx as nx

graph = nx.MultiDiGraph()
graph.add_node("horse", label="horse")
graph.add_node("bridle", label="bridle")
graph.add_node("window", label="window")
graph.add_node("door", label="door")

graph.add_edge("horse", "bridle", predicate="is wearing")
graph.add_edge("window", "door", predicate="is next to")

for subject, obj, relation in graph.edges(data=True):
    print(f"{subject} -> {relation['predicate']} -> {obj}")

The output exposes two queryable relational facts, with each predicate attached to its directed edge.

How Scene Graph Generation Works#

Scene graph generation, abbreviated SGG, predicts this representation from visual input. A typical pipeline combines object detection, feature extraction, and relationship classification. Object features describe individual regions; pairwise features describe candidate interactions. Context models such as MotifNet use surrounding objects to help predict relationships. Graph neural networks can also exchange information across connected objects, producing embeddings that encode relational context.

Ultralytics YOLO YOLO26 supplies the object instances for this pipeline through its detection outputs: boxes, class labels, and confidence scores. A downstream relationship model uses those instances to predict edges such as "wearing" or "standing on."

Applications in Visual Reasoning and Robotics#

Explicit relationships support tasks that require understanding how objects fit together:

  • Visual question answering: GQA uses scene graphs derived from Visual Genome to generate questions and functional reasoning programs. Traversing object relationships supports visual reasoning, including identifying objects through their attributes and connections.
  • Robotics: Kimera builds 3D dynamic scene graphs from visual-inertial input. Its layered representation connects objects, people, rooms, and buildings, supporting semantic mapping and hierarchical path planning. Spatial coordinates and time extend the representation beyond a single image.
  • Image generation: Justin Johnson, Agrim Gupta, and Li Fei-Fei's image generation from scene graphs system converts graphs into object layouts, predicts boxes and segmentation masks, and generates an image from that layout. The graph specifies both scene contents and relationships.

Evaluation and Relationship Errors#

Scene graph evaluation commonly separates three tasks. Predicate classification provides object boxes and labels and evaluates predicted relationships. Scene graph classification provides boxes and requires object and relationship labels. Scene graph detection requires the complete graph from the image. This separation identifies whether errors originate in localization, object recognition, or relationship prediction.

Relationship frequencies create dataset bias: frequent predicates dominate predictions while rare, informative relationships are missed. Recall@K measures the fraction of annotated relationships recovered among the K highest-ranked predictions. Mean Recall@K computes recall separately for each predicate category and averages those values, giving rare predicates the same category-level weight as frequent ones.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning