Update PlotQA_dataset.py
Browse files- PlotQA_dataset.py +5 -5
PlotQA_dataset.py
CHANGED
|
@@ -74,7 +74,7 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 74 |
features = datasets.Features(
|
| 75 |
{
|
| 76 |
"imgname": datasets.Value("string"),
|
| 77 |
-
"image": datasets.Image(),
|
| 78 |
#"version": datasets.Value("string"),
|
| 79 |
"query": datasets.Sequence(datasets.Value("string")),
|
| 80 |
"query_token": datasets.Sequence(datasets.Value("string")),
|
|
@@ -160,10 +160,10 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 160 |
def _generate_examples(self, annotation_v1_path:str, annotation_v2_path:str, img_anno_path:str ,images_path: str):
|
| 161 |
#Load image folder
|
| 162 |
# open file
|
| 163 |
-
file = tarfile.open(images_path)
|
| 164 |
# extracting file
|
| 165 |
-
file.extractall('./imgs')
|
| 166 |
-
file.close()
|
| 167 |
_multi_anno = [annotation_v1_path, annotation_v2_path]
|
| 168 |
|
| 169 |
idx = 0
|
|
@@ -173,7 +173,7 @@ class PlotQA(datasets.GeneratorBasedBuilder):
|
|
| 173 |
item = {}
|
| 174 |
item["img_ann"] = ele
|
| 175 |
item["imgname"] = str(ele['image_index'])+'.png'
|
| 176 |
-
item['image'] = os.path.join('./imgs',item['imgname'])
|
| 177 |
item["query_token"] = []
|
| 178 |
qa_returns = find_qa(annotation_v1_path,annotation_v2_path, item['image_index'])
|
| 179 |
_question = []
|
|
|
|
| 74 |
features = datasets.Features(
|
| 75 |
{
|
| 76 |
"imgname": datasets.Value("string"),
|
| 77 |
+
#"image": datasets.Image(),
|
| 78 |
#"version": datasets.Value("string"),
|
| 79 |
"query": datasets.Sequence(datasets.Value("string")),
|
| 80 |
"query_token": datasets.Sequence(datasets.Value("string")),
|
|
|
|
| 160 |
def _generate_examples(self, annotation_v1_path:str, annotation_v2_path:str, img_anno_path:str ,images_path: str):
|
| 161 |
#Load image folder
|
| 162 |
# open file
|
| 163 |
+
## file = tarfile.open(images_path)
|
| 164 |
# extracting file
|
| 165 |
+
## file.extractall('./imgs')
|
| 166 |
+
## file.close()
|
| 167 |
_multi_anno = [annotation_v1_path, annotation_v2_path]
|
| 168 |
|
| 169 |
idx = 0
|
|
|
|
| 173 |
item = {}
|
| 174 |
item["img_ann"] = ele
|
| 175 |
item["imgname"] = str(ele['image_index'])+'.png'
|
| 176 |
+
# item['image'] = os.path.join('./imgs',item['imgname'])
|
| 177 |
item["query_token"] = []
|
| 178 |
qa_returns = find_qa(annotation_v1_path,annotation_v2_path, item['image_index'])
|
| 179 |
_question = []
|