Skip to content

Commit

Permalink
restructuring completed
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jan 18, 2019
1 parent e6845dc commit 36b6613
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 194 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*.pyc
*.swp*

**/*.json
**/*.zip
1 change: 0 additions & 1 deletion PythonHelperTools/vqaTools/__init__.py

This file was deleted.

179 changes: 0 additions & 179 deletions PythonHelperTools/vqaTools/vqa.py

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ There are two types of tasks
- Multiple-choice task (18 choices per question)

## Requirements ##
- python 2.7
- python 3.5+
- scikit-image (visit [this page](http://scikit-image.org/docs/dev/install.html) for installation)
- matplotlib (visit [this page](http://matplotlib.org/users/installing.html) for installation)

Expand Down
4 changes: 2 additions & 2 deletions vqa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from vqa.vqa import VQA
from vqa.vqaEval import VQAEval
from .vqa import VQA
from .vqaEval import VQAEval
8 changes: 3 additions & 5 deletions vqa/vqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ def createIndex(self):
# create index
print('creating index...')
imgToQA = {ann['image_id']: [] for ann in self.dataset['annotations']}
qa = {ann['question_id']: []
for ann in self.dataset['annotations']}
qqa = {ann['question_id']: []
for ann in self.dataset['annotations']}
qa = {ann['question_id']: [] for ann in self.dataset['annotations']}
qqa = {ann['question_id']: [] for ann in self.dataset['annotations']}
for ann in self.dataset['annotations']:
imgToQA[ann['image_id']] += [ann]
qa[ann['question_id']] = ann
Expand All @@ -69,7 +67,7 @@ def info(self):
Print information about the VQA annotation file.
:return:
"""
for key, value in self.datset['info'].items():
for key, value in self.dataset['info'].items():
print('%s: %s' % (key, value))

def getQuesIds(self, imgIds=[], quesTypes=[], ansTypes=[]):
Expand Down
13 changes: 7 additions & 6 deletions vqa_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import random
import os
import argparse
import pprint


def parse_args():
Expand All @@ -18,7 +19,7 @@ def parse_args():
parser.add_argument("--questions")
parser.add_argument("--image_dir")
parser.add_argument("--data_dir", default=".")
parser.add_argument("--version", default="v2_")
parser.add_argument("--version", default="v2")
parser.add_argument("--task", default="OpenEnded")
parser.add_argument("--data", default="mscoco")
parser.add_argument("--data_subtype", default="val2014")
Expand All @@ -28,6 +29,8 @@ def parse_args():

args = parse_args()

pprint.pprint(vars(args))

# set up file names and paths
data_dir = args.data_dir
version = args.version # this should be 'v2' when using VQA v2.0 dataset
Expand All @@ -37,12 +40,10 @@ def parse_args():
data = args.data
data_subtype = args.data_subtype

ann_file = args.annotations or '%s/Annotations/%s%s_%s_annotations.json' % (
data_dir, version, data, data_subtype)
ques_file = args.questions or '%s/Questions/%s%s_%s_%s_questions.json' % (
data_dir, version, task, data, data_subtype)
ann_file = args.annotations or '{args.data_dir}/Annotations/{args.version}_{args.data}_{args.data_subtype}_annotations.json'.format(args=args)
ques_file = args.questions or '{args.data_dir}/Questions/{args.version}_{args.task}_{args.data}_{args.data_subtype}_questions.json'.format(args=args)

img_dir = args.image_dir or '%s/Images/%s/%s/' % (data_dir, data, data_subtype)
img_dir = args.image_dir or '{args.data_dir}/Images/{args.data}/{args.data_subtype}/'.format(args=args)
file_types = ['results', 'accuracy', 'evalQA', 'evalQuesType', 'evalAnsType']

# An example result json file has been provided in './Results' folder.
Expand Down

0 comments on commit 36b6613

Please sign in to comment.