Filter löschen
Filter löschen

I need to segment my input image using unet segmentation

2 Ansichten (letzte 30 Tage)
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 Kommentare
SARAH LONER
SARAH LONER am 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 am 21 Apr. 2021
have u got solution for the above query sarah if so please share it

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
SARAH LONER
SARAH LONER am 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 am 29 Nov. 2019
Sorry, I can't do that. If you need help, the Mathworks can help you. Contact them here: Mathworks Consulting

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by