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.
Files changed (173) hide show
  1. {rslearn-0.0.15/rslearn.egg-info → rslearn-0.0.17}/PKG-INFO +58 -25
  2. {rslearn-0.0.15 → rslearn-0.0.17}/README.md +57 -24
  3. {rslearn-0.0.15 → rslearn-0.0.17}/pyproject.toml +1 -1
  4. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/config/__init__.py +2 -10
  5. rslearn-0.0.17/rslearn/config/dataset.py +602 -0
  6. rslearn-0.0.17/rslearn/data_sources/__init__.py +28 -0
  7. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_landsat.py +13 -24
  8. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_open_data.py +21 -46
  9. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/aws_sentinel1.py +3 -14
  10. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/climate_data_store.py +21 -40
  11. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/copernicus.py +30 -91
  12. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/data_source.py +26 -0
  13. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/earthdaily.py +13 -38
  14. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/earthdata_srtm.py +14 -32
  15. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/eurocrops.py +5 -9
  16. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/gcp_public_data.py +46 -43
  17. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/google_earth_engine.py +31 -44
  18. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/local_files.py +91 -100
  19. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/openstreetmap.py +21 -51
  20. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planet.py +12 -30
  21. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planet_basemap.py +4 -25
  22. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/planetary_computer.py +58 -141
  23. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/usda_cdl.py +15 -26
  24. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/usgs_landsat.py +4 -29
  25. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/utils.py +9 -0
  26. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldcereal.py +47 -54
  27. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldcover.py +16 -14
  28. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/worldpop.py +15 -18
  29. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/xyz_tiles.py +11 -30
  30. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/dataset.py +6 -6
  31. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/manage.py +14 -20
  32. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/materialize.py +9 -45
  33. rslearn-0.0.17/rslearn/lightning_cli.py +443 -0
  34. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/main.py +3 -3
  35. rslearn-0.0.17/rslearn/models/concatenate_features.py +93 -0
  36. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/model.py +2 -5
  37. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/__init__.py +0 -11
  38. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/dataset.py +4 -12
  39. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/prediction_writer.py +16 -32
  40. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/classification.py +2 -1
  41. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/fsspec.py +20 -0
  42. rslearn-0.0.17/rslearn/utils/jsonargparse.py +112 -0
  43. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/raster_format.py +1 -41
  44. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/vector_format.py +1 -38
  45. {rslearn-0.0.15 → rslearn-0.0.17/rslearn.egg-info}/PKG-INFO +58 -25
  46. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/SOURCES.txt +1 -2
  47. rslearn-0.0.15/rslearn/config/dataset.py +0 -602
  48. rslearn-0.0.15/rslearn/data_sources/__init__.py +0 -51
  49. rslearn-0.0.15/rslearn/data_sources/geotiff.py +0 -1
  50. rslearn-0.0.15/rslearn/data_sources/raster_source.py +0 -23
  51. rslearn-0.0.15/rslearn/lightning_cli.py +0 -67
  52. rslearn-0.0.15/rslearn/utils/jsonargparse.py +0 -33
  53. {rslearn-0.0.15 → rslearn-0.0.17}/LICENSE +0 -0
  54. {rslearn-0.0.15 → rslearn-0.0.17}/NOTICE +0 -0
  55. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/__init__.py +0 -0
  56. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/arg_parser.py +0 -0
  57. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/const.py +0 -0
  58. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/data_sources/vector_source.py +0 -0
  59. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/__init__.py +0 -0
  60. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/add_windows.py +0 -0
  61. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/handler_summaries.py +0 -0
  62. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/index.py +0 -0
  63. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/remap.py +0 -0
  64. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/dataset/window.py +0 -0
  65. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/log_utils.py +0 -0
  66. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/__init__.py +0 -0
  67. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/anysat.py +0 -0
  68. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clay/clay.py +0 -0
  69. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clay/configs/metadata.yaml +0 -0
  70. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/clip.py +0 -0
  71. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/conv.py +0 -0
  72. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/croma.py +0 -0
  73. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/__init__.py +0 -0
  74. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/box_ops.py +0 -0
  75. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/detr.py +0 -0
  76. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/matcher.py +0 -0
  77. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/position_encoding.py +0 -0
  78. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/transformer.py +0 -0
  79. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/detr/util.py +0 -0
  80. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/dinov3.py +0 -0
  81. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/faster_rcnn.py +0 -0
  82. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/feature_center_crop.py +0 -0
  83. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/fpn.py +0 -0
  84. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/__init__.py +0 -0
  85. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/galileo.py +0 -0
  86. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/galileo/single_file_galileo.py +0 -0
  87. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/module_wrapper.py +0 -0
  88. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/molmo.py +0 -0
  89. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/multitask.py +0 -0
  90. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/__init__.py +0 -0
  91. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/olmoearth_pretrain/norm.py +0 -0
  92. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon.py +0 -0
  93. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/drone.yaml +0 -0
  94. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/enmap.yaml +0 -0
  95. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/goes.yaml +0 -0
  96. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/himawari.yaml +0 -0
  97. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/intuition.yaml +0 -0
  98. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/landsat8.yaml +0 -0
  99. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/modis_terra.yaml +0 -0
  100. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/qb2_ge1.yaml +0 -0
  101. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/sentinel1.yaml +0 -0
  102. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/sentinel2.yaml +0 -0
  103. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/superdove.yaml +0 -0
  104. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/panopticon_data/sensors/wv23.yaml +0 -0
  105. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/pick_features.py +0 -0
  106. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/pooling_decoder.py +0 -0
  107. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/__init__.py +0 -0
  108. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/presto.py +0 -0
  109. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/presto/single_file_presto.py +0 -0
  110. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/prithvi.py +0 -0
  111. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/registry.py +0 -0
  112. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/resize_features.py +0 -0
  113. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/sam2_enc.py +0 -0
  114. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/satlaspretrain.py +0 -0
  115. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/simple_time_series.py +0 -0
  116. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/singletask.py +0 -0
  117. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/ssl4eo_s12.py +0 -0
  118. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/swin.py +0 -0
  119. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/task_embedding.py +0 -0
  120. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/terramind.py +0 -0
  121. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/trunk.py +0 -0
  122. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/unet.py +0 -0
  123. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/upsample.py +0 -0
  124. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/models/use_croma.py +0 -0
  125. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/py.typed +0 -0
  126. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/template_params.py +0 -0
  127. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/default.py +0 -0
  128. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/tile_stores/tile_store.py +0 -0
  129. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/__init__.py +0 -0
  130. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/all_patches_dataset.py +0 -0
  131. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/__init__.py +0 -0
  132. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/adapters.py +0 -0
  133. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/freeze_unfreeze.py +0 -0
  134. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/gradients.py +0 -0
  135. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/callbacks/peft.py +0 -0
  136. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/data_module.py +0 -0
  137. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/lightning_module.py +0 -0
  138. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/optimizer.py +0 -0
  139. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/scheduler.py +0 -0
  140. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/__init__.py +0 -0
  141. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/detection.py +0 -0
  142. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/embedding.py +0 -0
  143. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/multi_task.py +0 -0
  144. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/per_pixel_regression.py +0 -0
  145. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/regression.py +0 -0
  146. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/segmentation.py +0 -0
  147. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/tasks/task.py +0 -0
  148. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/__init__.py +0 -0
  149. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/concatenate.py +0 -0
  150. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/crop.py +0 -0
  151. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/flip.py +0 -0
  152. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/mask.py +0 -0
  153. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/normalize.py +0 -0
  154. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/pad.py +0 -0
  155. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/select_bands.py +0 -0
  156. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/sentinel1.py +0 -0
  157. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/train/transforms/transform.py +0 -0
  158. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/__init__.py +0 -0
  159. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/array.py +0 -0
  160. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/feature.py +0 -0
  161. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/geometry.py +0 -0
  162. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/get_utm_ups_crs.py +0 -0
  163. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/grid_index.py +0 -0
  164. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/mp.py +0 -0
  165. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/rtree_index.py +0 -0
  166. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/spatial_index.py +0 -0
  167. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/sqlite_index.py +0 -0
  168. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn/utils/time.py +0 -0
  169. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/dependency_links.txt +0 -0
  170. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/entry_points.txt +0 -0
  171. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/requires.txt +0 -0
  172. {rslearn-0.0.15 → rslearn-0.0.17}/rslearn.egg-info/top_level.txt +0 -0
  173. {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.15
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
- "name": "rslearn.data_sources.gcp_public_data.Sentinel2",
347
- "index_cache_dir": "cache/sentinel2/",
348
- "sort_by": "cloud_cover",
349
- "use_rtree_index": false
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
- "name": "rslearn.data_sources.local_files.LocalFiles",
457
- "src_dir": "file:///path/to/world_cover_tifs/"
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
- # Replace this with the dataset path.
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
- path: /path/to/dataset/
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
- ### Logging to Weights & Biases
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 log to W&B by setting the logger under trainer in the model configuration file:
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
- logger:
779
- class_path: lightning.pytorch.loggers.WandbLogger
780
- init_args:
781
- project: land_cover_model
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, runs with this model configuration should show on W&B. For `model fit` runs,
786
- the training and validation loss and accuracy metric will be logged. The accuracy
787
- metric is provided by SegmentationTask, and additional metrics can be enabled by
788
- passing the relevant init_args to the task, e.g. mean IoU and F1:
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
- "name": "rslearn.data_sources.gcp_public_data.Sentinel2",
822
- "index_cache_dir": "cache/sentinel2/",
823
- "sort_by": "cloud_cover",
824
- "use_rtree_index": false,
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
- "name": "rslearn.data_sources.gcp_public_data.Sentinel2",
83
- "index_cache_dir": "cache/sentinel2/",
84
- "sort_by": "cloud_cover",
85
- "use_rtree_index": false
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
- "name": "rslearn.data_sources.local_files.LocalFiles",
193
- "src_dir": "file:///path/to/world_cover_tifs/"
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
- # Replace this with the dataset path.
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
- path: /path/to/dataset/
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
- ### Logging to Weights & Biases
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 log to W&B by setting the logger under trainer in the model configuration file:
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
- logger:
515
- class_path: lightning.pytorch.loggers.WandbLogger
516
- init_args:
517
- project: land_cover_model
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, runs with this model configuration should show on W&B. For `model fit` runs,
522
- the training and validation loss and accuracy metric will be logged. The accuracy
523
- metric is provided by SegmentationTask, and additional metrics can be enabled by
524
- passing the relevant init_args to the task, e.g. mean IoU and F1:
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
- "name": "rslearn.data_sources.gcp_public_data.Sentinel2",
558
- "index_cache_dir": "cache/sentinel2/",
559
- "sort_by": "cloud_cover",
560
- "use_rtree_index": false,
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
  }
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rslearn"
3
- version = "0.0.15"
3
+ version = "0.0.17"
4
4
  description = "A library for developing remote sensing datasets and models"
5
5
  authors = [
6
6
  { name = "OlmoEarth Team" },
@@ -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
  ]