Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Added candidates to clevr #243

Merged
merged 1 commit into from
Jul 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion parlai/tasks/clevr/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ def _path(opt):
return questions_path, images_path


counts = [str(i) for i in range(11)]
materials = ['metal', 'rubber']
sizes = ['small', 'large']
shapes = ['cube', 'sphere', 'cylinder']
colors = ['gray', 'blue', 'brown', 'yellow', 'red', 'green', 'purple', 'cyan']


class DefaultTeacher(DialogTeacher):
# all possile answers for the questions
cands = ['yes', 'no'] + counts + materials + sizes + shapes + colors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't some answers be combinations of these? like "metal cube" or "gray sphere"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that the questions are always related only to one aspect. I tested the current candidates set and all the answers are in it.


def __init__(self, opt, shared=None):
self.datatype = opt['datatype']
data_path, self.images_path = _path(opt)
Expand All @@ -37,6 +47,9 @@ def __init__(self, opt, shared=None):

super().__init__(opt, shared)

def label_candidates(self):
return self.cands

def setup_data(self, path):
print('loading: ' + path)
with open(path) as data_file:
Expand All @@ -55,5 +68,4 @@ def setup_data(self, path):

question = ques['question']
answer = [ques['answer']] if ques['split'] != 'test' else None
# TODO cands?
yield (question, answer, None, None, img_path), new_episode