Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example usage #1

Open
Liu0329 opened this issue Jan 23, 2019 · 5 comments
Open

example usage #1

Liu0329 opened this issue Jan 23, 2019 · 5 comments

Comments

@Liu0329
Copy link

Liu0329 commented Jan 23, 2019

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
Copy link
Owner

adityaSomak commented Jan 23, 2019

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
Copy link
Author

Liu0329 commented Jan 24, 2019

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
Copy link
Owner

adityaSomak commented Jan 24, 2019

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
Copy link
Author

Liu0329 commented Jan 24, 2019

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

@adityaSomak
Copy link
Owner

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
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants