Skip to content

Commit c535eab

Browse files
authored
Merge branch 'develop' into dev-define-engines-abc
2 parents 67ef0da + 3242b1a commit c535eab

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

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: semantic_segmentor.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: semantic_segmentor.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)