rrz0
rrz0

Reputation: 2302

How can I create a pixel labelled image for Semantic Segmentation?

I am following the Semantic Segmentation Examples tutorial by MathWorks.

I understand that I can load pixel labeled images

pxDir = fullfile(dataDir,'buildingPixelLabels');

Define the class names.

classNames = ["sky" "grass" "building" "sidewalk"];

Define the label ID for each class name.

pixelLabelID = [1 2 3 4];

and create a pixelLabelDatastore.

pxds = pixelLabelDatastore(pxDir,classNames,pixelLabelID);

But, how do I create a custom pixel labelled image where every pixel value represents the categorical label of that pixel?

I would then proceed by writing:

pxDir = fullfile(dataDir,'myCustomPixelLabels');

If I understood correctly, imageDatastore holds the actual image and not the pixel labels for that image.


EDIT:

On my system pxDir points to 'C:\Program Files\MATLAB\R2017a\toolbox\vision\visiondata\buildingPixelLabels'. Since I am on Matlab2017a so this example is not included by default, and I cannot compare or view the file to get a better understanding of what I need to do to reproduce this example.

Upvotes: 1

Views: 1759

Answers (1)

rrz0
rrz0

Reputation: 2302

The answer can be found here.

Matlab 2017a

Go to the APPS tab, and search for Image Labeler, or Training Image Labeler

Click on Add Images to add your training images.

Click on Add ROI Labels to add class names for the regions of interest.

Proceed to select the regions of interest manually from the uploaded images.

Once areas are selected, the data can be exported to workspace as a Ground Truth object.

Upvotes: 2

Related Questions