Error using trainNetwork - Number of observations in X and Y disagree.
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I want to build a cnn where my input is 1000 images of size 20 x 20 x 110 and output is 1000 images of size 20 x 20. 
Therefore I have 
net = trainNetwork(TB_train(:,:,:,:),TS_train(:,:,:),Layers,options); and I get an error 'Number of observations in X and Y disagree'. I don't understand as both of my matrices have 1000 images. 
My cnn has these layers: 
    Layers = [imageInputLayer([20 20 110],'Normalization','none') %,'Weights',W,'Bias',B)           
    convolution2dLayer(3,128,'Padding','same')%,'Weights',W,'Bias',B)              
    batchNormalizationLayer
    reluLayer
    convolution2dLayer(1,64,'Padding','same')%,'Weights',W,'Bias',B)
    batchNormalizationLayer
    reluLayer
    convolution2dLayer(1,32,'Padding','same')%,'Weights',W,'Bias',B)
    batchNormalizationLayer
    reluLayer
    convolution2dLayer(1,16,'Padding','same')%,'Weights',W,'Bias',B)
    batchNormalizationLayer
    reluLayer
    convolution2dLayer(1,1,'Padding','same')%,'Weights',W,'Bias',B)
    batchNormalizationLayer
    reluLayer
    regressionLayer];   
0 Kommentare
Antworten (2)
  Divya Gaddipati
    
 am 16 Jun. 2020
        Try using
net = trainNetwork(TB_train, TS_train, Layers, options);
0 Kommentare
  Joseph Williams
 am 25 Feb. 2021
        Hello, I know this is an old question, but I am having a very similar difficulty, except with 3D images. I have 4000 (4 x 256 x 4) 3-channel images and want to create 4000 (4 x 256 x 4) 1-channel images.
I have a very similar architecture to yours and using analyzeNetwork(layers) shows that the layer before regression puts in the right size (for both our networks).
What was your solution to generate 1000 images of size 20 x 20? it may be my solution as well.
Thanks!
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


