Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
1K<n<10K
License:
add mask config
Browse files- rock-glacier-dataset.py +14 -19
rock-glacier-dataset.py
CHANGED
@@ -90,9 +90,10 @@ class RockGlacierDataset(datasets.GeneratorBasedBuilder):
|
|
90 |
if self.config.name == "image-segmentation":
|
91 |
features = datasets.Features({
|
92 |
"image": datasets.Image(),
|
93 |
-
"
|
|
|
94 |
})
|
95 |
-
keys = ("image", "
|
96 |
|
97 |
|
98 |
return datasets.DatasetInfo(
|
@@ -149,28 +150,22 @@ class RockGlacierDataset(datasets.GeneratorBasedBuilder):
|
|
149 |
if self.config.name == "image-classification":
|
150 |
for i, path in enumerate(files):
|
151 |
file_name = os.path.basename(path)
|
152 |
-
dir_name = os.path.basename(os.path.dirname(path))
|
153 |
if dir_name != "masks" and file_name.endswith(".png"):
|
154 |
yield i, {
|
155 |
"image": path,
|
156 |
-
"labels":
|
157 |
"path": "/".join(path.split("/")[-3:]),
|
158 |
}
|
159 |
|
160 |
if self.config.name == "image-segmentation":
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
for i, path in enumerate(files):
|
170 |
-
file_name = os.path.basename(path)
|
171 |
-
if file_name.endswith(".png"):
|
172 |
-
yield i, {
|
173 |
-
"image": path,
|
174 |
-
"labels": imageId2mask[re.search('\d+', file_name).group(0)]
|
175 |
}
|
176 |
-
|
|
|
90 |
if self.config.name == "image-segmentation":
|
91 |
features = datasets.Features({
|
92 |
"image": datasets.Image(),
|
93 |
+
"masks": datasets.Image(),
|
94 |
+
"path": datasets.features.Value("string"),
|
95 |
})
|
96 |
+
keys = ("image", "masks")
|
97 |
|
98 |
|
99 |
return datasets.DatasetInfo(
|
|
|
150 |
if self.config.name == "image-classification":
|
151 |
for i, path in enumerate(files):
|
152 |
file_name = os.path.basename(path)
|
153 |
+
dir_name = os.path.basename(os.path.dirname(path)).lower()
|
154 |
if dir_name != "masks" and file_name.endswith(".png"):
|
155 |
yield i, {
|
156 |
"image": path,
|
157 |
+
"labels": dir_name,
|
158 |
"path": "/".join(path.split("/")[-3:]),
|
159 |
}
|
160 |
|
161 |
if self.config.name == "image-segmentation":
|
162 |
+
for i, path in enumerate(files):
|
163 |
+
file_name = os.path.basename(path)
|
164 |
+
dir_name = os.path.basename(os.path.dirname(path)).lower()
|
165 |
+
if dir_name == "glaciar" and file_name.endswith(".png"):
|
166 |
+
yield i, {
|
167 |
+
"image": path,
|
168 |
+
"masks": path.replace(dir_name, "masks"),,
|
169 |
+
"path": "/".join(path.split("/")[-3:]),
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
+
|