Skip to content

pianpwk/scene-graphs

Repository files navigation

scene-graphs

Repo for extracting + visualizing scene-graphs on MS-COCO 2014.

Scene graphs are pre-extracted from the px2graph repo, using Faster R-CNN proposals from here

Setup

Dependencies: cv2, matplotlib, scipy, json, urllib, h5py, graphviz (recommend installing graphviz with conda).

Data:

Download COCO image metadata from here, and place in source directory.

Download pre-extracted scene-graph data from here, and place in exp/sg_results/ - about 4 GB.

Spatial graphs for COCO: with threshold 0.5 (978 edges on avg), with threshold 0.25 (490 edges on avg)

Usage

All functions are in util.py, a demo is in visualize.ipynb. Functions get_graph_matrix() returns objects and predicates matrices under pruning specification (e.g. score thresholds, removing isolated nodes, non-max suppression), and visualize() displays bounding boxes on image + scene graph visualization (requires graphviz). NOTE: change graphviz path (example shown in notebook - path should appear if installed with conda)

Example

Example image:

alt text

Example graph (score threshold = 0.1, removed isolated nodes):

alt text

Corresponding graph, including isolated nodes:

alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published