Deep Learning Image regression in grayscale

1 次查看(过去 30 天)
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
  1 个评论
simone cammarasana
simone cammarasana 2020-2-27
As partial solution, the dimension of the input matrix has to be multiple of
I assume a fair workaround can be obtained by modifying the encodingLayers parameters.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by