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
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)
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 image:
Example graph (score threshold = 0.1, removed isolated nodes):
Corresponding graph, including isolated nodes: