Datasets:
Tasks:
Visual Question Answering
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
medical
License:
flaviagiammarino
commited on
Commit
·
6ccbafa
1
Parent(s):
8d2603c
Upload 4 files
Browse files- README.md +7 -26
- image.png +3 -0
- path_vqa.py +30 -65
README.md
CHANGED
@@ -11,7 +11,8 @@ size_categories:
|
|
11 |
- 10K<n<100K
|
12 |
---
|
13 |
|
14 |
-
# PathVQA
|
|
|
15 |
|
16 |
## Dataset Description
|
17 |
PathVQA is a dataset of question-answer pairs on pathology images. The dataset is intended to be used for training and testing
|
@@ -20,7 +21,7 @@ Board of Pathology (ABP) test. The dataset includes both open-ended questions an
|
|
20 |
built from two publicly-available pathology textbooks: "Textbook of Pathology" and "Basic Pathology", and a publicly-available
|
21 |
digital library: "Pathology Education Informational Resource" (PEIR). The copyrights of images and captions belong to the
|
22 |
publishers and authors of these two books, and the owners of the PEIR digital library.<br>
|
23 |
-
|
24 |
**Repository:** [PathVQA Official GitHub Repository](https://github.com/UCSD-AI4H/PathVQA)<br>
|
25 |
**Paper:** [PathVQA: 30000+ Questions for Medical Visual Question Answering](https://arxiv.org/abs/2003.10286)<br>
|
26 |
**Leaderboard:** [Papers with Code Leaderboard](https://paperswithcode.com/sota/medical-visual-question-answering-on-pathvqa)
|
@@ -47,33 +48,15 @@ The question-answer pairs are in English.
|
|
47 |
|
48 |
### Data Instances
|
49 |
Each instance consists of an image-question-answer triplet.
|
50 |
-
|
51 |
-
Example from training dataset:
|
52 |
-
```
|
53 |
-
{
|
54 |
-
'image': 'train_0001',
|
55 |
-
'question': 'What is the appearance of the chromatin texture, with fine and coarse clumps?',
|
56 |
-
'answer': 'a salt-and-pepper pattern'
|
57 |
-
}
|
58 |
-
```
|
59 |
-
Example from validation dataset:
|
60 |
```
|
61 |
{
|
62 |
-
'image': '
|
63 |
-
'question': '
|
64 |
-
'answer': '
|
65 |
-
}
|
66 |
-
```
|
67 |
-
Example from test dataset:
|
68 |
-
```
|
69 |
-
{
|
70 |
-
'image': 'test_0001',
|
71 |
-
'question': 'Is squamous cell carcinoma composed of nests of malignant cells that partially recapitulate the stratified organization of squamous epithelium?',
|
72 |
-
'answer': 'yes'
|
73 |
}
|
74 |
```
|
75 |
### Data Fields
|
76 |
-
- `'image'`: the
|
77 |
- `'question'`: the text of the question about the image.
|
78 |
- `'answer'`: the text of the expected answer.
|
79 |
|
@@ -83,11 +66,9 @@ The dataset is split into training, validation and test. The split is provided d
|
|
83 |
## Additional Information
|
84 |
|
85 |
### Licensing Information
|
86 |
-
|
87 |
The authors have released the dataset under the [MIT License](https://github.com/UCSD-AI4H/PathVQA/blob/master/LICENSE).
|
88 |
|
89 |
### Citation Information
|
90 |
-
|
91 |
```
|
92 |
@article{he2020pathvqa,
|
93 |
title={PathVQA: 30000+ Questions for Medical Visual Question Answering},
|
|
|
11 |
- 10K<n<100K
|
12 |
---
|
13 |
|
14 |
+
# Dataset Card for PathVQA
|
15 |
+
![image](image.png)
|
16 |
|
17 |
## Dataset Description
|
18 |
PathVQA is a dataset of question-answer pairs on pathology images. The dataset is intended to be used for training and testing
|
|
|
21 |
built from two publicly-available pathology textbooks: "Textbook of Pathology" and "Basic Pathology", and a publicly-available
|
22 |
digital library: "Pathology Education Informational Resource" (PEIR). The copyrights of images and captions belong to the
|
23 |
publishers and authors of these two books, and the owners of the PEIR digital library.<br>
|
24 |
+
|
25 |
**Repository:** [PathVQA Official GitHub Repository](https://github.com/UCSD-AI4H/PathVQA)<br>
|
26 |
**Paper:** [PathVQA: 30000+ Questions for Medical Visual Question Answering](https://arxiv.org/abs/2003.10286)<br>
|
27 |
**Leaderboard:** [Papers with Code Leaderboard](https://paperswithcode.com/sota/medical-visual-question-answering-on-pathvqa)
|
|
|
48 |
|
49 |
### Data Instances
|
50 |
Each instance consists of an image-question-answer triplet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
```
|
52 |
{
|
53 |
+
'image': {'bytes': b'\xff\xd8\xff\xee\x00\x0eAdobe\x00d..., 'path': None},
|
54 |
+
'question': 'What does immunoperoxidase staining reveal that marks positively with anti-CD4 antibodies?',
|
55 |
+
'answer': 'a predominantly perivascular cellular infiltrate'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
```
|
58 |
### Data Fields
|
59 |
+
- `'image'`: the image referenced by the question-answer pair, as a byte array.
|
60 |
- `'question'`: the text of the question about the image.
|
61 |
- `'answer'`: the text of the expected answer.
|
62 |
|
|
|
66 |
## Additional Information
|
67 |
|
68 |
### Licensing Information
|
|
|
69 |
The authors have released the dataset under the [MIT License](https://github.com/UCSD-AI4H/PathVQA/blob/master/LICENSE).
|
70 |
|
71 |
### Citation Information
|
|
|
72 |
```
|
73 |
@article{he2020pathvqa,
|
74 |
title={PathVQA: 30000+ Questions for Medical Visual Question Answering},
|
image.png
ADDED
Git LFS Details
|
path_vqa.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
"""PathVQA: 30000+ Questions for Medical Visual Question Answering"""
|
2 |
|
3 |
-
import pandas
|
4 |
import os
|
5 |
-
|
6 |
import datasets
|
7 |
|
8 |
_CITATION = """\
|
@@ -15,11 +14,13 @@ _CITATION = """\
|
|
15 |
"""
|
16 |
|
17 |
_DESCRIPTION = """\
|
18 |
-
PathVQA is a dataset of question-answer pairs on pathology images. The
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
and the owners of the PEIR digital library.
|
24 |
"""
|
25 |
|
@@ -28,12 +29,9 @@ _HOMEPAGE = "https://github.com/UCSD-AI4H/PathVQA"
|
|
28 |
_LICENSE = "MIT"
|
29 |
|
30 |
_URLS = {
|
31 |
-
"
|
32 |
-
"
|
33 |
-
"
|
34 |
-
"text_train": "data/text/train_qa.jsonl",
|
35 |
-
"text_val": "data/text/val_qa.jsonl",
|
36 |
-
"text_test": "data/text/test_qa.jsonl",
|
37 |
}
|
38 |
|
39 |
class PathVQA(datasets.GeneratorBasedBuilder):
|
@@ -41,95 +39,62 @@ class PathVQA(datasets.GeneratorBasedBuilder):
|
|
41 |
"""
|
42 |
PathVQA: 30000+ Questions for Medical Visual Question Answering.
|
43 |
|
44 |
-
The data was obtained from the updated Google Drive link shared by the authors
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
more than once in the same split (train, val, test). After dropping the duplicate image-question-answer
|
51 |
triplets, the dataset contains 32,632 question-answer pairs on 4,289 images.
|
52 |
"""
|
53 |
|
54 |
VERSION = datasets.Version("0.1.0")
|
55 |
|
56 |
-
BUILDER_CONFIGS = [
|
57 |
-
datasets.BuilderConfig(name="full", version=VERSION, description="Original dataset."),
|
58 |
-
datasets.BuilderConfig(name="de-duped", version=VERSION, description="De-duplicated dataset."),
|
59 |
-
]
|
60 |
-
|
61 |
-
DEFAULT_CONFIG_NAME = "de-duped"
|
62 |
-
|
63 |
def _info(self):
|
64 |
-
|
65 |
-
features = datasets.Features(
|
66 |
-
{
|
67 |
-
"image": datasets.Image(),
|
68 |
-
"question": datasets.Value("string"),
|
69 |
-
"answer": datasets.Value("string")
|
70 |
-
}
|
71 |
-
)
|
72 |
-
|
73 |
return datasets.DatasetInfo(
|
74 |
description=_DESCRIPTION,
|
75 |
-
features=
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
homepage=_HOMEPAGE,
|
77 |
license=_LICENSE,
|
78 |
citation=_CITATION,
|
79 |
)
|
80 |
|
81 |
def _split_generators(self, dl_manager):
|
82 |
-
|
83 |
-
# images
|
84 |
-
image_train_dir = dl_manager.download_and_extract(_URLS["image_train"])
|
85 |
-
image_val_dir = dl_manager.download_and_extract(_URLS["image_val"])
|
86 |
-
image_test_dir = dl_manager.download_and_extract(_URLS["image_test"])
|
87 |
-
|
88 |
-
# question-answer pairs
|
89 |
-
text_train_dir = dl_manager.download(_URLS["text_train"])
|
90 |
-
text_val_dir = dl_manager.download(_URLS["text_val"])
|
91 |
-
text_test_dir = dl_manager.download(_URLS["text_test"])
|
92 |
-
|
93 |
return [
|
94 |
-
|
95 |
datasets.SplitGenerator(
|
96 |
name=datasets.Split.TRAIN,
|
97 |
gen_kwargs={
|
98 |
-
"
|
99 |
-
"text_filepath": os.path.join(text_train_dir),
|
100 |
"split": "train",
|
101 |
},
|
102 |
),
|
103 |
-
|
104 |
datasets.SplitGenerator(
|
105 |
name=datasets.Split.VALIDATION,
|
106 |
gen_kwargs={
|
107 |
-
"
|
108 |
-
"text_filepath": os.path.join(text_val_dir),
|
109 |
"split": "val",
|
110 |
},
|
111 |
),
|
112 |
-
|
113 |
datasets.SplitGenerator(
|
114 |
name=datasets.Split.TEST,
|
115 |
gen_kwargs={
|
116 |
-
"
|
117 |
-
"text_filepath": os.path.join(text_test_dir),
|
118 |
"split": "test"
|
119 |
},
|
120 |
),
|
121 |
]
|
122 |
|
123 |
-
def _generate_examples(self,
|
124 |
-
|
125 |
-
df = pandas.read_json(text_filepath, orient='records', lines=True)
|
126 |
-
if self.config.name == "de-duped":
|
127 |
-
df = df.drop_duplicates(ignore_index=True)
|
128 |
-
|
129 |
for key, row in df.iterrows():
|
130 |
yield key, {
|
131 |
-
"image":
|
132 |
"question": row["question"],
|
133 |
"answer": row["answer"]
|
134 |
}
|
135 |
-
|
|
|
1 |
"""PathVQA: 30000+ Questions for Medical Visual Question Answering"""
|
2 |
|
|
|
3 |
import os
|
4 |
+
import pandas
|
5 |
import datasets
|
6 |
|
7 |
_CITATION = """\
|
|
|
14 |
"""
|
15 |
|
16 |
_DESCRIPTION = """\
|
17 |
+
PathVQA is a dataset of question-answer pairs on pathology images. The dataset is intended to
|
18 |
+
be used for training and testing Medical Visual Question Answering (VQA) systems. The questions
|
19 |
+
contained in the dataset are similar to those in the American Board of Pathology (ABP) test. The
|
20 |
+
dataset includes both open-ended questions and binary "yes/no" questions. The dataset is built
|
21 |
+
from two publicly-available pathology textbooks: "Textbook of Pathology" and "Basic Pathology",
|
22 |
+
and a publicly-available digital library: "Pathology Education Informational Resource" (PEIR).
|
23 |
+
The copyrights of images and captions belong to the publishers and authors of these two books,
|
24 |
and the owners of the PEIR digital library.
|
25 |
"""
|
26 |
|
|
|
29 |
_LICENSE = "MIT"
|
30 |
|
31 |
_URLS = {
|
32 |
+
"train": "data/train.parquet",
|
33 |
+
"val": "data/val.parquet",
|
34 |
+
"test": "data/test.parquet",
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
class PathVQA(datasets.GeneratorBasedBuilder):
|
|
|
39 |
"""
|
40 |
PathVQA: 30000+ Questions for Medical Visual Question Answering.
|
41 |
|
42 |
+
The data was obtained from the updated Google Drive link shared by the authors on Feb 15, 2023,
|
43 |
+
see https://github.com/UCSD-AI4H/PathVQA/commit/117e7f4ef88a0e65b0e7f37b98a73d6237a3ceab. This
|
44 |
+
version of the dataset contains a total of 5,004 images and 32,795 question-answer pairs. Out
|
45 |
+
of the 5,004 images, 4,289 images are referenced by a question-answer pair, while 715 images
|
46 |
+
are not used. There are a few image-question-answer triplets which occur more than once in the
|
47 |
+
same split (training, validation, test). After dropping the duplicate image-question-answer
|
|
|
48 |
triplets, the dataset contains 32,632 question-answer pairs on 4,289 images.
|
49 |
"""
|
50 |
|
51 |
VERSION = datasets.Version("0.1.0")
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
def _info(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
return datasets.DatasetInfo(
|
55 |
description=_DESCRIPTION,
|
56 |
+
features=datasets.Features(
|
57 |
+
{
|
58 |
+
"image": datasets.Image(),
|
59 |
+
"question": datasets.Value("string"),
|
60 |
+
"answer": datasets.Value("string")
|
61 |
+
}
|
62 |
+
),
|
63 |
homepage=_HOMEPAGE,
|
64 |
license=_LICENSE,
|
65 |
citation=_CITATION,
|
66 |
)
|
67 |
|
68 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
return [
|
|
|
70 |
datasets.SplitGenerator(
|
71 |
name=datasets.Split.TRAIN,
|
72 |
gen_kwargs={
|
73 |
+
"filepath": os.path.join(dl_manager.download(_URLS["train"])),
|
|
|
74 |
"split": "train",
|
75 |
},
|
76 |
),
|
|
|
77 |
datasets.SplitGenerator(
|
78 |
name=datasets.Split.VALIDATION,
|
79 |
gen_kwargs={
|
80 |
+
"filepath": os.path.join(dl_manager.download(_URLS["val"])),
|
|
|
81 |
"split": "val",
|
82 |
},
|
83 |
),
|
|
|
84 |
datasets.SplitGenerator(
|
85 |
name=datasets.Split.TEST,
|
86 |
gen_kwargs={
|
87 |
+
"filepath": os.path.join(dl_manager.download(_URLS["test"])),
|
|
|
88 |
"split": "test"
|
89 |
},
|
90 |
),
|
91 |
]
|
92 |
|
93 |
+
def _generate_examples(self, filepath, split):
|
94 |
+
df = pandas.read_parquet(filepath)
|
|
|
|
|
|
|
|
|
95 |
for key, row in df.iterrows():
|
96 |
yield key, {
|
97 |
+
"image": row["image"],
|
98 |
"question": row["question"],
|
99 |
"answer": row["answer"]
|
100 |
}
|
|