Skip to content

Commit 2d076c0

Browse files
authored
Merge branch 'dev-define-engines-abc' into dev-add-grandQC
2 parents d82cc3d + c535eab commit 2d076c0

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
sudo apt update
3131
sudo apt-get install -y libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.13.3 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.14.3 pytest pytest-cov pytest-runner
3434
pip install -r requirements/requirements.txt
3535
- name: Cache tiatoolbox static assets
3636
uses: actions/cache@v4

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- mdformat-black
2424
- mdformat-myst
2525
- repo: https://github.com/executablebooks/mdformat
26-
rev: 0.7.22
26+
rev: 1.0.0
2727
hooks:
2828
- id: mdformat
2929
# Optionally add plugins
@@ -60,7 +60,7 @@ repos:
6060
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst.
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
6262
# Ruff version.
63-
rev: v0.13.3
63+
rev: v0.14.3
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

requirements/requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pytest>=7.2.0
1010
pytest-cov>=4.0.0
1111
pytest-runner>=6.0
1212
pytest-xdist[psutil]
13-
ruff==0.13.3 # This will be updated by pre-commit bot to latest version
13+
ruff==0.14.3 # This will be updated by pre-commit bot to latest version
1414
toml>=0.10.2
1515
twine>=4.0.1
1616
wheel>=0.37.1

tests/models/test_arch_sccnn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,22 @@ def test_functionality(remote_sample: Callable) -> None:
3939
units="mpp",
4040
coord_space="resolution",
4141
)
42-
batch = torch.from_numpy(patch)[None]
4342
model = _load_sccnn(name="sccnn-crchisto")
43+
patch = model.preproc(patch)
44+
batch = torch.from_numpy(patch)[None]
4445
output = model.infer_batch(
4546
model,
4647
batch,
4748
device=select_device(on_gpu=env_detection.has_gpu()),
4849
)
4950
output = model.postproc(output[0])
50-
assert np.all(output == [[8, 7]])
51+
np.testing.assert_array_equal(output, np.array([[8, 7]]))
52+
5153
model = _load_sccnn(name="sccnn-conic")
5254
output = model.infer_batch(
5355
model,
5456
batch,
5557
device=select_device(on_gpu=env_detection.has_gpu()),
5658
)
5759
output = model.postproc(output[0])
58-
assert np.all(output == [[7, 8]])
60+
np.testing.assert_array_equal(output, np.array([[7, 8]]))

tiatoolbox/data/pretrained_model.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -863,14 +863,14 @@ sccnn-crchisto:
863863
class: io_config.IOSegmentorConfig
864864
kwargs:
865865
input_resolutions:
866-
- { "units": "mpp", "resolution": 0.5 }
866+
- { "units": "mpp", "resolution": 0.25 }
867867
output_resolutions:
868-
- { "units": "mpp", "resolution": 0.5 }
868+
- { "units": "mpp", "resolution": 0.25 }
869869
tile_shape: [ 2048, 2048 ]
870870
patch_input_shape: [ 31, 31 ]
871871
patch_output_shape: [ 13, 13 ]
872872
stride_shape: [ 8, 8 ]
873-
save_resolution: { 'units': 'mpp', 'resolution': 0.5 }
873+
save_resolution: { 'units': 'mpp', 'resolution': 0.25 }
874874

875875
sccnn-conic:
876876
hf_repo_id: TIACentre/TIAToolbox_pretrained_weights
@@ -886,14 +886,14 @@ sccnn-conic:
886886
class: io_config.IOSegmentorConfig
887887
kwargs:
888888
input_resolutions:
889-
- { "units": "mpp", "resolution": 0.5 }
889+
- { "units": "mpp", "resolution": 0.25 }
890890
output_resolutions:
891-
- { "units": "mpp", "resolution": 0.5 }
891+
- { "units": "mpp", "resolution": 0.25 }
892892
tile_shape: [ 2048, 2048 ]
893893
patch_input_shape: [ 31, 31 ]
894894
patch_output_shape: [ 13, 13 ]
895895
stride_shape: [ 8, 8 ]
896-
save_resolution: { 'units': 'mpp', 'resolution': 0.5 }
896+
save_resolution: { 'units': 'mpp', 'resolution': 0.25 }
897897

898898
nuclick_original-pannuke:
899899
hf_repo_id: TIACentre/TIAToolbox_pretrained_weights

tiatoolbox/models/architecture/sccnn.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def spatially_constrained_layer2(
239239
return sc2 * out_map_threshold
240240

241241
@staticmethod
242-
def preproc(image: torch.Tensor) -> torch.Tensor:
242+
def preproc(image: np.ndarray) -> np.ndarray:
243243
"""Transforming network input to desired format.
244244
245245
This method is model and dataset specific, meaning that it can be replaced by
@@ -309,7 +309,6 @@ def spatially_constrained_layer1(
309309
sigmoid2 = sigmoid[:, 2:3, :, :]
310310
return sigmoid0, sigmoid1, sigmoid2
311311

312-
input_tensor = self.preproc(input_tensor)
313312
l1 = self.layer["l1"]["conv1"](input_tensor)
314313
p1 = self.layer["pool1"](l1)
315314
l2 = self.layer["l2"]["conv1"](p1)

0 commit comments

Comments
 (0)