Semantic segmentation using numeric array training input

1 visualización (últimos 30 días)
Matt J
Matt J el 24 de Jul. de 2019
Comentada: Catherine Potts el 2 de Jun. de 2020
I have a series of P images, each MxNxC (in other words C channels) organized as a 4D numeric array X where size(X) is [M,N,C,P].
I have a corresponding series of P label maps organized as a 3D numeric array Y where size(Y) is [M,N,P].
Question: How do I convert this input to a form that can be fed to trainNetwork() in a semantic image segmentation application?
I know that trainNetwork has an input syntax,
trainedNet = trainNetwork(X,Y,layers,options)
but the documentation does not discuss the format of Y for semantic segmentation problems.

Respuesta aceptada

Vimal Rathod
Vimal Rathod el 31 de Jul. de 2019
In case you have images with their ground truth image files, you can create image datastore and a pixelLabelDatastore and pass it to trainNetwork function using the following command.
%imds = imageDatastore(imageDirectory); %Image DataStore
%pxds = pixelLabelDatastore(pixelatedImageDirectory,classNames,pixelLabelID); %PixelLabel DataStore
trainingData = pixelLabelImageDatastore(imds,pxds);
net = trainNetwork(trainingData,layers,opts);
Currently the support for directly using a 4D Numeric array is not present so you may have to convert the array into set of images and store then in files accordingly.
Refer to this link for more information:
  1 comentario
Catherine Potts
Catherine Potts el 2 de Jun. de 2020
I am faced with this exact same situation, can you elaborate on how to convert the array into a set of images and storing them in files so that you can use the datastore functions? The examples aren't very insightful as to what the file structures need to be in order to create an effective datastore from a 4-D array along with classification information.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by