adityaSomak / PSLQA

An implementation of Probabilistic Soft Logic Engine using Python/Gurobi
55 stars 5 forks source link

example usage #1

Open Liu0329 opened 5 years ago

Liu0329 commented 5 years ago

Hi Aditya, Thanks for the great work ! Could you provide an example usage for VQA ? python main.py vqa -pslcode <rules-file> -datadir <psl_test_data_dir> -parentDir <pslDataRootDir> -qaData <qaData> -option infer What are the datas in psl_test_data_dir, pslDataRootDir, qaData ?

adityaSomak commented 5 years ago

There are some gaps in the README with the current code. I will attempt to update the README when I find time. But overall pslDataRootDir and psl_test_data_dir should be structured the same as "expt2_aaai18" directory. And qaData should point to a json file structured similar to https://github.com/adityaSomak/PSLQA/blob/master/pslplus/data/vqa_demo/expt2_aaai18/OpenEnded_mscoco_val2014_questions.json.

Liu0329 commented 5 years ago

In the directory of pslplus, I run python2 main.py vqa -pslcode data/vqa_demo/vqa_rules.txt -datadir data -parentDir data/vqa_demo/expt2_aaai18 -qadata data/vqa_demo/expt2_aaai18/OpenEnded_mscoco_val2014_questions.json -option infer Then I got

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    if sys.argv[1] == "vqa":
  File "/PATH/code/PSLQA/pslplus/models/vqamodel.py", line 228, in run
    pslCodeFile = argsdict['pslcode']  # "vqa_psl.txt"
TypeError: list indices must be integers, not str

The argsdict turns out to be a list but not a dict.

UPDATE I see, something is missing in function 'run' in vqamodel.py. I uncomment the lines, but still 'startFrom', etc are missing.

adityaSomak commented 5 years ago

Hi Liu, actually for the VQA demo, you need to run test_pslqa.py which is already in the vqa_demo folder. The command was provided in REAME.md. But I missed backticks, so the command was not displaying properly: python2.7 test_pslqa <qatestdir> <pslDataRootDir> <answerFile> -stage 2/3 -split test/dev <startFrom>

Directory Structure: qatestdir: Expects generated Json files from DenseCaptioning software for each image under the subdirectory densecap/ pslDataRootDir: Stage 1 output will be stored here. Stage 2 output will be stored under psl subdirectory. answerFile: List of possible answers - one in each line. COMPOUND_NOUN_VOCAB_DIR: Expects the file stats_conceptNet_vocab/allEnglishPhrasesin_cn5.5.txt in it. These are the compound nouns from ConceptNet5.5 SIZE_COLOR_DICT_DIR: Expects the file allSizeAdjectives.txt, for all size adjectives and adverbs.

Liu0329 commented 5 years ago

Sorry, still confusing. For the demo, can you just give an exact example command to run ? That would make everything clear.

adityaSomak commented 5 years ago

I have already updated the README with an example. python2.7 test_pslqa vqa_demo/expt2_aaai18/densecap vqa_demo/expt2_aaai18/ <answerFile> -stage 3 -split dev 0