Borrar filtros
Borrar filtros

How to write imageDatastore include labels.

6 visualizaciones (últimos 30 días)
mohd akmal masud
mohd akmal masud el 23 de Ag. de 2022
Respondida: David Ho el 24 de Ag. de 2022
Hi all..
I have the original data (ImageTr as attached), and labels data (LabelsTr as attached) for training. My problems is how to write imageDatastore include labels in it?
Because the labels in LabelsTr folder
I try this one but was error.
clear all
close all
DATASetDir = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET');
IMAGEDir = fullfile(DATASetDir,'ImagesTr');
volReader = @(x) matRead(x);
volds = imageDatastore(IMAGEDir, ...
'FileExtensions','.mat','ReadFcn', volReader);
% labelReader = @(x) matread(x);
matFileDir = fullfile('C:\Users\Akmal\Desktop\NEW 3D U NET\LabelsTr');
classNames = ["background", "tumor"];
pixelLabelID = [0 1];
% pxds = (LabelDirr,classNames,pixelLabelID, ...
% 'FileExtensions','.mat','ReadFcn',labelReader);
pxds = pixelLabelDatastore(matFileDir,classNames,pixelLabelID, ...
p = imageDatastore(volds,pxds);
Error using imageDatastore
Expected a string scalar or character vector for the parameter name.

Respuesta aceptada

David Ho
David Ho el 24 de Ag. de 2022
To combine the two datastores into a single datastore, one option would be to use the combine function to create a CombinedDatastore:
cds = combine(volds, pxds);
Alternatively, if you wish to use the datastore for semantic segmentation, you might find a randomPatchExtractionDatastore to be the most useful:
patchSize = [50 50 50];
patchds = randomPatchExtractionDatastore(volds, pxds, patchSize);
This extracts corresponding randomly-positioned patches from the two datastores.
For a complete example showing how to perform semantic segmentation of 3-D volumes using deep learning, you can take a look at this example:

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