@@ -119,19 +119,19 @@ def __init__(self, selection=None, **kwargs):
119
119
self .selection = selection
120
120
121
121
122
- class Bigearthnet (tfds .core .GeneratorBasedBuilder ):
122
+ class Bigearthnet (tfds .core .BeamBasedBuilder ):
123
123
"""Bigearthnet remote sensing dataset of Sentinel-2 image patches."""
124
124
125
125
BUILDER_CONFIGS = [
126
126
BigearthnetConfig (
127
127
selection = 'rgb' ,
128
128
name = 'rgb' ,
129
- version = '0.0.1 ' ,
129
+ version = '0.0.2 ' ,
130
130
description = 'Sentinel-2 RGB channels' ),
131
131
BigearthnetConfig (
132
132
selection = 'all' ,
133
133
name = 'all' ,
134
- version = '0.0.1 ' ,
134
+ version = '0.0.2 ' ,
135
135
description = '13 Sentinel-2 channels' ),
136
136
]
137
137
@@ -218,11 +218,15 @@ def _split_generators(self, dl_manager):
218
218
),
219
219
]
220
220
221
- def _generate_examples (self , path , selection ):
222
- """Yields examples."""
223
- for subdir in tf .io .gfile .listdir (path ):
224
- d = _read_chip (os .path .join (path , subdir ), selection )
225
- yield d
221
+ def _build_pcollection (self , pipeline , path , selection ):
222
+ """Generates examples as dicts."""
223
+ beam = tfds .core .lazy_imports .apache_beam
224
+
225
+ def _process_example (subdir ):
226
+ return _read_chip (os .path .join (path , subdir ), selection )
227
+
228
+ return (pipeline | beam .Create (tf .io .gfile .listdir (path ))
229
+ | beam .Map (_process_example ))
226
230
227
231
228
232
def _read_chip (path , selection ):
0 commit comments