Skip to content

Commit 7cc2577

Browse files
committed
🔥 Clean up unnecessary code
1 parent 1db4e41 commit 7cc2577

File tree

4 files changed

+168
-310
lines changed

4 files changed

+168
-310
lines changed

tests/engines/test_semantic_segmentor.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import json
66
import sqlite3
77
from pathlib import Path
8-
from typing import TYPE_CHECKING, Callable
8+
from typing import Callable
99

1010
import numpy as np
1111
import torch
@@ -16,9 +16,6 @@
1616
from tiatoolbox.utils import env_detection as toolbox_env
1717
from tiatoolbox.utils.misc import imread
1818

19-
if TYPE_CHECKING:
20-
import pytest
21-
2219
device = "cuda" if toolbox_env.has_gpu() else "cpu"
2320

2421

@@ -215,7 +212,6 @@ def test_wsi_segmentor_zarr(
215212
remote_sample: Callable,
216213
sample_svs: Path,
217214
tmp_path: Path,
218-
caplog: pytest.LogCaptureFixture,
219215
) -> None:
220216
"""Test SemanticSegmentor for WSIs with zarr output."""
221217
wsi1_2k_2k_svs = Path(remote_sample("wsi1_2k_2k_svs"))
@@ -244,7 +240,6 @@ def test_wsi_segmentor_zarr(
244240
assert "probabilities" not in output_
245241
assert "canvas" not in output_
246242
assert "count" not in output_
247-
assert "Current Memory usage:" in caplog.text
248243

249244
segmentor = SemanticSegmentor(
250245
model="fcn-tissue_mask",
@@ -270,7 +265,6 @@ def test_wsi_segmentor_zarr(
270265
assert "probabilities" in output_
271266
assert "canvas" not in output_
272267
assert "count" not in output_
273-
assert "Canvas task graph length:" in caplog.text
274268

275269
# Return Probabilities is True
276270
# Using small image for faster run
@@ -293,7 +287,7 @@ def test_wsi_segmentor_zarr(
293287

294288
output_ = zarr.open(output[sample_svs], mode="r")
295289
assert 0.17 < np.mean(output_["predictions"][:]) < 0.19
296-
assert 0.48 < np.mean(output_["probabilities"][:]) < 0.52
290+
assert 0.52 < np.mean(output_["probabilities"][:]) < 0.56
297291

298292
output_ = zarr.open(output[wsi1_2k_2k_svs], mode="r")
299293
assert 0.24 < np.mean(output_["predictions"][:]) < 0.25

tiatoolbox/models/engine/engine_abc.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ class EngineABCRunParams(TypedDict, total=False):
8484
Number of image patches per forward pass.
8585
class_dict (dict):
8686
Mapping of classification outputs to class names.
87-
da_length_threshold (int):
88-
Dask graph length threshold to trigger caching behavior.
8987
device (str):
9088
Device to run the model on (e.g., "cpu", "cuda").
9189
See https://pytorch.org/docs/stable/tensor_attributes.html#torch.device
@@ -121,7 +119,6 @@ class EngineABCRunParams(TypedDict, total=False):
121119
auto_get_mask: bool
122120
batch_size: int
123121
class_dict: dict
124-
da_length_threshold: int
125122
device: str
126123
input_resolutions: list[dict[Units, Resolution]]
127124
ioconfig: ModelIOConfigABC

tiatoolbox/models/engine/patch_predictor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class PredictorRunParams(EngineABCRunParams, total=False):
5353
Number of image patches to feed to the model in a forward pass.
5454
class_dict (dict):
5555
Optional dictionary mapping classification outputs to class names.
56-
da_length_threshold (int):
57-
Dask graph length threshold to trigger caching behavior.
5856
device (str):
5957
Device to run the model on (e.g., "cpu", "cuda").
6058
input_resolutions (list[dict]):

0 commit comments

Comments
 (0)