How can I get the labels of the segment mask?
See original GitHub issuefrom keras.preprocessing import image
from segmentation_models import Unet
import numpy as np
import imageio
model = Unet(backbone_name='resnet152',
encoder_weights='imagenet', freeze_encoder=True)
model.compile('Adam', 'binary_crossentropy', ['binary_accuracy'])
img = image.load_img('seg_images/image1.png')
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
mask = model.predict(x)
mask = mask.astype('uint8')
imageio.imwrite("result.png", mask[0])
First, the mask is all black. But assuming it works, how can I get the various labels for each segment?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to retrieve the labels used in a segmentation mask in ...
As you can see from the code there are 21 possible labels and 2 were used in the mask, one for the motorbike...
Read more >Semantic Segmentation with Masks Data Labeling Template
Template for performing semantic segmentation with brush masks with Label Studio for your machine learning and data science projects.
Read more >Exporting cell segmentation as label mask - Image.sc Forum
I am trying to export the cells segmentation as a label mask where each cells will be exported using a different ID, id...
Read more >Get label mask segmentation from detect.py? #9539 - GitHub
Question I training model yolov5s-seg. I run detect.py and use save-txt but output label bbox is not mask. How to get label mask?...
Read more >How to create high-quality image segmentation masks quickly ...
Image segmentation is one of the most labor intensive annotation tasks because it requires pixel level accuracy. Labeling a single image can take...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @shamoons If I understand you correctly: Round mask -
mask.round()
0 - is background 1 - is target classHow would I load it?