Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Where can I find the resulting image of semantic segmentation? #424

Answered by ethanwharris
Kenta-b asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Kenta-b thanks for the question! The conversion from labels to image happens here: https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/image/segmentation/serialization.py You could probably convert the predicted labels to an image like this:

from flash.image.segmentation.serialization import SegmentationLabels

preds = model.predict(...)
pred_tensor = torch.tensor(preds[0][0])
image = SegmentationLabels.labels_to_image(pred_tensor, SegmentationLabels.create_random_labels_map(num_classes))

This is definitely something we can do better. Ideally there would be a serializer which just gives back segmentation masks as tensors or PIL images, would you be interested in mak…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kenta-b
Comment options

Answer selected by Kenta-b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants