@@ -22,7 +22,7 @@ class PADDataModule(pl.LightningDataModule):
2222
2323 def __init__ (
2424 self ,
25- root_path_coco : Union [str , Path ] = Path (),
25+ netcdf_path : Union [str , Path ] = Path (),
2626 path_train : Union [str , Path ] = Path (),
2727 path_val : Union [str , Path ] = Path (),
2828 path_test : Union [str , Path ] = Path (),
@@ -52,11 +52,11 @@ def __init__(
5252 ----------
5353 root_path_coco: Path or str
5454 The path containing the COCO files.
55- path_train : Path or str, default Path('coco_train.json')
56- The file path containing the training data.
57- path_val: Path or str, default Path('coco_val.json')
55+ netcdf_path : Path or str
56+ The path containing the training data (netCDF files) .
57+ path_val: Path or str
5858 The file path containing the validation data.
59- path_test: Path or str, default Path('coco_test.json')
59+ path_test: Path or str
6060 The file path containing the testing data.
6161 bands: list of str, default None
6262 A list of the bands to use. If None, then all available bands are
@@ -114,7 +114,7 @@ def __init__(
114114
115115 super ().__init__ ()
116116
117- self .root_path_coco = root_path_coco
117+ self .netcdf_path = netcdf_path
118118
119119 self .path_train = Path (path_train )
120120 self .path_val = Path (path_val )
@@ -185,97 +185,103 @@ def setup(self, stage=None):
185185 coco_train = COCO (self .path_train )
186186 coco_val = COCO (self .path_val )
187187
188- self .dataset_train = PADDataset (root_path_coco = self .root_path_coco ,
189- coco = coco_train ,
190- # transforms=transforms,
191- group_freq = self .group_freq ,
192- compression = self .compression ,
193- prefix = self .prefix ,
194- bands = self .bands ,
195- linear_encoder = self .linear_encoder ,
196- saved_medians = self .saved_medians ,
197- window_len = self .window_len ,
198- fixed_window = self .fixed_window ,
199- requires_norm = self .requires_norm ,
200- return_masks = self .return_masks ,
201- clouds = self .clouds ,
202- cirrus = self .cirrus ,
203- shadow = self .shadow ,
204- snow = self .snow ,
205- output_size = self .output_size ,
206- binary_labels = self .binary_labels ,
207- mode = 'train' ,
208- return_parcels = self .return_parcels
209- )
188+ self .dataset_train = PADDataset (
189+ root_path_netcdf = self .netcdf_path ,
190+ coco = coco_train ,
191+ # transforms=transforms,
192+ group_freq = self .group_freq ,
193+ compression = self .compression ,
194+ prefix = self .prefix ,
195+ bands = self .bands ,
196+ linear_encoder = self .linear_encoder ,
197+ saved_medians = self .saved_medians ,
198+ window_len = self .window_len ,
199+ fixed_window = self .fixed_window ,
200+ requires_norm = self .requires_norm ,
201+ return_masks = self .return_masks ,
202+ clouds = self .clouds ,
203+ cirrus = self .cirrus ,
204+ shadow = self .shadow ,
205+ snow = self .snow ,
206+ output_size = self .output_size ,
207+ binary_labels = self .binary_labels ,
208+ mode = 'train' ,
209+ return_parcels = self .return_parcels
210+ )
210211
211- self .dataset_eval = PADDataset (root_path_coco = self .root_path_coco ,
212- coco = coco_val ,
213- group_freq = self .group_freq ,
214- compression = self .compression ,
215- prefix = self .prefix ,
216- bands = self .bands ,
217- linear_encoder = self .linear_encoder ,
218- saved_medians = self .saved_medians ,
219- window_len = self .window_len ,
220- fixed_window = self .fixed_window ,
221- requires_norm = self .requires_norm ,
222- return_masks = self .return_masks ,
223- clouds = self .clouds ,
224- cirrus = self .cirrus ,
225- shadow = self .shadow ,
226- snow = self .snow ,
227- output_size = self .output_size ,
228- binary_labels = self .binary_labels ,
229- mode = 'val' ,
230- return_parcels = self .return_parcels
231- )
212+ self .dataset_eval = PADDataset (
213+ root_path_netcdf = self .netcdf_path ,
214+ coco = coco_val ,
215+ group_freq = self .group_freq ,
216+ compression = self .compression ,
217+ prefix = self .prefix ,
218+ bands = self .bands ,
219+ linear_encoder = self .linear_encoder ,
220+ saved_medians = self .saved_medians ,
221+ window_len = self .window_len ,
222+ fixed_window = self .fixed_window ,
223+ requires_norm = self .requires_norm ,
224+ return_masks = self .return_masks ,
225+ clouds = self .clouds ,
226+ cirrus = self .cirrus ,
227+ shadow = self .shadow ,
228+ snow = self .snow ,
229+ output_size = self .output_size ,
230+ binary_labels = self .binary_labels ,
231+ mode = 'val' ,
232+ return_parcels = self .return_parcels
233+ )
232234
233235 else :
234236 # Setup datasets for testing
235237 coco_test = COCO (self .path_test )
236238
237- self .dataset_test = PADDataset (root_path_coco = self .root_path_coco ,
238- coco = coco_test ,
239- group_freq = self .group_freq ,
240- compression = self .compression ,
241- prefix = self .prefix ,
242- bands = self .bands ,
243- linear_encoder = self .linear_encoder ,
244- saved_medians = self .saved_medians ,
245- window_len = self .window_len ,
246- fixed_window = self .fixed_window ,
247- requires_norm = self .requires_norm ,
248- return_masks = self .return_masks ,
249- clouds = self .clouds ,
250- cirrus = self .cirrus ,
251- shadow = self .shadow ,
252- snow = self .snow ,
253- output_size = self .output_size ,
254- binary_labels = self .binary_labels ,
255- mode = 'test' ,
256- return_parcels = self .return_parcels
257- )
239+ self .dataset_test = PADDataset (
240+ root_path_netcdf = self .netcdf_path ,
241+ coco = coco_test ,
242+ group_freq = self .group_freq ,
243+ compression = self .compression ,
244+ prefix = self .prefix ,
245+ bands = self .bands ,
246+ linear_encoder = self .linear_encoder ,
247+ saved_medians = self .saved_medians ,
248+ window_len = self .window_len ,
249+ fixed_window = self .fixed_window ,
250+ requires_norm = self .requires_norm ,
251+ return_masks = self .return_masks ,
252+ clouds = self .clouds ,
253+ cirrus = self .cirrus ,
254+ shadow = self .shadow ,
255+ snow = self .snow ,
256+ output_size = self .output_size ,
257+ binary_labels = self .binary_labels ,
258+ mode = 'test' ,
259+ return_parcels = self .return_parcels
260+ )
258261
259262 def train_dataloader (self ):
260- return DataLoader (self .dataset_train ,
261- batch_size = self .batch_size ,
262- shuffle = True ,
263- num_workers = self .num_workers ,
264- pin_memory = True
265- )
263+ return DataLoader (
264+ self .dataset_train ,
265+ batch_size = self .batch_size ,
266+ shuffle = True ,
267+ num_workers = self .num_workers ,
268+ pin_memory = True
269+ )
266270
267271 def val_dataloader (self ):
268- return DataLoader (self .dataset_eval ,
269- batch_size = self .batch_size ,
270- shuffle = False ,
271- num_workers = self .num_workers ,
272- pin_memory = True
273- )
272+ return DataLoader (
273+ self .dataset_eval ,
274+ batch_size = self .batch_size ,
275+ shuffle = False ,
276+ num_workers = self .num_workers ,
277+ pin_memory = True
278+ )
274279
275280 def test_dataloader (self ):
276- return DataLoader (self .dataset_test ,
277- batch_size = self .batch_size ,
278- shuffle = False ,
279- num_workers = self .num_workers ,
280- pin_memory = True
281- )
281+ return DataLoader (
282+ self .dataset_test ,
283+ batch_size = self .batch_size ,
284+ shuffle = False ,
285+ num_workers = self .num_workers ,
286+ pin_memory = True
287+ )
0 commit comments