Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
100K<n<1M
ArXiv:
License:
Check results
Browse files
NIH-Chest-X-ray-dataset.py
CHANGED
@@ -52,7 +52,7 @@ _URLS = {
|
|
52 |
'image_urls': _IMAGE_URLS
|
53 |
}
|
54 |
|
55 |
-
|
56 |
'Atelactasis': 1,
|
57 |
'Cardiomegaly': 2,
|
58 |
'Effusion': 3,
|
@@ -68,12 +68,14 @@ LABEL2IDX = {'No Finding': 0,
|
|
68 |
'Pleural_Thickening': 13,
|
69 |
'Hernia': 14}
|
70 |
|
71 |
-
_NAMES = list(
|
72 |
|
73 |
|
74 |
class XChest(datasets.GeneratorBasedBuilder):
|
75 |
"""NIH Image Chest X-ray dataset."""
|
76 |
|
|
|
|
|
77 |
def _info(self):
|
78 |
return datasets.DatasetInfo(
|
79 |
description=_DESCRIPTION,
|
@@ -82,10 +84,10 @@ class XChest(datasets.GeneratorBasedBuilder):
|
|
82 |
"image_file_path": datasets.Value("string"),
|
83 |
"image": datasets.Image(),
|
84 |
"labels": datasets.features.ClassLabel(names=_NAMES),
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
}
|
90 |
),
|
91 |
supervised_keys=("image", "labels"),
|
@@ -148,5 +150,6 @@ class XChest(datasets.GeneratorBasedBuilder):
|
|
148 |
#"labels": ["Mass", "Hernia"]
|
149 |
#"labels": [5, 14]
|
150 |
"labels": "Mass"
|
|
|
151 |
}
|
152 |
|
|
|
52 |
'image_urls': _IMAGE_URLS
|
53 |
}
|
54 |
|
55 |
+
_LABEL2IDX = {'No Finding': 0,
|
56 |
'Atelactasis': 1,
|
57 |
'Cardiomegaly': 2,
|
58 |
'Effusion': 3,
|
|
|
68 |
'Pleural_Thickening': 13,
|
69 |
'Hernia': 14}
|
70 |
|
71 |
+
_NAMES = list(_LABEL2IDX.keys())
|
72 |
|
73 |
|
74 |
class XChest(datasets.GeneratorBasedBuilder):
|
75 |
"""NIH Image Chest X-ray dataset."""
|
76 |
|
77 |
+
VERSION = datasets.Version("0.0.0")
|
78 |
+
|
79 |
def _info(self):
|
80 |
return datasets.DatasetInfo(
|
81 |
description=_DESCRIPTION,
|
|
|
84 |
"image_file_path": datasets.Value("string"),
|
85 |
"image": datasets.Image(),
|
86 |
"labels": datasets.features.ClassLabel(names=_NAMES),
|
87 |
+
"multi-labels": datasets.features.Sequence(
|
88 |
+
datasets.features.ClassLabel(num_classes=len(_NAMES),
|
89 |
+
names=_NAMES)
|
90 |
+
)
|
91 |
}
|
92 |
),
|
93 |
supervised_keys=("image", "labels"),
|
|
|
150 |
#"labels": ["Mass", "Hernia"]
|
151 |
#"labels": [5, 14]
|
152 |
"labels": "Mass"
|
153 |
+
"multi-labels": list(map(int, [_LABEL2IDX[x] for x in ["Mass", "Hernia"]))
|
154 |
}
|
155 |
|