Repository: microsoft/torchgeo

Issue:
AgriFieldNet missing filename glob
### Description

The filename glob is missing from the AgriFieldNet dataset.

### Steps to reproduce

1. Check line 76 in torchgeo/datasets/agrifieldnet.py

### Version

main


Discussion:
South Africa Crop Type is also missing this.
Dug into this deeper and this actually turned out to be a somewhat serious bug. Because AgriFieldNet, GlobBiomass, and SouthAfricaCropType use separate files for each band, and because the band was not listed in the filename glob, all bands were separately entered into the index. The result is that the final dataset length is 13x longer than it should be, and passing over a single epoch actually means passing over 13 epochs. Good catch!

Resolving patch:
diff --git a/torchgeo/datasets/agrifieldnet.py b/torchgeo/datasets/agrifieldnet.py
--- a/torchgeo/datasets/agrifieldnet.py
+++ b/torchgeo/datasets/agrifieldnet.py
@@ -73,6 +73,7 @@ class AgriFieldNet(RasterDataset):
     .. versionadded:: 0.6
     """
 
+    filename_glob = 'ref_agrifieldnet_competition_v1_source_*_{}_10m.*'
     filename_regex = r"""
         ^ref_agrifieldnet_competition_v1_source_
         (?P<unique_folder_id>[a-z0-9]{5})
@@ -146,6 +147,7 @@ def __init__(
         self.classes = classes
         self.ordinal_map = torch.zeros(max(self.cmap.keys()) + 1, dtype=self.dtype)
         self.ordinal_cmap = torch.zeros((len(self.classes), 4), dtype=torch.uint8)
+        self.filename_glob = self.filename_glob.format(bands[0])
 
         super().__init__(
             paths=paths, crs=crs, bands=bands, transforms=transforms, cache=cache


Test patch:
diff --git a/tests/data/agrifieldnet/data.py b/tests/data/agrifieldnet/data.py
--- a/tests/data/agrifieldnet/data.py
+++ b/tests/data/agrifieldnet/data.py
@@ -60,7 +60,18 @@ def generate_test_data(paths: str) -> str:
     os.makedirs(train_mask_dir, exist_ok=True)
     os.makedirs(test_field_dir, exist_ok=True)
 
-    source_unique_folder_ids = ['32407', '8641e', 'a419f', 'eac11', 'ff450']
+    source_unique_folder_ids = [
+        '32407',
+        '8641e',
+        'a419f',
+        'eac11',
+        'ff450',
+        '001c1',
+        '004fa',
+        '005fe',
+        '00720',
+        '00c23',
+    ]
     train_folder_ids = source_unique_folder_ids[0:5]
     test_folder_ids = source_unique_folder_ids[3:5]
 
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B01_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B01_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B01_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B02_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B02_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B02_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B03_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B03_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B03_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B04_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B04_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B04_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B05_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B05_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B05_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B06_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B06_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B06_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B07_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B07_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B07_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B08_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B08_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B08_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B09_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B09_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B09_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B11_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B11_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B11_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B12_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B12_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B12_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B8A_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B8A_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_001c1/ref_agrifieldnet_competition_v1_source_001c1_B8A_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B01_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B01_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B01_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B02_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B02_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B02_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B03_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B03_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B03_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B04_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B04_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B04_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B05_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B05_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B05_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B06_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B06_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B06_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B07_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B07_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B07_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B08_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B08_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B08_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B09_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B09_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B09_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B11_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B11_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B11_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B12_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B12_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B12_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B8A_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B8A_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_004fa/ref_agrifieldnet_competition_v1_source_004fa_B8A_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B01_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B01_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B01_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B02_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B02_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B02_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B03_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B03_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B03_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B04_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B04_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B04_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B05_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B05_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B05_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B06_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B06_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B06_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B07_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B07_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B07_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B08_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B08_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B08_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B09_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B09_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B09_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B11_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B11_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B11_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B12_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B12_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B12_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B8A_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B8A_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_005fe/ref_agrifieldnet_competition_v1_source_005fe_B8A_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B01_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B01_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B01_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B02_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B02_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B02_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B03_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B03_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B03_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B04_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B04_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B04_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B05_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B05_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B05_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B06_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B06_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B06_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B07_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B07_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B07_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B08_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B08_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B08_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B09_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B09_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B09_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B11_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B11_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B11_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B12_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B12_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B12_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B8A_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B8A_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00720/ref_agrifieldnet_competition_v1_source_00720_B8A_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B01_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B01_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B01_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B02_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B02_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B02_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B03_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B03_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B03_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B04_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B04_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B04_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B05_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B05_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B05_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B06_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B06_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B06_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B07_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B07_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B07_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B08_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B08_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B08_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B09_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B09_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B09_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B11_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B11_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B11_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B12_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B12_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B12_10m.tif differ
diff --git a/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B8A_10m.tif b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B8A_10m.tif
new file mode 100644
Binary files /dev/null and b/tests/data/agrifieldnet/source/ref_agrifieldnet_competition_v1_source_00c23/ref_agrifieldnet_competition_v1_source_00c23_B8A_10m.tif differ
diff --git a/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_eac11_field_ids.tif b/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_eac11_field_ids.tif
Binary files a/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_eac11_field_ids.tif and b/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_eac11_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_ff450_field_ids.tif b/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_ff450_field_ids.tif
Binary files a/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_ff450_field_ids.tif and b/tests/data/agrifieldnet/test_labels/ref_agrifieldnet_competition_v1_labels_test_ff450_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407_field_ids.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407_field_ids.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407_field_ids.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_32407_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e_field_ids.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e_field_ids.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e_field_ids.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_8641e_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f_field_ids.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f_field_ids.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f_field_ids.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_a419f_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11_field_ids.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11_field_ids.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11_field_ids.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_eac11_field_ids.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450.tif differ
diff --git a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450_field_ids.tif b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450_field_ids.tif
Binary files a/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450_field_ids.tif and b/tests/data/agrifieldnet/train_labels/ref_agrifieldnet_competition_v1_labels_train_ff450_field_ids.tif differ
diff --git a/tests/datasets/test_agrifieldnet.py b/tests/datasets/test_agrifieldnet.py
--- a/tests/datasets/test_agrifieldnet.py
+++ b/tests/datasets/test_agrifieldnet.py
@@ -34,6 +34,9 @@ def test_getitem(self, dataset: AgriFieldNet) -> None:
         assert isinstance(x['image'], torch.Tensor)
         assert isinstance(x['mask'], torch.Tensor)
 
+    def test_len(self, dataset: AgriFieldNet) -> None:
+        assert len(dataset) == 10
+
     def test_and(self, dataset: AgriFieldNet) -> None:
         ds = dataset & dataset
         assert isinstance(ds, IntersectionDataset)