I want to use labeled images from Image labeling in semantic segmentation,

4 ビュー (過去 30 日間)
Rus Gabriela
Rus Gabriela 2022 年 1 月 4 日
回答済み: yanqi liu 2022 年 1 月 8 日
Hello! I try to use my labeled images from Image Labeler tool, to train a network for semantic segmentation, but I have problems because those images are PNG. I have this error: Pixel label image must have 3 channels when RGB-triplet pixel label IDs are specified. My question is: Can I use these images for semantic segmentation or not? And if the answer is yes, how can I manage these images to be suitable for my porpose?

回答 (1 件)

yanqi liu
yanqi liu 2022 年 1 月 8 日
yes,sir,may be modify read image function,make it to rgb,such as
trainingImages = imageDatastore('train',...
'IncludeSubfolders',true,...
'LabelSource','foldernames','ReadFcn',@data_preporcess);
and in read function
function data = data_preporcess(file)
data = imread(file);
if ndims(data) == 2
data = cat(3, data, data, data);
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by