SKYWF commited on
Commit
6378057
·
1 Parent(s): 552b2bf
data/1-Full-1.jpg DELETED

Git LFS Details

  • SHA256: a5bdfbf190720605361b93ef8e9ecaff2d152e6359728c93218f61171d4af32b
  • Pointer size: 130 Bytes
  • Size of remote file: 26 kB
data/2-Full-0.jpg DELETED

Git LFS Details

  • SHA256: 3cc4ac30df8ed4aa80338b51fdb92e9a4a4dda5aa96ae8425fce58a9dee2a868
  • Pointer size: 130 Bytes
  • Size of remote file: 26.7 kB
data/{1-Full-0.jpg → IQ.zip} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3cc4ac30df8ed4aa80338b51fdb92e9a4a4dda5aa96ae8425fce58a9dee2a868
3
- size 26717
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4ff1dadedfd8595311eb4e0ff41611eb196a95a166d5997566f54123f738d70
3
+ size 65830
metadata.jsonl DELETED
@@ -1,3 +0,0 @@
1
- {"file_name": "data/1-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "f"}
2
- {"file_name": "data/1-Full-1.jpg", "question": "Select the missing image.", "gt_answer": "f"}
3
- {"file_name": "data/2-Full-0.jpg", "question": "Select the missing image.", "gt_answer": "e"}
 
 
 
 
vrptest2.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Builder script
2
+ # coding=utf-8
3
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ # GNU GENERAL PUBLIC LICENSE
19
+ # Version 3, 29 June 2007
20
+ #
21
+ # Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
22
+ # Everyone is permitted to copy and distribute verbatim copies
23
+ # of this license document, but changing it is not allowed.
24
+ """VRP2 dataset"""
25
+
26
+ import copy
27
+ import json
28
+ import os
29
+ import pandas as pd
30
+
31
+ import datasets
32
+ from datasets import load_dataset
33
+
34
+ _CITATION = """\
35
+ @article{vp2r2022jjk,
36
+ title={xxxxx},
37
+ author={test1},
38
+ journal={arXiv preprint arXiv:2203.10981},
39
+ year={2022}
40
+ }
41
+ """
42
+ _DESCRIPTION = """\
43
+ yhello
44
+ """
45
+
46
+ _LICENSE = "GNU General Public License v3.0"
47
+ _SPLITS = ["test"]
48
+
49
+ _URL = "https://huggingface.co/datasets/mujif/vrptest2/resolve/main/data/IQ.zip" # todo
50
+
51
+
52
+ class ChartQA(datasets.GeneratorBasedBuilder):
53
+
54
+ def _info(self):
55
+ features = datasets.Features(
56
+ {
57
+ "imgname": datasets.Value("string"),
58
+ "image": datasets.Image(),
59
+ "question": datasets.Value("string"),
60
+ "gt_answer": datasets.Value("string"),
61
+ }
62
+ )
63
+
64
+ return datasets.DatasetInfo(
65
+ description=_DESCRIPTION,
66
+ features=features,
67
+ supervised_keys=None,
68
+ license=_LICENSE,
69
+ )
70
+
71
+ def _split_generators(self, dl_manager):
72
+ # downloaded_file = dl_manager.download_and_extract(_URL) + "/ChartQA Dataset"
73
+ downloaded_file = dl_manager.download_and_extract(_URL)
74
+
75
+
76
+ return [
77
+ datasets.SplitGenerator(
78
+ name=datasets.Split.TEST,
79
+ gen_kwargs={
80
+ "images_path": downloaded_file + "/test",
81
+ "img_anno_path": downloaded_file + "/test/result.jsonl",
82
+ },
83
+ ),
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
+ item = copy.deepcopy(item)
93
+ item["image"] = os.path.join(images_path,item["file_name"])
94
+ item["question"] = item["question"]
95
+ item["gt_answer"] = item["gt_answer"]
96
+
97
+ yield idx, item
98
+ idx += 1
99
+