fix
Browse files- data/IQ/test/result.jsonl +3 -3
- vrptest2.py +13 -7
data/IQ/test/result.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
{"imgname": "1-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "f"}
|
2 |
-
{"imgname": "1-Full-1.jpg", "question": "Select the missing image.", "gt_answer": "f"}
|
3 |
-
{"imgname": "2-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "e"}
|
|
|
1 |
+
{"imgname": "1-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "f", "qid": "1"}
|
2 |
+
{"imgname": "1-Full-1.jpg", "question": "Select the missing image.", "gt_answer": "f", "qid": "2"}
|
3 |
+
{"imgname": "2-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "e", "qid": "3"}
|
vrptest2.py
CHANGED
@@ -58,6 +58,7 @@ class ChartQA(datasets.GeneratorBasedBuilder):
|
|
58 |
"image": datasets.Image(),
|
59 |
"question": datasets.Value("string"),
|
60 |
"gt_answer": datasets.Value("string"),
|
|
|
61 |
}
|
62 |
)
|
63 |
|
@@ -84,16 +85,21 @@ class ChartQA(datasets.GeneratorBasedBuilder):
|
|
84 |
]
|
85 |
|
86 |
def _generate_examples(self, img_anno_path:str ,images_path: str):
|
87 |
-
idx = 0
|
88 |
with open(img_anno_path, "r", encoding="utf-8") as f:
|
89 |
data = json.load(f)
|
90 |
#returns the examples in the raw in json file
|
91 |
for item in data:
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
96 |
|
97 |
-
yield
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
|
|
|
58 |
"image": datasets.Image(),
|
59 |
"question": datasets.Value("string"),
|
60 |
"gt_answer": datasets.Value("string"),
|
61 |
+
"qid": datasets.Value("string"),
|
62 |
}
|
63 |
)
|
64 |
|
|
|
85 |
]
|
86 |
|
87 |
def _generate_examples(self, img_anno_path:str ,images_path: str):
|
|
|
88 |
with open(img_anno_path, "r", encoding="utf-8") as f:
|
89 |
data = json.load(f)
|
90 |
#returns the examples in the raw in json file
|
91 |
for item in data:
|
92 |
+
imgname = item["imgname"]
|
93 |
+
image = os.path.join(images_path,item["imgname"])
|
94 |
+
question = item["question"]
|
95 |
+
gt_answer = item["gt_answer"]
|
96 |
+
qid = item["qid"]
|
97 |
|
98 |
+
yield qid, {
|
99 |
+
"imgname": imgname,
|
100 |
+
"image": image,
|
101 |
+
"question": question,
|
102 |
+
"qid": qid,
|
103 |
+
"gt_answer": gt_answer,
|
104 |
+
}
|
105 |
|