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 CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by