Update PlotQA_dataset.py
Browse files- PlotQA_dataset.py +7 -5
PlotQA_dataset.py
CHANGED
|
@@ -75,12 +75,12 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 75 |
{
|
| 76 |
"imgname": datasets.Value("string"),
|
| 77 |
"image": datasets.Image(),
|
| 78 |
-
"
|
| 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 |
#This format required change
|
| 85 |
## "table_name": datasets.Value("string"),
|
| 86 |
## "table": datasets.Value("string"),
|
|
@@ -148,12 +148,14 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 148 |
#returns the examples in the raw in json file
|
| 149 |
for item in data:
|
| 150 |
item = copy.deepcopy(item)
|
|
|
|
| 151 |
item["image"] = os.path.join('./imgs',item["image_index"])
|
| 152 |
item["query_token"] = []
|
| 153 |
-
item["
|
| 154 |
item["label"] = item["answer"]
|
| 155 |
-
|
| 156 |
-
|
|
|
|
| 157 |
|
| 158 |
# item["image"] = os.path.join(images_path,item["imgname"])
|
| 159 |
# item["query_token"] = []
|
|
|
|
| 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 |
#This format required change
|
| 85 |
## "table_name": datasets.Value("string"),
|
| 86 |
## "table": datasets.Value("string"),
|
|
|
|
| 148 |
#returns the examples in the raw in json file
|
| 149 |
for item in data:
|
| 150 |
item = copy.deepcopy(item)
|
| 151 |
+
item["imgname"] = item["image_index"]
|
| 152 |
item["image"] = os.path.join('./imgs',item["image_index"])
|
| 153 |
item["query_token"] = []
|
| 154 |
+
item["query"] = item["question_string"]
|
| 155 |
item["label"] = item["answer"]
|
| 156 |
+
|
| 157 |
+
item["version"] = "temp"
|
| 158 |
+
item["img_ann"] = "TBD"
|
| 159 |
|
| 160 |
# item["image"] = os.path.join(images_path,item["imgname"])
|
| 161 |
# item["query_token"] = []
|