Update hls_burn_scars.py
Browse files- hls_burn_scars.py +7 -6
hls_burn_scars.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
|
3 |
import datasets
|
4 |
|
5 |
|
@@ -84,10 +84,11 @@ class HLSBurnScars(datasets.GeneratorBasedBuilder):
|
|
84 |
]
|
85 |
|
86 |
def _generate_examples(self, data, split):
|
87 |
-
|
88 |
-
for idx,
|
89 |
-
if
|
|
|
90 |
yield idx, {
|
91 |
-
"image": {"path":
|
92 |
-
"annotation": {"path":
|
93 |
}
|
|
|
1 |
import os
|
2 |
+
from glob import glob
|
3 |
import datasets
|
4 |
|
5 |
|
|
|
84 |
]
|
85 |
|
86 |
def _generate_examples(self, data, split):
|
87 |
+
files = glob(f"{data}/{split}/*_merged.tif")
|
88 |
+
for idx, filename in enumerate(files):
|
89 |
+
if filename.endswith("_merged.tif"):
|
90 |
+
annotation_filename = filename.replace('_merged.tif', '.mask.tif')
|
91 |
yield idx, {
|
92 |
+
"image": {"path": filename, "bytes": open(filename).read()},
|
93 |
+
"annotation": {"path": annotation_filename, "bytes": open(annotation_filename).read()},
|
94 |
}
|