Predict function returns concatenation error for a two-input Deep Neural Network

2 Ansichten (letzte 30 Tage)
I was successfully able to train the Two-Input Neural Network with a combined arrayDataStore with an image and a set of features.
I use a concatenation layer in my network to combined the two-input to give a single output. I was able to train successfully and also use the validation data, however when I try to predict using the arrayDataStore I get the following error:
Error using matlab.internal.math.cnn.MLFusedNetwork/predict
Arrays are not compatible for concatenation on specified axis.
I am not sure if the datastore is the issue or the somehow the concatenation layer is giving trouble when predicting.
The code and network image are attached
Layers for the Network:
Data store code:
Thank you

Antworten (1)

Ben
Ben am 16 Mär. 2023
The "Format" functionLayer is re-labelling the input as "CSSB", and the inputs are "CB", so it's going to make the batch dimension into a spatial dimension and you won't be able to concatenate that as the Fc_conv output has scalar spatial dimensions in DAGNetwork.
You could either change the format in the functionLayer to "CBSS" or move the functionLayer to the other branch and use the function @(x) dlarray(squeeze(x),"CB") to get rid of the scalar S dimensions - then you'd need to concatenate on dimension 1 rather than 3.

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by