Scene-Graph-Benchmark.pytorch icon indicating copy to clipboard operation
Scene-Graph-Benchmark.pytorch copied to clipboard

Code for scene graph visualization

Open iamsusiep opened this issue 4 years ago • 16 comments

❓ Questions and Help

Is there code for scene graph visualization after running inference/evaluation?

iamsusiep avatar Mar 03 '20 14:03 iamsusiep

My visualization codes are written in several independent jupyter notes, and not included in the main project by now. I will consider releasing them in the future after I organize all the codes.

KaihuaTang avatar Mar 03 '20 15:03 KaihuaTang

@KaihuaTang Have you organized the code for the visualization section? This is what I need urgently at present. Even if it is still in jupyter format, can it be made public? Thank you!

Iceland-Leo avatar Mar 21 '20 09:03 Iceland-Leo

@KaihuaTang Have you organized the code for the visualization section? This is what I need urgently at present. Even if it is still in jupyter format, can it be made public? Thank you!

Check https://github.com/KaihuaTang/Scene-Graph-Benchmark.pytorch/blob/master/visualization/1.visualize_PredCls_and_SGCls.ipynb

bbox with label & index are drawn on the picture. ground-truth relations and predicted relations are printed as a list. Since the predicted relations are pretty dense, you need to set a threshold to show the top-K. Then I drew the graphs through ppt for the best visual effects.

KaihuaTang avatar Mar 21 '20 11:03 KaihuaTang

@KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in __init__ self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in __init__ obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in __init__ self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Iceland-Leo avatar Mar 21 '20 12:03 Iceland-Leo

I don't know. I‘ve never seen this bug before.

KaihuaTang avatar Mar 21 '20 13:03 KaihuaTang

@KaihuaTang Can you release the visualization code for sgdet results?

JincanDeng avatar Mar 27 '20 10:03 JincanDeng

@KaihuaTang Can you release the visualization code for sgdet results?

It seems like I may lost this part of codes. The main difference between sgdet visualization and others is a bbox selection function (with threshold), otherwise there would be too many bboxes. I'm currently working on another project, maybe you can write your own.

KaihuaTang avatar Mar 27 '20 11:03 KaihuaTang

@KaihuaTang Thanks for the great and tidy code.

@JincanDeng A PR is opened to add the SGDet visualization. Not many changes from the SGCls notebook.

navidre avatar Apr 06 '20 00:04 navidre

@navidre Thanks for your visualization for the SGDets code. Could you tell me how to get to your visualization results? Especially for the pred scores? The Numerical values seem very small. Why are your results are so big?

runzeer avatar Apr 09 '20 07:04 runzeer

@navidre if connenient, could you share the config file for test?

runzeer avatar Apr 09 '20 08:04 runzeer

@KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in __init__ self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in __init__ obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in __init__ self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Did you solve this problem? I encountered the same problem. It is very strange that I downloaded glove.6B.zip in the glove folder, but every time I train, it will re-download a file called glove.6B.200d. Please help me, thank you!

folkaholic avatar Apr 13 '20 09:04 folkaholic

@KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in __init__ self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in __init__ obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in __init__ self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Did you solve this problem? I encountered the same problem. It is very strange that I downloaded glove.6B.zip in the glove folder, but every time I train, it will re-download a file called glove.6B.200d. Please help me, thank you!

I'm not sure. Maybe changing the path of the customized GLOVE_DIR in the command?

KaihuaTang avatar Apr 13 '20 14:04 KaihuaTang

You can unzip the glove.6b.zip, then train the model.

发自我的iPhone

------------------ Original ------------------ From: Kaihua Tang <[email protected]> Date: Mon,Apr 13,2020 10:20 PM To: KaihuaTang/Scene-Graph-Benchmark.pytorch <[email protected]> Cc: Liucheng <[email protected]>, Comment <[email protected]> Subject: Re: [KaihuaTang/Scene-Graph-Benchmark.pytorch] Code for scene graph visualization (#2)

@KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in init self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in init obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in init self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Did you solve this problem? I encountered the same problem. It is very strange that I downloaded glove.6B.zip in the glove folder, but every time I train, it will re-download a file called glove.6B.200d. Please help me, thank you!

I'm not sure. Maybe changing the path of the customized GLOVE_DIR in the command?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Iceland-Leo avatar Apr 14 '20 03:04 Iceland-Leo

@KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in __init__ self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in __init__ obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in __init__ self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

Did you solve this problem? I encountered the same problem. It is very strange that I downloaded glove.6B.zip in the glove folder, but every time I train, it will re-download a file called glove.6B.200d. Please help me, thank you!

I'm not sure. Maybe changing the path of the customized GLOVE_DIR in the command?

Thank you for your prompt reply!My problem may solved by @Iceland-Leo .Because the zip file I downloaded have problem in unzipping, the system will re-download the unzip file of glove.6B.zip everytime I train the model.

folkaholic avatar Apr 14 '20 03:04 folkaholic

You can unzip the glove.6b.zip, then train the model. 发自我的iPhone ------------------ Original ------------------ From: Kaihua Tang <[email protected]> Date: Mon,Apr 13,2020 10:20 PM To: KaihuaTang/Scene-Graph-Benchmark.pytorch <[email protected]> Cc: Liucheng <[email protected]>, Comment <[email protected]> Subject: Re: [KaihuaTang/Scene-Graph-Benchmark.pytorch] Code for scene graph visualization (#2) @KaihuaTang Thank you very much! One more question, when I start training, the glove will be download. But an error ocurred. File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/roi_relation_predictors.py", line 459, in init self.context_layer = VCTreeLSTMContext(config, obj_classes, rel_classes, statistics, in_channels) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/model_vctree.py", line 93, in init obj_embed_vecs = obj_edge_vectors(self.obj_classes, wv_dir=self.cfg.GLOVE_DIR, wv_dim=self.embed_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 152, in obj_edge_vectors wv_dict, wv_arr, wv_size = load_word_vectors(wv_dir, wv_type, wv_dim) File "/mnt/disk/cv/Liucheng/pytorchCode/Scene-Graph-Benchmark.pytorch-master/maskrcnn_benchmark/modeling/roi_heads/relation_head/utils_motifs.py", line 205, in load_word_vectors with zipfile.ZipFile(fname, "r") as zf: File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1131, in init self._RealGetContents() File "/home/cilab-cv/miniconda3/envs/sg/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file Did you solve this problem? I encountered the same problem. It is very strange that I downloaded glove.6B.zip in the glove folder, but every time I train, it will re-download a file called glove.6B.200d. Please help me, thank you! I'm not sure. Maybe changing the path of the customized GLOVE_DIR in the command? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Thank you for your prompt reply!Problem solved!

folkaholic avatar Apr 14 '20 03:04 folkaholic

thank you for the share. A question about the visualize code, what is the definition of 'dispaly' in draw_iamge? Thank you!

dami23 avatar May 13 '21 02:05 dami23