I am in the process of implementing a convolutional neural network for image denoising. The network architecture was proposed in THIS paper, on page 4. I am using Matlab 2018b, so I have all the latest Deep learning toolboxes installed. I have tried to recreate the neural network in the Deep Network Designer app, as can be seen in the two first images attached. The network analyzer shows no errors or warning, and the dimensions are ok.
Then I created an imagedatastore with my images. The second step was creating an denoisingImageDatastore for the sake of training deep networks. I then set the training options, and eventually went to train my network. All these steps were show in Mathworks tutorials, but here is the code anyway.
DatasetPath=fullfile('c:\', 'Users', 'Emir', 'Desktop', 'IU','seminarski', 'VOCdevkit', 'VOC2010','JPEGImagesSmall');
imds=imageDatastore(DatasetPath, 'IncludeSubfolders', true,...
'LabelSource','foldernames');
dnimds=denoisingImageDatastore(imds,'patchSize', [64 64], 'PatchesPerImage', 64, 'ChannelFormat','grayscale');
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01, ...
'MaxEpochs',1, ...
'Shuffle','every-epoch', ...
'ValidationFrequency',30, ...
'Verbose',false, ...
'Plots','training-progress',...
'ExecutionEnvironment', 'gpu');
net=trainNetwork(dnimds, lgraph_8,options);
I then went to test my trained network on the cameraman image.
I=imread('cameraman.tif');
noisyI=imnoise(I, 'gaussian', 0,0.01);
figure
imshowpair(I, noisyI, 'montage');
title('Original Image (left) and Noisy Image (right)')
denoisedI=denoiseImage(noisyI,net);
figure
imshow(denoisedI)
title('Denoised Image')
I get the following error message when running this script.
"Name of layer output must be a character vector or string scalar.
Error in DAGNetwork/activations (line 815)
iValidateIsStringOrCharArray(layerOut);
Error in denoiseImage (line 73)
res = activations(net,inputImage,numLayers-1,'OutputAs','channels');
Error in Untitled (line 44)
denoisedI=denoiseImage(noisyI,net);"
What causes this error message? In the proposed network, the output is an image of the dimensions 64x64x1, however it seems that matlab only lets me use the classification and regression output layers. How do I overcome this. I analyzed the structure of this network, and it is quite similar to mine, but the code which gave me an error previously runs fine when I use that pretrained network. What changes can I make to my network so it doesn't give me these errors?
0 Comments
Sign in to comment.