-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thanks Jiasen!! I think we'd like to keep the dataset downloading the images automatically (to datapath)--I know it's large, but users should only need to do it once anyways. Everything in downloads is also automatically downloaded (currently just the Memnn github repo). As far as DialogTeacher/DialogData, I think we want to write a new one instead that includes some of the data loading from your vqa_coco2014 (v1) and prepares us to handle the preprocessing options that we talked about before. We don't want image_id as part of the action/observation dictionary--just images themselves--so we want to include the image loading as part of that data class. |
@@ -36,7 +35,7 @@ def _path(opt): | |||
annotation_path = os.path.join(opt['datapath'], 'VQA-COCO2014', | |||
annotation_suffix + '_annotations.json') | |||
|
|||
image_path = os.path.join(opt['datapath'], 'VQA-COCO2014', img_suffix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, we'd like to keep the images in datapath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Then I think we might not want the image stay in 'VQA-COCO2014' folder, other task such as Visual Dialog may also use the COCO image. How about put the image under COCO-IMG
? Then, multiple task can share the image data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great! Yeah giving it the most general name for the data file is perfect, and then multiple tasks can depend on it (and it won't rebuild it if it's already there).
anno = self.annotation['annotations'][self.episode_idx] | ||
answers = [ans['answer'] for ans in anno['answers']] | ||
else: | ||
answers = ['fake_answer'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, just leave the labels field of the dict empty (accessing it gives KeyError, not None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks. will change this.
@jiasenlu updated the pull request - view changes |
Summary: Fix the VQA, VisalDialog, VQA v2.0 based on last update of ParAI. Test Plan: python examples/display_data.py -t vqa_coco2014 python examples/display_data.py -t vqa_coco2014_v2 python examples/display_data.py -t visdial Reviewers: Subscribers: Tasks: Tags: Blame Revision:
@jiasenlu updated the pull request - view changes |
@jiasenlu updated the pull request - view changes |
@jiasenlu updated the pull request - view changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking really good overall! how are you testing if the images are loading properly?
would be awesome to get a model in next so that we can try to train it and see if we can reproduce the results from the paper
@@ -265,7 +265,7 @@ def get(self, episode_idx, entry_idx=0): | |||
table['reward'] = entry[2] | |||
if len(entry) > 3: | |||
table['label_candidates'] = entry[3] | |||
if len(entry) > 4 and not opt.get('no_images', False): | |||
if len(entry) > 4 and not self.opt.get('no_images', False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good catch thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
self.len = len(self.ques['questions']) | ||
|
||
class DefaultTeacher(OeTeacher): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does v2 have a multiple-choice version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, VQA v2.0 doesn't have the multiple-choice now.
yes, we need to have at least a simple example of visualizing the images..
…On Thu, May 11, 2017 at 11:37 AM, Alexander Miller ***@***.*** > wrote:
***@***.**** approved this pull request.
looking really good overall! how are you testing if the images are loading
properly?
would be awesome to get a model in next so that we can try to train it and
see if we can reproduce the results from the paper
------------------------------
In parlai/core/dialog_teacher.py
<#54 (comment)>
:
> @@ -265,7 +265,7 @@ def get(self, episode_idx, entry_idx=0):
table['reward'] = entry[2]
if len(entry) > 3:
table['label_candidates'] = entry[3]
- if len(entry) > 4 and not opt.get('no_images', False):
+ if len(entry) > 4 and not self.opt.get('no_images', False):
ah good catch thank you
------------------------------
In parlai/tasks/vqa_coco2014_v2/agents.py
<#54 (comment)>
:
> + return shared
+
+ def _setup_data(self, data_path, annotation_path):
+ print('loading: ' + data_path)
+ with open(data_path) as data_file:
+ self.ques = json.load(data_file)
+
+ if self.datatype != 'test':
+ print('loading: ' + annotation_path)
+ with open(annotation_path) as data_file:
+ self.annotation = json.load(data_file)
+
+ self.len = len(self.ques['questions'])
+
+class DefaultTeacher(OeTeacher):
+ pass
does v2 have a multiple-choice version?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#54 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKjk-HHAo67A1CAmU1TddOwo2BCjWHSXks5r4ysogaJpZM4NTqgb>
.
|
simple example which prints ascii version of images (after import sys
from asciimatics.renderers import ImageFile
img = ImageFile(sys.argv[1], height=30)
print(img) maybe we want something like this in display_data? |
Yeah, I think we should do that. Maybe we can add this in a separate pull request? |
Just pushed this to get that fix in |
This pull request contains
1: add vqa_v2 task loader.
2: add VisDial_v0.9 task loader.
3: disable download COCO image as default
4: move COCO image path to "--download_path"
To test the new added task
For VQA 2.0: python examples/display_data.py -t vqa_coco2014_v2 --download-path 'path_to_COCO_img'
For Visual Dialog: python examples/display_data.py -t visdial
Currently, the Visual Dialog inherit from the default "DialogTeacher" class. There is no placeholder for the additional image information. The "DialogData" class with the format [(x, y, r, c), new_episode?], could we extend this to [(x, y, r, c, i), new_episode?] where "i" is some optional additional information such as image_id? If so, I can send another pull request to modify that.