Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
100K<n<1M
ArXiv:
License:
init dataset loader script - info
Browse files- nih-chest-x-ray.py +78 -0
nih-chest-x-ray.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
from datasets.tasks import ImageClassification
|
5 |
+
|
6 |
+
|
7 |
+
_HOMEPAGE = "https://nihcc.app.box.com/v/ChestXray-NIHCC"
|
8 |
+
|
9 |
+
_CITATION = """\
|
10 |
+
@ONLINE {beansdata,
|
11 |
+
author="Xiaosong Wang, Yifan Peng, Le Lu, Zhiyong Lu, Mohammadhadi Bagheri, Ronald Summer",
|
12 |
+
title="ChestX-ray8: Hospital-scale Chest X-ray Database and Benchmarks on Weakly-Supervised Classification and Localization of Common Thorax Diseases",
|
13 |
+
month="January",
|
14 |
+
year="2017",
|
15 |
+
url="https://nihcc.app.box.com/v/ChestXray-NIHCC"
|
16 |
+
}
|
17 |
+
"""
|
18 |
+
|
19 |
+
_DESCRIPTION = """\
|
20 |
+
The NIH Chest X-ray dataset consists of 100,000 de-identified images of chest x-rays. The images are in PNG format.
|
21 |
+
|
22 |
+
The data is provided by the NIH Clinical Center and is available through the NIH download site: https://nihcc.app.box.com/v/ChestXray-NIHCC
|
23 |
+
"""
|
24 |
+
|
25 |
+
_URLS = [
|
26 |
+
'https://nihcc.box.com/shared/static/vfk49d74nhbxq3nqjg0900w5nvkorp5c.gz',
|
27 |
+
'https://nihcc.box.com/shared/static/i28rlmbvmfjbl8p2n3ril0pptcmcu9d1.gz',
|
28 |
+
'https://nihcc.box.com/shared/static/f1t00wrtdk94satdfb9olcolqx20z2jp.gz',
|
29 |
+
'https://nihcc.box.com/shared/static/0aowwzs5lhjrceb3qp67ahp0rd1l1etg.gz',
|
30 |
+
'https://nihcc.box.com/shared/static/v5e3goj22zr6h8tzualxfsqlqaygfbsn.gz',
|
31 |
+
'https://nihcc.box.com/shared/static/asi7ikud9jwnkrnkj99jnpfkjdes7l6l.gz',
|
32 |
+
'https://nihcc.box.com/shared/static/jn1b4mw4n6lnh74ovmcjb8y48h8xj07n.gz',
|
33 |
+
'https://nihcc.box.com/shared/static/tvpxmn7qyrgl0w8wfh9kqfjskv6nmm1j.gz',
|
34 |
+
'https://nihcc.box.com/shared/static/upyy3ml7qdumlgk2rfcvlb9k6gvqq2pj.gz',
|
35 |
+
'https://nihcc.box.com/shared/static/l6nilvfa9cg3s28tqv1qc1olm3gnz54p.gz',
|
36 |
+
'https://nihcc.box.com/shared/static/hhq8fkdgvcari67vfhs7ppg2w6ni4jze.gz',
|
37 |
+
'https://nihcc.box.com/shared/static/ioqwiy20ihqwyr8pf4c24eazhh281pbu.gz'
|
38 |
+
]
|
39 |
+
|
40 |
+
LABEL2IDX = {'No Finding': 0,
|
41 |
+
'Atelactasis': 1,
|
42 |
+
'Cardiomegaly': 2,
|
43 |
+
'Effusion': 3,
|
44 |
+
'Infiltration': 4,
|
45 |
+
'Mass': 5,
|
46 |
+
'Nodule': 6,
|
47 |
+
'Pneumonia': 7,
|
48 |
+
'Pneumothorax': 8,
|
49 |
+
'Consolidation': 9,
|
50 |
+
'Edema': 10,
|
51 |
+
'Emphysema': 11,
|
52 |
+
'Fibrosis': 12,
|
53 |
+
'Pleural_Thickening': 13,
|
54 |
+
'Hernia': 14}
|
55 |
+
|
56 |
+
class XChest(datasets.GeneratorBasedBuilder):
|
57 |
+
"""NIH Image Chest X-ray dataset."""
|
58 |
+
|
59 |
+
def _info(self):
|
60 |
+
return datasets.DatasetInfo(
|
61 |
+
description=_DESCRIPTION,
|
62 |
+
features=datasets.Features(
|
63 |
+
{
|
64 |
+
"image_file_path": datasets.Value("string"),
|
65 |
+
"image": datasets.Image(),
|
66 |
+
"labels": datasets.features.ClassLabel(names=_NAMES),
|
67 |
+
}
|
68 |
+
),
|
69 |
+
supervised_keys=("image", "labels"),
|
70 |
+
homepage=_HOMEPAGE,
|
71 |
+
citation=_CITATION,
|
72 |
+
task_templates=[ImageClassification(image_column="image",
|
73 |
+
label_column="labels")],
|
74 |
+
)
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|