jherzog commited on
Commit
9dbdf7e
·
1 Parent(s): 54a23ba

removed TODO, restructured such that both examples run without error

Browse files
Files changed (1) hide show
  1. example_data_loading.py +7 -3
example_data_loading.py CHANGED
@@ -1,6 +1,6 @@
1
  from ben_txt_datamodule import BENTxTDataset, BENTxTDataModule
2
 
3
- if __name__ == "__main__":
4
  # Datasets example using the Red (B04), Green (B03), and Blue (B02) band from the Sentinel-2 images.
5
  ds_rgb = BENTxTDataset(
6
  lmdb_file="Encoded-BigEarthNet/",
@@ -14,9 +14,9 @@ if __name__ == "__main__":
14
  print(f"Text input: {sample['text_input']}")
15
  print(f"Reference output: {sample['reference_output']}")
16
 
 
17
  # Lightning DataModule example using the 10m and 20m spatial resolution bands from Sentinel-1 and Sentinel-2 and multiple metadata filters.
18
  # The datamodule will create 4 dataloaders: train, val, test, and bench.
19
- # TODO: Change image_lmdb_file path to the rico-hdl generated lmdb file path when available.
20
  dm = BENTxTDataModule(
21
  image_lmdb_file="Encoded-BigEarthNet/",
22
  metadata_file="BigEarthNet.txt.parquet",
@@ -39,4 +39,8 @@ if __name__ == "__main__":
39
  print(f"Batch image input shape: {batch['image_input'].shape}")
40
  print(f"First batch sample text input: {batch['text_input'][0]}")
41
  print(f"First batch sample text reference output: {batch['reference_output']}")
42
- break
 
 
 
 
 
1
  from ben_txt_datamodule import BENTxTDataset, BENTxTDataModule
2
 
3
+ def create_dataset_example():
4
  # Datasets example using the Red (B04), Green (B03), and Blue (B02) band from the Sentinel-2 images.
5
  ds_rgb = BENTxTDataset(
6
  lmdb_file="Encoded-BigEarthNet/",
 
14
  print(f"Text input: {sample['text_input']}")
15
  print(f"Reference output: {sample['reference_output']}")
16
 
17
+ def create_datamodule_example():
18
  # Lightning DataModule example using the 10m and 20m spatial resolution bands from Sentinel-1 and Sentinel-2 and multiple metadata filters.
19
  # The datamodule will create 4 dataloaders: train, val, test, and bench.
 
20
  dm = BENTxTDataModule(
21
  image_lmdb_file="Encoded-BigEarthNet/",
22
  metadata_file="BigEarthNet.txt.parquet",
 
39
  print(f"Batch image input shape: {batch['image_input'].shape}")
40
  print(f"First batch sample text input: {batch['text_input'][0]}")
41
  print(f"First batch sample text reference output: {batch['reference_output']}")
42
+ break
43
+
44
+ if __name__ == "__main__":
45
+ create_dataset_example()
46
+ create_datamodule_example()