rslearn 0.0.15__tar.gz → 0.0.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rslearn-0.0.15/rslearn.egg-info → rslearn-0.0.17}/PKG-INFO +58 -25
- {rslearn-0.0.15 → rslearn-0.0.17}/README.md +57 -24
- {rslearn-0.0.15 → rslearn-0.0.17}/pyproject.toml +1 -1
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/config/__init__.py +2 -10
- rslearn-0.0.17/rslearn/config/dataset.py +602 -0
- rslearn-0.0.17/rslearn/data_sources/__init__.py +28 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_landsat.py +13 -24
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_open_data.py +21 -46
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_sentinel1.py +3 -14
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/climate_data_store.py +21 -40
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/copernicus.py +30 -91
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/data_source.py +26 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/earthdaily.py +13 -38
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/earthdata_srtm.py +14 -32
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/eurocrops.py +5 -9
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/gcp_public_data.py +46 -43
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/google_earth_engine.py +31 -44
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/local_files.py +91 -100
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/openstreetmap.py +21 -51
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planet.py +12 -30
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planet_basemap.py +4 -25
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planetary_computer.py +58 -141
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/usda_cdl.py +15 -26
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/usgs_landsat.py +4 -29
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/utils.py +9 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldcereal.py +47 -54
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldcover.py +16 -14
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldpop.py +15 -18
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/xyz_tiles.py +11 -30
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/dataset.py +6 -6
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/manage.py +14 -20
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/materialize.py +9 -45
- rslearn-0.0.17/rslearn/lightning_cli.py +443 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/main.py +3 -3
- rslearn-0.0.17/rslearn/models/concatenate_features.py +93 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/model.py +2 -5
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/__init__.py +0 -11
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/dataset.py +4 -12
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/prediction_writer.py +16 -32
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/classification.py +2 -1
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/fsspec.py +20 -0
- rslearn-0.0.17/rslearn/utils/jsonargparse.py +112 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/raster_format.py +1 -41
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/vector_format.py +1 -38
- {rslearn-0.0.15 → rslearn-0.0.17/rslearn.egg-info}/PKG-INFO +58 -25
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/SOURCES.txt +1 -2
- rslearn-0.0.15/rslearn/config/dataset.py +0 -602
- rslearn-0.0.15/rslearn/data_sources/__init__.py +0 -51
- rslearn-0.0.15/rslearn/data_sources/geotiff.py +0 -1
- rslearn-0.0.15/rslearn/data_sources/raster_source.py +0 -23
- rslearn-0.0.15/rslearn/lightning_cli.py +0 -67
- rslearn-0.0.15/rslearn/utils/jsonargparse.py +0 -33
- {rslearn-0.0.15 → rslearn-0.0.17}/LICENSE +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/NOTICE +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/arg_parser.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/const.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/vector_source.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/add_windows.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/handler_summaries.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/index.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/remap.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/window.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/log_utils.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/anysat.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clay/clay.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clay/configs/metadata.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clip.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/conv.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/croma.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/box_ops.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/detr.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/matcher.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/position_encoding.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/transformer.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/util.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/dinov3.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/faster_rcnn.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/feature_center_crop.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/fpn.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/galileo.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/single_file_galileo.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/module_wrapper.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/molmo.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/multitask.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/norm.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/drone.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/enmap.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/goes.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/himawari.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/intuition.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/landsat8.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/modis_terra.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/qb2_ge1.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/sentinel1.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/sentinel2.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/superdove.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/wv23.yaml +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/pick_features.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/pooling_decoder.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/presto.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/single_file_presto.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/prithvi.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/registry.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/resize_features.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/sam2_enc.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/satlaspretrain.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/simple_time_series.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/singletask.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/ssl4eo_s12.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/swin.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/task_embedding.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/terramind.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/trunk.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/unet.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/upsample.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/use_croma.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/py.typed +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/template_params.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/default.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/tile_store.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/all_patches_dataset.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/adapters.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/freeze_unfreeze.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/gradients.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/peft.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/data_module.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/lightning_module.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/optimizer.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/scheduler.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/detection.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/embedding.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/multi_task.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/per_pixel_regression.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/regression.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/segmentation.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/task.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/concatenate.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/crop.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/flip.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/mask.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/normalize.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/pad.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/select_bands.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/sentinel1.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/transform.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/__init__.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/array.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/feature.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/geometry.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/get_utm_ups_crs.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/grid_index.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/mp.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/rtree_index.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/spatial_index.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/sqlite_index.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/time.py +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/dependency_links.txt +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/entry_points.txt +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/requires.txt +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/top_level.txt +0 -0
- {rslearn-0.0.15 → rslearn-0.0.17}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rslearn
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.17
|
|
4
4
|
Summary: A library for developing remote sensing datasets and models
|
|
5
5
|
Author: OlmoEarth Team
|
|
6
6
|
License: Apache License
|
|
@@ -343,10 +343,12 @@ directory `/path/to/dataset` and corresponding configuration file at
|
|
|
343
343
|
"bands": ["R", "G", "B"]
|
|
344
344
|
}],
|
|
345
345
|
"data_source": {
|
|
346
|
-
"
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
347
|
+
"init_args": {
|
|
348
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
349
|
+
"sort_by": "cloud_cover",
|
|
350
|
+
"use_rtree_index": false
|
|
351
|
+
}
|
|
350
352
|
}
|
|
351
353
|
}
|
|
352
354
|
}
|
|
@@ -453,8 +455,10 @@ automate this process. Update the dataset `config.json` with a new layer:
|
|
|
453
455
|
}],
|
|
454
456
|
"resampling_method": "nearest",
|
|
455
457
|
"data_source": {
|
|
456
|
-
"
|
|
457
|
-
"
|
|
458
|
+
"class_path": "rslearn.data_sources.local_files.LocalFiles",
|
|
459
|
+
"init_args": {
|
|
460
|
+
"src_dir": "file:///path/to/world_cover_tifs/"
|
|
461
|
+
}
|
|
458
462
|
}
|
|
459
463
|
}
|
|
460
464
|
},
|
|
@@ -516,8 +520,7 @@ model:
|
|
|
516
520
|
data:
|
|
517
521
|
class_path: rslearn.train.data_module.RslearnDataModule
|
|
518
522
|
init_args:
|
|
519
|
-
|
|
520
|
-
path: /path/to/dataset/
|
|
523
|
+
path: ${DATASET_PATH}
|
|
521
524
|
# This defines the layers that should be read for each window.
|
|
522
525
|
# The key ("image" / "targets") is what the data will be called in the model,
|
|
523
526
|
# while the layers option specifies which layers will be read.
|
|
@@ -615,7 +618,9 @@ trainer:
|
|
|
615
618
|
...
|
|
616
619
|
- class_path: rslearn.train.prediction_writer.RslearnWriter
|
|
617
620
|
init_args:
|
|
618
|
-
|
|
621
|
+
# We need to include this argument, but it will be overridden with the dataset
|
|
622
|
+
# path from data.init_args.path.
|
|
623
|
+
path: placeholder
|
|
619
624
|
output_layer: output
|
|
620
625
|
```
|
|
621
626
|
|
|
@@ -768,24 +773,43 @@ This will produce PNGs in the vis directory. The visualizations are produced by
|
|
|
768
773
|
SegmentationTask and overriding the visualize function.
|
|
769
774
|
|
|
770
775
|
|
|
771
|
-
###
|
|
776
|
+
### Checkpoint and Logging Management
|
|
777
|
+
|
|
778
|
+
Above, we needed to configure the checkpoint directory in the model config (the
|
|
779
|
+
`dirpath` option under `lightning.pytorch.callbacks.ModelCheckpoint`), and explicitly
|
|
780
|
+
specify the checkpoint path when applying the model. Additionally, metrics are logged
|
|
781
|
+
to the local filesystem and not well organized.
|
|
772
782
|
|
|
773
|
-
We can
|
|
783
|
+
We can instead let rslearn automatically manage checkpoints, along with logging to
|
|
784
|
+
Weights & Biases. To do so, we add project_name, run_name, and management_dir options
|
|
785
|
+
to the model config. The project_name corresponds to the W&B project, and the run name
|
|
786
|
+
corresponds to the W&B name. The management_dir is a directory to store project data;
|
|
787
|
+
rslearn determines a per-project directory at `{management_dir}/{project_name}/{run_name}/`
|
|
788
|
+
and uses it to store checkpoints.
|
|
774
789
|
|
|
775
790
|
```yaml
|
|
791
|
+
model:
|
|
792
|
+
# ...
|
|
793
|
+
data:
|
|
794
|
+
# ...
|
|
776
795
|
trainer:
|
|
777
796
|
# ...
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
name: version_00
|
|
797
|
+
project_name: land_cover_model
|
|
798
|
+
run_name: version_00
|
|
799
|
+
# This sets the option via the MANAGEMENT_DIR environment variable.
|
|
800
|
+
management_dir: ${MANAGEMENT_DIR}
|
|
783
801
|
```
|
|
784
802
|
|
|
785
|
-
Now,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
803
|
+
Now, set the `MANAGEMENT_DIR` environment variable and run `model fit`:
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
export MANAGEMENT_DIR=./project_data
|
|
807
|
+
rslearn model fit --config land_cover_model.yaml
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
The training and validation loss and accuracy metric should now be logged to W&B. The
|
|
811
|
+
accuracy metric is provided by SegmentationTask, and additional metrics can be enabled
|
|
812
|
+
by passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
789
813
|
|
|
790
814
|
```yaml
|
|
791
815
|
class_path: rslearn.train.tasks.segmentation.SegmentationTask
|
|
@@ -796,6 +820,13 @@ passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
|
796
820
|
enable_f1_metric: true
|
|
797
821
|
```
|
|
798
822
|
|
|
823
|
+
When calling `model test` and `model predict` with management_dir set, rslearn will
|
|
824
|
+
automatically load the best checkpoint from the project directory, or raise an error if
|
|
825
|
+
no existing checkpoint exists. This behavior can be overridden with the
|
|
826
|
+
`--load_checkpoint_mode` and `--load_checkpoint_required` options (see `--help` for
|
|
827
|
+
details). Logging will be enabled during fit but not test/predict, and this can also
|
|
828
|
+
be overridden, using `--log_mode`.
|
|
829
|
+
|
|
799
830
|
|
|
800
831
|
### Inputting Multiple Sentinel-2 Images
|
|
801
832
|
|
|
@@ -818,10 +849,12 @@ query_config section. This can replace the sentinel2 layer:
|
|
|
818
849
|
"bands": ["R", "G", "B"]
|
|
819
850
|
}],
|
|
820
851
|
"data_source": {
|
|
821
|
-
"
|
|
822
|
-
"
|
|
823
|
-
|
|
824
|
-
|
|
852
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
853
|
+
"init_args": {
|
|
854
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
855
|
+
"sort_by": "cloud_cover",
|
|
856
|
+
"use_rtree_index": false
|
|
857
|
+
},
|
|
825
858
|
"query_config": {
|
|
826
859
|
"max_matches": 3
|
|
827
860
|
}
|
|
@@ -79,10 +79,12 @@ directory `/path/to/dataset` and corresponding configuration file at
|
|
|
79
79
|
"bands": ["R", "G", "B"]
|
|
80
80
|
}],
|
|
81
81
|
"data_source": {
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
83
|
+
"init_args": {
|
|
84
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
85
|
+
"sort_by": "cloud_cover",
|
|
86
|
+
"use_rtree_index": false
|
|
87
|
+
}
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
}
|
|
@@ -189,8 +191,10 @@ automate this process. Update the dataset `config.json` with a new layer:
|
|
|
189
191
|
}],
|
|
190
192
|
"resampling_method": "nearest",
|
|
191
193
|
"data_source": {
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
+
"class_path": "rslearn.data_sources.local_files.LocalFiles",
|
|
195
|
+
"init_args": {
|
|
196
|
+
"src_dir": "file:///path/to/world_cover_tifs/"
|
|
197
|
+
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
},
|
|
@@ -252,8 +256,7 @@ model:
|
|
|
252
256
|
data:
|
|
253
257
|
class_path: rslearn.train.data_module.RslearnDataModule
|
|
254
258
|
init_args:
|
|
255
|
-
|
|
256
|
-
path: /path/to/dataset/
|
|
259
|
+
path: ${DATASET_PATH}
|
|
257
260
|
# This defines the layers that should be read for each window.
|
|
258
261
|
# The key ("image" / "targets") is what the data will be called in the model,
|
|
259
262
|
# while the layers option specifies which layers will be read.
|
|
@@ -351,7 +354,9 @@ trainer:
|
|
|
351
354
|
...
|
|
352
355
|
- class_path: rslearn.train.prediction_writer.RslearnWriter
|
|
353
356
|
init_args:
|
|
354
|
-
|
|
357
|
+
# We need to include this argument, but it will be overridden with the dataset
|
|
358
|
+
# path from data.init_args.path.
|
|
359
|
+
path: placeholder
|
|
355
360
|
output_layer: output
|
|
356
361
|
```
|
|
357
362
|
|
|
@@ -504,24 +509,43 @@ This will produce PNGs in the vis directory. The visualizations are produced by
|
|
|
504
509
|
SegmentationTask and overriding the visualize function.
|
|
505
510
|
|
|
506
511
|
|
|
507
|
-
###
|
|
512
|
+
### Checkpoint and Logging Management
|
|
513
|
+
|
|
514
|
+
Above, we needed to configure the checkpoint directory in the model config (the
|
|
515
|
+
`dirpath` option under `lightning.pytorch.callbacks.ModelCheckpoint`), and explicitly
|
|
516
|
+
specify the checkpoint path when applying the model. Additionally, metrics are logged
|
|
517
|
+
to the local filesystem and not well organized.
|
|
508
518
|
|
|
509
|
-
We can
|
|
519
|
+
We can instead let rslearn automatically manage checkpoints, along with logging to
|
|
520
|
+
Weights & Biases. To do so, we add project_name, run_name, and management_dir options
|
|
521
|
+
to the model config. The project_name corresponds to the W&B project, and the run name
|
|
522
|
+
corresponds to the W&B name. The management_dir is a directory to store project data;
|
|
523
|
+
rslearn determines a per-project directory at `{management_dir}/{project_name}/{run_name}/`
|
|
524
|
+
and uses it to store checkpoints.
|
|
510
525
|
|
|
511
526
|
```yaml
|
|
527
|
+
model:
|
|
528
|
+
# ...
|
|
529
|
+
data:
|
|
530
|
+
# ...
|
|
512
531
|
trainer:
|
|
513
532
|
# ...
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
name: version_00
|
|
533
|
+
project_name: land_cover_model
|
|
534
|
+
run_name: version_00
|
|
535
|
+
# This sets the option via the MANAGEMENT_DIR environment variable.
|
|
536
|
+
management_dir: ${MANAGEMENT_DIR}
|
|
519
537
|
```
|
|
520
538
|
|
|
521
|
-
Now,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
539
|
+
Now, set the `MANAGEMENT_DIR` environment variable and run `model fit`:
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
export MANAGEMENT_DIR=./project_data
|
|
543
|
+
rslearn model fit --config land_cover_model.yaml
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
The training and validation loss and accuracy metric should now be logged to W&B. The
|
|
547
|
+
accuracy metric is provided by SegmentationTask, and additional metrics can be enabled
|
|
548
|
+
by passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
525
549
|
|
|
526
550
|
```yaml
|
|
527
551
|
class_path: rslearn.train.tasks.segmentation.SegmentationTask
|
|
@@ -532,6 +556,13 @@ passing the relevant init_args to the task, e.g. mean IoU and F1:
|
|
|
532
556
|
enable_f1_metric: true
|
|
533
557
|
```
|
|
534
558
|
|
|
559
|
+
When calling `model test` and `model predict` with management_dir set, rslearn will
|
|
560
|
+
automatically load the best checkpoint from the project directory, or raise an error if
|
|
561
|
+
no existing checkpoint exists. This behavior can be overridden with the
|
|
562
|
+
`--load_checkpoint_mode` and `--load_checkpoint_required` options (see `--help` for
|
|
563
|
+
details). Logging will be enabled during fit but not test/predict, and this can also
|
|
564
|
+
be overridden, using `--log_mode`.
|
|
565
|
+
|
|
535
566
|
|
|
536
567
|
### Inputting Multiple Sentinel-2 Images
|
|
537
568
|
|
|
@@ -554,10 +585,12 @@ query_config section. This can replace the sentinel2 layer:
|
|
|
554
585
|
"bands": ["R", "G", "B"]
|
|
555
586
|
}],
|
|
556
587
|
"data_source": {
|
|
557
|
-
"
|
|
558
|
-
"
|
|
559
|
-
|
|
560
|
-
|
|
588
|
+
"class_path": "rslearn.data_sources.gcp_public_data.Sentinel2",
|
|
589
|
+
"init_args": {
|
|
590
|
+
"index_cache_dir": "cache/sentinel2/",
|
|
591
|
+
"sort_by": "cloud_cover",
|
|
592
|
+
"use_rtree_index": false
|
|
593
|
+
},
|
|
561
594
|
"query_config": {
|
|
562
595
|
"max_matches": 3
|
|
563
596
|
}
|
|
@@ -3,33 +3,25 @@
|
|
|
3
3
|
from .dataset import (
|
|
4
4
|
BandSetConfig,
|
|
5
5
|
CompositingMethod,
|
|
6
|
+
DatasetConfig,
|
|
6
7
|
DataSourceConfig,
|
|
7
8
|
DType,
|
|
8
9
|
LayerConfig,
|
|
9
10
|
LayerType,
|
|
10
11
|
QueryConfig,
|
|
11
|
-
RasterFormatConfig,
|
|
12
|
-
RasterLayerConfig,
|
|
13
12
|
SpaceMode,
|
|
14
13
|
TimeMode,
|
|
15
|
-
VectorFormatConfig,
|
|
16
|
-
VectorLayerConfig,
|
|
17
|
-
load_layer_config,
|
|
18
14
|
)
|
|
19
15
|
|
|
20
16
|
__all__ = [
|
|
21
17
|
"BandSetConfig",
|
|
22
18
|
"CompositingMethod",
|
|
19
|
+
"DatasetConfig",
|
|
23
20
|
"DataSourceConfig",
|
|
24
21
|
"DType",
|
|
25
22
|
"LayerConfig",
|
|
26
23
|
"LayerType",
|
|
27
24
|
"QueryConfig",
|
|
28
|
-
"RasterFormatConfig",
|
|
29
|
-
"RasterLayerConfig",
|
|
30
25
|
"SpaceMode",
|
|
31
26
|
"TimeMode",
|
|
32
|
-
"VectorFormatConfig",
|
|
33
|
-
"VectorLayerConfig",
|
|
34
|
-
"load_layer_config",
|
|
35
27
|
]
|