|
1 | 1 | """Module to store configuration parameters for napari_cellseg3d."""
|
2 | 2 | import datetime
|
3 |
| -from dataclasses import dataclass |
| 3 | +from dataclasses import dataclass, field |
4 | 4 | from pathlib import Path
|
5 | 5 | from typing import List, Optional
|
6 | 6 |
|
@@ -182,9 +182,9 @@ class PostProcessConfig:
|
182 | 182 | instance (InstanceSegConfig): instance segmentation config
|
183 | 183 | """
|
184 | 184 |
|
185 |
| - zoom: Zoom = Zoom() |
186 |
| - thresholding: Thresholding = Thresholding() |
187 |
| - instance: InstanceSegConfig = InstanceSegConfig() |
| 185 | + zoom: Zoom = field(default_factory=Zoom) |
| 186 | + thresholding: Thresholding = field(default_factory=Thresholding) |
| 187 | + instance: InstanceSegConfig = field(default_factory=InstanceSegConfig) |
188 | 188 | artifact_removal: bool = False
|
189 | 189 | artifact_removal_size: int = 500
|
190 | 190 |
|
@@ -265,16 +265,16 @@ class InferenceWorkerConfig:
|
265 | 265 | """
|
266 | 266 |
|
267 | 267 | device: str = "cpu"
|
268 |
| - model_info: ModelInfo = ModelInfo() |
269 |
| - weights_config: WeightsInfo = WeightsInfo() |
| 268 | + model_info: ModelInfo = field(default_factory=ModelInfo) |
| 269 | + weights_config: WeightsInfo = field(default_factory=WeightsInfo) |
270 | 270 | results_path: str = str(Path.home() / "cellseg3d" / "inference")
|
271 | 271 | filetype: str = ".tif"
|
272 | 272 | keep_on_cpu: bool = False
|
273 | 273 | compute_stats: bool = False
|
274 |
| - post_process_config: PostProcessConfig = PostProcessConfig() |
275 |
| - sliding_window_config: SlidingWindowConfig = SlidingWindowConfig() |
| 274 | + post_process_config: PostProcessConfig = field(default_factory=PostProcessConfig) |
| 275 | + sliding_window_config: SlidingWindowConfig = field(default_factory=SlidingWindowConfig) |
276 | 276 | use_crf: bool = False
|
277 |
| - crf_config: CRFConfig = CRFConfig() |
| 277 | + crf_config: CRFConfig = field(default_factory=CRFConfig) |
278 | 278 |
|
279 | 279 | images_filepaths: List[str] = None
|
280 | 280 | layer: napari.layers.Layer = None
|
@@ -329,10 +329,10 @@ class TrainingWorkerConfig:
|
329 | 329 | learning_rate: np.float64 = 1e-3
|
330 | 330 | validation_interval: int = 2
|
331 | 331 | batch_size: int = 1
|
332 |
| - deterministic_config: DeterministicConfig = DeterministicConfig() |
| 332 | + deterministic_config: DeterministicConfig = field(default_factory=DeterministicConfig) |
333 | 333 | scheduler_factor: float = 0.5
|
334 | 334 | scheduler_patience: int = 10
|
335 |
| - weights_info: WeightsInfo = WeightsInfo() |
| 335 | + weights_info: WeightsInfo = field(default_factory=WeightsInfo) |
336 | 336 | # data params
|
337 | 337 | results_path_folder: str = str(Path.home() / "cellseg3d" / "training")
|
338 | 338 | sampling: bool = False
|
|
0 commit comments