Why CNN Regression trainnetwork input output be the same 2-D metrics
1 view (last 30 days)
I want to use same size 2D Input Output data to build a denoising CNN model just like Resnet
But net = trainNetwork(X,X,layers,options) always sending error:
Invalid training data. X and Y must have the same number of observations.
And I do not understand how to fix it . Here is a sample code below, Thanks for your help
layers = [...
imageInputLayer([25 25 1])
fullyConnectedLayer(25*25)%Change the dimensions to match the outputs.
%create training option
options = trainingOptions('sgdm','InitialLearnRate',0.001, ...
X(:,:,:,1) = rand(25);
net = trainNetwork(X,Y,layers,options)
Siraj on 27 Jun 2022
It is my understanding that you want to train a model that gives the output of same dimension that of the input. For this you will have to tune your architecture, Currently the output dimensions of your network are 1X1X625 because the fully connected layer always gives a 1D output, also the error that you are getting is because the Y has incorrect dimensions. The responses, Y, can be a NxR matrix, where N = observations, R = number of responses (or output of the network).
Hope it helps