Skip to content

Commit

Permalink
domain adaption testing supported
Browse files Browse the repository at this point in the history
  • Loading branch information
VMarsocci committed Sep 17, 2024
1 parent 34110c7 commit 23c089c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
87 changes: 87 additions & 0 deletions configs/datasets/fivebillionpixels_cross_sensors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
dataset_name: FiveBillionPixels
root_path: /geomatics/gpuserver-1/vmarsocci/FiveBillionPixels/dom_adapt
download_url: False
auto_download: False

img_size: 1000
multi_temporal: False
multi_modal: False

# classes
ignore_index: 0
num_classes: 25
classes:
- unlabeled
- industrial area
- paddy field
- irrigated field
- dry cropland
- garden land
- arbor forest
- shrub forest
- park
- natural meadow
- artificial meadow
- river
- urban residential
- lake
- pond
- fish pond
- snow
- bareland
- rural residential
- stadium
- square
- road
- overpass
- railway station
- airport
distribution:
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111
- 0.88889
- 0.11111

bands:
optical:
- B4
- B3
- B2
- B8
data_mean:
optical:
- 124.3
- 94.2
- 98.
- 92.6
data_std:
optical:
- 51.
- 50.
- 47.1
- 44.5
data_min:
optical: [0.0000, 0.0000, 0.0000, 0.0000]
data_max:
optical: [0.0000, 0.0000, 0.0000, 0.0000]
2 changes: 1 addition & 1 deletion datasets/fivebillionpixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __getitem__(self, index):
def get_splits(dataset_config):
dataset_train = FiveBillionPixels(dataset_config, split="train", is_train=True)
dataset_val = FiveBillionPixels(dataset_config, split="val", is_train=False)
dataset_test = dataset_val
dataset_test = FiveBillionPixels(dataset_config, split="test", is_train=False)
return dataset_train, dataset_val, dataset_test

@staticmethod
Expand Down
13 changes: 13 additions & 0 deletions utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ def load_configs(parser:argparse.ArgumentParser) -> OmegaConf:
cli_provided, cli_defaults = omegaconf_from_argparse(parser)
all_cli = OmegaConf.merge(cli_defaults, cli_provided)

# print(all_cli)

if all_cli.eval_dir:
# Just load the dumped config file if we are evaluating
eval_config_path = pathlib.Path(all_cli.eval_dir) / 'configs'
file_cfg = OmegaConf.load(eval_config_path/"config.yaml")

# if all_cli.config:
# to do the test on different datasets (with same number of classes)
bootstrap_cfg = OmegaConf.merge(cli_defaults, file_cfg, cli_provided)
if bootstrap_cfg.augmentation_config_path is not None:
augmentation_cfg = OmegaConf.load(bootstrap_cfg.augmentation_config_path)
file_cfg["augmentation"] = augmentation_cfg
if bootstrap_cfg.augmentation_config_path is not None:
dataset_cfg = OmegaConf.load(bootstrap_cfg.dataset_config_path)
file_cfg["dataset"] = dataset_cfg

cfg = OmegaConf.merge(cli_defaults, file_cfg, cli_provided)

elif all_cli.config:
Expand Down

0 comments on commit 23c089c

Please sign in to comment.