Code Monkey home page Code Monkey logo

jaleedkhan / neusire Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 3.0 47.68 MB

NeuSyRE: A Neuro-Symbolic Visual Understanding and Reasoning Framework based on Scene Graph Enrichment

Jupyter Notebook 86.64% Lua 0.09% MATLAB 0.26% C++ 2.04% C 0.11% Makefile 0.01% Python 8.36% Cython 0.05% Dockerfile 0.02% Cuda 2.37% Shell 0.04% CSS 0.01% HTML 0.01%
commonsense-knowledge image-captioning image-generation image-representation knowledge-enrichment knowledge-graph scene-graph scene-graph-generation scene-graph-to-image visual-reasoning

neusire's Introduction

NeuSyRE: A Neuro-Symbolic Visual Understanding and Reasoning Framework based on Scene Graph Enrichment

PWC PWC PWC

SWJ-BlockDiagram

Requirements

  • Ubuntu 18.04
  • CUDA 10.1
  • Python 3.7
  • PyTorch 1.4
  • KGTK 0.5

Downloads

Code

Scene Graph Generation and Enrichment

Downstream Tasks

Important Directories

VG dataset

  • Generated scene graphs of all images (in Eval_IO/vg/0_images) in the dataset are saved to Eval_IO/vg/1_pred_scene_graphs
  • Enriched scene graphs are saved to Eval_IO/vg/2_enriched_scene_graphs
  • Generated images are saved to Eval_IO/vg/3_generated_images

COCO dataset

  • Generated scene graphs of all images (in Eval_IO/coco/0_images) in the dataset are saved to Eval_IO/coco/1_pred_scene_graphs
  • Enriched scene graphs are saved to Eval_IO/coco/2_enriched_scene_graphs
  • Generated captions are saved to Eval_IO/coco/3_captions

Steps to run the code

  • Download the datasets and place them in the given directories, and follow the following sequence to run the code in the notebooks.
  • Run all cells step-by-step in SGG/SGG.ipynb to install required packages, set up the SGG module, train the SGG deep learning pipeline, and test it on sample image(s).
  • Run all cells step-by-step in SGG/SGG_Evaluation.ipynb to run the trained SGG pipeline on all images in the dataset and generate scene graphs. (This step needs to be repeated for each dataset)
    • The variables 'eval_inp_img' and 'eval_outp_sg' in the first cell should point to the directory containing input images and the directory where the generated scene graphs should be placed, respectively.
    • The evaluation (calculation of recall metrics) is done along with the scene graph enrichment step in the next part.
  • Run all cells step-by-step in CSKG/j_SG_CSKG.ipynb to set up the knowledge enrichment module, enrich all scene graphs generated in the previous step with common sense knowledge, and to evaluate the recall measures for scene graphs and enriched scene graphs.
    • Once the enriched scene graphs have been created and saved for all images in the dataset, the code in the following cell will calculate the recall scores (R@K and mR@K for K = 20, 50, 100 for each dataset)
  • Run all cells step-by-step in SubGC/SubGC.ipynb to set up the image captioning module and test it on sample image(s).
  • Run all cells step-by-step in SubGC/SubGC_Evaluation.ipynb to run the trained image captioning module on scene graphs and enriched scene graphs generated in the previous steps, and calculate the evaluation metrics.
  • Change the paths to datasets and other resources in the code to your local paths where needed.

Citations

@article{khan2023neusyre,
  title={NeuSyRE: Neuro-Symbolic Visual Understanding and Reasoning Framework based on Scene Graph Enrichment},
  author={Khan, Muhammad Jaleed and Breslin, John G and Curry, Edward},
  journal={Semantic Web},
  year={2023}
}

@inproceedings{khan2022expressive,
  title={Expressive Scene Graph Generation Using Commonsense Knowledge Infusion for Visual Understanding and Reasoning},
  author={Khan, Muhammad Jaleed and Breslin, John G and Curry, Edward},
  booktitle={The Semantic Web: 19th International Conference, ESWC 2022, Hersonissos, Crete, Greece, May 29--June 2, 2022, Proceedings},
  pages={93--112},
  year={2022},
  organization={Springer}
}

@article{khan2022common,
  title={Common Sense Knowledge Infusion for Visual Understanding and Reasoning: Approaches, Challenges, and Applications},
  author={Khan, Muhammad Jaleed and Breslin, John G and Curry, Edward},
  journal={IEEE Internet Computing},
  volume={26},
  number={4},
  pages={21--27},
  year={2022},
  publisher={IEEE}
}

neusire's People

Contributors

jaleedkhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.