Skip to content

Commit ec2f1a1

Browse files
authored
Merge pull request #67 from WUR-AI/develop
Introduce multi-encoder, crop yield UC and concept captions
2 parents 97af8ad + 4023d96 commit ec2f1a1

95 files changed

Lines changed: 4253 additions & 540 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ TRAINER_PROFILE="gpu" # cpu/gpu/mps/ddp
1010
HF_HOME="${PROJECT_ROOT}/.cache/huggingface/" # set or will default to './.cache/huggingface/'
1111
DATA_DIR="${PROJECT_ROOT}/data/" # set to your local data folder (for aether), or will default to '${PROJECT_ROOT}/data/'
1212

13+
# Base cache directory for TESSERA.
14+
# GeoTessera registry/metadata is stored here; large raw source tiles go in the
15+
# raw/ subfolder. This folder can get very large — point it at an external drive
16+
# if needed.
17+
TESSERA_EMBEDDINGS_DIR="${PROJECT_ROOT}/data/cache/tessera/"
18+
1319
# Working directories
1420
# STORAGE_MODE=# or "shared"
1521
# SHARED_CACHE=# or "/path/to/shared/.cache"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,4 @@ notebooks/01-TvdP-tmp.ipynb
228228
*/source/*
229229
*.tif # for now
230230
..env.swp
231+
/data/yield_africa/

configs/callbacks/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ early_stopping:
1919
mode: "min"
2020

2121
model_summary:
22-
max_depth: 2
22+
max_depth: 1

configs/data/butterfly_coords_text.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dataset:
1414
caption_builder:
1515
_target_: src.data.butterfly_caption_builder.ButterflyCaptionBuilder
1616
templates_fname: v3.json
17+
concepts_fname: v1.json
1718
data_dir: ${paths.data_dir}/s2bms
1819
seed: ${seed}
1920

configs/data/butterfly_full_param_example.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ dataset:
2222

2323
caption_builder:
2424
_target_: src.data.butterfly_caption_builder.ButterflyCaptionBuilder
25-
templates_fname: caption_templates.json
25+
templates_fname: v3.json
26+
concepts_fname: v1.json
2627
data_dir: ${paths.data_dir}/s2bms
2728
seed: ${seed}
2829

configs/data/yield_africa_all.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
_target_: src.data.base_datamodule.BaseDataModule
2+
3+
dataset:
4+
_target_: src.data.yield_africa_dataset.YieldAfricaDataset
5+
data_dir: ${paths.data_dir}
6+
modalities:
7+
coords: {}
8+
use_target_data: true
9+
use_features: true
10+
use_aux_data: none
11+
seed: ${seed}
12+
cache_dir: ${paths.cache_dir}
13+
# Country/year filters — set to a list to restrict, null to include all.
14+
# countries and years select only the listed values;
15+
# exclude_countries and exclude_years drop the listed values.
16+
countries: ["BF", "BUR", "ETH", "KEN", "MAL", "RWA", "TAN", "ZAM"]
17+
years: [2014, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024]
18+
exclude_countries: null
19+
exclude_years: null
20+
21+
batch_size: 64
22+
num_workers: 0
23+
pin_memory: false
24+
25+
# todo - use spatial split (pre-calculate and then load from file)
26+
# - hold out country/year block for validation
27+
# - or leave one country out for validation
28+
# - normalize data by country (after filtering)
29+
30+
split_mode: "random"
31+
train_val_test_split: [0.7, 0.15, 0.15]
32+
save_split: false
33+
seed: ${seed}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
_target_: src.data.base_datamodule.BaseDataModule
2+
3+
dataset:
4+
_target_: src.data.yield_africa_dataset.YieldAfricaDataset
5+
data_dir: ${paths.data_dir}
6+
modalities:
7+
coords: {}
8+
use_target_data: true
9+
use_features: true
10+
use_aux_data: none
11+
seed: ${seed}
12+
cache_dir: ${paths.cache_dir}
13+
# Include all countries and years so the split file determines the partition.
14+
countries: ["BF", "BUR", "ETH", "KEN", "MAL", "RWA", "TAN", "ZAM"]
15+
years: [2014, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024]
16+
exclude_countries: null
17+
exclude_years: null
18+
19+
batch_size: 64
20+
num_workers: 0
21+
pin_memory: false
22+
23+
# Leave-one-country-out split loaded from a pre-generated file.
24+
# Generate split files first:
25+
# python src/data_preprocessing/yield_africa_loco_splits.py --data_dir <data_dir>
26+
#
27+
# Override saved_split_file_name at the command line to change the held-out country:
28+
# python src/train.py experiment=yield_africa_tabular_loco \
29+
# data.saved_split_file_name=split_loco_RWA.pth
30+
split_mode: "from_file"
31+
saved_split_file_name: "split_loco_KEN.pth"
32+
save_split: false
33+
seed: ${seed}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
_target_: src.data.base_datamodule.BaseDataModule
2+
3+
dataset:
4+
_target_: src.data.yield_africa_dataset.YieldAfricaDataset
5+
data_dir: ${paths.data_dir}
6+
modalities:
7+
coords: {}
8+
use_target_data: true
9+
use_features: true
10+
use_aux_data: none
11+
seed: ${seed}
12+
cache_dir: ${paths.cache_dir}
13+
# Include all countries and years so the split file determines the partition.
14+
countries: ["BF", "BUR", "ETH", "KEN", "MAL", "RWA", "TAN", "ZAM"]
15+
years: [2014, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024]
16+
exclude_countries: null
17+
exclude_years: null
18+
19+
batch_size: 64
20+
num_workers: 0
21+
pin_memory: false
22+
23+
# Spatial-cluster split loaded from a pre-generated file.
24+
# Generate split files first (produces 10 km, 25 km, and 50 km variants):
25+
# python src/data_preprocessing/yield_africa_spatial_splits.py --data_dir <data_dir>
26+
#
27+
# Override saved_split_file_name at the command line to change the cluster distance:
28+
# python src/train.py experiment=yield_africa_tabular_spatial \
29+
# data.saved_split_file_name=split_spatial_10km.pth
30+
split_mode: "from_file"
31+
saved_split_file_name: "split_spatial_25km.pth"
32+
save_split: false
33+
seed: ${seed}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
_target_: src.data.base_datamodule.BaseDataModule
2+
3+
dataset:
4+
_target_: src.data.yield_africa_dataset.YieldAfricaDataset
5+
data_dir: ${paths.data_dir}
6+
modalities:
7+
tessera:
8+
# size must match the tile_size used when running the preprocessing script.
9+
# Default: 9 pixels (set by yield_africa_tessera_preprocess.py --tile_size).
10+
size: 9
11+
format: npy
12+
# year is intentionally omitted: yield_africa fetches per-record year tiles
13+
# via the preprocessing script rather than a single bulk-year download.
14+
use_target_data: true
15+
use_features: true
16+
use_aux_data: none
17+
seed: ${seed}
18+
cache_dir: ${paths.cache_dir}
19+
countries: ["BF", "BUR", "ETH", "KEN", "MAL", "RWA", "TAN", "ZAM"]
20+
years: [2014, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024]
21+
exclude_countries: null
22+
exclude_years: null
23+
24+
batch_size: 64
25+
num_workers: 0
26+
pin_memory: false
27+
28+
split_mode: "random"
29+
train_val_test_split: [0.7, 0.15, 0.15]
30+
save_split: false
31+
seed: ${seed}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
_target_: src.data.base_datamodule.BaseDataModule
2+
3+
dataset:
4+
_target_: src.data.yield_africa_dataset.YieldAfricaDataset
5+
data_dir: ${paths.data_dir}
6+
modalities:
7+
tessera:
8+
# size must match the tile_size used when running the preprocessing script.
9+
# Default: 9 pixels (set by yield_africa_tessera_preprocess.py --tile_size).
10+
size: 9
11+
format: npy
12+
# year is intentionally omitted: yield_africa fetches per-record year tiles
13+
# via the preprocessing script rather than a single bulk-year download.
14+
use_target_data: true
15+
use_features: true
16+
use_aux_data: none
17+
seed: ${seed}
18+
cache_dir: ${paths.cache_dir}
19+
# Include all countries and years so the split file determines the partition.
20+
countries: ["BF", "BUR", "ETH", "KEN", "MAL", "RWA", "TAN", "ZAM"]
21+
years: [2014, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024]
22+
exclude_countries: null
23+
exclude_years: null
24+
25+
batch_size: 64
26+
num_workers: 0
27+
pin_memory: false
28+
29+
# Leave-one-country-out split loaded from a pre-generated file.
30+
# Generate split files first:
31+
# python src/data_preprocessing/yield_africa_loco_splits.py --data_dir <data_dir>
32+
#
33+
# Override saved_split_file_name at the command line to change the held-out country:
34+
# python src/train.py experiment=yield_africa_tessera_fusion_loco \
35+
# data.saved_split_file_name=split_loco_RWA.pth
36+
split_mode: "from_file"
37+
saved_split_file_name: "split_loco_KEN.pth"
38+
save_split: false
39+
seed: ${seed}

0 commit comments

Comments
 (0)