Datasets:

Modalities:
Image
Languages:
English
DOI:
Libraries:
Datasets
License:
xhagrg commited on
Commit
68bf91e
·
1 Parent(s): ac3053f

Update hls_burn_scars.py

Browse files
Files changed (1) hide show
  1. 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
- print(list(data), split)
88
- for idx, (path, file) in enumerate(data):
89
- if path.endswith("_merged.tif"):
 
90
  yield idx, {
91
- "image": {"path": path, "bytes": file.read()},
92
- "annotation": {"path": path.replace('_merged.tif', '.mask.tif'), "bytes": file.read()},
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
  }