I need to segment my input image using unet segmentation

6 vues (au cours des 30 derniers jours)
SARAH LONER
SARAH LONER le 27 Nov 2019
Commenté : Manjunath R V le 21 Avr 2021
where inp is my input image
inp=b
DatasetPath=fullfile('C:\Users\Desktop\to');
imds=imageDatastore(DatasetPath, 'IncludeSubfolders', true,...
'LabelSource','foldernames','fileextension',{'.dcm'});
labelDir = fullfile(DatasetPath,'testImages');
I = readimage(imds,1);
I = histeq(I);
imshow(I)
classes = [
"MALIGNANT","BENIGN"
];
labelIDs=[255 0]
inputlayer = imageInputLayer([512 512 1],'Name','inp')
numFilters = 64;
numLayers = 16;
layers = [ ...
imageInputLayer([512 512 1])
convolution2dLayer(5,20)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,20)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
transposedConv2dLayer(4,numFilters,'Stride',2,'Cropping',1);
convolution2dLayer(5,20)
batchNormalizationLayer
reluLayer
transposedConv2dLayer(4,numFilters,'Stride',2,'Cropping',1);
convolution2dLayer(5,20)
batchNormalizationLayer
reluLayer
convolution2dLayer(5,20)
fullyConnectedLayer(4)
softmaxLayer
pixelClassificationLayer
]
% pxds = pixelLabelDatastore(labelDir,classes,labelIDs);
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01, ...
'MaxEpochs',1, ...
'Shuffle','every-epoch', ...
'ValidationFrequency',30, ...
'Verbose',false);
net=trainNetwork(imds,layers,options);
res = activations(net,inp,net.Layers(numLayers-1).Name,'OutputAs','channels');
I = read(imds);
% C = read(pxds)
C = semanticseg(I, net);
% Overlay pixel label data on the image and display.
B = labeloverlay(I, C);
figure(12)
imshow(B)
I got error @
Error using trainNetwork
Not enough input arguments.
Error in
net=trainNetwork(imds,layers,options);I
  2 commentaires
SARAH LONER
SARAH LONER le 27 Nov 2019
my input image was dicom image.
when i remove comment at pixelLabelDatastore it shows an eror that my
Input folders or files do not contain specified file extensions:
.bmp,.cur,.fts,.fits,.gif,.hdf,.ico,.j2c,.j2k,.jp2,.jpf,.jpx,.jpg,.jpeg,.pbm,.pcx,.pgm,.png,.pnm,.ppm,.ras,.tif,.tiff,.xwd
can any1 suggest me a solution for this?
Manjunath R V
Manjunath R V le 21 Avr 2021
have u got solution for the above query sarah if so please share it

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 27 Nov 2019
In the imageDatastore() function there is an option to specify the reader. For example, try something like:
imds = imageDatastore('*.dcm','ReadFcn',@dicomread);
  4 commentaires
SARAH LONER
SARAH LONER le 29 Nov 2019
HAI SIR CAN U GUIDE ME ONCE AGAIN ON ANOTHER ERROR I CANT ABLE TO TRAIN IMAGE
i cant able to read image at pxds in above code and once i cleared that i cant able to train network at
net=trainNetwork(pxds,layers,options);
kindly guide me to solve this error
Image Analyst
Image Analyst le 29 Nov 2019
Sorry, I can't do that. If you need help, the Mathworks can help you. Contact them here: Mathworks Consulting

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by