Update rsna-atd.py
Browse files- rsna-atd.py +65 -62
rsna-atd.py
CHANGED
@@ -32,27 +32,27 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
|
|
32 |
description=_DESCRIPTION,
|
33 |
features=datasets.Features(
|
34 |
{
|
35 |
-
"
|
36 |
-
"
|
37 |
-
"
|
38 |
-
"
|
39 |
-
# datasets.
|
40 |
-
"aortic_hu": datasets.Value("float64"),
|
41 |
-
"incomplete_organ": datasets.Value("int64"),
|
42 |
-
"bowel_healthy": datasets.Value("int64"),
|
43 |
-
"bowel_injury": datasets.Value("int64"),
|
44 |
-
"extravasation_healthy": datasets.Value("int64"),
|
45 |
-
"extravasation_injury": datasets.Value("int64"),
|
46 |
-
"kidney_healthy": datasets.Value("int64"),
|
47 |
-
"kidney_low": datasets.Value("int64"),
|
48 |
-
"kidney_high": datasets.Value("int64"),
|
49 |
-
"liver_healthy": datasets.Value("int64"),
|
50 |
-
"liver_low": datasets.Value("int64"),
|
51 |
-
"liver_high": datasets.Value("int64"),
|
52 |
-
"spleen_healthy": datasets.Value("int64"),
|
53 |
-
"spleen_low": datasets.Value("int64"),
|
54 |
-
"spleen_high": datasets.Value("int64"),
|
55 |
-
"any_injury": datasets.Value("int64"),
|
56 |
}
|
57 |
),
|
58 |
supervised_keys=None,
|
@@ -81,48 +81,51 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
|
|
81 |
|
82 |
def _generate_examples(self, images, masks, metadata):
|
83 |
df = pd.read_csv(metadata)
|
|
|
|
|
|
|
84 |
for idx, data in enumerate(df.to_numpy()):
|
85 |
-
image, mask = [hkl.load(f"images/{data[0]}")], [hkl.load(f"masks/{data[0]}")]
|
86 |
-
(
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
) = data[1:]
|
106 |
|
107 |
yield idx, {
|
108 |
-
"patient_id": patient_id,
|
109 |
-
"series_id": series_id,
|
110 |
-
"image": image,
|
111 |
-
"mask": mask,
|
112 |
-
"aortic_hu": aortic_hu,
|
113 |
-
"incomplete_organ": incomplete_organ,
|
114 |
-
"bowel_healthy": bowel_healthy,
|
115 |
-
"bowel_injury": bowel_injury,
|
116 |
-
"extravasation_healthy": extravasation_healthy,
|
117 |
-
"extravasation_injury": extravasation_injury,
|
118 |
-
"kidney_healthy": kidney_healthy,
|
119 |
-
"kidney_low": kidney_low,
|
120 |
-
"kidney_high": kidney_high,
|
121 |
-
"liver_healthy": liver_healthy,
|
122 |
-
"liver_low": liver_low,
|
123 |
-
"liver_high": liver_high,
|
124 |
-
"spleen_healthy": spleen_healthy,
|
125 |
-
"spleen_low": spleen_low,
|
126 |
-
"spleen_high": spleen_high,
|
127 |
-
"any_injury": any_injury,
|
128 |
}
|
|
|
32 |
description=_DESCRIPTION,
|
33 |
features=datasets.Features(
|
34 |
{
|
35 |
+
"test": datasets.Value("string")
|
36 |
+
# "patient_id": datasets.Value("int64"),
|
37 |
+
# "series_id": datasets.Value("int64"),
|
38 |
+
# "image": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
|
39 |
+
# "mask": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
|
40 |
+
# "aortic_hu": datasets.Value("float64"),
|
41 |
+
# "incomplete_organ": datasets.Value("int64"),
|
42 |
+
# "bowel_healthy": datasets.Value("int64"),
|
43 |
+
# "bowel_injury": datasets.Value("int64"),
|
44 |
+
# "extravasation_healthy": datasets.Value("int64"),
|
45 |
+
# "extravasation_injury": datasets.Value("int64"),
|
46 |
+
# "kidney_healthy": datasets.Value("int64"),
|
47 |
+
# "kidney_low": datasets.Value("int64"),
|
48 |
+
# "kidney_high": datasets.Value("int64"),
|
49 |
+
# "liver_healthy": datasets.Value("int64"),
|
50 |
+
# "liver_low": datasets.Value("int64"),
|
51 |
+
# "liver_high": datasets.Value("int64"),
|
52 |
+
# "spleen_healthy": datasets.Value("int64"),
|
53 |
+
# "spleen_low": datasets.Value("int64"),
|
54 |
+
# "spleen_high": datasets.Value("int64"),
|
55 |
+
# "any_injury": datasets.Value("int64"),
|
56 |
}
|
57 |
),
|
58 |
supervised_keys=None,
|
|
|
81 |
|
82 |
def _generate_examples(self, images, masks, metadata):
|
83 |
df = pd.read_csv(metadata)
|
84 |
+
yield 0, {
|
85 |
+
"test": images
|
86 |
+
}
|
87 |
for idx, data in enumerate(df.to_numpy()):
|
88 |
+
# image, mask = [hkl.load(f"images/{data[0]}")], [hkl.load(f"masks/{data[0]}")]
|
89 |
+
# (
|
90 |
+
# patient_id,
|
91 |
+
# series_id,
|
92 |
+
# aortic_hu,
|
93 |
+
# incomplete_organ,
|
94 |
+
# bowel_healthy,
|
95 |
+
# bowel_injury,
|
96 |
+
# extravasation_healthy,
|
97 |
+
# extravasation_injury,
|
98 |
+
# kidney_healthy,
|
99 |
+
# kidney_low,
|
100 |
+
# kidney_high,
|
101 |
+
# liver_healthy,
|
102 |
+
# liver_low,
|
103 |
+
# liver_high,
|
104 |
+
# spleen_healthy,
|
105 |
+
# spleen_low,
|
106 |
+
# spleen_high,
|
107 |
+
# any_injury,
|
108 |
+
# ) = data[1:]
|
109 |
|
110 |
yield idx, {
|
111 |
+
# "patient_id": patient_id,
|
112 |
+
# "series_id": series_id,
|
113 |
+
# "image": image,
|
114 |
+
# "mask": mask,
|
115 |
+
# "aortic_hu": aortic_hu,
|
116 |
+
# "incomplete_organ": incomplete_organ,
|
117 |
+
# "bowel_healthy": bowel_healthy,
|
118 |
+
# "bowel_injury": bowel_injury,
|
119 |
+
# "extravasation_healthy": extravasation_healthy,
|
120 |
+
# "extravasation_injury": extravasation_injury,
|
121 |
+
# "kidney_healthy": kidney_healthy,
|
122 |
+
# "kidney_low": kidney_low,
|
123 |
+
# "kidney_high": kidney_high,
|
124 |
+
# "liver_healthy": liver_healthy,
|
125 |
+
# "liver_low": liver_low,
|
126 |
+
# "liver_high": liver_high,
|
127 |
+
# "spleen_healthy": spleen_healthy,
|
128 |
+
# "spleen_low": spleen_low,
|
129 |
+
# "spleen_high": spleen_high,
|
130 |
+
# "any_injury": any_injury,
|
131 |
}
|