SKYWF commited on
Commit
812eb00
1 Parent(s): c929750
Files changed (3) hide show
  1. data/IQ/test/result.jsonl +0 -3
  2. metadata.csv +4 -0
  3. vrptest2.py +0 -105
data/IQ/test/result.jsonl DELETED
@@ -1,3 +0,0 @@
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"}
 
 
 
 
metadata.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ imgname,question,gt_answer,qid
2
+ 1-Full-0.jpg,Select the missing image.,f,1
3
+ 1-Full-1.jpg,Select the missing image.,f,2
4
+ 2-Full-0.jpg,Select the missing image.,e,3
vrptest2.py DELETED
@@ -1,105 +0,0 @@
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" # 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
- "qid": datasets.Value("string"),
62
- }
63
- )
64
-
65
- return datasets.DatasetInfo(
66
- description=_DESCRIPTION,
67
- features=features,
68
- supervised_keys=None,
69
- license=_LICENSE,
70
- )
71
-
72
- def _split_generators(self, dl_manager):
73
- # downloaded_file = dl_manager.download_and_extract(_URL) + "/ChartQA Dataset"
74
- downloaded_file = dl_manager.download_and_extract(_URL)
75
-
76
-
77
- return [
78
- datasets.SplitGenerator(
79
- name=datasets.Split.TEST,
80
- gen_kwargs={
81
- "images_path": downloaded_file + "/test",
82
- "img_anno_path": downloaded_file + "/test/result.jsonl",
83
- },
84
- ),
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
-