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

Error with the utils file while using RGB images #43

Open
sivaramakrishnan-rajaraman opened this issue Dec 16, 2020 · 1 comment
Open
Labels
bug Something isn't working

Comments

@sivaramakrishnan-rajaraman

I am using the utils.py functions to work with RGB images. My mode works with RGB images and RGB masks and generates RGB masks (3 channel images). I am working with (256,256,3) images and masks. While running the code, I get the following error wit the plot_imgs function: How should we modify this plot function t work with RGB images? Thanks in advance.

ValueError Traceback (most recent call last)
in
----> 1 plot_imgs(org_imgs=X_train, mask_imgs=y_train, pred_imgs=preds_train, nm_img_to_plot=1)

in plot_imgs(org_imgs, mask_imgs, pred_imgs, nm_img_to_plot, figsize, alpha, color)
145 mask_to_rgba(
146 zero_pad_mask(pred_imgs[im_id], desired_size=org_imgs_size),
--> 147 color=color,
148 ),
149 cmap=get_cmap(pred_imgs),

in mask_to_rgba(mask, color)
59 w = mask.shape[1]
60 zeros = np.zeros((h, w))
---> 61 ones = mask.reshape(h, w)
62 if color == "red":
63 return np.stack((ones, zeros, zeros, ones), axis=-1)

ValueError: cannot reshape array of size 196608 into shape (256,256)

@karolzak
Copy link
Owner

Hi @sivaramakrishnan-rajaraman
Unfortunately these utils lack any tests or whatsoever and they were develop in a rush and designed only for single layer masks.
Don't have any quick fix for this atm but I encourage you to dig into the code and do a PR with necessary changes for everyones benefit.

@karolzak karolzak added the bug Something isn't working label Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants