orthoseg 0.8.0.dev1__tar.gz → 0.8.0.dev2__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 (74) hide show
  1. {orthoseg-0.8.0.dev1/orthoseg.egg-info → orthoseg-0.8.0.dev2}/PKG-INFO +1 -1
  2. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/model/model_factory.py +2 -2
  3. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/model/model_helper.py +11 -1
  4. orthoseg-0.8.0.dev2/orthoseg/version.txt +1 -0
  5. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2/orthoseg.egg-info}/PKG-INFO +1 -1
  6. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_model_helper.py +18 -0
  7. orthoseg-0.8.0.dev1/orthoseg/version.txt +0 -1
  8. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/LICENSE.MD +0 -0
  9. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/MANIFEST.in +0 -0
  10. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/README.md +0 -0
  11. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/__init__.py +0 -0
  12. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/_compat.py +0 -0
  13. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/helpers/__init__.py +0 -0
  14. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/helpers/config_helper.py +0 -0
  15. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/helpers/email_helper.py +0 -0
  16. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/helpers/vectorfile_helper.py +0 -0
  17. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/__init__.py +0 -0
  18. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/cleanup.py +0 -0
  19. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/postprocess_predictions.py +0 -0
  20. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/predicter.py +0 -0
  21. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/prepare_traindatasets.py +0 -0
  22. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/lib/trainer.py +0 -0
  23. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/load_images.py +0 -0
  24. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/load_sampleprojects.py +0 -0
  25. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/model/__init__.py +0 -0
  26. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/model/model_weights_helper.py +0 -0
  27. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/postprocess.py +0 -0
  28. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/predict.py +0 -0
  29. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/project_defaults.ini +0 -0
  30. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/py.typed +0 -0
  31. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/scriptrunner.py +0 -0
  32. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/scriptrunner_defaults.ini +0 -0
  33. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/train.py +0 -0
  34. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/__init__.py +0 -0
  35. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/_processing_util.py +0 -0
  36. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/config_util.py +0 -0
  37. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/data.py +0 -0
  38. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/general_util.py +0 -0
  39. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/image_util.py +0 -0
  40. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/log_util.py +0 -0
  41. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/progress_util.py +0 -0
  42. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/util/vector_util.py +0 -0
  43. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg/validate.py +0 -0
  44. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg.egg-info/SOURCES.txt +0 -0
  45. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg.egg-info/dependency_links.txt +0 -0
  46. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg.egg-info/entry_points.txt +0 -0
  47. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg.egg-info/requires.txt +0 -0
  48. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/orthoseg.egg-info/top_level.txt +0 -0
  49. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/pyproject.toml +0 -0
  50. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/setup.cfg +0 -0
  51. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/setup.py +0 -0
  52. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/__init__.py +0 -0
  53. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_cleanup.py +0 -0
  54. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_config_helper.py +0 -0
  55. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_config_util.py +0 -0
  56. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_data.py +0 -0
  57. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_end2end.py +0 -0
  58. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_helper.py +0 -0
  59. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_image_util.py +0 -0
  60. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_load_images.py +0 -0
  61. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_load_sampleprojects.py +0 -0
  62. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_model_factory.py +0 -0
  63. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_model_weights_helper.py +0 -0
  64. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_postprocess.py +0 -0
  65. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_postprocess_predictions.py +0 -0
  66. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_predict.py +0 -0
  67. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_predicter.py +0 -0
  68. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_prepare_traindata.py +0 -0
  69. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_train.py +0 -0
  70. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_trainer.py +0 -0
  71. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_validate.py +0 -0
  72. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_vector_util.py +0 -0
  73. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_vectorfile_helper.py +0 -0
  74. {orthoseg-0.8.0.dev1 → orthoseg-0.8.0.dev2}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orthoseg
3
- Version: 0.8.0.dev1
3
+ Version: 0.8.0.dev2
4
4
  Summary: Package to make it easier to segment orthophotos.
5
5
  Home-page: https://github.com/orthoseg/orthoseg
6
6
  Author: Pieter Roggemans
@@ -67,8 +67,8 @@ def get_model(
67
67
  cached to and read from. If None, the system temp directory is used.
68
68
  freeze (bool, optional): Freeze the weights of all layers that were initialized
69
69
  with pretrained values. If only encoder/backend weight are preloaded (e.g.
70
- weights="imagenet"), only those layers are frozen, if all layers
71
- are pre-loaded (e.g. weights="aerial"), all layers except the top
70
+ weights_type="imagenet"), only those layers are frozen, if all layers
71
+ are pre-loaded (e.g. weights_type="aerial"), all layers except the top
72
72
  layers are frozen. It is useful to use this option for the first few
73
73
  epochs to get a more robust network. Defaults to False.
74
74
 
@@ -84,6 +84,7 @@ class TrainParams:
84
84
  earlystop_monitor_metric_mode: Literal["auto", "min", "max"] = "auto",
85
85
  log_tensorboard: bool = False,
86
86
  log_csv: bool = True,
87
+ **kwargs: dict[str, Any],
87
88
  ):
88
89
  """Class containing the hyper parameters needed to perform a training.
89
90
 
@@ -146,6 +147,7 @@ class TrainParams:
146
147
  logging. Defaults to False.
147
148
  log_csv (bool, optional): True to activate logging to a csv.
148
149
  Defaults to True
150
+ kwargs: dict, optional: to allow for deprecated parameters.
149
151
 
150
152
  Raises:
151
153
  Exception: [description]
@@ -156,7 +158,15 @@ class TrainParams:
156
158
  self.trainparams_id = trainparams_id
157
159
  self.image_augmentations = image_augmentations
158
160
  self.mask_augmentations = mask_augmentations
159
- self.weights_type = weights_type
161
+ if "weights" in kwargs:
162
+ # When loading old hyperparams, the weights type was stored in a parameter
163
+ # called "weights", so check for this for backwards compatibility.
164
+ weights = kwargs["weights"]
165
+ self.weights_type: str | None = (
166
+ str(weights) if weights is not None else None
167
+ )
168
+ else:
169
+ self.weights_type = weights_type
160
170
 
161
171
  self.class_weights = class_weights
162
172
  self.batch_size = batch_size
@@ -0,0 +1 @@
1
+ 0.8.0.dev2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orthoseg
3
- Version: 0.8.0.dev1
3
+ Version: 0.8.0.dev2
4
4
  Summary: Package to make it easier to segment orthophotos.
5
5
  Home-page: https://github.com/orthoseg/orthoseg
6
6
  Author: Pieter Roggemans
@@ -129,6 +129,24 @@ def test_parse_model_filename_invalid(tmp_path, filename, err_msg):
129
129
  _ = model_helper.parse_model_filename(tmp_file)
130
130
 
131
131
 
132
+ def test_trainparams_backwards_compatibility():
133
+ """Test if the TrainParams class can still load old hyperparams.
134
+
135
+ In orthoseg < 0.8, `weights_type` was stored in a parameter called `weights`. Check
136
+ if this parameter can still be used for backwards compatibility.
137
+ """
138
+ old_hyperparams = {
139
+ "trainparams_id": 1,
140
+ "image_augmentations": {"cval": 0, "fill_mode": "constant", "rescale": 1},
141
+ "mask_augmentations": {"cval": 0, "fill_mode": "constant", "rescale": 1},
142
+ "weights": "old_weights_type",
143
+ "class_weights": None,
144
+ "batch_size": 32,
145
+ }
146
+ params = model_helper.TrainParams(**old_hyperparams)
147
+ assert params.weights_type == "old_weights_type"
148
+
149
+
132
150
  @pytest.mark.parametrize("class_weights", [None, {0: 1.0, 1: 2.0}])
133
151
  def test_trainparams_defaults(class_weights):
134
152
  params = model_helper.TrainParams(
@@ -1 +0,0 @@
1
- 0.8.0.dev1
File without changes
File without changes
File without changes
File without changes
File without changes