Update PlotQA_dataset.py
Browse files- PlotQA_dataset.py +8 -7
PlotQA_dataset.py
CHANGED
|
@@ -73,12 +73,12 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 73 |
def _info(self):
|
| 74 |
features = datasets.Features(
|
| 75 |
{
|
| 76 |
-
"imgname": datasets.Value("string"),
|
| 77 |
"image": datasets.Image(),
|
| 78 |
"version": datasets.Value("string"),
|
| 79 |
-
"query": datasets.Value("string"),
|
| 80 |
"query_token": datasets.Sequence(datasets.Value("string")),
|
| 81 |
-
"label": datasets.Value("string"),
|
| 82 |
"img_ann": datasets.Value("string"),
|
| 83 |
###
|
| 84 |
"image_index": datasets.Value("string"),
|
|
@@ -146,7 +146,8 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 146 |
# extracting file
|
| 147 |
file.extractall('./imgs')
|
| 148 |
file.close()
|
| 149 |
-
_multi_anno = [annotation_v1_path, annotation_v2_path]
|
|
|
|
| 150 |
idx = 0
|
| 151 |
|
| 152 |
###
|
|
@@ -156,11 +157,11 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 156 |
#returns the examples in the raw in json file
|
| 157 |
for item in data:
|
| 158 |
item = copy.deepcopy(item)
|
| 159 |
-
item["imgname"] = item["image_index"]
|
| 160 |
item["image"] = os.path.join('./imgs',item["image_index"])
|
| 161 |
item["query_token"] = []
|
| 162 |
-
item["query"] = item["question_string"]
|
| 163 |
-
item["label"] = item["answer"]
|
| 164 |
|
| 165 |
item["version"] = "temp"
|
| 166 |
item["img_ann"] = "TBD"
|
|
|
|
| 73 |
def _info(self):
|
| 74 |
features = datasets.Features(
|
| 75 |
{
|
| 76 |
+
#"imgname": datasets.Value("string"),
|
| 77 |
"image": datasets.Image(),
|
| 78 |
"version": datasets.Value("string"),
|
| 79 |
+
#"query": datasets.Value("string"),
|
| 80 |
"query_token": datasets.Sequence(datasets.Value("string")),
|
| 81 |
+
#"label": datasets.Value("string"),
|
| 82 |
"img_ann": datasets.Value("string"),
|
| 83 |
###
|
| 84 |
"image_index": datasets.Value("string"),
|
|
|
|
| 146 |
# extracting file
|
| 147 |
file.extractall('./imgs')
|
| 148 |
file.close()
|
| 149 |
+
#_multi_anno = [annotation_v1_path, annotation_v2_path]
|
| 150 |
+
_multi_anno = [annotation_v1_path]
|
| 151 |
idx = 0
|
| 152 |
|
| 153 |
###
|
|
|
|
| 157 |
#returns the examples in the raw in json file
|
| 158 |
for item in data:
|
| 159 |
item = copy.deepcopy(item)
|
| 160 |
+
#item["imgname"] = item["image_index"]
|
| 161 |
item["image"] = os.path.join('./imgs',item["image_index"])
|
| 162 |
item["query_token"] = []
|
| 163 |
+
#item["query"] = item["question_string"]
|
| 164 |
+
#item["label"] = item["answer"]
|
| 165 |
|
| 166 |
item["version"] = "temp"
|
| 167 |
item["img_ann"] = "TBD"
|