Closed shoyip closed 1 year ago
Hi @shoyip ,
Without the data I can not really tell 100%, but I imagine that what is happening is that one of your masks have all the same values in it. This is making the normalizeMinMax
function to return NaN values as np.amax(x) - np.amin(x)
of an image with the all the values being the same is zero, then the division between zero returns Nan.
# Simple normalization to min/max for the Mask
def normalizeMinMax(x, dtype=np.float32):
x = x.astype(dtype,copy=False)
x = (x - np.amin(x)) / (np.amax(x) - np.amin(x))
return x
Therefore, to solve it, in 021c2c03f5776806fb50b3965b31b0ff13bb1800 I have added a really small value to avoid divisions between zero and with this NaN values.
# Simple normalization to min/max for the Mask
def normalizeMinMax(x, dtype=np.float32):
x = x.astype(dtype,copy=False)
x = (x - np.amin(x)) / (np.amax(x) - np.amin(x) + 1e-10)
return x
Thank you very much for your issue and helping us to solve this problem. Please try the new notebook and if the problem persist, fell free to comment it again in the issue.
Iván
Describe the bug I am currently using the ZeroCostDL4Mic U-Net 2D notebook. Everything is smooth until I get to step 4.1. Running the cell causes the following ValueError
Is there any brute-force method to mask the NaNs? What do you suggest to do?
To Reproduce Steps to reproduce the behavior:
Expected behavior No error, the preparation should run smoothly
Desktop (please complete the following information):