Closed mjbeyeler closed 4 years ago
Hi Michael,
Glad this is working for you. The reason seems to be in the mask generation process you can find in the get_fov()
function inside both predict_one_image.py
and predict_one_image_av.py
(around line 81). You see, the rgb2hsv conversion does not seem to like very reddish images. Maybe it's better to replace:
im_v = equalize_adapthist(rgb2hsv(np.array(img))[:, :, 2])
simply by
im_v = equalize_adapthist(np.array(img))[:, :, 1]
Note that we use the green channel here, instead of the Value channel of the HSV-converted image.
This change seems to work on the image you sent me, although it could then break on other images, who knows. I have pushed this change to the repo, in case you want to pull the changes, or do it manually on your copy of the code. Do let me know if I can close this issue.
Regards,
Adrian
Got it!
Actually, I found out that even before, though an error appeared, the algorithm still managed to compute an output image, so the error wasn’t actually that bad.
Just wanted to share this.
Have a nice weekend!
From: Adrian Galdran notifications@github.com Reply to: agaldran/lwnet reply@reply.github.com Date: Tuesday, 8 September 2020 at 22:31 To: agaldran/lwnet lwnet@noreply.github.com Cc: Michael Beyeler michael.beyeler@unil.ch, Author author@noreply.github.com Subject: Re: [agaldran/lwnet] raise RuntimeError('Unable to find two maxima in histogram' (#1)
Hi Michael,
Glad this is working for you. The reason seems to be in the mask generation process you can find in the get_fov() function inside both predict_one_image.py and predict_one_image_av.py (around line 81). You see, the rgb2hsv conversion does not seem to like very reddish images. Maybe it's better to replace:
im_v = equalize_adapthist(rgb2hsv(np.array(img))[:, :, 2])
simply by
im_v = equalize_adapthist(np.array(img))[:, :, 1]
Note that we use the green channel here, instead of the Value channel of the HSV-converted image.
This change seems to work on the image you sent me, although it could then break on other images, who knows. I have pushed this change to the repo, in case you want to pull the changes, or do it manually on your copy of the code. Do let me know if I can close this issue.
Regards,
Adrian
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/agaldran/lwnet/issues/1#issuecomment-689119163, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHXUFBE5JWA76EBZFYK64RLSE2ICTANCNFSM4RAJXBZQ.
Hi!
First of all I wanted to say that your new software runs smoothly and accurately on independent datasets, so cheers and thanks for the awesome work!
For some images however, I am getting the following error for some reason (independent which pre-trained dataset I use)
* FOV mask not provided, generating it Traceback (most recent call last): File "predict_one_image_av.py", line 210, in <module> mask = get_fov(img) File "predict_one_image_av.py", line 83, in get_fov thresh = threshold_minimum(im_v) .../miniconda3/envs/lwnet/lib/python3.7/site-packages/skimage/filters/thresholding. py", line 721, in threshold_minimum raise RuntimeError('Unable to find two maxima in histogram') RuntimeError: Unable to find two maxima in histogram
I wonder what this could be, given that the image in question looks very good (sent it to you by mail).
Have a nice evening Michael