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

2 ビュー (過去 30 日間)
Arish Yaseen
Arish Yaseen 2023 年 1 月 12 日
回答済み: Ben 2023 年 3 月 16 日
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

回答 (1 件)

Ben
Ben 2023 年 3 月 16 日
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.

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by