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

A question about the labels #22

Open
luna9722 opened this issue Apr 26, 2021 · 2 comments
Open

A question about the labels #22

luna9722 opened this issue Apr 26, 2021 · 2 comments

Comments

@luna9722
Copy link

Hello,
I have a question about the boundary labels, I tried the prprocessing file and tried np.unique for one of the labels and got [0 255] A i not supposed to get 3 elements one for the background, one for the cell and one for the boundary ? to encode them later for the multi class classification for unet 3 classes ??
I would be grateful if can someone answer my question.

@jccaicedo
Copy link
Collaborator

You are correct, boundary labels are supposed to be 3 values. Can you visualize the resulting image and post it here? Also, can you give a reference to the specific notebook and block of code where you think the error is happening?

Thank you!

@luna9722
Copy link
Author

luna9722 commented Apr 27, 2021

It is not about an error that I found, I am just trying to understand the annotations and your code.
I took an image from the masks and tried this code from the preprocessing file in your repo.

`annot=skimage.io.imread('/content/drive/MyDrive/BBBC039/masks/IXMtest_A02_s1_w1051DAA7C-7042-435F-99F0-1E847D9B42CB.png')
print(annot.shape)
total_objects=0
if len(annot.shape) == 3:
annot = annot[:,:,0]

annot = skimage.morphology.label(annot)
total_objects += len(np.unique(annot)) - 1

annot = skimage.morphology.remove_small_objects(annot, min_size=25)

boundaries = skimage.segmentation.find_boundaries(annot)

for k in range(2, 2, 2):
boundaries = skimage.morphology.binary_dilation(boundaries)

label_binary = np.zeros((annot.shape + (3,)))

label_binary[(annot == 0) & (boundaries == 0), 0] = 1
label_binary[(annot != 0) & (boundaries == 0), 1] = 1
label_binary[boundaries == 1, 2] = 1

skimage.io.imsave('/content/imgg0.png', label_binary)

print("Total objects: ",total_objects)
imm=skimage.io.imread('/content/imgg0.png')
print(imm.shape)
print(np.unique(imm))
plt.imshow(imm)
`

ANd this is what i got
image
and I found it weird to get [0 255] knowing that we have 3 classes. Can you explain it to me ? Thank you in advance.

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

2 participants