Datasets:
Tasks:
Image Segmentation
Modalities:
Image
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
10K - 100K
License:
Update RSNA-ATD2023.py
Browse files- RSNA-ATD2023.py +6 -9
RSNA-ATD2023.py
CHANGED
@@ -62,20 +62,17 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
|
|
62 |
),
|
63 |
]
|
64 |
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
def _generate_examples(self, images, masks, metadata):
|
69 |
df = pd.read_csv(metadata)
|
70 |
|
71 |
for idx, ((image_path, image), (mask_path, mask)) in enumerate(
|
72 |
-
sorted(
|
73 |
-
zip(images, masks),
|
74 |
-
key=lambda x: x[0]["image_path"]
|
75 |
-
.replace("images/", "")
|
76 |
-
.replace(".png", "")
|
77 |
-
.split("_"),
|
78 |
-
)
|
79 |
):
|
80 |
row = df.loc[df["path"] == image_path.lower().replace("images/", "")]
|
81 |
|
|
|
62 |
),
|
63 |
]
|
64 |
|
65 |
+
def sort_key(self, x):
|
66 |
+
patient_id, series_id, frame_id = (
|
67 |
+
x[0][0].replace("images/", "").replace(".png", "").split("_")
|
68 |
+
)
|
69 |
+
return int(patient_id), int(series_id), int(frame_id)
|
70 |
|
71 |
def _generate_examples(self, images, masks, metadata):
|
72 |
df = pd.read_csv(metadata)
|
73 |
|
74 |
for idx, ((image_path, image), (mask_path, mask)) in enumerate(
|
75 |
+
sorted(zip(images, masks), key=self.sort_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
):
|
77 |
row = df.loc[df["path"] == image_path.lower().replace("images/", "")]
|
78 |
|