example usage
Liu0329 opened this issue · 5 comments
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 ?
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.
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.
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.
Sorry, still confusing. For the demo, can you just give an exact example command to run ? That would make everything clear.
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
- Here for
answerFile
you need to download and parse the answers from VQA-training json file, write the top 1000 most-frequent answers (and its prior confidence score such as normalized frequency) in the following format
word1\tConfidence1\n
word2\tConfidence2\n
...