Skip to content

Commit

Permalink
always cast to float;
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Morris committed Apr 22, 2024
1 parent e2e80d0 commit 6c10c85
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cyto_dl/models/im2im/utils/postprocessing/auto_thresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
class AutoThreshold:
def __init__(self, method: Optional[Union[float, str]] = None):
if isinstance(method, float):

def thresh_func(image):
return method

Expand All @@ -23,7 +22,7 @@ def thresh_func(image):
self.thresh_func = thresh_func

def __call__(self, image):
image = image.detach().cpu().numpy()
image = image.detach().cpu().numpy().astype(float)
if self.thresh_func is None:
return image
return (image > self.thresh_func(image)).astype(np.uint8)

0 comments on commit 6c10c85

Please sign in to comment.