Open SunshineJunFu opened 5 years ago
sg2im/data/coco.py
hi, could you please tell me how to visualize scene graphs on the validation dataset of COCO-Stuff? There are lack of prepared json files for each image.
This is the function we used to make scene graph visualizations:
https://github.com/google/sg2im/blob/master/sg2im/vis.py#L110
There isn't any code that works out-of-the-box to run this on COCO-Stuff validation images; but it should be pretty straightforward to write a standalone script that builds a COCO data loader, (https://github.com/google/sg2im/blob/master/sg2im/data/coco.py), iterates through it to construct random scene graphs, then use the draw_scene_graph
function to visualize them.
Thank you, Justin! I have complete this code. But a found a small mistake in line 139 of vis.py. I think "p = vocab['pred_name_to_idx'][triples[i, 1].item()]" should be changed into "p = vocab['pred_idx_to_name'][triples[i, 1].item()]".
Could you provide codes for generating scene graphs in JSON format?