diff --git a/configs/data/heat_krakow.yaml b/configs/data/heat_krakow.yaml index 1644b12c..0e5a4f5e 100644 --- a/configs/data/heat_krakow.yaml +++ b/configs/data/heat_krakow.yaml @@ -8,6 +8,7 @@ dataset: use_target_data: true use_features: true use_aux_data: none + use_unlabelled_data: false seed: ${seed} cache_dir: ${paths.cache_dir} @@ -16,8 +17,6 @@ num_workers: 8 pin_memory: true split_mode: "from_file" -save_split: false saved_split_file_name: "heat_krakow_split_20260522_1120.pth" -train_val_test_split: [0.7, 0.15, 0.15] seed: ${seed} diff --git a/configs/data/heat_krakow_tessera_text.yaml b/configs/data/heat_krakow_tessera_text.yaml new file mode 100644 index 00000000..23a798d8 --- /dev/null +++ b/configs/data/heat_krakow_tessera_text.yaml @@ -0,0 +1,146 @@ +# Alignment data config for the Krakow LST use case (Tessera + expert-legend captions). +# +# Requirements before running: +# 1. The model-ready CSV the dataset loads from ${paths.data_dir} must contain the +# feat_* and aux_*_label columns. +# 2. Tessera tiles at ${paths.data_dir}/heat_krakow/eo/tessera/tessera_.npy +# (10x10, 128-band). +_target_: src.data.base_datamodule.BaseDataModule + +dataset: + _target_: src.data.heat_krakow_dataset.HeatKrakowDataset + data_dir: ${paths.data_dir} + modalities: + tessera: + year: 2024 + size: 10 + format: npy + coords: {} + use_target_data: false + use_features: false + use_unlabelled_data: false + use_aux_data: + aux: + columns: + - target_lst + - feat_ndvi_20240829 + - feat_ndwi_20240829 + - feat_ari_20240829 + - feat_nbr_20240829 + - feat_meanbuildingsheight + - feat_buildingscoverha + - feat_buildingscoverpercent + - feat_copernicusmeanimperviousdensity2021 + - feat_res_per_1ha + - feat_dem_5m + - feat_slope_5m + - feat_aspect_5m + - feat_tpi_5m + - feat_tri_5m + - feat_annualsolarradiation + - feat_meancanopyheight + - feat_forestcoverha + - feat_forestcoverpercent + - feat_vegetationvoxelnumber + - feat_vegetationlidarptsnumber + - feat_hvv2bv + - feat_copernicusmeantreecoverdensity2023 + - feat_districtname__Bieńczyce + - feat_districtname__Bieżanów_Prokocim + - feat_districtname__Bronowice + - feat_districtname__Czyżyny + - feat_districtname__Dębniki + - feat_districtname__Grzegórzki + - feat_districtname__Krowodrza + - feat_districtname__Mistrzejowice + - feat_districtname__Nowa_Huta + - feat_districtname__Podgórze + - feat_districtname__Podgórze_Duchackie + - feat_districtname__Prądnik_Biały + - feat_districtname__Prądnik_Czerwony + - feat_districtname__Stare_Miasto + - feat_districtname__Swoszowice + - feat_districtname__Wzgórza_Krzesławickie + - feat_districtname__Zwierzyniec + - feat_districtname__Łagiewniki_Borek_Fałęcki + - feat_gridtype__industrial + - feat_gridtype__natural + - feat_gridtype__residential + - feat_gridtype__transport_infrastructure + - feat_griddominantlanduse__agriculture + - feat_griddominantlanduse__allotment_garden + - feat_griddominantlanduse__barren_land + - feat_griddominantlanduse__built_up_commercial + - feat_griddominantlanduse__built_up_industrial + - feat_griddominantlanduse__forest + - feat_griddominantlanduse__forest_nursery + - feat_griddominantlanduse__grove + - feat_griddominantlanduse__industrial + - feat_griddominantlanduse__low_vegetation + - feat_griddominantlanduse__multifamily_residential + - feat_griddominantlanduse__orchard + - feat_griddominantlanduse__other_built_up + - feat_griddominantlanduse__plantation + - feat_griddominantlanduse__residential + - feat_griddominantlanduse__river + - feat_griddominantlanduse__shrubland + - feat_griddominantlanduse__single_family_residential + - feat_griddominantlanduse__transport_infrastructure + - feat_griddominantlanduse__waterbodies + - feat_copernicusclcplusbackbone2023class__coniferous_forest + - feat_copernicusclcplusbackbone2023class__deciduous_forest + - feat_copernicusclcplusbackbone2023class__herbaceous_vegetation_permanent + - feat_copernicusclcplusbackbone2023class__herbaceous_vegetation_temporary + - feat_copernicusclcplusbackbone2023class__no_vegetation + - feat_copernicusclcplusbackbone2023class__sealed + - feat_copernicusclcplusbackbone2023class__shrubs + - feat_copernicusclcplusbackbone2023class__water + - feat_copernicusherbaceousvegpresence2023__herbaceous_vegetation_present + - feat_copernicusherbaceousvegpresence2023__no_herbaceous_vegetation + top: + columns: + - aux_ndvi_20240829_label + - aux_ndwi_20240829_label + - aux_ari_20240829_label + - aux_nbr_20240829_label + - aux_meanbuildingsheight_label + - aux_buildingscoverha_label + - aux_buildingscoverpercent_label + - aux_copernicusmeanimperviousdensity2021_label + - aux_res_per_1ha_label + - aux_dem_5m_label + - aux_slope_5m_label + - aux_aspect_5m_label + - aux_tpi_5m_label + - aux_tri_5m_label + - aux_annualsolarradiation_label + - aux_meancanopyheight_label + - aux_forestcoverha_label + - aux_forestcoverpercent_label + - aux_vegetationvoxelnumber_label + - aux_vegetationlidarptsnumber_label + - aux_hvv2bv_label + - aux_copernicusmeantreecoverdensity2023_label + - aux_districtid_label + - aux_districtname_label + - aux_gridtype_label + - aux_griddominantlanduse_label + - aux_copernicusclcplusbackbone2023class_label + - aux_copernicusherbaceousvegpresence2023_label + seed: ${seed} + cache_dir: ${paths.cache_dir} + +caption_builder: + _target_: src.data.heat_krakow_caption_builder.HeatKrakowCaptionBuilder + templates_fname: v1.json + concepts_fname: v2.json + data_dir: ${paths.data_dir}/heat_krakow + seed: ${seed} + +batch_size: 64 +num_workers: 8 +pin_memory: true + +split_mode: "from_file" +saved_split_file_name: "heat_krakow_split_20260522_1120.pth" +seed: ${seed} diff --git a/configs/experiment/krakow/heat_krakow_alignment.yaml b/configs/experiment/krakow/heat_krakow_alignment.yaml new file mode 100644 index 00000000..7aecc648 --- /dev/null +++ b/configs/experiment/krakow/heat_krakow_alignment.yaml @@ -0,0 +1,29 @@ +# @package _global_ + +defaults: + - override /data: heat_krakow_tessera_text + - override /model: heat_krakow_tessera_alignment + - override /callbacks: default + - override /trainer: default + +# Experiment identification +task_name: "heat_krakow_alignment" +tags: ["krakow", "lst", "tessera", "alignment"] + +# Datamodule overrides +datamodule: + batch_size: 32 + num_workers: 4 + +# Model parameters (Geo & Text Encoder Setup) +model: + optimizer: + _target_: torch.optim.AdamW + lr: 1e-4 + weight_decay: 0.01 + +trainer: + min_epochs: 1 + max_epochs: 50 + accelerator: gpu + devices: 1 diff --git a/configs/model/heat_krakow_tessera_alignment.yaml b/configs/model/heat_krakow_tessera_alignment.yaml new file mode 100644 index 00000000..d57e1017 --- /dev/null +++ b/configs/model/heat_krakow_tessera_alignment.yaml @@ -0,0 +1,33 @@ +_target_: src.models.text_alignment_model.TextAlignmentModel + +geo_encoder: + _target_: src.models.components.geo_encoders.average_encoder.AverageEncoder + geo_data_name: tessera + +text_encoder: + _target_: src.models.components.text_encoders.clip_text_encoder.ClipTextEncoder + hf_cache_dir: ${paths.huggingface_cache} + +match_to_geo: false +trainable_modules: + - text_encoder.projector + - loss_fn.log_temp + +metrics: null + +optimizer: + _target_: torch.optim.Adam + _partial_: true + lr: 0.001 + weight_decay: 0.0 + +scheduler: + _target_: torch.optim.lr_scheduler.ReduceLROnPlateau + _partial_: true + mode: min + factor: 0.1 + patience: 10 + +loss_fn: + _target_: src.models.components.loss_fns.clip_loss.ClipLoss + temperature: 0.07 diff --git a/data/heat_krakow/concept_captions/v1.json b/data/heat_krakow/concept_captions/v1.json new file mode 100644 index 00000000..0c933689 --- /dev/null +++ b/data/heat_krakow/concept_captions/v1.json @@ -0,0 +1,102 @@ +[ + { + "concept_caption": "Hot surface above the urban heat-stress limit", + "is_max": true, + "col": "target_lst" + }, + { + "concept_caption": "Areas with abundant vegetation in good condition", + "is_max": true, + "col": "feat_ndvi_20240829" + }, + { + "concept_caption": "Healthy vegetation in moist environment", + "is_max": true, + "col": "feat_ndwi_20240829" + }, + { + "concept_caption": "Areas covered with healthy, green vegetation", + "is_max": false, + "col": "feat_ari_20240829" + }, + { + "concept_caption": "Dense, healthy vegetation", + "is_max": true, + "col": "feat_nbr_20240829" + }, + { + "concept_caption": "High density of tall blocks of flats", + "is_max": true, + "col": "feat_meanbuildingsheight" + }, + { + "concept_caption": "Built-up areas with little or no green infrastructure", + "is_max": true, + "col": "feat_buildingscoverha" + }, + { + "concept_caption": "Built-up areas with little or no green infrastructure", + "is_max": true, + "col": "feat_buildingscoverpercent" + }, + { + "concept_caption": "Areas fully covered with anthropogenic structures", + "is_max": true, + "col": "feat_copernicusmeanimperviousdensity2021" + }, + { + "concept_caption": "Sparsely populated areas, or areas without permanent residents", + "is_max": false, + "col": "feat_res_per_1ha" + }, + { + "concept_caption": "Areas situated in the Vistula river valley", + "is_max": false, + "col": "feat_dem_5m" + }, + { + "concept_caption": "Steep slopes of natural or anthropogenic terrain features", + "is_max": true, + "col": "feat_slope_5m" + }, + { + "concept_caption": "Terrain features that rise above the neighbourhood", + "is_max": true, + "col": "feat_tpi_5m" + }, + { + "concept_caption": "Jagged terrain with uneven areas", + "is_max": true, + "col": "feat_tri_5m" + }, + { + "concept_caption": "High potential incoming solar radiation throughout the year", + "is_max": true, + "col": "feat_annualsolarradiation" + }, + { + "concept_caption": "Tall, dense forests", + "is_max": true, + "col": "feat_meancanopyheight" + }, + { + "concept_caption": "Areas with no forest cover", + "is_max": false, + "col": "feat_forestcoverha" + }, + { + "concept_caption": "High vegetation volume and biomass", + "is_max": true, + "col": "feat_vegetationvoxelnumber" + }, + { + "concept_caption": "Areas dominated by high vegetation with no buildings", + "is_max": true, + "col": "feat_hvv2bv" + }, + { + "concept_caption": "Areas covered with dense forests", + "is_max": true, + "col": "feat_copernicusmeantreecoverdensity2023" + } +] diff --git a/data/heat_krakow/concept_captions/v2.json b/data/heat_krakow/concept_captions/v2.json new file mode 100644 index 00000000..46af606c --- /dev/null +++ b/data/heat_krakow/concept_captions/v2.json @@ -0,0 +1,142 @@ +[ + { + "concept_caption": "Hot surface above the urban heat-stress limit", + "is_max": true, + "col": "target_lst", + "id": 0, + "theta_k": 33.433387756347656, + "accuracy_baseline_train": 7.180138111114502, + "accuracy_baseline_val": 7.002706050872803, + "accuracy_baseline_test": 7.424319744110107 + }, + { + "concept_caption": "Healthy vegetation in moist environment", + "is_max": true, + "col": "feat_ndwi_20240829", + "id": 2, + "theta_k": -0.1660308837890625, + "accuracy_baseline_train": 10.906126022338867, + "accuracy_baseline_val": 10.943842887878418, + "accuracy_baseline_test": 10.823609352111816 + }, + { + "concept_caption": "Dense, healthy vegetation", + "is_max": true, + "col": "feat_nbr_20240829", + "id": 4, + "theta_k": 0.20608046650886536, + "accuracy_baseline_train": 3.725987672805786, + "accuracy_baseline_val": 3.7889041900634766, + "accuracy_baseline_test": 4.160325050354004 + }, + { + "concept_caption": "High density of tall blocks of flats", + "is_max": true, + "col": "feat_meanbuildingsheight", + "id": 5, + "theta_k": 16.044946670532227, + "accuracy_baseline_train": 5.733961582183838, + "accuracy_baseline_val": 5.6326117515563965, + "accuracy_baseline_test": 5.750041961669922 + }, + { + "concept_caption": "Built-up areas with little or no green infrastructure", + "is_max": true, + "col": "feat_buildingscoverha", + "id": 6, + "theta_k": 0.268550306558609, + "accuracy_baseline_train": 7.346864700317383, + "accuracy_baseline_val": 7.171853542327881, + "accuracy_baseline_test": 7.745645046234131 + }, + { + "concept_caption": "Built-up areas with little or no green infrastructure", + "is_max": true, + "col": "feat_buildingscoverpercent", + "id": 7, + "theta_k": 0.33154356479644775, + "accuracy_baseline_train": 7.346864700317383, + "accuracy_baseline_val": 7.171853542327881, + "accuracy_baseline_test": 7.745645046234131 + }, + { + "concept_caption": "Areas fully covered with anthropogenic structures", + "is_max": true, + "col": "feat_copernicusmeanimperviousdensity2021", + "id": 8, + "theta_k": 35.460235595703125, + "accuracy_baseline_train": 22.069589614868164, + "accuracy_baseline_val": 22.158321380615234, + "accuracy_baseline_test": 22.543548583984375 + }, + { + "concept_caption": "Steep slopes of natural or anthropogenic terrain features", + "is_max": true, + "col": "feat_slope_5m", + "id": 11, + "theta_k": 7.012476444244385, + "accuracy_baseline_train": 10.500181198120117, + "accuracy_baseline_val": 10.385656356811523, + "accuracy_baseline_test": 10.29934024810791 + }, + { + "concept_caption": "Terrain features that rise above the neighbourhood", + "is_max": true, + "col": "feat_tpi_5m", + "id": 13, + "theta_k": 0.019795430824160576, + "accuracy_baseline_train": 3.8564696311950684, + "accuracy_baseline_val": 3.636671304702759, + "accuracy_baseline_test": 3.8897342681884766 + }, + { + "concept_caption": "Jagged terrain with uneven areas", + "is_max": true, + "col": "feat_tri_5m", + "id": 14, + "theta_k": 1.8499562740325928, + "accuracy_baseline_train": 9.144618034362793, + "accuracy_baseline_val": 9.235453605651855, + "accuracy_baseline_test": 8.89565372467041 + }, + { + "concept_caption": "Tall, dense forests", + "is_max": true, + "col": "feat_meancanopyheight", + "id": 16, + "theta_k": 15.03244686126709, + "accuracy_baseline_train": 10.583544731140137, + "accuracy_baseline_val": 10.943842887878418, + "accuracy_baseline_test": 11.2125825881958 + }, + { + "concept_caption": "High vegetation volume and biomass", + "is_max": true, + "col": "feat_vegetationvoxelnumber", + "id": 19, + "theta_k": 17026.263671875, + "accuracy_baseline_train": 17.763683319091797, + "accuracy_baseline_val": 18.048038482666016, + "accuracy_baseline_test": 17.85895538330078 + }, + { + "concept_caption": "Areas dominated by high vegetation with no buildings", + "is_max": true, + "col": "feat_hvv2bv", + "id": 21, + "theta_k": 94.12316131591797, + "accuracy_baseline_train": 35.49474334716797, + "accuracy_baseline_val": 34.489173889160156, + "accuracy_baseline_test": 35.22746658325195 + }, + { + "concept_caption": "Areas covered with dense forests", + "is_max": true, + "col": "feat_copernicusmeantreecoverdensity2023", + "id": 22, + "theta_k": 21.72222137451172, + "accuracy_baseline_train": 21.692642211914062, + "accuracy_baseline_val": 22.02300453186035, + "accuracy_baseline_test": 21.93471908569336 + } +] \ No newline at end of file diff --git a/data/heat_krakow/location_caption_templates/v1.json b/data/heat_krakow/location_caption_templates/v1.json new file mode 100644 index 00000000..ef9557fd --- /dev/null +++ b/data/heat_krakow/location_caption_templates/v1.json @@ -0,0 +1,1002 @@ +[ + "Geospatial area characterised by , situated in , showing and .", + "Environment with , in , under conditions.", + "Place with , situated in , influenced by .", + "Place dominated by , situated in , with and .", + "Earth observation image where is prevalent, in , influenced by , and .", + "Overhead view where is prevalent, placed in , showing , and .", + "Location dominated by , that is a part of , influenced by , and .", + "Region dominated by , that is a part of , influenced by .", + "Environment where is prevalent, placed in , with and .", + "Landscape characterised by , located in , with .", + "Location with , situated in , with , and .", + "Landscape where is prevalent, that is a part of , showing , and .", + "Place where is prevalent, situated in , showing , and .", + "Territory dominated by , situated in , under , and conditions.", + "Area dominated by , located in , showing and .", + "Landscape characterised by , placed in , under and conditions.", + "Setting where is prevalent, situated in , with , and .", + "Region characterised by , situated in , showing .", + "Earth observation image characterised by , placed in , under and conditions.", + "Earth observation image where is prevalent, situated in , showing , and .", + "Earth observation image dominated by , placed in , influenced by and .", + "Patch where is prevalent, that is a part of , with .", + "Territory with , that is a part of , with and .", + "Geographical area with , that is a part of , under , and conditions.", + "Area characterised by , located in , with , and .", + "Geographical area characterised by , placed in , under conditions.", + "Environment dominated by , located in , showing , and .", + "Geospatial area characterised by , that is a part of , with and .", + "Location dominated by , located in , showing and .", + "Region with , in , under conditions.", + "Site where is prevalent, situated in , under , and conditions.", + "Region dominated by , in , under conditions.", + "Area characterised by , in , influenced by .", + "Locale characterised by , that is a part of , showing .", + "Location dominated by , in , with , and .", + "Geospatial area characterised by , situated in , under , and conditions.", + "Area dominated by , situated in , with and .", + "Environment where is prevalent, placed in , with and .", + "Geographical area where is prevalent, placed in , with , and .", + "Territory dominated by , located in , showing .", + "Setting where is prevalent, in , under conditions.", + "Region characterised by , in , under conditions.", + "Earth observation image with , placed in , under and conditions.", + "Environment dominated by , situated in , influenced by , and .", + "Geographical area where is prevalent, in , under , and conditions.", + "Site where is prevalent, situated in , with , and .", + "Locale characterised by , placed in , with , and .", + "Setting characterised by , placed in , with , and .", + "Site where is prevalent, situated in , influenced by and .", + "Earth observation image characterised by , placed in , influenced by .", + "Overhead view characterised by , that is a part of , under and conditions.", + "Geographical area dominated by , that is a part of , under conditions.", + "Territory dominated by , in , under and conditions.", + "Geographical area characterised by , in , influenced by .", + "Environment characterised by , situated in , showing and .", + "Location dominated by , situated in , showing and .", + "Territory where is prevalent, in , under conditions.", + "Overhead view dominated by , in , under , and conditions.", + "Earth observation image with , located in , influenced by and .", + "Setting with , placed in , under and conditions.", + "Territory dominated by , situated in , under , and conditions.", + "Overhead view dominated by , placed in , showing , and .", + "Earth observation image with , placed in , influenced by and .", + "Location characterised by , placed in , influenced by and .", + "Locale dominated by , in , showing and .", + "Geographical area where is prevalent, placed in , with and .", + "Overhead view dominated by , in , influenced by and .", + "Geographical area where is prevalent, in , showing and .", + "Geospatial area where is prevalent, that is a part of , influenced by and .", + "Overhead view where is prevalent, located in , influenced by and .", + "Locale with , situated in , under conditions.", + "Geospatial area characterised by , situated in , influenced by .", + "Area where is prevalent, in , showing and .", + "Overhead view dominated by , located in , with .", + "Environment characterised by , placed in , with and .", + "Landscape dominated by , placed in , with , and .", + "Landscape with , located in , under conditions.", + "Locale characterised by , that is a part of , under and conditions.", + "Overhead view with , in , influenced by , and .", + "Geospatial area characterised by , in , showing and .", + "Setting dominated by , located in , showing and .", + "Overhead view dominated by , in , showing , and .", + "Territory with , that is a part of , influenced by and .", + "Overhead view characterised by , that is a part of , showing and .", + "Overhead view characterised by , that is a part of , showing , and .", + "Geographical area with , located in , with , and .", + "Locale where is prevalent, that is a part of , with .", + "Site where is prevalent, placed in , showing .", + "Territory dominated by , placed in , influenced by .", + "Region characterised by , situated in , under , and conditions.", + "Place dominated by , situated in , showing and .", + "Earth observation image dominated by , that is a part of , influenced by , and .", + "Area where is prevalent, situated in , showing .", + "Locale characterised by , in , with , and .", + "Site dominated by , in , under conditions.", + "Earth observation image where is prevalent, that is a part of , under , and conditions.", + "Setting with , in , influenced by , and .", + "Geographical area with , placed in , with .", + "Setting with , in , showing and .", + "Area dominated by , located in , showing , and .", + "Earth observation image where is prevalent, situated in , showing , and .", + "Place where is prevalent, that is a part of , showing and .", + "Area dominated by , placed in , influenced by and .", + "Earth observation image with , situated in , with and .", + "Territory characterised by , that is a part of , influenced by , and .", + "Place characterised by , in , influenced by , and .", + "Region characterised by , situated in , with , and .", + "Location where is prevalent, in , showing and .", + "Geospatial area with , placed in , with .", + "Locale where is prevalent, in , with and .", + "Patch with , located in , showing .", + "Place with , in , under conditions.", + "Location dominated by , located in , under and conditions.", + "Earth observation image where is prevalent, placed in , under conditions.", + "Location dominated by , placed in , under , and conditions.", + "Location dominated by , in , showing and .", + "Location dominated by , placed in , influenced by .", + "Environment characterised by , in , under and conditions.", + "Setting where is prevalent, that is a part of , showing and .", + "Locale where is prevalent, placed in , showing and .", + "Landscape with , located in , under conditions.", + "Setting where is prevalent, situated in , showing , and .", + "Region with , in , under conditions.", + "Environment characterised by , that is a part of , showing , and .", + "Overhead view with , situated in , showing .", + "Area characterised by , that is a part of , with , and .", + "Geospatial area dominated by , situated in , showing and .", + "Overhead view dominated by , located in , under conditions.", + "Earth observation image characterised by , in , with .", + "Environment characterised by , situated in , with , and .", + "Area characterised by , located in , showing , and .", + "Region dominated by , situated in , showing and .", + "Location with , in , showing , and .", + "Setting with , located in , with , and .", + "Location where is prevalent, that is a part of , under conditions.", + "Geospatial area dominated by , in , influenced by .", + "Locale characterised by , that is a part of , with , and .", + "Location characterised by , that is a part of , showing and .", + "Site with , in , with and .", + "Place with , located in , under conditions.", + "Site where is prevalent, placed in , with and .", + "Area dominated by , located in , with , and .", + "Place characterised by , situated in , influenced by .", + "Site characterised by , located in , showing , and .", + "Setting with , that is a part of , under conditions.", + "Region dominated by , that is a part of , under and conditions.", + "Overhead view dominated by , placed in , influenced by , and .", + "Overhead view with , that is a part of , with , and .", + "Locale where is prevalent, placed in , with .", + "Place characterised by , that is a part of , influenced by , and .", + "Place where is prevalent, situated in , under , and conditions.", + "Patch with , placed in , showing , and .", + "Territory characterised by , placed in , showing and .", + "Site dominated by , that is a part of , under and conditions.", + "Geographical area characterised by , that is a part of , under conditions.", + "Geographical area characterised by , situated in , showing .", + "Earth observation image where is prevalent, located in , influenced by and .", + "Place dominated by , placed in , with and .", + "Setting with , situated in , under conditions.", + "Patch characterised by , in , influenced by .", + "Area characterised by , located in , with , and .", + "Earth observation image with , placed in , showing and .", + "Overhead view dominated by , that is a part of , influenced by .", + "Geospatial area where is prevalent, located in , showing , and .", + "Region with , that is a part of , with , and .", + "Region with , located in , with .", + "Patch characterised by , situated in , under conditions.", + "Geospatial area with , that is a part of , showing .", + "Site characterised by , located in , with .", + "Site where is prevalent, situated in , under , and conditions.", + "Landscape with , placed in , under , and conditions.", + "Setting characterised by , situated in , with , and .", + "Landscape dominated by , that is a part of , with .", + "Area dominated by , located in , influenced by .", + "Region where is prevalent, located in , with and .", + "Patch with , in , under and conditions.", + "Geospatial area where is prevalent, placed in , influenced by and .", + "Environment dominated by , that is a part of , showing , and .", + "Place with , situated in , showing and .", + "Landscape where is prevalent, that is a part of , showing .", + "Setting dominated by , located in , showing .", + "Locale dominated by , in , influenced by and .", + "Region with , placed in , with and .", + "Earth observation image where is prevalent, located in , influenced by .", + "Setting dominated by , placed in , with and .", + "Geographical area where is prevalent, located in , under conditions.", + "Site where is prevalent, located in , showing , and .", + "Locale with , in , influenced by .", + "Landscape with , in , under conditions.", + "Setting characterised by , situated in , under conditions.", + "Geographical area dominated by , in , showing , and .", + "Geospatial area where is prevalent, located in , influenced by and .", + "Overhead view dominated by , situated in , with .", + "Territory where is prevalent, located in , under , and conditions.", + "Place dominated by , that is a part of , showing , and .", + "Landscape with , located in , with , and .", + "Location characterised by , situated in , with and .", + "Region where is prevalent, situated in , with and .", + "Environment characterised by , situated in , influenced by , and .", + "Geospatial area dominated by , in , with and .", + "Place where is prevalent, located in , influenced by .", + "Geographical area with , that is a part of , with .", + "Region where is prevalent, that is a part of , influenced by and .", + "Overhead view where is prevalent, in , under conditions.", + "Area where is prevalent, placed in , with .", + "Overhead view characterised by , situated in , under , and conditions.", + "Environment where is prevalent, in , under and conditions.", + "Locale where is prevalent, located in , influenced by and .", + "Site dominated by , in , with , and .", + "Earth observation image with , situated in , influenced by .", + "Site where is prevalent, that is a part of , under conditions.", + "Overhead view where is prevalent, placed in , with .", + "Area dominated by , situated in , under , and conditions.", + "Place characterised by , situated in , showing and .", + "Setting dominated by , placed in , with , and .", + "Place with , in , influenced by and .", + "Patch where is prevalent, that is a part of , under and conditions.", + "Earth observation image with , that is a part of , with .", + "Location where is prevalent, placed in , influenced by , and .", + "Landscape where is prevalent, that is a part of , showing and .", + "Location dominated by , situated in , influenced by and .", + "Territory where is prevalent, placed in , with , and .", + "Location dominated by , placed in , influenced by , and .", + "Earth observation image characterised by , placed in , with and .", + "Environment characterised by , in , under and conditions.", + "Landscape characterised by , situated in , with , and .", + "Territory characterised by , placed in , influenced by , and .", + "Region where is prevalent, placed in , showing .", + "Region where is prevalent, situated in , showing .", + "Setting with , located in , influenced by , and .", + "Area with , in , showing .", + "Locale characterised by , situated in , influenced by .", + "Earth observation image characterised by , located in , showing and .", + "Geographical area with , placed in , under conditions.", + "Geospatial area characterised by , placed in , showing .", + "Patch dominated by , situated in , showing .", + "Environment dominated by , in , influenced by , and .", + "Site with , that is a part of , under , and conditions.", + "Overhead view where is prevalent, in , showing .", + "Environment characterised by , in , influenced by and .", + "Territory where is prevalent, situated in , with , and .", + "Place characterised by , placed in , with and .", + "Region with , located in , showing .", + "Patch with , that is a part of , with .", + "Place dominated by , placed in , showing .", + "Geospatial area characterised by , located in , with , and .", + "Geographical area dominated by , situated in , with , and .", + "Locale with , in , showing , and .", + "Region dominated by , situated in , showing and .", + "Geographical area characterised by , placed in , showing , and .", + "Patch with , in , under conditions.", + "Patch dominated by , situated in , showing and .", + "Site characterised by , located in , under conditions.", + "Geographical area dominated by , that is a part of , influenced by .", + "Territory dominated by , that is a part of , influenced by and .", + "Setting characterised by , that is a part of , under and conditions.", + "Overhead view with , placed in , under , and conditions.", + "Landscape characterised by , situated in , with , and .", + "Place where is prevalent, situated in , showing and .", + "Place where is prevalent, that is a part of , with .", + "Locale characterised by , located in , with .", + "Territory dominated by , in , with , and .", + "Landscape where is prevalent, that is a part of , showing and .", + "Location with , placed in , influenced by and .", + "Locale dominated by , in , influenced by .", + "Area dominated by , that is a part of , influenced by and .", + "Place characterised by , located in , influenced by and .", + "Landscape characterised by , placed in , with .", + "Region where is prevalent, located in , with .", + "Patch dominated by , placed in , under and conditions.", + "Site where is prevalent, that is a part of , influenced by , and .", + "Geospatial area with , situated in , influenced by , and .", + "Locale where is prevalent, placed in , under , and conditions.", + "Territory dominated by , in , influenced by .", + "Site with , located in , showing and .", + "Site where is prevalent, situated in , with and .", + "Location where is prevalent, placed in , with , and .", + "Region where is prevalent, that is a part of , showing , and .", + "Geographical area dominated by , situated in , under , and conditions.", + "Patch where is prevalent, placed in , under , and conditions.", + "Geospatial area where is prevalent, located in , influenced by .", + "Earth observation image where is prevalent, in , with , and .", + "Geographical area with , that is a part of , with and .", + "Site where is prevalent, located in , showing and .", + "Area characterised by , placed in , with and .", + "Environment characterised by , in , influenced by .", + "Environment where is prevalent, situated in , under and conditions.", + "Location with , located in , showing .", + "Landscape with , situated in , influenced by , and .", + "Landscape dominated by , that is a part of , with , and .", + "Region where is prevalent, located in , influenced by .", + "Patch where is prevalent, in , under conditions.", + "Geographical area dominated by , located in , showing .", + "Territory dominated by , located in , with .", + "Territory where is prevalent, situated in , with , and .", + "Earth observation image dominated by , situated in , influenced by .", + "Geographical area characterised by , that is a part of , with and .", + "Geographical area characterised by , located in , influenced by , and .", + "Site characterised by , placed in , influenced by .", + "Area where is prevalent, in , influenced by and .", + "Location where is prevalent, situated in , influenced by and .", + "Site dominated by , situated in , with and .", + "Landscape where is prevalent, situated in , under , and conditions.", + "Geographical area characterised by , located in , showing and .", + "Place with , that is a part of , under and conditions.", + "Location characterised by , located in , showing and .", + "Environment dominated by , in , showing and .", + "Overhead view where is prevalent, that is a part of , showing .", + "Earth observation image dominated by , situated in , under and conditions.", + "Overhead view characterised by , placed in , with .", + "Territory with , in , with , and .", + "Site characterised by , that is a part of , showing , and .", + "Setting characterised by , placed in , showing .", + "Environment where is prevalent, situated in , influenced by , and .", + "Earth observation image dominated by , located in , under conditions.", + "Patch where is prevalent, located in , showing , and .", + "Patch where is prevalent, in , influenced by .", + "Region characterised by , that is a part of , influenced by , and .", + "Environment with , in , under and conditions.", + "Place characterised by , in , under , and conditions.", + "Geospatial area with , that is a part of , influenced by .", + "Site characterised by , situated in , showing .", + "Location characterised by , located in , with and .", + "Territory with , situated in , with and .", + "Setting characterised by , located in , with .", + "Location dominated by , situated in , with and .", + "Area dominated by , situated in , showing and .", + "Setting characterised by , located in , influenced by and .", + "Patch with , in , under conditions.", + "Earth observation image characterised by , that is a part of , influenced by , and .", + "Landscape with , in , with and .", + "Geospatial area dominated by , located in , with , and .", + "Territory dominated by , located in , with .", + "Earth observation image where is prevalent, located in , showing .", + "Site dominated by , situated in , showing and .", + "Earth observation image with , in , under and conditions.", + "Setting dominated by , that is a part of , influenced by and .", + "Patch characterised by , placed in , with and .", + "Region dominated by , placed in , showing .", + "Place dominated by , located in , under and conditions.", + "Place dominated by , located in , with .", + "Overhead view dominated by , located in , under conditions.", + "Geographical area where is prevalent, located in , with and .", + "Geographical area dominated by , that is a part of , influenced by .", + "Landscape with , situated in , showing .", + "Geographical area with , that is a part of , with .", + "Overhead view characterised by , in , influenced by and .", + "Patch dominated by , that is a part of , under conditions.", + "Place characterised by , located in , under , and conditions.", + "Overhead view dominated by , in , showing , and .", + "Region dominated by , situated in , under and conditions.", + "Geographical area dominated by , placed in , influenced by , and .", + "Location where is prevalent, situated in , showing .", + "Territory with , situated in , under conditions.", + "Territory where is prevalent, that is a part of , under conditions.", + "Place characterised by , that is a part of , with and .", + "Location characterised by , located in , under and conditions.", + "Patch dominated by , situated in , with .", + "Geographical area characterised by , that is a part of , under and conditions.", + "Location characterised by , in , under , and conditions.", + "Earth observation image characterised by , located in , influenced by .", + "Geographical area dominated by , situated in , under and conditions.", + "Environment where is prevalent, that is a part of , under and conditions.", + "Territory characterised by , located in , under , and conditions.", + "Landscape with , located in , showing and .", + "Landscape characterised by , in , under conditions.", + "Locale dominated by , that is a part of , showing , and .", + "Location dominated by , situated in , under and conditions.", + "Overhead view with , situated in , showing and .", + "Geospatial area with , situated in , showing and .", + "Landscape with , located in , showing and .", + "Area characterised by , located in , with .", + "Landscape characterised by , located in , showing and .", + "Site with , that is a part of , with .", + "Region with , situated in , under , and conditions.", + "Earth observation image with , in , influenced by , and .", + "Locale with , in , with and .", + "Locale dominated by , placed in , influenced by .", + "Earth observation image dominated by , situated in , showing , and .", + "Environment where is prevalent, placed in , influenced by , and .", + "Place characterised by , placed in , under , and conditions.", + "Environment with , placed in , with .", + "Place dominated by , situated in , with , and .", + "Earth observation image characterised by , located in , under and conditions.", + "Territory with , situated in , showing .", + "Area where is prevalent, that is a part of , with , and .", + "Site where is prevalent, in , showing .", + "Place characterised by , located in , showing .", + "Geospatial area dominated by , in , showing , and .", + "Area characterised by , in , under and conditions.", + "Setting dominated by , in , showing .", + "Site with , situated in , influenced by and .", + "Geospatial area dominated by , located in , influenced by .", + "Geospatial area where is prevalent, in , with .", + "Patch dominated by , in , under conditions.", + "Place with , in , showing and .", + "Site where is prevalent, placed in , showing and .", + "Overhead view with , in , showing , and .", + "Geospatial area characterised by , placed in , under , and conditions.", + "Overhead view with , situated in , influenced by and .", + "Place with , located in , showing , and .", + "Locale characterised by , that is a part of , showing , and .", + "Site characterised by , placed in , showing , and .", + "Earth observation image where is prevalent, located in , under and conditions.", + "Geographical area where is prevalent, placed in , showing , and .", + "Site characterised by , that is a part of , influenced by and .", + "Geospatial area where is prevalent, placed in , under conditions.", + "Setting dominated by , that is a part of , influenced by , and .", + "Locale dominated by , that is a part of , influenced by .", + "Patch dominated by , located in , influenced by and .", + "Overhead view dominated by , located in , showing .", + "Site characterised by , placed in , showing , and .", + "Earth observation image dominated by , in , under conditions.", + "Earth observation image characterised by , located in , with , and .", + "Landscape where is prevalent, situated in , under , and conditions.", + "Site where is prevalent, placed in , under , and conditions.", + "Earth observation image characterised by , placed in , under and conditions.", + "Place where is prevalent, that is a part of , under and conditions.", + "Locale with , situated in , under and conditions.", + "Site dominated by , that is a part of , under and conditions.", + "Territory dominated by , that is a part of , with .", + "Overhead view characterised by , placed in , with , and .", + "Place with , located in , influenced by and .", + "Environment characterised by , situated in , showing .", + "Setting characterised by , situated in , under , and conditions.", + "Site characterised by , situated in , with and .", + "Site where is prevalent, located in , with .", + "Patch where is prevalent, that is a part of , with .", + "Geospatial area characterised by , placed in , under , and conditions.", + "Setting dominated by , located in , under conditions.", + "Territory with , that is a part of , showing and .", + "Landscape where is prevalent, that is a part of , influenced by and .", + "Territory dominated by , that is a part of , with .", + "Location with , that is a part of , influenced by , and .", + "Patch where is prevalent, placed in , under and conditions.", + "Region where is prevalent, that is a part of , influenced by , and .", + "Setting characterised by , located in , showing and .", + "Patch where is prevalent, located in , under and conditions.", + "Environment with , that is a part of , showing , and .", + "Location with , in , influenced by , and .", + "Overhead view with , placed in , showing and .", + "Patch characterised by , placed in , showing , and .", + "Geospatial area characterised by , located in , under , and conditions.", + "Patch with , that is a part of , with .", + "Environment where is prevalent, placed in , showing , and .", + "Locale characterised by , located in , with , and .", + "Environment with , situated in , under , and conditions.", + "Overhead view with , that is a part of , under and conditions.", + "Area characterised by , located in , with and .", + "Geospatial area with , that is a part of , under and conditions.", + "Setting where is prevalent, that is a part of , under and conditions.", + "Patch with , situated in , under and conditions.", + "Setting dominated by , located in , under and conditions.", + "Region dominated by , situated in , with and .", + "Place where is prevalent, placed in , showing and .", + "Territory dominated by , in , under and conditions.", + "Geographical area characterised by , located in , showing and .", + "Setting characterised by , located in , under conditions.", + "Site dominated by , that is a part of , under , and conditions.", + "Environment dominated by , in , with .", + "Overhead view where is prevalent, that is a part of , showing , and .", + "Region with , that is a part of , influenced by , and .", + "Territory where is prevalent, that is a part of , with and .", + "Area where is prevalent, placed in , under , and conditions.", + "Site with , placed in , influenced by .", + "Overhead view with , located in , influenced by .", + "Patch characterised by , placed in , showing .", + "Geographical area dominated by , placed in , with , and .", + "Area with , in , with , and .", + "Environment with , located in , showing .", + "Geospatial area dominated by , in , with and .", + "Earth observation image characterised by , located in , with and .", + "Geographical area characterised by , situated in , under and conditions.", + "Environment where is prevalent, located in , showing and .", + "Landscape dominated by , that is a part of , influenced by , and .", + "Locale dominated by , located in , under conditions.", + "Location dominated by , placed in , showing .", + "Area where is prevalent, in , with , and .", + "Territory dominated by , situated in , with , and .", + "Environment with , situated in , under conditions.", + "Place with , placed in , influenced by .", + "Territory dominated by , located in , showing .", + "Patch characterised by , placed in , showing .", + "Patch dominated by , that is a part of , showing and .", + "Region characterised by , placed in , showing , and .", + "Geospatial area where is prevalent, placed in , influenced by .", + "Earth observation image dominated by , located in , influenced by and .", + "Patch characterised by , that is a part of , showing , and .", + "Region characterised by , placed in , influenced by , and .", + "Earth observation image characterised by , in , showing and .", + "Site with , situated in , showing , and .", + "Place with , that is a part of , showing .", + "Overhead view with , located in , showing and .", + "Locale with , that is a part of , with and .", + "Environment characterised by , in , showing and .", + "Landscape characterised by , placed in , under conditions.", + "Environment where is prevalent, placed in , showing and .", + "Location characterised by , situated in , showing .", + "Earth observation image with , located in , influenced by and .", + "Patch dominated by , located in , influenced by , and .", + "Location where is prevalent, situated in , showing .", + "Site characterised by , in , influenced by , and .", + "Setting dominated by , located in , with , and .", + "Setting characterised by , located in , under and conditions.", + "Patch where is prevalent, situated in , under , and conditions.", + "Setting dominated by , located in , influenced by .", + "Geospatial area with , placed in , under conditions.", + "Site characterised by , in , with , and .", + "Territory characterised by , in , under conditions.", + "Setting with , situated in , with , and .", + "Earth observation image where is prevalent, located in , influenced by and .", + "Geographical area with , located in , with .", + "Locale with , situated in , with .", + "Place dominated by , in , showing , and .", + "Place characterised by , placed in , under conditions.", + "Site where is prevalent, located in , with , and .", + "Environment where is prevalent, in , under , and conditions.", + "Site with , that is a part of , under conditions.", + "Patch where is prevalent, in , under conditions.", + "Earth observation image with , placed in , under , and conditions.", + "Site characterised by , situated in , under , and conditions.", + "Area with , located in , with .", + "Setting where is prevalent, placed in , showing and .", + "Environment dominated by , placed in , with , and .", + "Overhead view with , situated in , with .", + "Geographical area dominated by , that is a part of , influenced by and .", + "Territory with , that is a part of , under and conditions.", + "Location characterised by , situated in , influenced by .", + "Setting with , in , under and conditions.", + "Patch dominated by , that is a part of , showing .", + "Geospatial area characterised by , that is a part of , under and conditions.", + "Location where is prevalent, placed in , showing and .", + "Geospatial area where is prevalent, located in , showing and .", + "Setting where is prevalent, situated in , influenced by , and .", + "Overhead view where is prevalent, located in , with .", + "Overhead view where is prevalent, in , under conditions.", + "Patch characterised by , that is a part of , influenced by .", + "Place dominated by , situated in , showing .", + "Geospatial area dominated by , that is a part of , showing , and .", + "Place with , in , showing , and .", + "Territory where is prevalent, that is a part of , influenced by and .", + "Earth observation image characterised by , in , under conditions.", + "Locale where is prevalent, located in , showing and .", + "Geospatial area where is prevalent, that is a part of , with .", + "Setting where is prevalent, situated in , with .", + "Environment with , that is a part of , with , and .", + "Territory dominated by , in , under conditions.", + "Geospatial area with , placed in , with .", + "Earth observation image with , placed in , showing .", + "Geospatial area characterised by , that is a part of , showing , and .", + "Area with , placed in , showing .", + "Territory with , situated in , influenced by .", + "Earth observation image where is prevalent, that is a part of , under and conditions.", + "Site dominated by , in , influenced by and .", + "Site dominated by , that is a part of , with .", + "Locale dominated by , situated in , influenced by .", + "Territory where is prevalent, in , under conditions.", + "Locale dominated by , located in , influenced by , and .", + "Overhead view where is prevalent, located in , influenced by .", + "Environment with , placed in , showing .", + "Earth observation image characterised by , that is a part of , showing .", + "Landscape dominated by , that is a part of , under , and conditions.", + "Geographical area dominated by , placed in , with , and .", + "Place characterised by , located in , with .", + "Locale with , in , under and conditions.", + "Earth observation image where is prevalent, placed in , under and conditions.", + "Overhead view where is prevalent, that is a part of , under , and conditions.", + "Environment where is prevalent, placed in , under , and conditions.", + "Environment dominated by , in , under conditions.", + "Area dominated by , located in , influenced by , and .", + "Site with , in , with , and .", + "Area with , in , with .", + "Site dominated by , that is a part of , with .", + "Patch where is prevalent, located in , influenced by .", + "Overhead view characterised by , located in , under , and conditions.", + "Patch with , placed in , influenced by .", + "Territory characterised by , that is a part of , under , and conditions.", + "Setting with , placed in , with , and .", + "Territory where is prevalent, placed in , with , and .", + "Setting where is prevalent, in , showing and .", + "Site where is prevalent, situated in , influenced by .", + "Locale dominated by , placed in , under conditions.", + "Overhead view where is prevalent, placed in , showing , and .", + "Patch dominated by , that is a part of , showing .", + "Geographical area dominated by , placed in , showing .", + "Location with , in , showing , and .", + "Landscape where is prevalent, in , showing and .", + "Place where is prevalent, situated in , with and .", + "Site with , placed in , under and conditions.", + "Geographical area dominated by , in , with , and .", + "Site with , placed in , with , and .", + "Geospatial area with , in , with and .", + "Geographical area where is prevalent, that is a part of , under , and conditions.", + "Geospatial area with , situated in , influenced by and .", + "Geographical area with , that is a part of , showing , and .", + "Location where is prevalent, in , showing , and .", + "Environment characterised by , placed in , influenced by .", + "Environment where is prevalent, that is a part of , under conditions.", + "Site where is prevalent, that is a part of , under , and conditions.", + "Setting dominated by , located in , influenced by .", + "Region where is prevalent, in , with , and .", + "Locale characterised by , in , showing and .", + "Territory dominated by , placed in , influenced by .", + "Site with , placed in , showing .", + "Landscape where is prevalent, in , under conditions.", + "Patch dominated by , situated in , with and .", + "Environment with , located in , with , and .", + "Earth observation image with , in , influenced by , and .", + "Earth observation image where is prevalent, placed in , showing , and .", + "Earth observation image dominated by , situated in , showing , and .", + "Environment dominated by , placed in , with and .", + "Geospatial area with , located in , under and conditions.", + "Earth observation image where is prevalent, placed in , influenced by , and .", + "Overhead view where is prevalent, that is a part of , under , and conditions.", + "Area with , in , influenced by .", + "Environment characterised by , located in , influenced by and .", + "Overhead view dominated by , in , under and conditions.", + "Environment dominated by , in , with and .", + "Overhead view characterised by , that is a part of , showing and .", + "Setting where is prevalent, located in , under and conditions.", + "Earth observation image dominated by , located in , showing , and .", + "Patch dominated by , located in , showing and .", + "Place where is prevalent, in , with .", + "Site dominated by , situated in , influenced by and .", + "Environment characterised by , that is a part of , under and conditions.", + "Place where is prevalent, placed in , with , and .", + "Region where is prevalent, in , showing , and .", + "Place where is prevalent, located in , under , and conditions.", + "Setting with , that is a part of , with , and .", + "Region characterised by , that is a part of , showing , and .", + "Geospatial area with , that is a part of , influenced by and .", + "Setting with , located in , showing , and .", + "Environment with , situated in , with and .", + "Territory characterised by , that is a part of , influenced by , and .", + "Locale characterised by , placed in , influenced by and .", + "Area dominated by , located in , influenced by , and .", + "Site where is prevalent, that is a part of , with and .", + "Location where is prevalent, that is a part of , with .", + "Locale where is prevalent, in , under conditions.", + "Geographical area dominated by , located in , influenced by , and .", + "Area with , that is a part of , with and .", + "Patch where is prevalent, situated in , showing .", + "Environment with , located in , with , and .", + "Patch characterised by , located in , under and conditions.", + "Geographical area characterised by , that is a part of , influenced by .", + "Region where is prevalent, situated in , with , and .", + "Location where is prevalent, that is a part of , under and conditions.", + "Place with , located in , with , and .", + "Territory with , situated in , showing , and .", + "Patch with , situated in , influenced by , and .", + "Patch where is prevalent, in , showing and .", + "Territory dominated by , in , influenced by and .", + "Geospatial area with , that is a part of , under , and conditions.", + "Setting dominated by , in , influenced by .", + "Environment characterised by , placed in , influenced by and .", + "Overhead view characterised by , placed in , showing .", + "Environment dominated by , situated in , under and conditions.", + "Environment where is prevalent, that is a part of , showing .", + "Environment where is prevalent, in , under and conditions.", + "Patch characterised by , located in , influenced by , and .", + "Setting where is prevalent, placed in , influenced by and .", + "Site dominated by , in , with , and .", + "Overhead view with , situated in , influenced by .", + "Overhead view dominated by , located in , showing , and .", + "Overhead view dominated by , located in , influenced by , and .", + "Environment where is prevalent, located in , with and .", + "Locale dominated by , that is a part of , showing .", + "Setting with , in , influenced by and .", + "Landscape dominated by , in , with and .", + "Place dominated by , located in , under , and conditions.", + "Site characterised by , situated in , showing , and .", + "Site with , situated in , showing , and .", + "Region dominated by , in , influenced by .", + "Territory dominated by , placed in , under , and conditions.", + "Site characterised by , placed in , influenced by .", + "Landscape with , in , showing and .", + "Region where is prevalent, situated in , with , and .", + "Place where is prevalent, in , under , and conditions.", + "Place with , placed in , under conditions.", + "Locale dominated by , placed in , showing .", + "Earth observation image where is prevalent, that is a part of , influenced by and .", + "Region where is prevalent, located in , influenced by and .", + "Geographical area dominated by , located in , under , and conditions.", + "Geographical area with , located in , showing and .", + "Landscape dominated by , located in , influenced by .", + "Locale with , situated in , under and conditions.", + "Geographical area with , situated in , with and .", + "Place characterised by , in , under and conditions.", + "Region dominated by , that is a part of , with and .", + "Territory dominated by , in , with .", + "Location where is prevalent, situated in , influenced by and .", + "Region where is prevalent, located in , influenced by , and .", + "Patch where is prevalent, located in , showing and .", + "Location dominated by , that is a part of , influenced by .", + "Location where is prevalent, placed in , influenced by , and .", + "Place where is prevalent, in , with and .", + "Patch with , placed in , showing .", + "Earth observation image with , located in , showing , and .", + "Earth observation image characterised by , that is a part of , influenced by , and .", + "Region where is prevalent, in , showing , and .", + "Patch characterised by , placed in , influenced by .", + "Area characterised by , in , influenced by and .", + "Region dominated by , that is a part of , with .", + "Territory characterised by , situated in , with , and .", + "Geospatial area with , located in , under and conditions.", + "Place dominated by , situated in , under conditions.", + "Geospatial area with , placed in , under conditions.", + "Locale with , situated in , under conditions.", + "Environment dominated by , located in , influenced by .", + "Region dominated by , in , influenced by , and .", + "Area with , in , influenced by , and .", + "Place dominated by , placed in , with and .", + "Environment where is prevalent, situated in , with .", + "Region with , located in , with , and .", + "Location with , placed in , influenced by and .", + "Patch where is prevalent, in , under , and conditions.", + "Place characterised by , situated in , with , and .", + "Geographical area dominated by , situated in , showing and .", + "Area characterised by , situated in , under , and conditions.", + "Area characterised by , in , showing .", + "Setting where is prevalent, situated in , showing and .", + "Setting dominated by , located in , under , and conditions.", + "Earth observation image characterised by , in , showing and .", + "Geospatial area dominated by , situated in , showing .", + "Area dominated by , located in , showing , and .", + "Geographical area dominated by , situated in , influenced by and .", + "Place characterised by , that is a part of , under conditions.", + "Place where is prevalent, that is a part of , influenced by , and .", + "Territory dominated by , placed in , with , and .", + "Site with , located in , influenced by .", + "Landscape with , located in , with and .", + "Environment with , placed in , influenced by .", + "Landscape dominated by , placed in , under and conditions.", + "Place with , placed in , with , and .", + "Area characterised by , located in , showing and .", + "Landscape characterised by , placed in , with .", + "Setting with , situated in , with .", + "Environment where is prevalent, situated in , influenced by .", + "Patch with , placed in , under , and conditions.", + "Territory dominated by , that is a part of , showing and .", + "Location characterised by , situated in , showing and .", + "Site where is prevalent, placed in , under conditions.", + "Overhead view characterised by , situated in , influenced by , and .", + "Geographical area characterised by , situated in , influenced by and .", + "Landscape with , that is a part of , with and .", + "Site where is prevalent, that is a part of , with , and .", + "Region where is prevalent, that is a part of , under conditions.", + "Overhead view with , that is a part of , influenced by .", + "Earth observation image dominated by , in , under conditions.", + "Landscape dominated by , in , under conditions.", + "Environment characterised by , in , showing .", + "Territory with , placed in , showing , and .", + "Place where is prevalent, that is a part of , showing .", + "Setting dominated by , situated in , influenced by and .", + "Overhead view dominated by , that is a part of , showing and .", + "Locale where is prevalent, in , influenced by and .", + "Locale dominated by , located in , under conditions.", + "Location with , placed in , showing .", + "Region dominated by , that is a part of , under and conditions.", + "Earth observation image with , situated in , influenced by , and .", + "Landscape dominated by , placed in , with , and .", + "Overhead view characterised by , in , influenced by , and .", + "Patch where is prevalent, situated in , under , and conditions.", + "Place where is prevalent, placed in , with .", + "Area with , that is a part of , under , and conditions.", + "Place characterised by , placed in , influenced by , and .", + "Setting with , in , with , and .", + "Earth observation image dominated by , placed in , with , and .", + "Setting dominated by , situated in , showing , and .", + "Territory characterised by , that is a part of , showing .", + "Location dominated by , located in , showing .", + "Overhead view dominated by , situated in , under and conditions.", + "Patch characterised by , that is a part of , with , and .", + "Geospatial area characterised by , in , influenced by and .", + "Geospatial area dominated by , situated in , showing .", + "Region dominated by , in , with , and .", + "Area characterised by , situated in , showing .", + "Place with , in , influenced by .", + "Locale characterised by , that is a part of , showing , and .", + "Site with , in , showing .", + "Territory where is prevalent, situated in , with and .", + "Locale with , situated in , showing .", + "Landscape where is prevalent, placed in , showing and .", + "Place where is prevalent, that is a part of , under , and conditions.", + "Area where is prevalent, that is a part of , showing and .", + "Overhead view with , that is a part of , showing , and .", + "Territory dominated by , that is a part of , with .", + "Overhead view where is prevalent, in , showing .", + "Patch where is prevalent, located in , showing and .", + "Earth observation image characterised by , located in , showing , and .", + "Geographical area with , that is a part of , under conditions.", + "Landscape where is prevalent, situated in , under , and conditions.", + "Geographical area where is prevalent, in , influenced by .", + "Region with , that is a part of , with .", + "Geographical area dominated by , that is a part of , influenced by and .", + "Area with , that is a part of , with .", + "Patch characterised by , placed in , influenced by , and .", + "Overhead view where is prevalent, situated in , influenced by and .", + "Area dominated by , in , influenced by , and .", + "Locale with , situated in , showing .", + "Location where is prevalent, placed in , influenced by and .", + "Setting where is prevalent, in , under , and conditions.", + "Area with , that is a part of , showing .", + "Overhead view with , located in , with .", + "Region dominated by , located in , under , and conditions.", + "Geospatial area with , that is a part of , showing , and .", + "Locale with , located in , under , and conditions.", + "Site dominated by , that is a part of , influenced by and .", + "Landscape where is prevalent, that is a part of , influenced by .", + "Region with , in , with and .", + "Place characterised by , that is a part of , influenced by , and .", + "Geospatial area dominated by , that is a part of , influenced by .", + "Territory characterised by , placed in , with .", + "Patch with , placed in , under conditions.", + "Site dominated by , situated in , with , and .", + "Territory with , located in , influenced by .", + "Geospatial area characterised by , placed in , influenced by .", + "Landscape where is prevalent, placed in , under conditions.", + "Patch dominated by , that is a part of , under and conditions.", + "Geographical area characterised by , located in , under , and conditions.", + "Territory where is prevalent, placed in , with and .", + "Geographical area dominated by , that is a part of , with , and .", + "Region dominated by , situated in , influenced by and .", + "Site characterised by , located in , influenced by , and .", + "Locale dominated by , located in , under conditions.", + "Overhead view with , in , influenced by and .", + "Patch dominated by , situated in , with and .", + "Area dominated by , situated in , showing and .", + "Landscape where is prevalent, placed in , under and conditions.", + "Geospatial area characterised by , placed in , with .", + "Environment with , situated in , under conditions.", + "Overhead view dominated by , placed in , showing , and .", + "Environment dominated by , in , influenced by , and .", + "Setting with , placed in , with , and .", + "Location dominated by , placed in , with .", + "Geospatial area where is prevalent, placed in , with .", + "Geographical area characterised by , placed in , under conditions.", + "Earth observation image where is prevalent, that is a part of , influenced by , and .", + "Patch where is prevalent, located in , with , and .", + "Territory dominated by , in , under , and conditions.", + "Overhead view with , located in , influenced by .", + "Place characterised by , located in , influenced by .", + "Territory where is prevalent, that is a part of , with , and .", + "Place where is prevalent, located in , with and .", + "Earth observation image with , in , influenced by and .", + "Area where is prevalent, that is a part of , influenced by and .", + "Patch with , placed in , with , and .", + "Earth observation image where is prevalent, situated in , under and conditions.", + "Geographical area characterised by , in , under , and conditions.", + "Area with , located in , with .", + "Place characterised by , situated in , with .", + "Place with , situated in , under and conditions.", + "Locale dominated by , situated in , under conditions.", + "Site characterised by , placed in , under , and conditions.", + "Place with , in , with and .", + "Geographical area characterised by , located in , with .", + "Environment with , situated in , under conditions.", + "Site with , that is a part of , with , and .", + "Locale with , situated in , influenced by and .", + "Setting where is prevalent, in , influenced by , and .", + "Overhead view characterised by , situated in , showing , and .", + "Territory dominated by , situated in , with and .", + "Environment dominated by , that is a part of , with and .", + "Geospatial area dominated by , located in , under , and conditions.", + "Setting with , in , under , and conditions.", + "Site with , that is a part of , showing .", + "Overhead view where is prevalent, in , under , and conditions.", + "Patch characterised by , located in , showing and .", + "Place characterised by , situated in , under , and conditions.", + "Region with , in , showing and .", + "Area with , that is a part of , with , and .", + "Landscape characterised by , located in , with and .", + "Patch where is prevalent, located in , showing and .", + "Patch characterised by , in , with , and .", + "Location characterised by , situated in , with , and .", + "Setting dominated by , placed in , influenced by , and .", + "Site characterised by , located in , with and .", + "Region characterised by , in , influenced by , and .", + "Location dominated by , located in , influenced by , and .", + "Earth observation image characterised by , in , showing , and .", + "Site with , located in , showing .", + "Geospatial area characterised by , situated in , under and conditions.", + "Locale with , placed in , influenced by .", + "Geospatial area dominated by , situated in , showing .", + "Site where is prevalent, located in , showing and .", + "Setting where is prevalent, that is a part of , showing .", + "Geospatial area characterised by , located in , influenced by and .", + "Earth observation image dominated by , located in , showing and .", + "Area where is prevalent, in , influenced by .", + "Region dominated by , situated in , under conditions.", + "Landscape characterised by , placed in , under conditions.", + "Area characterised by , in , showing , and .", + "Environment dominated by , that is a part of , under and conditions.", + "Place dominated by , that is a part of , under , and conditions.", + "Site characterised by , that is a part of , showing , and .", + "Site dominated by , in , showing , and .", + "Locale where is prevalent, placed in , with .", + "Earth observation image dominated by , located in , with .", + "Environment where is prevalent, that is a part of , showing .", + "Environment dominated by , located in , influenced by .", + "Setting with , that is a part of , with , and .", + "Patch characterised by , that is a part of , under and conditions.", + "Overhead view characterised by , in , under , and conditions.", + "Area with , situated in , with .", + "Region dominated by , situated in , influenced by and .", + "Earth observation image where is prevalent, in , showing and .", + "Location characterised by , in , influenced by .", + "Place with , in , showing .", + "Environment with , that is a part of , under , and conditions.", + "Locale with , placed in , influenced by and .", + "Overhead view characterised by , placed in , showing , and .", + "Landscape where is prevalent, that is a part of , influenced by .", + "Setting where is prevalent, placed in , showing .", + "Patch with , placed in , influenced by and .", + "Overhead view characterised by , in , showing , and .", + "Earth observation image dominated by , situated in , with .", + "Area where is prevalent, located in , with , and .", + "Area where is prevalent, situated in , influenced by , and .", + "Geospatial area characterised by , in , under , and conditions.", + "Location dominated by , in , influenced by , and .", + "Territory where is prevalent, placed in , influenced by and .", + "Earth observation image characterised by , situated in , under , and conditions.", + "Area dominated by , located in , influenced by and .", + "Earth observation image characterised by , located in , with and .", + "Geospatial area characterised by , situated in , influenced by , and .", + "Geospatial area dominated by , that is a part of , with , and .", + "Area characterised by , in , influenced by .", + "Geographical area dominated by , located in , influenced by .", + "Environment dominated by , situated in , influenced by and .", + "Geographical area characterised by , located in , influenced by .", + "Region dominated by , in , under , and conditions.", + "Overhead view with , situated in , under , and conditions.", + "Location where is prevalent, placed in , influenced by and .", + "Setting with , situated in , under and conditions.", + "Geographical area dominated by , in , with and .", + "Region where is prevalent, located in , with .", + "Area with , in , influenced by .", + "Territory dominated by , in , showing and .", + "Region characterised by , that is a part of , under and conditions.", + "Earth observation image dominated by , placed in , showing , and .", + "Earth observation image characterised by , placed in , showing , and .", + "Overhead view characterised by , in , showing and .", + "Location with , placed in , under conditions.", + "Geographical area with , situated in , under conditions.", + "Setting with , in , under conditions.", + "Territory with , situated in , influenced by .", + "Geospatial area with , that is a part of , with .", + "Setting where is prevalent, located in , showing and .", + "Patch characterised by , in , showing , and .", + "Geospatial area characterised by , placed in , with , and .", + "Locale dominated by , in , with .", + "Geographical area with , situated in , showing , and .", + "Environment characterised by , located in , showing and .", + "Region characterised by , in , showing , and .", + "Locale characterised by , that is a part of , under conditions.", + "Setting dominated by , that is a part of , influenced by .", + "Region dominated by , in , with , and .", + "Landscape where is prevalent, situated in , under , and conditions.", + "Territory characterised by , located in , under , and conditions.", + "Overhead view dominated by , in , with and .", + "Setting with , located in , with .", + "Locale with , in , under conditions.", + "Site characterised by , placed in , under and conditions.", + "Overhead view dominated by , situated in , influenced by , and .", + "Earth observation image where is prevalent, in , under , and conditions.", + "Region where is prevalent, placed in , under and conditions.", + "Environment with , located in , showing .", + "Location where is prevalent, located in , under conditions.", + "Place where is prevalent, in , with , and .", + "Environment with , situated in , showing and .", + "Earth observation image characterised by , situated in , with , and .", + "Place dominated by , that is a part of , under conditions.", + "Territory where is prevalent, that is a part of , showing , and .", + "Overhead view with , that is a part of , with and .", + "Area characterised by , placed in , showing .", + "Region characterised by , situated in , under , and conditions.", + "Area characterised by , that is a part of , under conditions.", + "Geographical area with , that is a part of , influenced by .", + "Area dominated by , placed in , with and .", + "Locale characterised by , situated in , influenced by and .", + "Patch with , located in , under , and conditions.", + "Landscape with , situated in , under , and conditions.", + "Setting characterised by , situated in , showing .", + "Earth observation image where is prevalent, situated in , under conditions.", + "Earth observation image with , located in , under conditions.", + "Location with , in , influenced by , and .", + "Geographical area dominated by , located in , with .", + "Region characterised by , in , showing .", + "Location characterised by , located in , showing and .", + "Landscape dominated by , in , under , and conditions.", + "Environment dominated by , placed in , influenced by .", + "Locale dominated by , situated in , influenced by .", + "Geographical area where is prevalent, situated in , showing , and .", + "Patch characterised by , in , showing and .", + "Patch characterised by , located in , with .", + "Area where is prevalent, placed in , with , and .", + "Area characterised by , placed in , with , and .", + "Earth observation image dominated by , located in , influenced by and .", + "Region dominated by , placed in , influenced by and .", + "Landscape dominated by , that is a part of , under conditions." +] \ No newline at end of file diff --git a/src/data/heat_krakow_caption_builder.py b/src/data/heat_krakow_caption_builder.py new file mode 100644 index 00000000..496ed804 --- /dev/null +++ b/src/data/heat_krakow_caption_builder.py @@ -0,0 +1,138 @@ +"""Caption builder for the Kraków urban heat island (LST) dataset. + +Location: src/data/heat_krakow_caption_builder.py +""" + +import logging +import os +from typing import Dict, List, Tuple, Union, override + +import torch + +from src.data.base_caption_builder import BaseCaptionBuilder +from src.data.base_dataset import BaseDataset + +log = logging.getLogger(__name__) + + +class HeatKrakowCaptionBuilder(BaseCaptionBuilder): + """Caption builder for Kraków dataset supporting flexible column prefixes (feat_ / aux_).""" + + def __init__( + self, + templates_fname: str, + concepts_fname: str, + data_dir: str, + seed: int = 12345, + n_captions_for_validation: Union[int, str] = "all", + return_aux_ids: bool = False, + ) -> None: + resolved_data_dir = data_dir + if not os.path.exists(os.path.join(data_dir, "location_caption_templates")): + hk_dir = os.path.join(data_dir, "heat_krakow") + if os.path.exists(os.path.join(hk_dir, "location_caption_templates")): + resolved_data_dir = hk_dir + + super().__init__( + templates_fname=templates_fname, + concepts_fname=concepts_fname, + data_dir=resolved_data_dir, + seed=seed, + n_captions_for_validation=n_captions_for_validation, + return_aux_ids=return_aux_ids, + ) + self.top_alias_map: Dict[str, int] = {} + self.aux_alias_map: Dict[str, int] = {} + self.top_raw_cols: List[str] = [] + + @staticmethod + def _normalize(name: str) -> str: + """Strips prefixes (feat_, aux_) and suffixes (_label) for universal matching.""" + s = name + if s.startswith("feat_"): + s = s[5:] + elif s.startswith("aux_"): + s = s[4:] + if s.endswith("_label"): + s = s[:-6] + return s + + @override + def sync_with_dataset(self, dataset: BaseDataset) -> None: + """Builds column mapping supporting feat_*, aux_*, and *_label variations.""" + self.column_to_metadata_map = {"aux": {}} + + # 1. Register numeric feature/aux columns + aux_cols = dataset.use_aux_data.get("aux", []) if dataset.use_aux_data else [] + for i, col in enumerate(aux_cols): + meta = {"id": i} + norm_col = self._normalize(col) + + # Map exact name and prefix-stripped name + self.column_to_metadata_map["aux"][col] = meta + self.column_to_metadata_map["aux"][norm_col] = meta + + self.aux_alias_map[col] = i + self.aux_alias_map[norm_col] = i + + # 2. Register text label columns ('top') + top_cols = dataset.use_aux_data.get("top", []) if dataset.use_aux_data else [] + self.top_raw_cols = top_cols + for i, col in enumerate(top_cols): + self.top_alias_map[col] = i + self.top_alias_map[self._normalize(col)] = i + + # 3. Synchronize concepts with numeric aux IDs + self.sync_concepts() + + def _resolve_top_token(self, token: str) -> Union[int, None]: + """Resolves token to index in 'top' label list.""" + if token in self.top_alias_map: + return self.top_alias_map[token] + return self.top_alias_map.get(self._normalize(token)) + + def _resolve_aux_token(self, token: str) -> Union[int, None]: + """Resolves token to index in 'aux' numeric tensor.""" + if token in self.aux_alias_map: + return self.aux_alias_map[token] + return self.aux_alias_map.get(self._normalize(token)) + + @override + def _build_from_template( + self, template_idx: int, aux: torch.Tensor, top: List[str] | None = None + ) -> Union[str, Tuple[str, List[int]]]: + """Fills template tokens using text labels or formatted numeric values.""" + template = self.templates[template_idx] + fillers: Dict[str, str] = {} + used_aux_ids: List[int] = [] + + for token in self.tokens_in_template[template_idx]: + top_idx = self._resolve_top_token(token) + aux_idx = self._resolve_aux_token(token) + + if top_idx is not None and top is not None: + fillers[token] = str(top[top_idx]) + + # Match label back to its numeric feature ID for evaluation + raw_label_col = self.top_raw_cols[top_idx] + norm_name = self._normalize(raw_label_col) + for aux_col_name, meta in self.column_to_metadata_map["aux"].items(): + if self._normalize(aux_col_name) == norm_name: + used_aux_ids.append(meta["id"]) + break + + elif aux_idx is not None: + val = aux[aux_idx].item() + fillers[token] = f"{val:.2f}" + used_aux_ids.append(aux_idx) + else: + raise KeyError( + f"Token '<{token}>' could not be resolved. " + f"Available top columns: {self.top_raw_cols}" + ) + + filled_caption = self._fill(template, fillers) + + if self.return_aux_ids: + return filled_caption, used_aux_ids + return filled_caption diff --git a/src/data/heat_krakow_dataset.py b/src/data/heat_krakow_dataset.py index 6499ca69..5fae3e1a 100644 --- a/src/data/heat_krakow_dataset.py +++ b/src/data/heat_krakow_dataset.py @@ -1,203 +1,152 @@ -"""Heat Krakow LST dataset. +"""Heat Kraków LST dataset. Location: src/data/heat_krakow_dataset.py - -Based on Heat Guatemala dataset class, follows the same changes described below: -Changes vs original: - - tabular_dim property added so the datamodule (and model) can read it - without hardcoding anything. - - implemented_mod stays {"coords"} because tabular data arrives - automatically through feat_* CSV columns, not through the modalities dict. - This is documented explicitly below. - - Implemented an override for `setup_tessera` in `HeatKrakowDataset`: - setup_tessera inherited from `BaseDataset` where `self.records.pop(i)` - was mutating the list mid-iteration, caused it to skip every second - missing file and eventually trigger a PyTorch DataLoader `IndexError: list index out of range`. - - Minor: __getitem__ guard tightened (tabular only added when feat_names exist - and modality logic is cleaner). """ +import logging import os from typing import Any, Dict, override -import numpy as np import torch +import torch.nn as nn +from omegaconf import DictConfig, OmegaConf +import src.utils.experiment_tracking as et from src.data.base_dataset import BaseDataset +log = logging.getLogger(__name__) + +# Compatibility Patch for experiment_tracking.py +_orig_parse_data_name = et.parse_data_name + +def _patched_parse_data_name(run=None, cfg=None): + if cfg is not None and isinstance(cfg, DictConfig): + cfg = OmegaConf.to_container(cfg, resolve=True) + return _orig_parse_data_name(run=run, cfg=cfg) + +et.parse_data_name = _patched_parse_data_name + + +# Patch torch.nn.Module to support base_model's loss_fn.setup() call safely +if not hasattr(nn.Module, "setup"): + nn.Module.setup = lambda self, *args, **kwargs: None + class HeatKrakowDataset(BaseDataset): - """Dataset for the urban heat island use case (Kraków, LST regression). - - CSV layout expected (produced by scripts/make_model_ready_heat_krakow.py): - - name_loc : unique location identifier - - lat, lon : WGS84 coordinates - - target_lst : Land Surface Temperature [°C] - - feat_* : tabular features (numeric + one-hot categorical) - - Modality design note - -------------------- - `implemented_mod = {"coords"}` because in this framework a "modality" refers - to data loaded from a separate file (e.g. a GeoTIFF or .npy embedding). - Tabular features live directly in the model-ready CSV and are picked up - automatically by BaseDataset.get_records() via the `feat_` column prefix. - They do NOT need to be listed in `modalities`. - """ + """Dataset for the urban heat island use case (Kraków, LST regression).""" def __init__( self, data_dir: str, modalities: dict, use_target_data: bool = True, - use_aux_data: Dict[str, Any] | str = "all", + use_aux_data: Any = None, + use_features: bool = True, seed: int = 12345, cache_dir: str = None, mock: bool = False, - use_features: bool = True, + dtype: str = "float32", + return_name_loc: bool = False, + csv_name: str = "model_ready_heat_krakow.csv", + **kwargs, ) -> None: + if mock: + csv_name = None + else: + csv_name = "model_ready_heat_krakow.csv" + + # Trim directory path if base_data_dir ends with 'heat_krakow' + base_data_dir = data_dir.rstrip("/\\") + if base_data_dir.endswith("heat_krakow"): + base_data_dir = os.path.dirname(base_data_dir) + super().__init__( - data_dir=data_dir, + data_dir=base_data_dir, modalities=modalities, use_target_data=use_target_data, use_aux_data=use_aux_data, dataset_name="heat_krakow", seed=seed, cache_dir=cache_dir, - implemented_mod={"coords", "tessera"}, + implemented_mod={"tessera", "coords"}, mock=mock, + dtype=dtype, use_features=use_features, + return_name_loc=return_name_loc, + csv_name=csv_name, ) - # ------------------------------------------------------------------ - # Required overrides - # ------------------------------------------------------------------ - - def setup(self) -> None: - """No files to download / prepare for this dataset.""" - # Set up each requested modality + def _setup(self): + """Sets up active modalities on self.df prior to record generation.""" for mod in self.modalities.keys(): if mod == "coords" and len(self.modalities.keys()) == 1: return elif mod == "tessera": - self.setup_tessera() - # elif mod == "aef": - # self.setup_aef() - return + super().setup_tessera() @override def __getitem__(self, idx: int) -> Dict[str, Any]: row = self.records[idx] - sample: Dict[str, Any] = {"eo": {}} + formatted_row: Dict[str, Any] = {"eo": {}} + + # Base tensor dtype fallback + if isinstance(self.dtype, str): + tensor_dtype = getattr(torch, self.dtype) + elif isinstance(self.dtype, torch.dtype): + tensor_dtype = self.dtype + else: + tensor_dtype = torch.float32 - # --- EO modalities --- + # Process requested modalities for modality in self.modalities: - if modality in ["coords"]: - sample["eo"][modality] = torch.tensor([row["lat"], row["lon"]]) - elif modality == "tessera": - sample["eo"][modality] = self.load_tessera(row["tessera_path"]) - elif modality == "aef": - sample["eo"][modality] = self.load_aef(row["aef_path"]) + if modality == "coords": + mod_cfg = self.modalities["coords"] + if isinstance(mod_cfg, dict) and "dtype" in mod_cfg: + dtype_val = mod_cfg["dtype"] + mod_dtype = ( + getattr(torch, dtype_val) if isinstance(dtype_val, str) else dtype_val + ) + else: + mod_dtype = tensor_dtype - # --- Tabular features (always included if present in CSV) --- - if self.use_features and self.feat_names: - sample["eo"]["tabular"] = torch.tensor( - [row[k] for k in self.feat_names], dtype=torch.float32 - ) + formatted_row["eo"]["coords"] = torch.tensor( + [row["lat"], row["lon"]], + dtype=mod_dtype, + ) + elif modality == "tessera": + formatted_row["eo"]["tessera"] = self.load_tessera(row["tessera_path"]) - # --- Target --- + # Target data if self.use_target_data: - sample["target"] = torch.tensor( - [row[k] for k in self.target_names], dtype=torch.float32 - ) + target_names = getattr(self, "target_names", ["target_lst"]) + target_vals = [row[k] for k in target_names if k in row] + if not target_vals and "target_lst" in row: + target_vals = [row["target_lst"]] + formatted_row["target"] = torch.tensor(target_vals, dtype=torch.float32) - # --- Auxiliary data --- + # Auxiliary data if self.use_aux_data: - sample["aux"] = {} + formatted_row["aux"] = {} for aux_cat, vals in self.use_aux_data.items(): if aux_cat == "aux": - sample["aux"][aux_cat] = torch.tensor( - [row[v] for v in vals], dtype=torch.float32 + formatted_row["aux"][aux_cat] = torch.tensor( + [row[v] for v in vals], dtype=tensor_dtype ) else: - sample["aux"][aux_cat] = [row[v] for v in vals] - - return sample - - @override - def setup_tessera(self) -> None: - """Overridden setup_tessera to fix the list mutation bug.""" - from src.data_preprocessing.tessera_embeds import ( - get_tessera_embeds, - tessera_from_df, - ) - - print("\n\nSetting up Tessera data (Using Krakow Overridden Method)...\n\n") - download_missing_tiles = False - - # Check if data is already available - dst_dir = os.path.join(self.data_dir, "eo/tessera") - - year = self.modalities["tessera"].get( - "year", KeyError('Missing parameter "year" for Tessera modality') - ) - size = self.modalities["tessera"].get( - "size", KeyError('Missing parameter "size" for Tessera modality') - ) - - # If data does not exist or is empty → full download - if not os.path.exists(dst_dir) or len(os.listdir(dst_dir)) == 0: - os.makedirs(dst_dir, exist_ok=True) - - tessera_from_df( - self.df, - data_dir=dst_dir, - year=year, - tile_size=size, - cache_dir=self.cache_dir, - ) - - # Download missing rows (if any) - else: - from geotessera import GeoTessera - - print("Downloading missing Tessera tiles...") - print("[Warning]: it may download tessera tiles filled with 0a") - - avail_files = os.listdir(dst_dir) - gt = None - - # Create a safe list to collect valid records - valid_records = [] - - for rec in self.records: - fname = os.path.basename(rec["tessera_path"]) - - if fname in avail_files: - # File exists locally, keep it - valid_records.append(rec) - else: - # File is missing - if download_missing_tiles: - print(f"Retrieving missing Tessera data: {fname}") - gt = gt or GeoTessera(cache_dir=self.cache_dir) - row = self.df[self.df["name_loc"] == rec["name_loc"]] - lon, lat = row.lon.item(), row.lat.item() - try: - get_tessera_embeds( - lon, - lat, - rec["name_loc"], - year=year, - save_dir=dst_dir, - tile_size=size, - tessera_con=gt, - ) - valid_records.append(rec) - continue - except Exception as e: - print(f"Tile for {fname} could not be retrieved. Error: {e}") - - print(f"No tile found for {fname} thus it will not be used.") - - # Safely swap the filtered list in place - self.records = valid_records + formatted_row["aux"][aux_cat] = [row[v] for v in vals] + + # Tabular features + if self.use_features and getattr(self, "feat_names", None): + raw = torch.tensor([row[k] for k in self.feat_names], dtype=torch.float32) + if ( + getattr(self, "_feat_mean", None) is not None + and getattr(self, "_feat_std", None) is not None + ): + formatted_row["eo"]["tabular"] = (raw - self._feat_mean) / self._feat_std + else: + formatted_row["eo"]["tabular"] = raw + + if self.return_name_loc: + formatted_row["name"] = row.get("name_loc") or row.get("name", f"record_{idx}") + + return formatted_row diff --git a/src/data_preprocessing/caption_generation_krakow.py b/src/data_preprocessing/caption_generation_krakow.py new file mode 100644 index 00000000..264309ab --- /dev/null +++ b/src/data_preprocessing/caption_generation_krakow.py @@ -0,0 +1,206 @@ +import argparse +import itertools +import json +import os +import random + +# ------------------------- +# 1. Variable pools +# ------------------------- + +VEGIDX = [ + "", + "", + "", + "", +] + +URBAN = [ + "", + "", + "", + "", + "", +] + +TERRAIN = [ + "", + "", + "", + "", + "", + "", +] + +VEGETATION_STRUCTURE = [ + "", + "", + "", + "", + "", + "", + "", + "", +] + +LULC = [ + "", + "", + "", +] +DISTRICTS = [""] + +# ------------------------- +# 2. Language pools +# ------------------------- + +ENTITIES = [ + "Location", + "Area", + "Region", + "Site", + "Landscape", + "Territory", + "Geographical area", + "Place", + "Environment", + "Setting", + "Locale", + "Patch", + "Overhead view", + "Earth observation image", + "Geospatial area", +] + +ENTITY_TEMPLATES = [ + "{E}" + # "This {E}", + # "A {E}", + # "The {E}", +] + +CONTEXT_TEMPLATES_ONE = [ + "with {V1}", + "under {V1} conditions", + "influenced by {V1}", + "showing {V1}", +] + +CONTEXT_TEMPLATES_TWO = [ + "with {V1} and {V2}", + "under {V1} and {V2} conditions", + "influenced by {V1} and {V2}", + "showing {V1} and {V2}", +] + +CONTEXT_TEMPLATES_THREE = [ + "with {V1}, {V2} and {V3}", + "under {V1}, {V2} and {V3} conditions", + "influenced by {V1}, {V2} and {V3}", + "showing {V1}, {V2} and {V3}", +] + + +# ------------------------- +# 3. Functions +# ------------------------- + + +def pick_entity(): + """Picks a random entity and template.""" + e = random.choice(ENTITIES) + return random.choice(ENTITY_TEMPLATES).format(E=e) + + +def pick_landcover(): + """Picks a random landcover description style and variables.""" + lulc_item = random.choice(LULC) + + return random.choice( + [ + f"dominated by {lulc_item}", + f"characterised by {lulc_item}", + f"where {lulc_item} is prevalent", + f"with {lulc_item}", + ] + ) + + +def pick_district(): + """Picks a random district style.""" + district_item = random.choice(DISTRICTS) + + return random.choice( + [ + f"situated in {district_item}", + f"placed in {district_item}", + f"located in {district_item}", + f"in {district_item}", + f"that is a part of {district_item}", + ] + ) + + +def get_context_template(k): + """Picks a random context template based on the number of variables k.""" + if k == 1: + return random.choice(CONTEXT_TEMPLATES_ONE) + elif k == 2: + return random.choice(CONTEXT_TEMPLATES_TWO) + else: + return random.choice(CONTEXT_TEMPLATES_THREE) + + +def pick_context(): + """Picks a random context description style and variables.""" + pool = VEGIDX + TERRAIN + URBAN + VEGETATION_STRUCTURE + LULC + k = random.choice([1, 2, 3]) + vars_ = random.sample(pool, k=k) + tmpl = get_context_template(k) + # print(get_context_template(k), tmpl) + if k == 1: + return tmpl.format(V1=vars_[0]) + elif k == 2: + return tmpl.format(V1=vars_[0], V2=vars_[1]) + else: + return tmpl.format(V1=vars_[0], V2=vars_[1], V3=vars_[2]) + + +def generate_captions(n=100, seed=42, save_path=None): + """Generates n captions by randomly sampling from the variable and template pools.""" + random.seed(seed) + captions = set() + + while len(captions) < n: + cap = f"{pick_entity()} {pick_landcover()}, {pick_district()}, {pick_context()}." + captions.add(cap) + + if save_path is not None: + assert os.path.isdir(save_path), f"save_path must be a directory, got {save_path}" + existing_versions = [ + int(f.split(".")[0].lstrip("v")) + for f in os.listdir(save_path) + if f.startswith("v") and f.endswith(".json") and f.split(".")[0].lstrip("v").isdigit() + ] + version = max(existing_versions + [-1]) + 1 + with open(os.path.join(save_path, f"v{version}.json"), "w") as f: + json.dump(list(captions), f, indent=4) + print(f"Saved {len(captions)} captions to {os.path.join(save_path, f'v{version}.json')}") + return list(captions) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate captions.") + parser.add_argument("--n", type=int, default=20, help="Number of captions to generate") + parser.add_argument( + "--save_path", type=str, default=None, help="Directory to save the JSON file" + ) + + args = parser.parse_args() + + caps = generate_captions(n=args.n, save_path=args.save_path) + + # Only print if we aren't saving to a file + if args.save_path is None: + for c in caps: + print(c)