Hello everyone,
I was following this code for the image-to-image regression described in
In order to apply it to grayscale images, I've added the following code, as suggested in comments
lgraph = lgraph.addLayers(regressionLayer('name','regressionLayer'));
lgraph = lgraph.addLayers(convolution2dLayer([1 1],1,'Padding','same','name','conv_jp'));
lgraph = connectLayers(lgraph,'Final-ConvolutionLayer','conv_jp');
lgraph = connectLayers(lgraph,'conv_jp','regressionLayer');
net = trainNetwork(patchds,lgraph,options);
Finally, I predicted the image result with
output = activations(net,input,'regressionLayer')
where input is a generic 2D grayscale image.
However, I got the following error
Error using cat
Dimensions of arrays being concatenated are not consistent
Error in nn.net.internal.cnn.layer.Concatenation.predict
Z = cat(this.ConcatenationAxis, X{:});
I've tried going deep the nn.net.internal.cnn.layer.Concatenation.predict , and I have noticed that when performing
Z = predict(this,X)
X = iWrapSingleInputInCell(X);
Z = cat(this.ConcatenationAxis,X{:});
at some point, X (which is a 2X1 cell array) appears to be composed of two different dimensions matrices, which leads to the aforementioned error.
Thanks for helping,
Simone Cammarasana