Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot write mode F as PNG #252

Open
judycpChen opened this issue Dec 25, 2023 · 3 comments
Open

cannot write mode F as PNG #252

judycpChen opened this issue Dec 25, 2023 · 3 comments

Comments

@judycpChen
Copy link

微信图片_20231225110818
微信图片_20231225110825
I ran into this problem when I was running main.py. How do I fix it

@angleboy8
Copy link

网上说应该将输出图像转成整数,bug是没了,但是结果显示的不对。

@zadorliza
Copy link

zadorliza commented Mar 10, 2024

I have the same problem, not sure how to solve it. Did you solve it?
UPD: as I understood, this error means that program try to save an array to PNG. I found location of this error: file data.py, function saveResult. Object 'img' in this function is ndarray, and I don't know yet how to convert it to PNG file.

UPD2: I still don't know why I get this error because io.imsave must work with numpy arrays. But I found a way to get an images anyway: instead of "io.imsave(os.path.join(save_path,"%d_predict.png"%i),img)" you can write this:
image
Not perfect solution because if you have a lot of test images, it will take a lot of time to save it by yourself. Besides, saved images have axis, like this one:
Figure_1

@partha-90
Copy link

partha-90 commented Jul 3, 2024

find and change in saveResult (data.py) for grayscale image

img = labelVisualize(num_class,COLOR_DICT,item) if flag_multi_class else (item[:,:,0]*255).astype(np.uint8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants