diff --git a/configs/experiment/ml/test_linear_virchow2_lbfgs.yaml b/configs/experiment/ml/test_linear_virchow2_lbfgs.yaml index 0d60bd1..bfb9804 100644 --- a/configs/experiment/ml/test_linear_virchow2_lbfgs.yaml +++ b/configs/experiment/ml/test_linear_virchow2_lbfgs.yaml @@ -31,6 +31,7 @@ trainer: _target_: ml.callbacks.TiffPredictionMapWriter slides_uri: runs:/${dataset.mlflow_artifacts.tiling_run_id}/test_split/slides.parquet artifact_path: prediction_maps_tiff + background_value: 0 draw_region: central_stride slide_selection: all max_slides: null diff --git a/configs/ml/trainer/final_with_prediction_maps.yaml b/configs/ml/trainer/final_with_prediction_maps.yaml index c744d28..ab6aa9d 100644 --- a/configs/ml/trainer/final_with_prediction_maps.yaml +++ b/configs/ml/trainer/final_with_prediction_maps.yaml @@ -25,6 +25,7 @@ trainer: _target_: ml.callbacks.TiffPredictionMapWriter slides_uri: runs:/${dataset.mlflow_artifacts.tiling_run_id}/test_split/slides.parquet artifact_path: prediction_maps_tiff + background_value: 0 draw_region: central_stride slide_selection: all max_slides: null diff --git a/ml/callbacks/tiff_prediction_map_writer.py b/ml/callbacks/tiff_prediction_map_writer.py index e6a00b3..c8834ec 100644 --- a/ml/callbacks/tiff_prediction_map_writer.py +++ b/ml/callbacks/tiff_prediction_map_writer.py @@ -1,7 +1,6 @@ """Write tile predictions as WSI-aligned BigTIFF masks.""" from collections.abc import Mapping -from hashlib import blake2b from pathlib import Path from re import sub from tempfile import TemporaryDirectory @@ -28,7 +27,7 @@ def __init__( self, slides_uri: str, artifact_path: str = "prediction_maps_tiff", - background_value: int = 255, + background_value: int = 0, draw_region: str = "central_stride", max_slides: int | None = None, slide_selection: str = "all", @@ -518,10 +517,7 @@ def _safe_filename(value: str) -> str: def _slide_prediction_filename(path: str | Path) -> str: - path_str = str(path) - stem = Path(path_str).stem - digest = blake2b(path_str.encode("utf-8"), digest_size=4).hexdigest() - return _safe_filename(f"{stem}-{digest}.tiff") + return Path(path).with_suffix(".tiff").name def _spread_lut(n_classes: int) -> np.ndarray: