@@ -54,6 +54,7 @@ def __init__(self, scale, verbose):
54
54
self .scale = scale
55
55
56
56
def scale_input (self , input_volume , is_segmentation = False ):
57
+ t0 = time .time ()
57
58
if self .scale is None :
58
59
return input_volume
59
60
@@ -73,10 +74,11 @@ def scale_input(self, input_volume, is_segmentation=False):
73
74
input_volume = rescale (input_volume , self .scale , preserve_range = True ).astype (input_volume .dtype )
74
75
75
76
if self .verbose :
76
- print ("Rescaled volume from" , self ._original_shape , "to" , input_volume .shape )
77
+ print ("Rescaled volume from" , self ._original_shape , "to" , input_volume .shape , "in" , time . time () - t0 , "s" )
77
78
return input_volume
78
79
79
80
def rescale_output (self , output , is_segmentation ):
81
+ t0 = time .time ()
80
82
if self .scale is None :
81
83
return output
82
84
@@ -91,6 +93,9 @@ def rescale_output(self, output, is_segmentation):
91
93
else :
92
94
output = resize (output , out_shape , preserve_range = True ).astype (output .dtype )
93
95
96
+ if self .verbose :
97
+ print ("Resized prediction back to original shape" , output .shape , "in" , time .time () - t0 , "s" )
98
+
94
99
return output
95
100
96
101
@@ -463,7 +468,6 @@ def get_default_tiling(is_2d: bool = False) -> Dict[str, Dict[str, int]]:
463
468
tiling = {"tile" : tile , "halo" : halo }
464
469
print (f"Determined tile size for MPS: { tiling } " )
465
470
466
-
467
471
# I am not sure what is reasonable on a cpu. For now choosing very small tiling.
468
472
# (This will not work well on a CPU in any case.)
469
473
else :
0 commit comments