image labelling for background
6 次查看(过去 30 天)
显示 更早的评论
I want to label images in order to use it in semantic segmentation
However, i want to label only specific area,
so if i only mark specific areas in whole image dataset
the areas which are not mark are automatically assumed as background?
Or do i have to mark it manually mark it as background as well?
0 个评论
回答(2 个)
Image Analyst
2019-4-8
It depends on what you want to do. If you only process the things you have labeled, then you don't need to worry about the background being labeled since even if it were, you'd not process it. If you want to process it, then you need to label it.
5 个评论
Image Analyst
2019-10-10
You do not need to label the background (i.e. with bwconncomp or bwlabel). All you need to do is to segment out the foreground and process it (like find the area, brightness or whatever you want to do.) I go over all this in my Image Segmentation Tutorial
OJ27
2020-4-22
any solution to this? is there an automatic way to label the undefined pixels as background? I want to use a cnn to do semantic segmentation of a specific object. The examples MATLAB offers come with datasets that two classes and no undefined pixels.
OJ27
2020-4-22
So I solved this by only labeling the desired areas in my images with the class cat and the background was left without a label.
pxDir = fullfile('...'); % insert your directory
imds = imageDatastore('...'); % insert your directory
classNames = ["cat"];
pixelLabelID = [1];
pxds = pixelLabelDatastore(pxDir,classNames,pixelLabelID);
C = readimage(pxds,1);
undefinedPixels = isundefined(C);
If you look at C, the entries are either '<undefined>' or 'cat'. Also if you look at undefinedPixels you'll see how many of the pixels have this label and you can even plot it. So I replaced these two lines
classNames = ["cat","background"];
pixelLabelID = [1,0];
and now C shows either 'background' or 'cat'. If you run the
undefinedPixels = isundefined(C);
again, you'll find sum(sum(undefinedPixels)) is zero.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!