Datasets:
File size: 979 Bytes
a248601 73c6f98 7dcdc23 80c0b47 73c6f98 b7d4966 df111b5 73c6f98 97064ef b7d4966 97064ef b7d4966 97064ef 7dcdc23 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import datasets
class ForestSegmentationDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features({
"sample_id": datasets.Value("string"),
"image_paths": datasets.Sequence(datasets.Value("string")),
"mask": datasets.Value("string"),
}),
)
def _split_generators(self, dl_manager):
sample_stream = dl_manager.iter_jsonl("index.jsonl")
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={"samples": sample_stream}
)
]
def _generate_examples(self, samples):
for sample in samples:
yield sample["sample_id"], {
"sample_id": sample["sample_id"],
"image_paths": sample["image_paths"],
"mask": sample["mask_path"],
}
|