Jinchen Ge
commited on
Commit
·
675179f
1
Parent(s):
1d2a45f
Revert "Start to add test subset"
Browse filesThis reverts commit 1d2a45f737335f535d2ce192730ae59019f65c33.
- gqa-lxmert.py +5 -14
gqa-lxmert.py
CHANGED
@@ -44,14 +44,12 @@ seeking to address key shortcomings of previous visual question answering (VQA)
|
|
44 |
|
45 |
_URLS = {
|
46 |
"train": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/train.json",
|
47 |
-
"
|
48 |
-
"
|
49 |
-
"test": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/testdev.json",
|
50 |
-
"test_feat": "https://nlp.cs.unc.edu/data/lxmert_data/vg_gqa_imgfeat/gqa_testdev_obj36.zip",
|
51 |
"ans2label": "https://raw.githubusercontent.com/airsplay/lxmert/master/data/gqa/trainval_ans2label.json",
|
52 |
}
|
53 |
|
54 |
-
_FEAT_PATH = "vg_gqa_imgfeat/
|
55 |
|
56 |
FIELDNAMES = [
|
57 |
"img_id", "img_h", "img_w", "objects_id", "objects_conf", "attrs_id", "attrs_conf", "num_boxes", "boxes", "features"
|
@@ -134,15 +132,8 @@ class GqaLxmert(datasets.GeneratorBasedBuilder):
|
|
134 |
with open(filepath, encoding="utf-8") as f:
|
135 |
gqa = json.load(f)
|
136 |
for id_, d in enumerate(gqa):
|
137 |
-
|
138 |
-
|
139 |
-
except KeyError:
|
140 |
-
continue
|
141 |
-
label_key = next(iter(d["label"]))
|
142 |
-
if label_key not in self.ans2label:
|
143 |
-
print ("Ignored one label")
|
144 |
-
continue
|
145 |
-
label = self.ans2label[label_key]
|
146 |
yield id_, {
|
147 |
"question": d["sent"],
|
148 |
"question_id": d["question_id"],
|
|
|
44 |
|
45 |
_URLS = {
|
46 |
"train": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/train.json",
|
47 |
+
"dev": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/valid.json",
|
48 |
+
"feat": "https://nlp.cs.unc.edu/data/lxmert_data/vg_gqa_imgfeat/vg_gqa_obj36.zip",
|
|
|
|
|
49 |
"ans2label": "https://raw.githubusercontent.com/airsplay/lxmert/master/data/gqa/trainval_ans2label.json",
|
50 |
}
|
51 |
|
52 |
+
_FEAT_PATH = "vg_gqa_imgfeat/vg_gqa_obj36.tsv"
|
53 |
|
54 |
FIELDNAMES = [
|
55 |
"img_id", "img_h", "img_w", "objects_id", "objects_conf", "attrs_id", "attrs_conf", "num_boxes", "boxes", "features"
|
|
|
132 |
with open(filepath, encoding="utf-8") as f:
|
133 |
gqa = json.load(f)
|
134 |
for id_, d in enumerate(gqa):
|
135 |
+
img_features = self.id2features[d["img_id"]]
|
136 |
+
label = self.ans2label[next(iter(d["label"]))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
yield id_, {
|
138 |
"question": d["sent"],
|
139 |
"question_id": d["question_id"],
|